<?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>PCR&#039;s notepad &#187; programming</title>
	<atom:link href="http://notepad.patheticcockroach.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://notepad.patheticcockroach.com</link>
	<description>The area in patheticcockroach.com where the EEG isn&#039;t isoelectric</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:11:36 +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>R: working around &#8220;error in La.svd Lapack routine &#8216;dgesdd&#8217;&#8221;</title>
		<link>http://notepad.patheticcockroach.com/2746/r-working-around-error-in-la-svd-lapack-routine-dgesdd/</link>
		<comments>http://notepad.patheticcockroach.com/2746/r-working-around-error-in-la-svd-lapack-routine-dgesdd/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 03:04:03 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[R (R-project)]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2746</guid>
		<description><![CDATA[That&#8217;s a quite enigmatic and unhelpful error message that apparently can be tracked down to some stuff written in *cough* Fortran (source, look for message 26). I don&#8217;t really have a sure solution, but I did manage to evade that error with, so far, a 100% success rate. I got the error while doing some [...]]]></description>
			<content:encoded><![CDATA[<p>That&#8217;s a quite enigmatic and unhelpful error message that apparently can be tracked down to some stuff written in *cough* Fortran (<a href="https://stat.ethz.ch/pipermail/r-help/2010-May/237778.html">source, look for message 26</a>).</p>
<p>I don&#8217;t really have a sure solution, but I did manage to evade that error with, so far, a 100% success rate. I got the error while doing some machine learning (feature selection + classification task, not sure at which step it broke), and I noticed that even though it was in a pretty large loop, it seemed to be 100% reproducible for me (loop always crashing on the same iteration). I realized that I was using <code>set.seed()</code> in order to get more stable results (I&#8217;m generating lots of artificial data, and having them vary between various experimental conditions adds unwanted noise), and so I thought, since this seems to usually be a random error, maybe setting another seed would work. And indeed it did: changing the seed from 100 to 99 in my case &#8220;solved&#8221; the issue.</p>
<p>Long story short: If it occurs randomly and you don&#8217;t use a seed, if this is a possibility do try setting a seed (try a few if it doesn&#8217;t work the first time). If it occurs deterministically and you do use a seed, try another seed value (same, try a few if needed).<br />
If it occurs deterministically and you don&#8217;t use a seed, I&#8217;m not sure setting a seed would help. If it occurs randomly and you do use a seed, I really don&#8217;t think changing the seed would help. But I guess it costs nothing to try&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2746/r-working-around-error-in-la-svd-lapack-routine-dgesdd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enriching Notepad++&#8217;s lang.xml to add better MySQL support</title>
		<link>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/</link>
		<comments>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 16:17:55 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2704</guid>
		<description><![CDATA[For the moment, Notepad++ is my editor of choice to edit MySQL stuff. Its syntax highlighting works nice, however for some reason it lacks quite a few keywords, such as DATETIME and UNSIGNED. I don&#8217;t know the reason for this, maybe those types are MySQL-specific and not generic SQL types, but anyway I don&#8217;t really [...]]]></description>
			<content:encoded><![CDATA[<p>For the moment, <a href="http://notepad-plus-plus.org/">Notepad++</a> is my editor of choice to edit MySQL stuff. Its syntax highlighting works nice, however for some reason it lacks quite a few keywords, such as DATETIME and UNSIGNED. I don&#8217;t know the reason for this, maybe those types are MySQL-specific and not generic SQL types, but anyway I don&#8217;t really care about generic SQL, I just want a more comprehensive highlighting for the SQL I use &#8211; MySQL.<br />
Fortunately, it&#8217;s very easy to add language elements: you just need to edit langs.xml (+/- langs.model.xml, I&#8217;m not really sure if you need to edit both, but that&#8217;s what I did), find the SQL section (starts with something like <code>&lt;Language name="sql" ext="sql" commentStart="/*" commentEnd="*/"&gt;</code>), and add the tags. Without further ado, here&#8217;s my edited SQL section. Note that for the moment I didn&#8217;t really add many tags (just the *cough* 5 at the very bottom&#8230;), but more <del>will</del> should come as I stumble upon them&#8230;</p>
<p><code>&lt;Language name="sql" ext="sql" commentStart="/*" commentEnd="*/"&gt;<br />
	&lt;Keywords name="instre1"&gt;abs absolute access acos add add_months adddate admin after aggregate all allocate alter and any app_name are array as asc ascii asin assertion at atan atn2 audit authid authorization autonomous_transaction avg before begin benchmark between bfilename bin binary binary_checksum binary_integer bit bit_count bit_and bit_or blob body boolean both breadth bulk by call cascade cascaded case cast catalog ceil ceiling char char_base character charindex chartorowid check checksum checksum_agg chr class clob close cluster coalesce col_length col_name collate collation collect column comment commit completion compress concat concat_ws connect connection constant constraint constraints constructorcreate contains containsable continue conv convert corr corresponding cos cot count count_big covar_pop covar_samp create cross cube cume_dist current current_date current_path current_role current_time current_timestamp current_user currval cursor cycle data datalength databasepropertyex date date_add date_format date_sub dateadd datediff datename datepart day db_id db_name deallocate dec declare decimal decode default deferrable deferred degrees delete dense_rank depth deref desc describe descriptor destroy destructor deterministic diagnostics dictionary disconnect difference distinct do domain double drop dump dynamic each else elsif empth encode encrypt end end-exec equals escape every except exception exclusive exec execute exists exit exp export_set extends external extract false fetch first first_value file float floor file_id file_name filegroup_id filegroup_name filegroupproperty fileproperty for forall foreign format formatmessage found freetexttable from from_days fulltextcatalog fulltextservice function general get get_lock getdate getansinull getutcdate global go goto grant greatest group grouping having heap hex hextoraw host host_id host_name hour ident_incr ident_seed ident_current identified identity if ifnull ignore immediate in increment index index_col indexproperty indicator initcap initial initialize initially inner inout input insert instr instrb int integer interface intersect interval into is is_member is_srvrolemember is_null is_numeric isdate isnull isolation iterate java join key lag language large last last_day last_value lateral lcase lead leading least left len length lengthb less level like limit limited ln lpad local localtime localtimestamp locator lock log log10 long loop lower ltrim make_ref map match max maxextents mid min minus minute mlslabel mod mode modifies modify module month months_between names national natural naturaln nchar nclob new new_time newid next next_day nextval no noaudit nocompress nocopy none not nowait null nullif number number_base numeric nvl nvl2 object object_id object_name object_property ocirowid oct of off offline old on online only opaque open operator operation option or ord order ordinalityorganization others out outer output package pad parameter parameters partial partition path pctfree percent_rank pi pls_integer positive positiven postfix pow power pragma precision prefix preorder prepare preserve primary prior private privileges procedure public radians raise rand range rank ratio_to_export raw rawtohex read reads real record recursive ref references referencing reftohex relative release release_lock rename repeat replace resource restrict result return returns reverse revoke right rollback rollup round routine row row_number rowid rowidtochar rowlabel rownum rows rowtype rpad rtrim savepoint schema scroll scope search second section seddev_samp select separate sequence session session_user set sets share sign sin sinh size smallint some soundex space specific specifictype sql sqlcode sqlerrm sqlexception sqlstate sqlwarning sqrt start state statement static std stddev stdev_pop strcmp structure subdate substr substrb substring substring_index subtype successful sum synonym sys_context sys_guid sysdate system_user table tan tanh temporary terminate than then time timestamp timezone_abbr timezone_minute timezone_hour timezone_region to to_char to_date to_days to_number to_single_byte trailing transaction translate translation treat trigger trim true trunc truncate type ucase uid under union unique unknown unnest update upper usage use user userenv using validate value values var_pop var_samp varchar varchar2 variable variance varying view vsize when whenever where with without while with work write year zone<br />
	mediumint datetime tinyint text unsigned&lt;/Keywords&gt;<br />
&lt;/Language&gt;</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2704/enriching-notepads-lang-xml-to-add-better-mysql-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A bad idea in R: using variables named like existing functions</title>
		<link>http://notepad.patheticcockroach.com/2565/a-bad-idea-in-r-using-variables-with-the-same-name-as-existing-functions/</link>
		<comments>http://notepad.patheticcockroach.com/2565/a-bad-idea-in-r-using-variables-with-the-same-name-as-existing-functions/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:15:33 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[R (R-project)]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2565</guid>
		<description><![CDATA[R has an amazing robustness to programming weirdness. To give you a first idea: you can call a function with missing arguments, with named or unnamed (or truncated-named!) arguments, with badly-ordered arguments (as long as you name them), or with truncated parameter values as long as they are unambiguous. For instance, all these work and [...]]]></description>
			<content:encoded><![CDATA[<p>R has an amazing robustness to programming weirdness. To give you a first idea: you can call a function with missing arguments, with named or unnamed (or truncated-named!) arguments, with badly-ordered arguments (as long as you name them), or with truncated parameter values as long as they are unambiguous. For instance, all these work and give the very same result:</p>
<p><code>curve(expr=dexp(x, rate = 1, log = TRUE),from=0,to=5);<br />
curve(expr=dexp(x, rat = 1, lo = T),fro=0,to=5);<br />
curve(dexp(x, rate = 1, log = T),0,5);<br />
curve(from=0,to=5,expr=dexp(x,log = T, rate = 1));</code></p>
<p>And it is even possible to create a variable which has the same name as an existing standard function (you can&#8217;t do that with user-defined functions, though). For instance, check out this sequence:</p>
<p><code>&gt; max=5;<br />
&gt; max(8,7);<br />
[1] 8<br />
&gt; max;<br />
[1] 5</code></p>
<p>We define a variable called &#8220;max&#8221;, set it to 5, then use the max() function normally, then call our &#8220;max&#8221; variable.</p>
<p>Falling to this kind of lazy standards, though, isn&#8217;t a good idea, because problems can arise. For instance if you name a variable like a standard function, you won&#8217;t be able to use apply() on it any more:</p>
<p><code>&gt; A=matrix(c(1,5,2,4),2,2);<br />
&gt; max=5;<br />
&gt; apply(A,2,max);<br />
Error in get(as.character(FUN), mode = "function", envir = envir) :<br />
  object 'FUN' of mode 'function' was not found</code></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2565/a-bad-idea-in-r-using-variables-with-the-same-name-as-existing-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling GnuPG 1.x on Linux for Windows</title>
		<link>http://notepad.patheticcockroach.com/2317/compiling-gnupg-1-x-on-linux-for-windows/</link>
		<comments>http://notepad.patheticcockroach.com/2317/compiling-gnupg-1-x-on-linux-for-windows/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 14:38:39 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[privacy]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2317</guid>
		<description><![CDATA[There are two types of encryption: one that will prevent your sister from reading your diary and one that will prevent your government. Bruce Schneier Update: sorry, the download links are offline because they were stolen by the FBI. Update 2: I finally re-uploaded the files to my own server. To make file management easier, [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p><em>There are two types of encryption: one that will prevent your sister from reading your diary and one that will prevent your government.</em></p>
<p style="text-align:right;">Bruce Schneier</p>
</blockquote>
<p><strong>Update: sorry, the download links are offline because they were <a href="http://notepad.patheticcockroach.com/2616/oops-the-fbi-stole-my-files/">stolen by the FBI</a>.<br />
Update 2: I finally re-uploaded the files to my own server. To make file management easier, only one archive now, containing both binaries and the source.</strong></p>
<p><a href="http://sks.betabuild.net:11371/pks/lookup?search=0x18BEA442&#038;op=vindex"><img src="http://img.patheticcockroach.com/01/GnuPG-size-matters.png" alt="GnuPG: key size matters, and my key is much bigger than yours" width="500" height="70"/></a></p>
<p>In a <a href="http://notepad.patheticcockroach.com/2278/sending-and-receiving-encrypted-e-mail-on-windows/">previous tutorial</a> a few days ago, I explained in details how to create your own OpenPGP key and use it to sign and receive encrypted e-mails. In this tutorial, I didn&#8217;t really go deep into the key length choice: I just suggested to pick the maximum choice offered by Kleopatra (3072 bits) or to go to command line to pick GnuPG&#8217;s maximum value (4096 bits) and voilà.<br />
However, as SHA-1 is starting to show some weaknesses, <a href="http://www.apache.org/dev/release-signing.html#key-length">key length might matter more than you think</a> until SHA-3 is out. An RSA key larger than 4096 bits will definitely break an old programs or two, but as long as you&#8217;re communicating with no too outdated versions of GnuPG, a bigger key should be fine. The main problem is: to generate an RSA key longer than 4096 bits, you&#8217;ll need to compile your own GnuPG: GnuPG is perfectly capable to handle longer keys, but a limit of 4096 bits has been hard-coded into the key generation function.<br />
So, here&#8217;s a quick guide to edit the maximum key length and then cross-compile GnuPG for Windows on Linux. Note that compiling for Linux should be quite trivial from the documentation. If you don&#8217;t want to compile you can just grab <a href="http://img.patheticcockroach.com/01/GnuPG-1.4.11-bigkey.7z">my builds</a><!--The link used to point to http://www.megaupload.com/?d=Y7885050.--> (there&#8217;s one standard and one optimized for &#8220;recent&#8221; AMD CPUs such as Phenom 2), although trusting random builds from the internet probably isn&#8217;t what you&#8217;ll want to do if you&#8217;re here worrying about getting a key longer than 4096 bits&#8230; Another option is to download my modified source that I finally <a href="http://img.patheticcockroach.com/01/GnuPG-1.4.11-bigkey.7z">included into the archive where the binaries are</a><!--The link used to point to http://www.megaupload.com/?d=3OH7BR4Q.-->. NB: it&#8217;s compressed in 7-zip, in order to uncompress it with Ark you&#8217;ll need to install the <code>p7zip-full</code> package.</p>
<h2>My setup</h2>
<p>I used Kubuntu 11.10 32 bits, up-to-date as of 29 October 2011. That notably includes MinGW-GCC version 4.4.x (I love how current that is, on Windows we have version 4.6.x already). It should be much the same on Ubuntu 11.10, and I guess close enough on Debian and possibly Fedora.</p>
<h2>Grabbing the source code</h2>
<p>The source can be downloaded from <a href="http://www.gnupg.org/download/">http://www.gnupg.org/download/</a>. Note that we&#8217;ll grab version 1.4 and not version 2.0 (see a bit below for the reason why). It&#8217;s older but works just as well for key generation.</p>
<h2>Getting dependencies</h2>
<p>NB: those dependencies are for GnuPG 2.x, I&#8217;m not sure if all those are needed for GnuPG 1.x. That&#8217;s because I first I tried to compile GnuPG 2.x, but since I failed I fell back to version 1.x, keeping all the packages I had already installed in the process.<br />
<code>apt-get install gcc-mingw32<br />
apt-get install libgpg-error-dev libgcrypt11-dev libassuan-dev libksba-dev libpth-dev<br />
apt-get install zlib1g-dev</code></p>
<h2>Increasing maximum key size</h2>
<p>In <em>g10/keygen.c</em>, find (that&#8217;s on line 1580 as of version 1.4.11)<br />
<code>unsigned nbits, min, def=2048, max=4096;</code><br />
and replace, for instance, with:<br />
<code>unsigned nbits, min, def=2048, max=1048576;</code><br />
(NB: that&#8217;s a lot too large, but this way you can be sure you won&#8217;t need to edit that again in a big while ^^) (<a href="http://albanianwizard.org/gnupg-create-keys-over-4096-bit-stronger-encryption.albanianwizard">source 1</a>, <a href="http://www.jroller.com/robertburrelldonkin/entry/gnupg_8192bit_rsa_keys">source 2</a>)</p>
<h2>Preparing to build and building</h2>
<p>First, an optional step for those who want to optimize the binary to fit their architecture better (for me this would be &#8220;<a href="http://gcc.gnu.org/wiki/AMDFAM10">amdfam10</a>&#8220;): you can customize the compilation flags.</p>
<ul>
<li><del>in <em>configure.ac</em> find <code>CFLAGS="$CFLAGS -Wall"</code> and replace it with <code>CFLAGS="-O3 -march=amdfam10"</code></del> this one doesn&#8217;t seem to be useful</li>
<li>in <em>configure</em>, find <code>CFLAGS="$CFLAGS -Wall"</code> (in version 1.4.11 that&#8217;s on line 16170) and replace it with <code>CFLAGS="-O3 -march=amdfam10"</code> (NB: it might be a good idea to just comment the old code then add your own, instead of overwriting it)</li>
</ul>
<p>Even with those optimizations, my &#8220;optimized&#8221; build is still like twice slower than the official builds&#8230; I can&#8217;t figure out why :/</p>
<p>Now all the commands to build (NB: I&#8217;m assuming you are in the gnupg root folder):<br />
<code>scripts/autogen.sh --build-w32<br />
touch po/all<br />
make<br />
mkdir dist-w32<br />
scripts/mk-w32-dist</code></p>
<p>Your built executables will then be available in the dist-w32 folder. Note that the last command seems a bit broken, because according to the <a href="http://www.gossamer-threads.com/lists/gnupg/users/11223">source</a> where I found it it should pack all those executables into a zip, which it doesn&#8217;t do, but for what we need this will be good enough, as we&#8217;ll only use gpg.exe. Before bringing it to Windows, you may want to strip it (to make it smaller, although normally it should be stripped already): <code>strip gpg.exe</code>. Now you can just use it as you would use your original gpg.exe. I&#8217;d recommend that you gave this new gpg a different name, and that you&#8217;d use it only for creating new keys, because it&#8217;s probably slower than official builds (at least for me it is).</p>
<p>Finally, a hint about key size: 10,240 bits sounds more than enough. It&#8217;s already <strong>a lot</strong> slower than 4,096 (I&#8217;m talking about a few minutes to generate your key, compared to a few seconds for 4096 bits). I tried 16,384: it took like 40 minutes and eventually gpg crashed while validating the key (cf picture below).<br />
<a href="http://img.patheticcockroach.com/01/gpg-key-too-big.png"><img src="http://img.patheticcockroach.com/01/gpg-key-too-big.png" alt="What happens when your key is really too fat" width="500" height="253"/></a></p>
<h2>Bonus: cleaning in case you messed up</h2>
<p>If you need to rebuild, make sure you run <code>make clean</code>, otherwise the compiler will just use the previously compiled objects, without recompiling them.</p>
<p>Update (2012-01-07): finally uploaded the modified sources.<br />
Update (2012-01-28): uploaded everything back to my own server after the FBI took down the files when taking down MegaUpload.</p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2317/compiling-gnupg-1-x-on-linux-for-windows/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Fixing &#8220;aclocal: command not found&#8221;</title>
		<link>http://notepad.patheticcockroach.com/2255/fixing-aclocal-command-not-found/</link>
		<comments>http://notepad.patheticcockroach.com/2255/fixing-aclocal-command-not-found/#comments</comments>
		<pubDate>Fri, 07 Oct 2011 16:14:27 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=2255</guid>
		<description><![CDATA[Shortest post in a while Had this error when trying to prepare some program for Linux=>Windows cross-compilation using MinGW32. For me the solution was: just make sure you did install autoconf and automake. So on Fedora this would be like: yum install autoconf automake Source: http://forums.fedoraforum.org/showthread.php?t=115965]]></description>
			<content:encoded><![CDATA[<p>Shortest post in a while <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br />
Had this error when trying to prepare some program for Linux=>Windows cross-compilation using MinGW32. For me the solution was: just make sure you did install autoconf and automake. So on Fedora this would be like:<br />
<code>yum install autoconf automake</code></p>
<p>Source: <a href="http://forums.fedoraforum.org/showthread.php?t=115965">http://forums.fedoraforum.org/showthread.php?t=115965</a></p>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/2255/fixing-aclocal-command-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Program working in step-by-step, but crashing both in release and debug</title>
		<link>http://notepad.patheticcockroach.com/1854/program-working-in-step-by-step-but-crashing-both-in-release-and-debug/</link>
		<comments>http://notepad.patheticcockroach.com/1854/program-working-in-step-by-step-but-crashing-both-in-release-and-debug/#comments</comments>
		<pubDate>Tue, 24 May 2011 04:26:01 +0000</pubDate>
		<dc:creator>David Dernoncourt</dc:creator>
				<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://notepad.patheticcockroach.com/?p=1854</guid>
		<description><![CDATA[Time to narrate yet another story of my trouble with C++ debugging (with GDB via Code::Blocks). That one seemed even more weird than the time where no debugging symbols were placed in the debug executable. At some point, given some specific input, the program crashed both in release and debug (with no breakpoint) mode&#8230; but [...]]]></description>
			<content:encoded><![CDATA[<p>Time to narrate yet another story of my trouble with C++ debugging (with GDB via Code::Blocks). That one seemed even more weird than the time where no debugging symbols were placed in the debug executable. At some point, given some specific input, the program crashed both in release and debug (with no breakpoint) mode&#8230; but when run step-by-step it would work properly&#8230; what the heck, really&#8230;</p>
<p>The crash terminated the program with 0xC0000005: Access Violation. So, memory issue. After asking here and there (offline, yay! <img src='http://notepad.patheticcockroach.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> ), I was eventually told that memory is handled really quite differently when debugging step-by-step and when running normally (even a &#8220;debug&#8221; build). I did know that, but never thought the difference was big enough to prevent a memory violation crash: after all, if running step-by-step &#8220;fixes&#8221; such big issues &#8220;automatically&#8221;, then debugging is kind of broken&#8230; So, no way to debug using the debugger&#8230; I was left with only one option: reading the code again looking for something that would generate memory violation, and placing some std::cout to check my variables before the crash.</p>
<p>In my particular case, I dealt with quite a few arrays, passing their lengths all around the place and accessing indexes according to ranges defined by other variables which was supposed to match&#8230; but eventually didn&#8217;t. <strong>Long story short, in rare cases, I was reading and even writing out of some arrays&#8217; limits. That can do a crash case not reproducible when running step-by-step.</strong></p>
<p>Some sources that helped:</p>
<ul>
<li><a href="http://www.codeguru.com/forum/showthread.php?t=269905">Codeguru forums &#8211; Visual C++ Debugging: Why does program work in debug mode, but fail in release mode?</a></li>
<li><a href="http://www.programmersheaven.com/mb/CandCPP/285121/285121/0xc0000005-access-violation/">Programmers Heaven &#8211; 0xC0000005: Access Violation</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://notepad.patheticcockroach.com/1854/program-working-in-step-by-step-but-crashing-both-in-release-and-debug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

