<?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 DevBlog &#187; Programming</title>
	<atom:link href="http://gushh.net/blog/?tag=programming&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://gushh.net/blog</link>
	<description>This blog is about software, electronics engineering and game development.</description>
	<lastBuildDate>Tue, 24 Jan 2012 00:31:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>(PB) String Between Characters</title>
		<link>http://gushh.net/blog/pb-string-characters/</link>
		<comments>http://gushh.net/blog/pb-string-characters/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 12:30:07 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[find string]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[string between chars]]></category>
		<category><![CDATA[str_between_char]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=849</guid>
		<description><![CDATA[This is a small purebasic function used to retrieve a string between two known characters, it also allows you to provide a starting position. Procedure.s str_between_char&#40; *Source.CHARACTER, First.C, Last.C, StartAt.i = 0 &#41; Define.i dwLength &#160; *Source + &#40;StartAt * SizeOf&#40;CHARACTER&#41;&#41; Repeat If *Source\c = First ; If this character matches the First character *Source [...]]]></description>
			<content:encoded><![CDATA[<p>This is a small purebasic function used to retrieve a string between two known characters, it also allows you to provide a starting position.</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Procedure</span>.s str_between_char<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>Source.CHARACTER, First.C, Last.C, StartAt.i <span style="color: #000066;">=</span> <span style="color: #CC0000;">0</span> <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Define</span>.i dwLength
&nbsp;
	<span style="color: #000066;">*</span>Source <span style="color: #000066;">+</span> <span style="color: #000066;">&#40;</span>StartAt <span style="color: #000066;">*</span> <span style="color: #0000ff;">SizeOf</span><span style="color: #000066;">&#40;</span>CHARACTER<span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Repeat</span>
		<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>Source<span style="color: #000066;">\</span>c <span style="color: #000066;">=</span> First <span style="color: #ff0000; font-style: italic;">; If this character matches the First character</span>
			<span style="color: #000066;">*</span>Source <span style="color: #000066;">+</span> <span style="color: #0000ff;">SizeOf</span><span style="color: #000066;">&#40;</span>CHARACTER<span style="color: #000066;">&#41;</span>
			dwLength <span style="color: #000066;">=</span> <span style="color: #000066;">*</span>Source
			<span style="color: #000066; font-weight: bold;">Repeat</span> <span style="color: #ff0000; font-style: italic;">; Repeat until we find an occurrance with the Last character</span>
				<span style="color: #000066;">*</span>Source <span style="color: #000066;">+</span> <span style="color: #0000ff;">SizeOf</span><span style="color: #000066;">&#40;</span>CHARACTER<span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">Until</span> <span style="color: #000066;">*</span>Source<span style="color: #000066;">\</span>c <span style="color: #000066;">=</span> Last
			dwLength <span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>Source <span style="color: #000066;">-</span> dwLength<span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #0000ff;">PeekS</span><span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>Source <span style="color: #000066;">-</span> dwLength, dwLength <span style="color: #000066;">&#41;</span> <span style="color: #ff0000; font-style: italic;">; Peek the output string</span>
			<span style="color: #000066; font-weight: bold;">Break</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
		<span style="color: #000066;">*</span>Source <span style="color: #000066;">+</span> <span style="color: #0000ff;">SizeOf</span><span style="color: #000066;">&#40;</span>CHARACTER<span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Until</span> <span style="color: #000066;">*</span>Source<span style="color: #000066;">\</span>c <span style="color: #000066;">=</span> #Null
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>Example use:</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">Define</span>.s <span style="color: #0000ff;">str</span> 		<span style="color: #000066;">=</span> <span style="color: #009900;">&quot;dd(hallo)xyz(a)&quot;</span>
<span style="color: #000066; font-weight: bold;">Define</span>.s result 	<span style="color: #000066;">=</span> str_between_char<span style="color: #000066;">&#40;</span>@<span style="color: #0000ff;">str</span>, '<span style="color: #000066;">&#40;</span>', '<span style="color: #000066;">&#41;</span>', <span style="color: #CC0000;">2</span><span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">Debug</span> result</pre></div></div>

<p>If you&#8217;re working on a parser or similar project this will sure come in handy.<br />
<strong>Enjoy!</strong></p>
<g:plusone href='http://gushh.net/blog/pb-string-characters/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/pb-string-characters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Away from the IDEs.</title>
		<link>http://gushh.net/blog/away-from-the-ides/</link>
		<comments>http://gushh.net/blog/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>
<g:plusone href='http://gushh.net/blog/away-from-the-ides/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/away-from-the-ides/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TimeLapse lib</title>
		<link>http://gushh.net/blog/timelapse-lib/</link>
		<comments>http://gushh.net/blog/timelapse-lib/#comments</comments>
		<pubDate>Wed, 05 Aug 2009 18:48:02 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[callback]]></category>
		<category><![CDATA[Game Development]]></category>
		<category><![CDATA[gettickcount]]></category>
		<category><![CDATA[lib]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[time lapse]]></category>
		<category><![CDATA[timelapse]]></category>
		<category><![CDATA[timer]]></category>
		<category><![CDATA[timing]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=171</guid>
		<description><![CDATA[This little lib is used to keep track of time using the low resolution timer provided by the OS (in Windows &#8220;GetTickCount&#8221;). The goal of this type of library is to encapsulate timing actions. It was originally designed for game development in mind but needless to say you can use it and adapt it to [...]]]></description>
			<content:encoded><![CDATA[<p>This little lib is used to keep track of time using the low resolution timer provided by the OS (in Windows &#8220;GetTickCount&#8221;). The goal of this type of library is to encapsulate timing actions. It was originally designed for game development in mind but needless to say you can use it and adapt it to your own needs.</p>
<p>Basically you define a time interval as you create the &#8220;timelapse&#8221; instance. Every time you call the update function a simple check determines whether the time was reached or not. This is trivial, but encapsulating it makes sense. Specially if you plan to create an animation system in the future!</p>
<p><span id="more-171"></span><br />
The code:</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">EnableExplicit</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Prototype</span>.i TimeLapse_Callback<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.i <span style="color: #000066;">&#41;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Structure</span> TIMELAPSE
	old_time.i			<span style="color: #ff0000; font-style: italic;">; Stores the &quot;old&quot; time value.</span>
	new_time.i			<span style="color: #ff0000; font-style: italic;">; Stores the &quot;new&quot; time value.</span>
	time_out.i			<span style="color: #ff0000; font-style: italic;">; Time period for the TimeLapse , in ms.</span>
	<span style="color: #000066;">*</span>callback.TimeLapse_Callback	<span style="color: #ff0000; font-style: italic;">; User callback.</span>
	userdata.i			<span style="color: #ff0000; font-style: italic;">; User data.</span>
<span style="color: #000066; font-weight: bold;">EndStructure</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">CompilerSelect</span> #PB_Compiler_OS
	<span style="color: #000066; font-weight: bold;">CompilerCase</span> #PB_OS_Windows
		<span style="color: #000066; font-weight: bold;">Macro</span> _time<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> : timeGetTime_<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>		: <span style="color: #000066; font-weight: bold;">EndMacro</span>
	<span style="color: #000066; font-weight: bold;">CompilerDefault</span>
		<span style="color: #000066; font-weight: bold;">Macro</span> _time<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</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;">EndMacro</span>
<span style="color: #000066; font-weight: bold;">CompilerEndSelect</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i TimeLapseCreate<span style="color: #000066;">&#40;</span> Timeout.i, <span style="color: #000066;">*</span>Callback.TimeLapse_Callback <span style="color: #000066;">=</span> #Null, UserData.i <span style="color: #000066;">=</span> #Null <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Define</span>.TimeLapse  <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>TimeLapse <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;">With</span> <span style="color: #000066;">*</span>this
			<span style="color: #000066;">\</span>new_time 	<span style="color: #000066;">=</span> _time<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
			<span style="color: #000066;">\</span>old_time 	<span style="color: #000066;">=</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>new_time
			<span style="color: #000066;">\</span>time_out	<span style="color: #000066;">=</span> Timeout
			<span style="color: #000066;">\</span>callback	<span style="color: #000066;">=</span> <span style="color: #000066;">*</span>Callback
			<span style="color: #000066;">\</span>userdata	<span style="color: #000066;">=</span> UserData
		<span style="color: #000066; font-weight: bold;">EndWith</span>
&nbsp;
		<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 TimeLapseDestroy<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.TIMELAPSE  <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>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i TimeLapseUpdate<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.TIMELAPSE  <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>new_time <span style="color: #000066;">=</span> _time<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>new_time <span style="color: #000066;">-</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>old_time<span style="color: #000066;">&#41;</span> <span style="color: #000066;">=&gt;</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>time_out<span style="color: #000066;">&#41;</span>
&nbsp;
			<span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>old_time <span style="color: #000066;">=</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>new_time
&nbsp;
			<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>callback
				<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>callback<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this <span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> #True
&nbsp;
		<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>
&nbsp;
&nbsp;
<span style="color: #ff0000; font-style: italic;">; Helper routines</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i TimeLapseSet<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.TIMELAPSE , Timeout.i <span style="color: #000066;">&#41;</span>
&nbsp;
 	<span style="color: #000066; font-weight: bold;">If</span> Timeout <span style="color: #000066;">&gt;</span> <span style="color: #CC0000;">0</span>
		<span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>time_out <span style="color: #000066;">=</span> Timeout
	<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 TimeLapseGet<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.TIMELAPSE  <span style="color: #000066;">&#41;</span>
&nbsp;
 	<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>time_out
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>Example:</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">If</span> <span style="color: #0000ff;">OpenConsole</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Define</span>.TIMELAPSE  <span style="color: #000066;">*</span>test_timer  <span style="color: #000066;">=</span> TimeLapseCreate<span style="color: #000066;">&#40;</span> <span style="color: #CC0000;">500</span> <span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Repeat</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> TimeLapseUpdate<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>test_timer  <span style="color: #000066;">&#41;</span>
			<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span><span style="color: #009900;">&quot; Timer says hi!&quot;</span> <span style="color: #000066;">&#41;</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
		<span style="color: #0000ff;">Delay</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #000066;">&#41;</span>
	<span style="color: #000066; font-weight: bold;">Until</span> <span style="color: #0000ff;">Inkey</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> <span style="color: #0000ff;">Chr</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">27</span><span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">CloseConsole</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
<span style="color: #000066; font-weight: bold;">EndIf</span>
<span style="color: #000066; font-weight: bold;">End</span></pre></div></div>

<p>The nice thing about this library is the ability to use callbacks. Whenever a callback is defined, once the timer reaches the maximum allowed time-lapse, it&#8217;ll return by executing the callback.</p>
<p>In the callback you can do anything you want; From simple event triggering to manipulating another timer depending on XYZ conditions: it&#8217;s up to you!.</p>
<p><strong>Just keep in mind:</strong> Always return &#8220;true&#8221; unless you want to invalidate the update call.</p>
<p>Here is a more advanced example with a callback, user data and multiple timers:</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 MyCallback<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this.TIMELAPSE  <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #ff0000; font-style: italic;">; It's imperative that you return #true (1) in your callbacks if you want the &quot;Update&quot; calls to pass once the timeout is reached.</span>
	<span style="color: #ff0000; font-style: italic;">; This is a design choice for flexibility and nothing else.</span>
&nbsp;
	<span style="color: #0000ff;">ConsoleColor</span><span style="color: #000066;">&#40;</span><span style="color: #0000ff;">Random</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">15</span><span style="color: #000066;">&#41;</span>, <span style="color: #0000ff;">Random</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">15</span><span style="color: #000066;">&#41;</span><span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span><span style="color: #009900;">&quot; Hi from the callback! &quot;</span><span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span> <span style="color: #009900;">&quot; The other timer is set to: &quot;</span> <span style="color: #000066;">+</span> <span style="color: #0000ff;">Str</span><span style="color: #000066;">&#40;</span> TimeLapseGet<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>userdata <span style="color: #000066;">&#41;</span> <span style="color: #000066;">&#41;</span> <span style="color: #000066;">+</span> <span style="color: #009900;">&quot;ms&quot;</span> <span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span> <span style="color: #009900;">&quot; ...Reducing the time interval down by 50 ms... &quot;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	TimeLapseSet<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>userdata, TimeLapseGet<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>this<span style="color: #000066;">\</span>userdata <span style="color: #000066;">&#41;</span> <span style="color: #000066;">-</span> <span style="color: #CC0000;">50</span> <span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">ConsoleColor</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">15</span>, <span style="color: #CC0000;">0</span><span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> #True
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Define</span>.TIMELAPSE  <span style="color: #000066;">*</span>timer_one 	<span style="color: #000066;">=</span> TimeLapseCreate<span style="color: #000066;">&#40;</span> <span style="color: #CC0000;">500</span> <span style="color: #000066;">&#41;</span>				<span style="color: #ff0000; font-style: italic;">; The first TimeLapse , nothing special.</span>
<span style="color: #000066; font-weight: bold;">Define</span>.TIMELAPSE  <span style="color: #000066;">*</span>timer_two 	<span style="color: #000066;">=</span> TimeLapseCreate<span style="color: #000066;">&#40;</span> <span style="color: #CC0000;">2000</span>, @MyCallback<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, <span style="color: #000066;">*</span>timer_one <span style="color: #000066;">&#41;</span>	<span style="color: #ff0000; font-style: italic;">; The second TimeLapse , it manipulates the first one through a callback.</span>
<span style="color: #000066; font-weight: bold;">Define</span>.TIMELAPSE  <span style="color: #000066;">*</span>timer_three	<span style="color: #000066;">=</span> TimeLapseCreate<span style="color: #000066;">&#40;</span> <span style="color: #CC0000;">20</span><span style="color: #000066;">*</span><span style="color: #CC0000;">1000</span> <span style="color: #000066;">&#41;</span>				<span style="color: #ff0000; font-style: italic;">; This TimeLapse  will simply let us exit the example after the set time.</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #0000ff;">OpenConsole</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #0000ff;">EnableGraphicalConsole</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">1</span><span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">ConsoleColor</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">15</span>, <span style="color: #CC0000;">0</span><span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Define</span>.i quit <span style="color: #000066;">=</span> #False
&nbsp;
	<span style="color: #000066; font-weight: bold;">Repeat</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> TimeLapseUpdate<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>timer_three <span style="color: #000066;">&#41;</span>
			quit <span style="color: #000066;">=</span> #True
		<span style="color: #000066; font-weight: bold;">Else</span>
			<span style="color: #000066; font-weight: bold;">If</span> TimeLapseUpdate<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>timer_one <span style="color: #000066;">&#41;</span>
				<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span><span style="color: #009900;">&quot;timer_one: &quot;</span> <span style="color: #000066;">+</span> <span style="color: #0000ff;">Str</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>timer_one<span style="color: #000066;">\</span>time_out<span style="color: #000066;">&#41;</span> <span style="color: #000066;">+</span> <span style="color: #009900;">&quot;ms reached.&quot;</span><span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">EndIf</span>
			<span style="color: #000066; font-weight: bold;">If</span> TimeLapseUpdate<span style="color: #000066;">&#40;</span> <span style="color: #000066;">*</span>timer_two <span style="color: #000066;">&#41;</span>
				<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span><span style="color: #009900;">&quot;timer_two: &quot;</span> <span style="color: #000066;">+</span> <span style="color: #0000ff;">Str</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>timer_two<span style="color: #000066;">\</span>time_out<span style="color: #000066;">&#41;</span> <span style="color: #000066;">+</span> <span style="color: #009900;">&quot;ms reached.&quot;</span><span style="color: #000066;">&#41;</span>
			<span style="color: #000066; font-weight: bold;">EndIf</span>
		<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
		<span style="color: #0000ff;">Delay</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">10</span><span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Until</span> <span style="color: #0000ff;">Inkey</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">=</span> <span style="color: #0000ff;">Chr</span><span style="color: #000066;">&#40;</span><span style="color: #CC0000;">27</span><span style="color: #000066;">&#41;</span> <span style="color: #000066; font-weight: bold;">Or</span> quit 
&nbsp;
	<span style="color: #0000ff;">PrintN</span><span style="color: #000066;">&#40;</span> <span style="color: #009900;">&quot;timer_three: The example finished.&quot;</span> <span style="color: #000066;">&#41;</span>
&nbsp;
	TimeLapseDestroy<span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>timer_one<span style="color: #000066;">&#41;</span>
	TimeLapseDestroy<span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>timer_two<span style="color: #000066;">&#41;</span>
	TimeLapseDestroy<span style="color: #000066;">&#40;</span><span style="color: #000066;">*</span>timer_three<span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #0000ff;">Input</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
	<span style="color: #0000ff;">CloseConsole</span><span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndIf</span>
<span style="color: #000066; font-weight: bold;">End</span></pre></div></div>

<p>The examples are crude, but they show every function in the library.<br />
Should you have any questions, feel free to ask.</p>
<p>I&#8217;ll soon post the &#8220;Animation&#8221; lib that depends on &#8220;TimeLapse&#8221;.</p>
<p>Cheers.</p>
<g:plusone href='http://gushh.net/blog/timelapse-lib/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/timelapse-lib/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Centered MessageRequester() / MessageBox()</title>
		<link>http://gushh.net/blog/pb-centered-messagerequester/</link>
		<comments>http://gushh.net/blog/pb-centered-messagerequester/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 16:25:00 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[PureBasic]]></category>
		<category><![CDATA[Apple]]></category>
		<category><![CDATA[CBT]]></category>
		<category><![CDATA[Centered Dialog]]></category>
		<category><![CDATA[Dual Screen]]></category>
		<category><![CDATA[Fanboy]]></category>
		<category><![CDATA[GuShH]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[IDE]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[MessageBox]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[pb]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[SetWindowsHookEx]]></category>
		<category><![CDATA[UnhookWindowsHookEx]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=87</guid>
		<description><![CDATA[As usual, I was browsing the PureBasic forums to see what was new, nothing much (heh&#8230;) but something caught my attention, the fact that some user requested for the IDE&#8217;s message dialogs to be &#8220;centered&#8221; ( because he had multiple displays and the messages would appear in between them ) just to get shit-faced by [...]]]></description>
			<content:encoded><![CDATA[<p>As usual, I was browsing the PureBasic forums to see what was new, nothing much (heh&#8230;) but something caught my attention, the fact that some user requested for the IDE&#8217;s message dialogs to be &#8220;centered&#8221; ( because he had multiple displays and the messages would appear in between them ) just to get shit-faced by an actual staff member!</p>
<p>You can&#8217;t just say &#8220;it&#8217;s Microsoft&#8217;s fault&#8221; &#8212; Are you in some sort of mac-only cleanse?, What&#8217;s your #%&amp;%#$ problem?!</p>
<p>Those who &#8220;pass the ball&#8221; (as the user suggested) are part of the problem. You, being a programmer can certainly code a simple CBT hook, right?. Are you against hooks, perhaps &#8211; you are a purist, I hear&#8230; Sorry, but sometimes solutions <strong>are</strong> &#8220;dirty&#8221; and you have to live with them.</p>
<div id="attachment_88" class="wp-caption aligncenter" style="width: 658px"><img class="size-full wp-image-88 " title="split_screen" src="http://gushh.net/blog/wp-content/uploads/2009/07/split_screen.jpg" alt="Just for the record, I too use a split-screen and I find it annoying that dialog boxes are not centered to their parent." width="648" height="203" /><p class="wp-caption-text">Just for the record, I too use a split-screen and I find it annoying that dialog boxes are not centered to their parent.</p></div>
<p><span id="more-87"></span></p>
<p>I certainly think that this sort of behavior is not good for a business, but then again they&#8217;ve been cat-walking away from reality for years now (Look at their website if not, look at the fact that they haven&#8217;t implemented basic functionality to their language and by basic I mean a proper container library and whatnot!). Most of their user-base consists of people who are afraid of real, world-class languages. That&#8217;s my opinion, take it or leave it.</p>
<p>But before you throw crap at me do remember that I support them, I just don&#8217;t like the way they&#8217;re doing things. Pretty much like Apple does (they do crap) however the fanboys don&#8217;t realize this and they see any criticism as bad for the company image, when in fact what damages the company is that nonsense wall they put up when anybody, and I do mean &#8220;anybody&#8221; says &#8220;anything&#8221; that appears to be &#8220;against&#8221; their product/s.</p>
<p>Even if you don&#8217;t like it at least have the decency to hear those who are genuinely interested in your product, those who are giving away (and for free) true and useful suggestions for you to improve them. I don&#8217;t give a damn about this particular user but I do care when a so called company does this sort of things to their own users, it&#8217;s just uncalled for and plainly unprofessional.</p>
<p>Have a nice day, code follows.</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">; This snippet was based on the following code by Microsoft:</span>
<span style="color: #ff0000; font-style: italic;">; http://support.microsoft.com/kb/180936</span>
<span style="color: #000066; font-weight: bold;">EnableExplicit</span> <span style="color: #ff0000; font-style: italic;">; The only way to go.</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i CenterMsgCallBack<span style="color: #000066;">&#40;</span> uMsg.i, wParam.i, lParam.i <span style="color: #000066;">&#41;</span> 
&nbsp;
	<span style="color: #000066; font-weight: bold;">Select</span> uMsg
		<span style="color: #000066; font-weight: bold;">Case</span> #HCBT_ACTIVATE
&nbsp;
			<span style="color: #000066; font-weight: bold;">Define</span>.RECT typFormRect, typRectMsg
			<span style="color: #000066; font-weight: bold;">Define</span>.i plMsgHook, hWnd
			<span style="color: #000066; font-weight: bold;">Define</span>.i lxPos, lyPos
&nbsp;
			hWnd <span style="color: #000066;">=</span> GetParent_<span style="color: #000066;">&#40;</span>wParam<span style="color: #000066;">&#41;</span> 																																																		<span style="color: #ff0000; font-style: italic;">; the parent will be the callee</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">If</span> hWnd 																																																											<span style="color: #ff0000; font-style: italic;">; can't hurt to check.</span>
&nbsp;
				plMsgHook 	<span style="color: #000066;">=</span> GetWindowLong_<span style="color: #000066;">&#40;</span> hWnd, #GWL_USERDATA <span style="color: #000066;">&#41;</span> 																																				<span style="color: #ff0000; font-style: italic;">; get the hook address</span>
&nbsp;
				<span style="color: #000066; font-weight: bold;">If</span> plMsgHook 																																																								<span style="color: #ff0000; font-style: italic;">; can't hurt to check.</span>
&nbsp;
					GetWindowRect_<span style="color: #000066;">&#40;</span> hWnd, typFormRect <span style="color: #000066;">&#41;</span>
					GetWindowRect_<span style="color: #000066;">&#40;</span> wParam, typRectMsg <span style="color: #000066;">&#41;</span>
&nbsp;
					lxPos <span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span>typFormRect<span style="color: #000066;">\</span><span style="color: #0000ff;">Left</span> <span style="color: #000066;">+</span> <span style="color: #000066;">&#40;</span>typFormRect<span style="color: #000066;">\</span><span style="color: #0000ff;">Right</span> <span style="color: #000066;">-</span> typFormRect<span style="color: #000066;">\</span><span style="color: #0000ff;">Left</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">/</span> <span style="color: #CC0000;">2</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">-</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>typRectMsg<span style="color: #000066;">\</span><span style="color: #0000ff;">Right</span> <span style="color: #000066;">-</span> typRectMsg<span style="color: #000066;">\</span><span style="color: #0000ff;">Left</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">/</span> <span style="color: #CC0000;">2</span><span style="color: #000066;">&#41;</span>
					lyPos <span style="color: #000066;">=</span> <span style="color: #000066;">&#40;</span>typFormRect<span style="color: #000066;">\</span>Top  <span style="color: #000066;">+</span>	<span style="color: #000066;">&#40;</span>typFormRect<span style="color: #000066;">\</span>Bottom <span style="color: #000066;">-</span> typFormRect<span style="color: #000066;">\</span>Top<span style="color: #000066;">&#41;</span> <span style="color: #000066;">/</span> <span style="color: #CC0000;">2</span><span style="color: #000066;">&#41;</span> <span style="color: #000066;">-</span> <span style="color: #000066;">&#40;</span><span style="color: #000066;">&#40;</span>typRectMsg<span style="color: #000066;">\</span>Bottom <span style="color: #000066;">-</span> typRectMsg<span style="color: #000066;">\</span>Top<span style="color: #000066;">&#41;</span> <span style="color: #000066;">/</span> <span style="color: #CC0000;">2</span><span style="color: #000066;">&#41;</span>
&nbsp;
					SetWindowPos_<span style="color: #000066;">&#40;</span> wParam, <span style="color: #CC0000;">0</span>, lxPos, lyPos, <span style="color: #CC0000;">0</span>, <span style="color: #CC0000;">0</span>,	#SWP_NOSIZE <span style="color: #000066;">|</span> #SWP_NOZORDER <span style="color: #000066;">|</span> #SWP_NOACTIVATE <span style="color: #000066;">&#41;</span> 														<span style="color: #ff0000; font-style: italic;">; position the window.</span>
					UnhookWindowsHookEx_<span style="color: #000066;">&#40;</span>plMsgHook<span style="color: #000066;">&#41;</span> 																																													<span style="color: #ff0000; font-style: italic;">; release the hook.</span>
					SetWindowLong_<span style="color: #000066;">&#40;</span> hWnd, #GWL_USERDATA, #Null <span style="color: #000066;">&#41;</span> 																																							<span style="color: #ff0000; font-style: italic;">; unset the user data.</span>
&nbsp;
				<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">EndIf</span>
	<span style="color: #000066; font-weight: bold;">EndSelect</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span> 
&nbsp;
<span style="color: #000066; font-weight: bold;">Procedure</span>.i CenteredMessageRequester<span style="color: #000066;">&#40;</span> Title.s, Text.s, Flags.i<span style="color: #000066;">=</span>#Null, hWnd.i<span style="color: #000066;">=</span>#Null <span style="color: #000066;">&#41;</span>
&nbsp;
	<span style="color: #000066; font-weight: bold;">Define</span>.i lInstance, lThreadID, plMsgHook
&nbsp;
	<span style="color: #000066; font-weight: bold;">If</span> <span style="color: #000066; font-weight: bold;">Not</span> hWnd
		hWnd <span style="color: #000066;">=</span> <span style="color: #0000ff;">WindowID</span><span style="color: #000066;">&#40;</span> <span style="color: #0000ff;">GetActiveWindow</span><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;">If</span> hWnd
&nbsp;
		lInstance <span style="color: #000066;">=</span> GetWindowLong_<span style="color: #000066;">&#40;</span> hWnd, #GWL_HINSTANCE <span style="color: #000066;">&#41;</span>
		lThreadID <span style="color: #000066;">=</span> GetCurrentThreadId_<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">If</span> lInstance <span style="color: #000066; font-weight: bold;">And</span> lThreadID 																																																			<span style="color: #ff0000; font-style: italic;">; just to make sure, can't hurt.</span>
&nbsp;
			plMsgHook <span style="color: #000066;">=</span> SetWindowsHookEx_<span style="color: #000066;">&#40;</span>#WH_CBT, @CenterMsgCallBack<span style="color: #000066;">&#40;</span><span style="color: #000066;">&#41;</span>, lInstance, lThreadID<span style="color: #000066;">&#41;</span> 																						<span style="color: #ff0000; font-style: italic;">; create the cbt hook.</span>
			SetWindowLong_<span style="color: #000066;">&#40;</span>	hWnd, #GWL_USERDATA, plMsgHook <span style="color: #000066;">&#41;</span> 																																							<span style="color: #ff0000; font-style: italic;">; save the hook address, we'll need it to release it.</span>
&nbsp;
			<span style="color: #000066; font-weight: bold;">ProcedureReturn</span> MessageBox_<span style="color: #000066;">&#40;</span> hWnd, Text, Title, Flags <span style="color: #000066;">&#41;</span>																																				<span style="color: #ff0000; font-style: italic;">; finally, create the message box.</span>
&nbsp;
		<span style="color: #000066; font-weight: bold;">EndIf</span>
	<span style="color: #000066; font-weight: bold;">EndIf</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">EndProcedure</span></pre></div></div>

<p>And a small example:</p>

<div class="wp_syntax"><div class="code"><pre class="purebasic" style="font-family:monospace;"><span style="color: #0000ff;">OpenWindow</span><span style="color: #000066;">&#40;</span> <span style="color: #CC0000;">0</span>, <span style="color: #CC0000;">500</span>, <span style="color: #CC0000;">200</span>, <span style="color: #CC0000;">400</span>, <span style="color: #CC0000;">200</span>, <span style="color: #009900;">&quot;testing&quot;</span> <span style="color: #000066;">&#41;</span>																																											<span style="color: #ff0000; font-style: italic;">; test window</span>
<span style="color: #0000ff;">MessageRequester</span><span style="color: #000066;">&#40;</span> <span style="color: #009900;">&quot;:(&quot;</span>, <span style="color: #009900;">&quot;I'm a normal messagebox&quot;</span>, #MB_APPLMODAL <span style="color: #000066;">|</span> #MB_ICONERROR <span style="color: #000066;">&#41;</span>																									<span style="color: #ff0000; font-style: italic;">; conventional msgbox</span>
CenteredMessageRequester<span style="color: #000066;">&#40;</span> <span style="color: #009900;">&quot;:)&quot;</span>, <span style="color: #009900;">&quot;I'm a centered messagebox!&quot;</span>, #MB_APPLMODAL <span style="color: #000066;">|</span> #MB_ICONEXCLAMATION <span style="color: #000066;">&#41;</span>																	<span style="color: #ff0000; font-style: italic;">; our centered msgbox.</span></pre></div></div>

<p>The &#8220;Programmer&#8221; can now copy&amp;paste and compile.</p>
<p>Cheers.</p>
<p>PS: You can also find the source in here: <a href="http://gushh.net/dev/?file=pb/centermessagebox.pb">http://gushh.net/dev/?file=pb/centermessagebox.pb</a> As usual, that&#8217;s my code repository for PB.</p>
<g:plusone href='http://gushh.net/blog/pb-centered-messagerequester/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/pb-centered-messagerequester/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Going from Basic to the real world.</title>
		<link>http://gushh.net/blog/going-from-basic-to-the-real-world/</link>
		<comments>http://gushh.net/blog/going-from-basic-to-the-real-world/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 23:17:19 +0000</pubDate>
		<dc:creator>GuShH</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[basic]]></category>
		<category><![CDATA[blitzbasic]]></category>
		<category><![CDATA[darkbasic]]></category>
		<category><![CDATA[freebasic]]></category>
		<category><![CDATA[limitations]]></category>
		<category><![CDATA[masochism]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[purebasic]]></category>
		<category><![CDATA[realbasic]]></category>

		<guid isPermaLink="false">http://gushh.net/blog/?p=59</guid>
		<description><![CDATA[You&#8217;ve been coding in *Basic for a while now, you feel you know it all and there&#8217;s nothing else to get from it. Well, that wouldn&#8217;t be a strange scenario, it happens to anyone who has been misled into the programming world to begin with! The problem with the Basic languages is that they were [...]]]></description>
			<content:encoded><![CDATA[<p>You&#8217;ve been coding in *Basic for a while now, you feel you know it all and there&#8217;s nothing else to get from it. Well, that wouldn&#8217;t be a strange scenario, it happens to anyone who has been misled into the programming world to begin with!</p>
<p>The problem with the Basic languages is that they were conceived as a learning step and nothing else. Some of them try to stretch the bar, failing miserably in the process.</p>
<p>Now, don&#8217;t get me wrong I like them, But they&#8217;re not a world-class programming environment nor language nor compiler. Why else do you think that no one hires for *Basic?, because it practically doesn&#8217;t exist in the real world.</p>
<p>As a learning tool if it served it&#8217;s purpose then applaud and make yourself a favor: <strong>move on</strong>.</p>
<p> </p>
<p><span id="more-59"></span></p>
<h2>The next step: Choosing a real language.</h2>
<p>Languages are like fruit, you bake an apple cake with apples and you make an orange mousse with oranges. You don&#8217;t go around faking the apple cake with another fruit because then, it wouldn&#8217;t be an apple cake to begin with.  How is this example any good?, it&#8217;s the same as saying &#8220;choosing the right tool for the right job&#8221;. I just like to cook and present bad analogies.</p>
<p>Alas, your big project won&#8217;t go anywhere in it&#8217;s current state but porting towards a world-class language isn&#8217;t hard at all, once you&#8217;ve mastered the target language. This could take some time, specially with C++ (some say, you will never stop learning it &#8211; isn&#8217;t this amazing?, you can&#8217;t get bored with it!).</p>
<p>But, the real purpose for moving on is not only because no one will ever hire a &#8220;basic&#8221; programmer, It&#8217;s simply because you shouldn&#8217;t have to put up with any language limitations to write your dream code. And also, because the support for world-class languages is ten orders of magnitude better than your current &#8220;Official forums&#8221; and &#8220;Official IRC Channel&#8221; for your beloved Basic variant.</p>
<p>I always say, those &#8220;Neo Basic&#8221; languages are nothing but the retarded bastard child of a couple of bad programmers who couldn&#8217;t get their facts straight to begin with. Either that, or they needed some quick beer money. You choose. The truth is, you can learn how to program with better languages (I hear Python, C#, etc) and never, ever, have to put up with a Basic language at all.  It&#8217;s not an ideal-world scenario, it&#8217;s the real world and you can do it right now, no one forces you to a lesser language but yourself.</p>
<p> </p>
<p>Now, for prototyping, that&#8217;s another story; see&#8230; almost any language is good for prototyping!. Just don&#8217;t forget that those libraries presented on that *Basic language could well be available in a world-class language already. So unless you&#8217;re trying to escape a strict syntax or you already have a bunch of code templates done, don&#8217;t go for a lesser language.</p>
<p>So really, the only reason you&#8217;d try and code in a *Basic language is for nostalgia&#8217;s sake. Either that or you have a bad case of masochism. But I don&#8217;t blame you, I sometimes fire up some sort of Basic compiler just for fun, if any.</p>
<p>As I said &#8211; and I don&#8217;t think I&#8217;m the only one with this point of view &#8211; You should <strong>open your eyes</strong> and see what&#8217;s really out there, <strong>stop limiting yourself</strong>. Put that bucket of excuses in a hole and bury it, <strong>live again</strong>.</p>
<g:plusone href='http://gushh.net/blog/going-from-basic-to-the-real-world/'></g:plusone>]]></content:encoded>
			<wfw:commentRss>http://gushh.net/blog/going-from-basic-to-the-real-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Served from: gushh.net @ 2012-02-09 08:04:45 by W3 Total Cache -->
