tag:blogger.com,1999:blog-222383312024-03-13T22:17:22.042+00:00Vague vagariesI have no idea what to be putting in here.Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.comBlogger207125tag:blogger.com,1999:blog-22238331.post-71340131842725543512020-11-21T02:48:00.001+00:002020-11-21T02:48:36.414+00:00Avoiding negative reviews with EULA abuse<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Avoiding negative reviews with EULA abuse</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html"><p>After seeing some fun-looking gameplay videos of <a href="https://store.steampowered.com/app/582550/Passpartout_The_Starving_Artist/">Passportout</a>, I went to Steam to buy the game which had quite good reviews. First, though, I was invited to read the <a href="https://www.flamebaitgames.com/passpartout-eula/">end-user license agreement</a> (EULA), which said a few things that made me quite uncomfortable, but especially the following:</p>
<blockquote>
<p>FLAMEBAIT GAMES RESERVES THE RIGHT TO ADD, MODIFY, OR DELETE/CANCEL THE GAME, INCLUDING YOUR ACCESS TO THE GAME AT ANY TIME.</p>
</blockquote>
<p>So, after buying the game, they can “delete” it or disable my access at any time, for any reason. Why?</p>
<blockquote>
<p>In consideration of the payment of any applicable fees and subject to your registering for an account and compliance with the terms contained herein, Flamebait Games or the platform/service provider will, upon receipt of your payment if applicable, provide you with a limited, non-exclusive, revocable license to access the Game and enable you to access and play the Game for your personal use subject to the other applicable provisions, limitations and restrictions in this End User License Agreement.</p>
</blockquote>
<p>Seriously? So if I pay you, I don’t actually own a copy of the game – I get a <em>revocable</em> license to access it? Why?</p>
<p>It continues:</p>
<blockquote>
<p>You may not upload or republish the Game or Game Content on any Internet, Intranet or Extranet sites or incorporate the information in any other database or compilation, and any other use of the Game or Game Content not expressly allowed under this Agreement is strictly prohibited.</p>
</blockquote>
<p>This is worded extremely broadly, implying that you can’t even publish a screenshot of the game.</p>
<blockquote>
<p>However, you may upload recordings of yourself playing the Game on channels like <a href="http://Twitch.com">Twitch.com</a> and <a href="http://YouTube.com">YouTube.com</a> etc, provided that such use is done in good taste and does not infringe on the intellectual property rights of Flamebait Games <strong>or reflect negative on Flamebait Games or the Game</strong>.</p>
</blockquote>
<p>Basically the EULA forces you to agree not to upload or stream gameplay videos, unless it’s “in good taste” (whatever that means, seems totally subjective) and doesn’t reflect negatively on the game. In effect, the EULA prohibits you from using footage of yourself playing the game if you’re going to say anything critical about it.</p>
<p>That really is disgusting and unethical abuse of an EULA that most people almost certainly click through without fully reading. It’s likely unenforceable since it overly restricts freedom of expression and criticism, so it leaves me to wonder why they bothered. This is the kind of thing you might expect from Nintendo, not a small European game company.</p>
<p>Shame on you, Flamebait Games.</p>
</div>
</body>
</html>
Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-56059332897097213042018-06-17T21:34:00.002+01:002018-06-17T21:34:53.557+01:00Lazy evaluation and list random access in Haskell<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lazy evaluation and list random access in Haskell</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html"><p>Today I learned about the <a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html#ghci-cmd-:sprint"><code>:sprint</code></a> command in <a href="https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html">GHCi</a>, which prints the value bound to given identifier without forcing its evaluation. The unevaluated part, if any, is printed as an underscore.</p>
<p>Here, we can see that the value bound to <code>s</code> is entirely unevaluated at first:</p>
<pre class=" language-haskell"><code class="prism language-haskell">λ<span class="token operator">></span> <span class="token hvariable">s</span> <span class="token operator">=</span> <span class="token string">"0123456789"</span>
λ<span class="token operator">></span> <span class="token operator">:</span><span class="token hvariable">sprint</span> <span class="token hvariable">s</span>
<span class="token hvariable">s</span> <span class="token operator">=</span> <span class="token hvariable">_</span>
</code></pre>
<p>Now let’s peek at the first character in the string:</p>
<pre class=" language-haskell"><code class="prism language-haskell">λ<span class="token operator">></span> <span class="token builtin">head</span> <span class="token hvariable">s</span>
<span class="token char">'0'</span>
λ<span class="token operator">></span> <span class="token operator">:</span><span class="token hvariable">sprint</span> <span class="token hvariable">s</span>
<span class="token hvariable">s</span> <span class="token operator">=</span> <span class="token char">'0'</span> <span class="token operator">:</span> <span class="token hvariable">_</span>
</code></pre>
<p>We can see that only the first character in the string (i.e. the first element of a list of characters) was evaluated. Now, let’s use the <code>!!</code> operator to print the fourth character in <code>s</code>:</p>
<pre class=" language-haskell"><code class="prism language-haskell">λ<span class="token operator">></span> <span class="token hvariable">s</span> <span class="token operator">!!</span> <span class="token number">3</span>
<span class="token char">'3'</span>
λ<span class="token operator">></span> <span class="token operator">:</span><span class="token hvariable">sprint</span> <span class="token hvariable">s</span>
<span class="token hvariable">s</span> <span class="token operator">=</span> <span class="token char">'0'</span> <span class="token operator">:</span> <span class="token char">'1'</span> <span class="token operator">:</span> <span class="token char">'2'</span> <span class="token operator">:</span> <span class="token char">'3'</span> <span class="token operator">:</span> <span class="token hvariable">_</span>
</code></pre>
<p>Interesting – we can see that this caused all of the intervening elements to be consumed, which demonstrates that random access of a list with the <code>!!</code> operator must walk along the <code>cons</code> cells and therefore can be expected to require linear time to complete.</p>
<p>If we print the whole string, then <code>:sprint</code> shows the entire string with no unevaluated component:</p>
<pre class=" language-haskell"><code class="prism language-haskell">λ<span class="token operator">></span> <span class="token hvariable">s</span>
<span class="token string">"0123456789"</span>
λ<span class="token operator">></span> <span class="token operator">:</span><span class="token hvariable">sprint</span> <span class="token hvariable">s</span>
<span class="token hvariable">s</span> <span class="token operator">=</span> <span class="token string">"0123456789"</span>
</code></pre>
</div>
</body>
</html>
Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-28762176836736668852018-02-04T00:18:00.001+00:002018-02-04T00:18:31.357+00:00Controlling test execution in ExUnit<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Controlling test execution in ExUnit</title>
<link rel="stylesheet" href="https://stackedit.io/style.css" />
</head>
<body class="stackedit">
<div class="stackedit__html"><p>The <a href="https://elixir-lang.org/">Elixir</a> programming language comes with a nice, simple testing library called <a href="https://hexdocs.pm/ex_unit/ExUnit.html">ExUnit</a>, and you can run all of your tests with <code>mix test</code>.</p>
<p>But sometimes you don’t want to run all your tests. Maybe you added integration tests or for whatever reason have a test that gives useful information but takes a long time to execute. In these situations, you can add the “skip” tag by adding an annotation before a test which shouldn’t be executed by <code>mix test</code>:</p>
<pre class=" language-elixir"><code class="prism language-elixir"><span class="token attribute variable">@tag</span> <span class="token atom symbol">:skip</span>
test <span class="token string">"should be skipped..."</span> <span class="token keyword">do</span>
<span class="token operator">...</span>
</code></pre>
<p>This way, a normal <code>mix test</code> run will be fast (and won’t break your continuous integration system), and when you want to actually run that test locally, you can:<br>
<code>mix test --include skip</code></p>
<p>However, this will run <em>all</em> tests marked <code>skip</code>. A more flexible approach is to add your own tag and use it to name your slow tests.</p>
<p>First, modify <code>test/test_helper.exs</code> to look like this, to prevent those tests from running by default:</p>
<pre class=" language-elixir"><code class="prism language-elixir">ExUnit<span class="token punctuation">.</span>start<span class="token punctuation">(</span><span class="token attr-name">exclude:</span> <span class="token atom symbol">:slow_test</span><span class="token punctuation">)</span>
</code></pre>
<p>Next, annotate your slow tests with names:</p>
<pre class=" language-elixir"><code class="prism language-elixir"> <span class="token attribute variable">@tag</span> <span class="token attr-name">slow_test:</span> <span class="token string">"backtest"</span>
test <span class="token string">"Backtest should take ages"</span> <span class="token keyword">do</span>
<span class="token operator">...</span>
<span class="token keyword">end</span>
<span class="token attribute variable">@tag</span> <span class="token attr-name">slow_test:</span> <span class="token string">"optimiser"</span>
test <span class="token string">"Optimiser should waste a lot of time"</span> <span class="token keyword">do</span>
<span class="token operator">...</span>
<span class="token keyword">end</span>
</code></pre>
<p>Now <code>mix test</code> will still run your normal unit tests, and you can run one of the slow tests with <code>mix test --trace --only slow_test:optimiser</code> (the addition of the <code>--trace</code> option means ExUnit will let the test run as long as is necessary rather than killing it after 60 seconds).</p>
</div>
</body>
</html>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-9853524743217168112017-08-30T15:42:00.001+01:002017-08-30T15:47:45.592+01:00Should we fine cyclists for breaking red lights?<p><em>(This was a comment I made in a discussion on Facebook that seemed worth saving. You be the judge.)</em></p>
<p>I don’t think cyclists should be fined for breaking red lights unless they clearly and avoidably place other people at risk, because it discourages casual cyclists and drives them back to… driving, which is of course much more likely to cause death and injury to others.</p>
<p>But if we insist upon it, then the fine should be proportional to the amount of damage you’re likely to do if you hit someone – this is based on many factors, so probably the most reasonable approach is a fine proportional to kinetic energy, which is the mass of vehicle and rider times the square of their speed.</p>
<p>Let’s do a worked example:</p>
<ul>
<li><p>80kg rider + 15kg bike + 5kg gear, travelling at 25km/h (just under 7 m/s)</p>
<ul><li>= 0.5 * 100 * (6.944…)^2 = 2,411 joules</li></ul></li>
<li><p>80kg driver + 1180kg car (2017 Volkswagen Golf, 1.4L manual), travelling at 30km/h (city centre speed limits, just over 8 m/s)</p>
<ul><li>= 0.5 * 1260 * (8.3…)^2 = 43,750 joules</li></ul></li>
<li><p>80kg driver + 3365kg van (2012 Ford Transit, 2.0L diesel), travelling at 50km/h</p>
<ul><li>= 0.5 * 3445 * (13.8…)^2 = 332,272 joules.</li></ul></li>
</ul>
<p>So if we charged people 1 cent per joule of kinetic energy involved in these infractions, it would cost a cyclist €24.11 to break a red light, or €437.50 for a driver of a Golf doing 30, or €3322.72 for a driver of a Transit doing 50.</p>
<p>Or maybe we could acknowledge the fact that cyclists pose so little threat to life compared to cars and vans that we should stop discouraging them from cycling and stop focusing so much effort on blaming them for being “a menace” given that cars travelling at even low speeds carry 20 times as much kinetic energy, take more space, cause more pollution, cause more health problems, damage more bridges and lampposts, and of course cause almost all road deaths.</p>
<p>With this in mind, why are we even having articles in newspapers or radio discussions about the dangers posed by cyclists? Why aren’t our papers and radio discussions filled with appeals to the public to get on their bikes?</p>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com1tag:blogger.com,1999:blog-22238331.post-73082246765552721042015-03-19T23:11:00.001+00:002015-03-19T23:11:49.377+00:00(Linux/Ubuntu) Frequent 802.11g/WPA2 connection drops with brcmsmac/BCM4313 driverMy Samsung laptop running Ubuntu 14.10 has been dropping its WiFi connection a lot. A cursory examination of the system log reveals that it usually happens once every 20-40 minutes, with a few suspicious cases where it dropped and re-established the connection after exactly 25 minutes:
<br>
<pre>$ grep "wlan0: associated" /var/log/syslog.1
Mar 17 20:45:48 gravitycat kernel: [101379.946156] wlan0: associated
Mar 17 21:10:48 gravitycat kernel: [102880.685412] wlan0: associated
Mar 17 21:33:32 gravitycat kernel: [104244.524634] wlan0: associated
Mar 17 21:43:03 gravitycat kernel: [104815.501396] wlan0: associated
Mar 17 22:08:03 gravitycat kernel: [106316.384463] wlan0: associated
Mar 17 22:11:23 gravitycat kernel: [ 35.255877] wlan0: associated
Mar 17 22:46:55 gravitycat kernel: [ 2167.317562] wlan0: associated
[...]
Mar 17 23:29:08 gravitycat kernel: [ 4701.239455] wlan0: associated
Mar 17 23:54:08 gravitycat kernel: [ 6201.802957] wlan0: associated
[...]
Mar 18 00:00:26 gravitycat kernel: [ 6579.424244] wlan0: associated
Mar 18 00:25:26 gravitycat kernel: [ 8080.034656] wlan0: associated</pre>
<br>
The connection drops usually looked like this:
<br>
<pre>Mar 17 22:08:03 gravitycat NetworkManager[785]: <warn> Connection disconnected (reason -4)</pre>
<br>
But were sometimes preceded by this:
<br>
<pre>Mar 18 01:09:43 gravitycat kernel: [10736.798220] wlan0: cannot understand ECSA IE operating class 33, disconnecting</pre>
<br>
It alternates between "class 33" and "class 12". After a tiny bit of digging, I found a suggestion <a href="https://bbs.archlinux.org/viewtopic.php?id=170264">here</a> to try switching from Gnome's NetworkManager to <a href="https://help.ubuntu.com/community/WICD">WICD</a>. At first, that seemed to make things better, but it started happening again after about an hour, with the same really frustrating behaviour (having to repeatedly queue the same videos on my Chromecast when it sees me "leave" due to the laptop dropping and reconnecting to the router).
<br><br>
Next port of call is to check the driver. Here's what lspci says is installed in my laptop:
<pre>$ lspci -vvnn | grep -A 9 Network
03:00.0 Network controller [0280]: Broadcom Corporation BCM4313 802.11bgn Wireless Network Adapter [14e4:4727] (rev 01)
Subsystem: Askey Computer Corp. Device [144f:7179]</pre>
<br>
For this device, Ubuntu defaults to the "brcmsmac" open source driver, which is always preferable to a closed-source proprietary driver, all other things being equal. This issue is so frustrating, however, that I'll take the closed-source "bcmwl" driver if it works, <a href="https://help.ubuntu.com/community/WifiDocs/Driver/bcm43xx">following these steps</a>:
<pre>$ sudo apt-get install bcmwl-kernel-source
$ sudo modprobe -r brcmsmac bcma
$ sudo modprobe wl</pre>
<br>
After manually reconnecting with WICD, things seem stable and the ChromeCast hasn't bailed over the past day or so. It's a shame the open source driver isn't working well with the BCM4313 chipset. It'd be nice if there was a simple way to get started debugging/testing the driver – i.e. not having to download a massive tarball of the latest kernel source and spend hours tweaking with build scripts and the like. Unless things have changed in the last few years and now this is easy...?Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-53000640788396569762015-02-09T12:07:00.001+00:002015-02-09T12:07:31.865+00:00OpenCV 2.4.10 and MacportsEvery time I've needed to build OpenCV on my work Mac, it's been a bit of a struggle. I have Macports installed which helps make some things easier, but throws up problems of its own:
<br>
<i>(using "mp-gcc49")</i>
<pre>/Users/oisin/Documents/code/vision/opencv-2.4.10/modules/highgui/src/window_cocoa.mm: In function 'void cvDestroyAllWindows()':
/Users/oisin/Documents/code/vision/opencv-2.4.10/modules/highgui/src/window_cocoa.mm:202:23: error: expected ';' before 'in'
for(NSString *key in list) {
</pre>
<br>
<i>(using "apple-gcc42")</i>
<pre>/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected ')' before '(' token
- (void)modernizeWithCompletionHandler:(void (^)(void))handler AVAILABLE_QTKIT_VERSION_7_7_3_AND_LATER;
^
/System/Library/Frameworks/QTKit.framework/Headers/QTMovieModernizer.h:123:46: error: expected identifier before '(' token</pre>
<br>
The problem appears to be Objective-C stuff in QTKit and in OpenCV's HighGUI code. This time, the solution was to revert to the system-default C/C++ compiler, Clang:
<br>
<pre>$ sudo port select gcc none
Warning: port definitions are more than two weeks old, consider updating them by running 'port selfupdate'.
Selecting 'none' for 'gcc' succeeded. 'none' is now active.</pre>
<br>
It's slightly counterintuitive that "port select gcc none" is how you go back to the system compiler with Macports, and it doesn't appear to be stated <a href="https://trac.macports.org/wiki/UsingTheRightCompiler">in the docs</a>, so... well here it is!Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-84892082108949871992014-07-27T20:02:00.000+01:002014-07-28T01:08:21.960+01:00A tiny line-editing trick for Bash (or any REPL using Readline/emacs bindings)A lot of shells (e.g. Bash) and interactive console programs (e.g. mysql, sqlite, ghci, irb) provide a line-editing interface based on Emacs bindings, either via the Readline library or similar.
<br><br>
These key bindings mostly take the form of ESC-<key> which is either an uncomfortable stretch or (on a full-size keyboard) takes your left hand away from the home row and slows you down. Here's a handy tip though: pressing Ctrl+[ is equivalent to hitting escape, but allows you to keep your hands on the keyboard's home row. And if you're lucky, you can hold the Alt key instead (so you can jump backwards with Alt-b and delete the next word with Alt-d — this works on Gnome Terminal for me at least, except where the key is one of the menu accelerator characters (f, e, v, s, t or h). Seriously though, until today I was hitting ESC then the desired key...Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-83763435860400411802013-09-26T11:03:00.000+01:002013-09-26T11:03:15.094+01:00Ralink RF3070 USB wireless support finally added to LinuxFor a long time, these cheap Chinese USB wifi adapters didn't work in Linux. Believe it or not, I wiped my old laptop's Linux partition and tried FreeBSD and OpenBSD just to see if <i>they</i> supported it - but they didn't either.<br/>
So I reinstalled Linux and eventually produced a <a href="http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-June/006101.html">patch</a> back in June to add support for the device, but for whatever reason it was ignored.
<br/><br/>Now, though, one of the maintainers has <a href="http://rt2x00.serialmonkey.com/pipermail/users_rt2x00.serialmonkey.com/2013-September/006401.html">implemented</a> a proper patch and it looks like the RF3070 will soon work out-of-box in Linux.
<br/><br/>Yay!Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-80379462909650838932013-05-13T12:01:00.001+01:002013-05-13T12:01:03.148+01:00OpenCV build: "Could NOT find JNI" (Ubuntu)While trying to build OpenCV so I could use the new Java bindings, I kept getting this somewhat confusing message:
<blockquote>Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY)</blockquote>
<br/>What does it mean - did I need to set environment variables for the AWT and JVM libraries? Surely they're both already installed. What does it even mean to say "Could NOT find JNI", since JNI is a part of Java which is installed?
<br/><br/>Turns out I needed to manually set the JAVA_HOME environment variable:
<blockquote>export JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64</blockquote>
Why Ubuntu doesn't automatically set this when you install the <i>openjdk7</i> package, I have no idea.Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com1tag:blogger.com,1999:blog-22238331.post-91456592446916997752013-02-24T23:42:00.001+00:002013-05-13T12:09:33.616+01:00Eye queueThis comment by "Cabochon1360" on one of David Mitchell's Youtube <a href="https://www.youtube.com/watch?v=qPMKqyaXtHI">videos</a> struck me today (far more than the video), and sums up my own feelings better than I could have.
<blockquote>In my teens, I was proud of my allegedly high IQ. But decades of failures and other humbling experiences have shown me it's just one personal characteristic, and not the most important one.</blockquote>
Another thing to bear in mind is that telling your kids they did well on a test because they're smart <a href="http://www.parentingscience.com/praise-and-intelligence.html">hinders their future performance</a>. Perhaps counter-intuitive but it's been demonstrated in a number of studies (even when performed on adults, AFAIK).Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-37194299604321763132012-07-20T15:20:00.001+01:002012-07-20T15:20:23.758+01:00What did I miss about modern Linux?After running Windows alone for a couple of years, I had to install a Linux distro yesterday since the CUDA API in Windows is pretty ridiculous, flat out refusing to work with MinGW (the Windows port of gcc/g++ and pals).
<br/><br/>Although I wasted a lot of time trying to get my dumb Medion PC (MS-7358 mainboard) to boot from two different USB keys, eventually a blank CD turned up and Ubuntu 12.04 landed on it.
The install was quick, and this time (unlike on the old Acer laptop my kid uses) the Nvidia card was supported better, giving a usable display.
<br/><br/>I needed to install some tools first before getting the CUDA API/SDK/drivers on Ubuntu:
<blockquote><pre>The following NEW packages will be installed:
build-essential dpkg-dev freeglut3-dev g++ g++-4.6 libalgorithm-diff-perl
libalgorithm-diff-xs-perl libalgorithm-merge-perl libdpkg-perl libdrm-dev
libgl1-mesa-dev libglu1-mesa-dev libice-dev libkms1 libpthread-stubs0
libpthread-stubs0-dev libsm-dev libstdc++6-4.6-dev libtimedate-perl
libx11-dev libx11-doc libxau-dev libxcb1-dev libxdmcp-dev libxext-dev
libxi-dev libxmu-dev libxmu-headers libxt-dev mesa-common-dev
x11proto-core-dev x11proto-input-dev x11proto-kb-dev x11proto-xext-dev
xorg-sgml-doctools xtrans-dev
0 upgraded, 36 newly installed, 0 to remove and 0 not upgraded.
Need to get 15.3 MB of archives.
...
Fetched 15.3 MB in 3s (3,835 kB/s)
...
Setting up build-essential (11.5ubuntu2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
$
</pre></blockquote>
Now I really wish I'd prefixed this with the "time" command, because it took far less than a minute - maybe 15 to 30 seconds to install all of this... the C++ compiler, X11 libraries and a bunch of other stuff.
<br/><br/>In contrast, it took a good 5 minutes just to install Visual Studio 2010 on my Windows 7 laptop (a 64-bit box with a better CPU than this desktop) and the library problems cost me a couple of hours of headbanging which was never resolved.
<br/><br/>There are still serious driver problems in Linux, but the whole experience has improved so much since I started with a Red Hat install back in 1998.
<br/>Being able to install any number of programs and libraries rapidly, with a single command, is so much more relaxing than trying to hack things together in Windows. Try it!Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-69970703168659418782012-06-17T23:13:00.000+01:002012-06-17T23:13:16.765+01:00Terrorist postcards(from <a href="http://www.bbc.co.uk/news/uk-politics-18477158">BBC news</a>)
<blockquote>It has been dubbed a "snooper's charter" by civil liberties groups but the Home Office says new powers are needed to keep pace with how criminals and terrorists are using new technology.</blockquote>
Postcards are new technology now? It hardly seems like the most secure and timely way to communicate, though, does it?
<br/><br/>Do they really think they can catch terrorists and other criminals by reading people's postcards - or are they just a pack of nosy bastards?Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-71093998880316409812012-05-30T00:49:00.000+01:002012-05-30T00:49:05.985+01:00Simple Heuristics that Make Windows Dumb<blockquote><pre>C:\U\O\Documents\c\...\src> .\patch.exe --help
Access is denied.
C:\U\O\Documents\c\...\src> ren patch.exe piss.exe
C:\U\O\Documents\c\...\src> .\piss.exe --help
Usage: .\piss.exe [OPTION]... [ORIGFILE [PATCHFILE]]
</pre></blockquote>
<i>...Fuck you very much, Windows.</i>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-75985280247848358172012-04-17T13:34:00.000+01:002012-04-17T13:34:01.943+01:00Gluap: not-really-useful-yet PushGP in LuaAfter abandoning this for a while, I decided to update my pet project Gluap, a PushGP-based genetic programming library for Lua. While I was at it, I opened a Github account and <a href="https://github.com/DestyNova/Gluap">uploaded the project</a> to a new repo.
If you like, try it out, figure out why it's not performing well and improve it! :)Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-4645377958457486592012-03-09T01:15:00.002+00:002015-07-24T00:47:42.258+01:00(Recursive) Confirmation biasEver heard of <a href="https://en.wikipedia.org/wiki/Confirmation_bias">confirmation bias</a>?
<br/><br/>The worst thing? Being aware of the effect actually <i>increases</i> your susceptibility to it, rather than decreasing it. No need to thank me.
<br/><br/>
But does awareness of <i>that</i> fact <i>reduce</i> susceptibility? And if so, and you know it, does <i>that itself</i>---
<br/><i>--- ERROR: STACK OVERFLOW</i>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-34064765481724100312012-02-24T19:24:00.001+00:002013-09-26T11:11:15.170+01:00Ever wanted to use the Unix "which" command on Windows?The <i>which</i> Unix command takes a program name as an argument, and gives you the first matching directory on your path which contains that program. This is useful if, for example, you're trying to uninstall or upgrade software and are trying to figure out why you can still call the program after you thought it'd been deleted.
<br/><br/>
Unfortunately, there doesn't seem to be any kind of related command for DOS.
Happily, a user named <a href="http://www.computing.net/answers/windows-xp/dos-equivalent-of-unix-which/175022.html">Mechanix2Go</a> posted a hackish version which you can save as a batch file. I've made a couple of minor tweaks, to suppress file not found errors and fix the frankly idiotic treatment by DOS of the PATH variable as a set of tokens delimited by spaces. Some horrible hackery was taken from <a href="http://stackoverflow.com/questions/5471556/pretty-print-windows-path-variable-how-to-split-on-in-cmd-shell/5472168#5472168">here</a> to partially work around the problem. It will still fall over on weird paths with a ';' in them, and it'll echo double quotes.<br/>
Trying to express yourself in DOS batch language is like trying to compose a symphony using only two piano strings.
<br/><br/>
<blockquote><pre>@echo off & setLocal EnableDelayedExpansion
if %1'==' goto :eof
for %%a in ("%path:;=";"%") do (
dir /b %%a 2>&1 | findstr /i /b /c:"%1.exe" /c:"%1.bat" /c:"%1.com" > nul
if not errorlevel 1 echo %1 is in %%~a && goto :eof
)</pre></blockquote>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-52398155876342274982012-02-21T14:40:00.000+00:002012-02-21T14:43:34.267+00:00Reporting on reports about bad reports: SMS vs Web messaging(source: <a href="http://www.bbc.co.uk/news/technology-17111044">BBC News</a>)<br/>
<blockquote><i>Social messaging applications cost mobile network operators $13.9bn (£8.8bn) in lost SMS revenue last year, a report has claimed.<br/>
[...]<br/>
However, the study <b>did not factor in the extra income</b> networks received from mobile data costs because of <b>increased internet usage</b> resulting from social messaging.</i></blockquote>
...Then why are you even writing about it? Damnit BBC.<br/><br/>
That's like saying "Clondalkin cost Dublin Bus $13.9bn in lost revenue on the 51B bus route last year, a report has claimed. The study did not factor in the extra income received from the 51C bus route which completely replaced the 51B route."<br/>
If they lost money on one service because everyone started using a different service that <u>THEY ALSO PROVIDE</u>, then you have to account for that before reporting that they lost money.
Sure, sending one message via a phone's internet connection is probably much cheaper than sending an SMS, but without accounting for how much money they've been making from the increased internet usage - in general, not just for sending messages outside of SMS - it's meaningless for people to say things like this:
<blockquote><i>"I think it's a <b>growing threat</b> which is manageable through the right tariffs and the right costing," Mr Barford added. </i></blockquote>
Hardly a threat, if they're raking in money from all the data plans people are signing up to nowadays.Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-42689699253499703292011-11-15T17:19:00.001+00:002011-11-15T17:45:02.554+00:00Google gets cabbage fronds both ways.To follow up on an <a href="http://vaguevagaries.blogspot.com/2007/01/blog-post.html">oldish post</a> on the patchy quality of Google Translate, I tried the examples and found that they now translate very well.<br />
<br />
<br />
Even doing a lengthy trip between very different languages produces quite good results, which is a good sign that the meaning behind text is being properly treated:<br />
<br />
English "I like to eat cabbage fronds all day long." -> Japanese <span style="background-color: #d9ead3; color: #38761d;">"私は長い一日キャベツの葉を食べるのが好き。"</span><br />
Japanese -> French <span style="background-color: #ead1dc; color: #741b47;">"J'aime manger les feuilles de chou toute la journée."</span><br />
French -> Kannada <span style="background-color: #d9ead3; color: #38761d;">"ನಾನು ಎಲೆಕೋಸು ಎಲ್ಲಾ ದಿನ ಎಲೆಗಳನ್ನು ತಿನ್ನಲು ಪ್ರೀತಿ."</span><br />
Kannada -> Hindi <span style="background-color: #ead1dc; color: #741b47;">"मैं सारा दिन गोभी के पत्ते खाने से प्यार है."</span><br />
Hindi -> Irish <span style="background-color: #d9ead3; color: #38761d;">"Is breá liom a ithe na duilleoga cabáiste an lá ar fad."</span><br />
Irish -> Korean <span style="background-color: #ead1dc; color: #741b47;">"하루 종일 배추의 잎을 먹는 사랑 해요."</span><br />
Korean -> Polish <span style="background-color: #d9ead3; color: #38761d;">"Uwielbiam jeść liście kapusty cały dzień."</span><br />
Polish -> Welsh <span style="background-color: #ead1dc; color: #741b47;">"Rwyf wrth fy modd i fwyta'r dail bresych drwy'r dydd."</span><br />
Welsh -> English <span style="background-color: #d9ead3; color: #38761d;">"I love to eat the leaves of cabbage all day."</span><br />
<br />
So our 9-step purple monkey dishwasher train converted "I like to eat cabbage fronds all day long" into "I love to eat the leaves of cabbage all day".<br />
<br />
There were a couple of languages (Arabic, Gujarati, Chinese) which mangled or lost some of the information (e.g. "cabbage fronds" into "cabbage" or "all day" into "every day"), but this is pretty impressive, and a tangible improvement in a relatively short time. Good work, lads!Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-18705527671805366462011-10-18T12:49:00.000+01:002011-10-18T12:52:57.448+01:00Nonsmooth justice: the discontinuous mapping of crimes to sentencesFrom <a href="http://www.bbc.co.uk/news/uk-15347868">BBC news</a>:
<blockquote><i>Jordan Blackshaw, 21, of Northwich, Cheshire, jailed for four years after admitting encouraging a riot on Facebook, which never happened</i></blockquote>
For comparison, if you were driving at 3 times the speed limit on the wrong side of the road, and you knocked someone down and left them in a braindead coma forever, the <a href="http://www.enfieldindependent.co.uk/news/localnews/9311595.Tougher_sentences_welcomed_for_dangerous_drivers_who_cause_serious_injury/">maximum sentence</a> you could receive in the UK is 5 years. Until very recently it was 2 years.<br/><br/>
This is somehow on a par with "encouraging a riot on Facebook, which never happened" which gained at least two people a 4 year sentence each.<br/>
Are you having a laugh? Because I'm not.<br/><br/>
The situation is similar to that of a schoolteacher in the US who was sentenced to <a href="https://secure.wikimedia.org/wikipedia/en/wiki/Morton_Berger">200 years</a> (!!) in prison without the possibility of parole, for possession of 20 images of child porn. Sure, collecting child porn is not a particularly nice thing to do, but again, there are murderers who will be sentenced and get out of jail before his sentence is finished. There are people who physically abuse, torture or actually kill children who could get out before him. Doesn't make much sense, does it?Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-80042794319514493572011-09-10T02:33:00.002+01:002011-09-10T02:43:19.978+01:00Google Translate's voice input: phones only?So apparently Google Translate takes voice input now - although it seems you need Chrome if you're not doing it on an Android or iPhone. The privacy issue of Chrome being able to record from your microphone without your consent is... interesting.<br /><br />If you do it on a PC<sup>*</sup>, it only allows you to give voice input in English. But if you do it via the iPhone/Android apps - even though they seem to use HTML5 anyway - you can give input in 15 different languages.<br /><br />Google, hello? People use laptops and desktops as well - why are they restricted to English-only voice input? I couldn't find an answer to this, or a timeline for when the other languages will be available in the "vanilla" Google Translate.<br /><br />
<br />
<font size=1><i><sup>*</sup> Is there a good and concise term for "non-smartphone computer"?</i></font>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-32393836926770492902011-08-25T19:14:00.005+01:002013-05-13T12:02:27.597+01:00Gradient-free data bars in Excel 2007?Data bars are a quick and handy tool for making numbers more visually obvious in Excel. Mostly I just use them for progress bars on long ongoing writing tasks like my the... thes... I can't say the word for some reason, nevermind.
<br />
<br />Anyway, the problem<sup>*</sup> is that Excel 2007 forces the data bars to have gradient fade to white as they reach the top. This makes them look a bit stupid and indistinct, with the apparent rationalisation that it makes it easier to read the numbers in that cell - which is pretty weak TBH, just choose the right colours, bold your text and it won't be a problem.
<br />
<br />A ridiculous workaround to get fake-solid bars is to set the bar colour to white and change the background colour of the cell to something with nice contrast that doesn't melt your eyes. Like neon green or piss yellow. Blue works for me...
<br />
<br />Anyone know a better way of doing this (other than not using Excel, or upgrading to Office 2010, since then I end up with documents that don't work properly in the ancient versions of Powerpoint installed on DCU machines)?
<br />
<br />
<br />
<br /><i><sup>*</sup>Well, one of the problems. The others are that the default range values make almost no sense, and that values at the minimum of the range (or lower) still produces a bar, and that values over the top of the range don't entirely fill the bar. What...</i>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-76916862197491113642011-08-16T21:32:00.007+01:002011-09-13T20:33:25.962+01:00Browser tab overloadAfter a couple of years of using the excellent Opera browser, I switched to Firefox after some crashes and extremely high memory usage. It turns out that Opera was doing pretty well given that I had some 200 tabs open, though... (yes, I find interesting articles quicker than I read them, and if mail myself the links or put them in a "to read" folder, well, they seem to not get read either).
<br />
<br />Anyway, with addons and things, I've grown accustomed to Firefox now, and a recent-ish update which forces JS events from background events/timers to be processed at most once per second really helped with CPU usage.
<br />However, it still struggles a bit with some 100 tabs open on this laptop, and actually crashes with an out-of-memory exception on my 32-bit Vista box from time to time. Not that it explains this or anything, it just vanishes and pops up a crash reporter which doesn't seem to explain the crash; I had to run Firefox under WinDbg to get a proper, source-line annotated stack trace.
<br />
<br />One workaround for this is to just not be so lazy and to read articles immediately and follow links in a depth-first way, rather than the exponentially disastrous strategy of reading a Wikipedia article and clicking open 12 interesting links into background tabs, then doing the same for each of those tabs if I ever get that far.
<br />
<br />Until I have the discipline to do that, though (i.e. never), I found a couple of Javascript bookmarklets are helpful.
<br />So I stole a few bookmarklets to zap plugins, events and timers from <a href="https://www.squarefree.com/bookmarklets/zap.html">here</a> and taped them together into one <a href="javascript:(function(){function%20zapPlugins(){function%20R(w){try{var%20d=w.document,j,i,t,T,N,b,r=1,C;for(j=0;t=[%22object%22,%22embed%22,%22applet%22,%22iframe%22][j];++j){T=d.getElementsByTagName(t);for(i=T.length-1;(i+1)%26%26(N=T[i]);--i)if(j!=3||!R((C=N.contentWindow)%3FC:N.contentDocument.defaultView)){b=d.createElement(%22div%22);b.style.width=N.width;b.style.height=N.height;b.innerHTML=%22%3Cdel%3E%22+(j==3%3F%22third-party%20%22+t:t)+%22%3C/del%3E%22;N.parentNode.replaceChild(b,N);}}}catch(E){r=0}return%20r}R(self);var%20i,x;for(i=0;x=frames[i];++i)R(x)}function%20zapEvents(){var%20H=[%22mouseover%22,%22mouseout%22,%22unload%22,%22resize%22],o=window.opera;if(document.addEventListener/*MOZ*/%26%26!o)for(j%20in%20H)document.addEventListener(H[j],function(e){e.stopPropagation();},true);else%20if(window.captureEvents/*NS4*/%26%26!o){document.captureEvents(-1/*ALL*/);for(j%20in%20H)window[%22on%22+H[j]]=null;}else/*IE*/{function%20R(N){var%20i,x;for(j%20in%20H)if(N[%22on%22+H[j]]/*NOT%20TEXTNODE*/)N[%22on%22+H[j]]=null;for(i=0;x=N.childNodes[i];++i)R(x);}R(document);}}function%20zapTimers(){var%20c,tID,iID;tID=setTimeout(function(){},0);for(c=1;c%3C1000%20%26%26%20c%3C=tID;++c)clearTimeout(tID%20-%20c);iID=setInterval(function(){},1000);for(c=0;c%3C1000%20%26%26%20c%3C=iID;++c)clearInterval(iID%20-%20c);}function%20zapAll(){zapPlugins();zapEvents();zapTimers();}zapAll();})();">"Zap all"</a> snippet. Going through the roughly five million open and unread Lifehacker tabs and zapping off the Javascript machinery and other cruft managed to reduce the CPU usage to a respectable ~1% mostly. And pared the RAM usage from 1.5 gigs down to just under 1 gig on that Vista box.
<br />
<br />Screw solving the underlying problem when you have <i>bookmarklets</i>!
<br/><br/><b>Obsolescence update: A recent feature in Firefox (at least the Aurora 8.0x releases) allows you to set tabs to load lazily (i.e. a tab won't automatically load after opening Firefox, until you activate that tab)... this is perfect for messy users like myself who end up with more tabs than they can eat - it seems to work really well.</b>
Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-26319081873572601002011-06-17T15:40:00.010+01:002011-11-15T17:10:56.194+00:00Closed windows from a crashed Firefox: Dig [out of] your own grave and save!Well, I don't know what happened. The Windows box went down for a reboot due to the usual bundle of patches for Windows bugs. Somewhere along the line, Firefox managed to close the window with all my (way too many) tabs, and when I rebooted, it opened up on the Mozilla homepage. Burn.<br /><br />No problem, going to <i>about:sessionrestore</i> displays a list of... empty. Oh.<br /><br />Ok then. A quick look in the profile dir (%APPDATA%\Mozilla\Firefox\Profiles\*.default) shows that the sessionstore.js and backup are over 4 megs in size - that looks promising. So I copy them and quit Firefox.<br />Inside sessionstore.js is a gigantic JSON string. Inside that, I find a closed tab (the session restore tab which I had given up on), with apparently another full JSON string in the #sessionData field. After decoding <i>that</i>, I find an empty list of windows, and a list of _closedWindows including my main window with many many tabs. Yay, I can just swap them then.<br /><br />Here's a little program in Lua which might help resurrect your tabs/windows if something similar happens to you. It uses the very fast <a href="http://www-users.rwth-aachen.de/David.Kolf/json-lua">dkjson</a> library (the whole read/decode/futz/encode/write process for a 4.5mb file takes about 1.25 seconds on my run-of-the-mill desktop using <a href="http://luajit.org/">LuaJIT</a>).<br /><br />
<b>In this case, there was an open window with one closed tab containing an <i>about:sessionrestore</i> form...</b>
<blockquote><pre> json = require('dkjson')
print('Reading file...')
local session = assert(io.open('sessionstore.js', 'r'))
local session_data = session:read('*all')
print('Parsing ('..#session_data..' bytes)...')
local obj, pos, err = json.decode(session_data, 1, json.null)
if err then error(err) end
print('Success! table size: '..#obj, pos, err)
-- I closed the session restore tab since the list was empty.
-- Turns out it still had the closed window data, so
-- we can extract that. You may have to change this.
local data = obj.windows[1]._closedTabs[1].state.
entries[1].formdata['#sessionData']
-- parse it, swap open/closed windows
local data_p = json.decode(data, 1, json.null)
print('Decoded, swapping closed and open windows')
local old_windows = data_p.windows
data_p.windows = data_p._closedWindows
data_p._closedWindows = old_windows
print('Encoding')
local outf = assert(io.open('sessionstore-rec-fixed.js', 'w'))
outf:write(json.encode(data_p))
outf:close()
</pre></blockquote>
<br/><b>In this case, the open windows had suddenly become closed windows... (this just happened now, the hell Aurora?)</b>
<blockquote><pre> json = require('dkjson')
print('Reading file...')
local session = assert(io.open('sessionstore.js', 'r'))
local session_data = session:read('*all')
print('Parsing ('..#session_data..' bytes)...')
local obj, pos, err = json.decode(session_data, 1, json.null)
if err then error(err) end
print('Success! table size: '..#obj, pos, err)
print('Decoded, swapping closed and open windows')
local old_windows = obj.windows
obj.windows = obj._closedWindows
obj._closedWindows = old_windows
print('Encoding')
local outf = assert(io.open('sessionstore-rec-fixed.js', 'w'))
outf:write(json.encode(obj))
outf:close()
</pre></blockquote>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-47420445426469285442011-03-28T17:00:00.004+01:002011-03-28T17:11:14.627+01:00Rachota... oh no you di'n't!Started using <a href="http://rachota.sourceforge.net/en/index.html">Rachota</a> a couple of days ago to keep track of how much time I'm spending on my research, which currently consists of reading a big stats book.<br /><br />Clicked into the "Analytics" tab just now and was informed of the following:<br /><blockquote>* You don't categorize your tasks enough. Try to assign some keyword to as many tasks as you can. This helps to track how much time your projects consume.<br />* You seem to spend too much time on private tasks or off the computer. Either minimize working on private stuff or don't leave your computer often without measuring such activity.<br />* It looks like your tasks are either very short or too long. Try to consolidate the short ones or divide the complex tasks. This helps to identify where your time really goes.<br />* You don't prioritize your tasks correctly. Use different priorities to distinguish important tasks from the low priority ones. This helps to keep focus on your real objectives.<br />* You don't use regular tasks properly. This might indicate you often work on a task that is not set as regular or there is a regular task that in fact occurs very rarely.<br />* It seems you leave your tasks open forever. Instead, close it once you are done with each task in reality to make your daily ToDo list shorter. <b>Or don't you really finish anything?</b></blockquote><br /><br />... <a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1fxHPmufDxR0lvNSqOyDuRtyS2RHvGBifxUgbA-9DxsdTXmfuqv2tte9ZsG93LAyfJim1as2uu7-xmXW7SJ1mJTRibjyJLC9IvNFEgbFsYYWgETzQpRhmT-4Mgbq-ZAEdM_D-VQ/s1600/rachota-y-u-2.jpg"><img style="cursor:pointer; cursor:hand;width: 320px; height: 240px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1fxHPmufDxR0lvNSqOyDuRtyS2RHvGBifxUgbA-9DxsdTXmfuqv2tte9ZsG93LAyfJim1as2uu7-xmXW7SJ1mJTRibjyJLC9IvNFEgbFsYYWgETzQpRhmT-4Mgbq-ZAEdM_D-VQ/s320/rachota-y-u-2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5589163929607059922" /></a>Oisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0tag:blogger.com,1999:blog-22238331.post-1737824939795758442011-03-01T18:51:00.001+00:002011-03-01T18:52:31.444+00:00Pointing float> =(1/0.1)<br />10<br />> =(1/(1-0.9))<br />10<br /><br />> =math.ceil(1/0.1)<br />10<br />> =math.ceil(1/(1-0.9))<br /><b><i>11</i></b><br /><br />....FFFFFFFUUUUUUUUUOisínhttp://www.blogger.com/profile/14940197011612073631noreply@blogger.com0