2010-08-30 19:49Implementing Genesis in JavaI got talking to a colleague from work about the philosophical issues of morality and surveillance (does being surveilled make people more moral?) and we ended up discussing the moral and societal framework of the Garden of Eden, as described in the book of Genesis, in the Old Testament of the Bible. He made an interesting point that, being unaware of the existence or nature of evil, Adam and Eve may not have been best equipped to determine whether a statement was a lie, or even know to ask themselves the question of whether something was a lie or not, being unaware of such things. As programmers, one natural way to express ourselves clearly on such important theological questions was to write some software, and sure enough my colleague wrote a PHP implementation of the Human class, and pointed out the inherent flaw in the design, which was, he claimed, a flaw in the design described in Genesis. I was not so convinced that he had implemented the Genesis specification correctly, however, which perhaps shows that Intelligent Design should be left up to God (and even God might want to implement it via an evolutionary algorithm instead), but I decided to give it a go myself, confident that, whatever language God used, I would stand a better chance using Java than I would PHP. 2010-08-30 19:49Using the DIV tag to replace tablesThis month I attended an enjoyable party which happened to have some A-list celebrities (of the Free Software world) present. I did feel slightly out of my depth when the topic of conversation turned to compiler optimisation bugs, but as luck would have it, I found myself listening to a conversation about web design. “I know this!” I thought, as the conversation developed into a good-humoured flame war about the semantic validity and practicality of using the TABLE tag for presentation. Fortunately I was not the only one to believe that using the TABLE tag this should be avoided at all costs, and that meant I didn’t have to argue the point. I did end up, however, talking to someone trying to understand the precise use case they had in mind that encouraged them to use tables, and they weren’t even happy with the result, so I knew it was my duty to educate myself and others about what the alternative DIV-based design would be. 2010-07-31 18:04Checking PHP security with PHPOne interesting thing about software is that because it is written in a language that a computer can understand, it is also possible, in theory, to get the computer to tell you things about that software. There are various classes of utilities from static analysers to code style checkers, but I have recently been considering how possible it is to check for uses of specific deprecated functions and classes in a PHP project. The actual checker I was thinking of creating would be written in PHP itself, but because the process would be a static analysis one, which I hoped didn’t have to resort to tokenising the PHP source code it was examining, this checker could in fact be written in any language just as (if not more) easily. As is often the case in my blog posts about PHP recently, it turns out that various “features” of PHP make things more difficult (regardless of the language that the checker is written in), although trying to solve a problem the wrong way doesn’t help either. Continue reading "Checking PHP security with PHP"2010-07-31 18:04The problems with banksI recently had trouble buying something online and this resulted in me having to go into a local branch of the bank with which I had the account I was trying to use. There had actually been several issues which had been accumulating with this account, and so I thought that attending in person might be the quickest way to get things sorted out, but the process ended up taking a lot longer than I thought. Fortunately along the way I had an enlightening and somewhat amusing conversation with the cashier who was trying to help me, and I thought that I should share some of the things I have learnt. For privacy reasons I will not go into details about the current state of my account, nor will I disclose which bank it is I have this account with, but I hope it will give people a benchmark to compare their banks against, and I would be interested to know which banks don’t have the same problems as the ones I describe (or have other problems). Continue reading "The problems with banks"2010-06-29 21:36Hacking the dependencies of a downloaded Debian packageYet again I have found myself on the wrong side of Debian’s strict packaging policy. There is a piece of software that I want to install which isn’t packaged for Debian, but which fortunately is packaged for the sister distro, Ubuntu. This alternative source of packages is only useful, though, if Ubuntu uses sufficiently similar package names and version numbers, otherwise the Debian package management tools will treat the package as invalid due to dependency problems. The last time I had to deal with this sort of problem was with an earlier version of the same package, plasma-widget-adjustableclock, but this time the dependency problem is slightly different and I’ve tried fixing the problem in a different way too. Below I detail what the problem is, and my not-entirely-successful efforts at solving it. Continue reading "Hacking the dependencies of a downloaded Debian package"2010-06-28 23:13EU state flowersThe opportunity to speak with Americans about their federal system is one I rarely turn down, as it helps me understand Europe’s federal system. While talking to a particular American, I found that, despite the stereotypes, they did not believe that the EU was a federal country, and although this meant they agreed with the vast majority of Europeans on the matter, I decided to dismiss their view as uninformed and presented them with a video of the EU president celebrating the EU national day by reading a speech and watching the EU flag being lifted by members of the EU army, followed by a military band performance of the EU national anthem. I feel, though, that to really convince an American (and possibly a European too) that the EU is a country, I must provide a list of the state flowers of each of the EU states, which was, as I explained in an earlier blog post, one of the only things the EU was missing. Continue reading "EU state flowers"2010-05-31 20:10Getting a domain nameI’ve recently made a few changes to my blog and thought that, in the self-referential tradition of bloggers, I should mention some of the decisions I made and how they affect my blog. The most external change, and the one mentioned in the title of this post, is that I do now have a domain to host this blog on. By “external” I don’t just mean it is potentially visible in your address bar when you visit any page of the blog, I also mean that it involved interaction with various third parties. It is a change I had been meaning to make for a while now, and one I should have made long ago, but hopefully it should last a long time. Continue reading "Getting a domain name"2010-05-31 20:10
The only other problem with PHP Posted by Hagfish
in Programming at
20:10
Comments (0) Trackbacks (0) The only other problem with PHPBy a strange coincidence, I’ve recently bumped into another PHP gotcha, well, actually three of them depending on how you’re counting, but I’m sure that these must be the last three unexpected things about PHP and I won’t soon have to write another blog post detailing something else unintuitive that PHP does. The reason these could be seen as one gotcha is that they all involve PHP’s support for floating point numbers, so one workaround would just be to not use that datatype at all in your programs. As I will show though, it is harder than you might think to avoid them, so perhaps the best advice is to avoid using numbers at all. To be on the safe side though, maybe you should just use a different programming language. Continue reading "The only other problem with PHP"2010-04-30 19:40
Spelling conventions for software ... Posted by Hagfish
in Programming, Standards at
19:53
Comments (0) Trackbacks (0) Spelling conventions for software projectsA project at work recently reached an interesting crossroads where it had to be decided what the spelling convention should be for some code which the company’s partners would have to interact with. The use of English as a common language had been uncontroversial up to that point, but there had crept into the software words which had different spellings between American English (en_US) and British English (en_GB). As a passionate European, it made sense to me to choose the version of English spoken by the English, but the more I researched it, the more I realised that the correct international standard really was en_US. Perhaps the deciding factor for me was that the coding standard for the European Space Agency requires the use of en_US spelling, which I will mention below in my depressingly convincing argument for that same linguistic standard. Continue reading "Spelling conventions for software projects"2010-04-30 19:40
Is that all that's wrong with PHP? Posted by Hagfish
in Programming at
19:40
Comments (3) Trackbacks (0) Is that all that's wrong with PHP?While my previous blog post covered what may be an actual bug in PHP, there are still a couple of gotchas which might be worth mentioning. Firstly there is the inconsistent way it deals with single and double quotes around strings, and then there are the undesirable consequences of how it juggles variable types, for which I have an example. Of course, all languages have their problems, with the obvious exception of Groovy, the superiority of which I will demonstrate with a one-liner, possibly accompanied by an excuse to explain why that simple one-liner was so hard to write. Continue reading "Is that all that's wrong with PHP?"2010-03-31 18:38Hate PHPThe title of this post is even less helpful (and less fair) than the title of the blog post which inspired it, so it should probably be viewed as parody. However, I do sadly have a file on my computer called hate.php containing a series of lines of valid PHP source code which produce unexpected and even perplexing results. Admittedly there are only 6 lines, and the behaviour of half of them is as documented, but I hold PHP to a higher standard than I would a “messy” language like Perl, so I thought this deserved a blog post. Continue reading "Hate PHP"2010-03-31 18:38What is the Protestant way to mark Lent?One of the things I have noticed in the lead up to Pasch is what a benefit it is to have friends of several different Christian denominations and backgrounds, as they have provided me with interesting insights into different Christian traditions. Having done some research myself into the history of Lent, and comparing the different modern practices, I have noticed a gap in the apologetical literature, a gap which I have decided to treat as a challenge. I aim to construct (although not explicitly define) a Protestant position on Lent (for some value of “Protestant”), based on Church history and the Bible. The resulting position may not actually match the position of any particular Protestant group, or even intersect with any, but I think it is a thought-provoking task with an equally thought-provoking result. Continue reading "What is the Protestant way to mark Lent?"2010-02-28 22:47ICANN, you can'tI am always a little shocked to hear people defend the level of control that the American government has over the Internet through its influence of ICANN, and just as shocked to hear people’s paranoid speculation that having America’s role transferred to a UN body would somehow lead to massive censorship and spying taking place, as if that’s never been possible in America, and as if UN technical bodies have any history of doing that. It is understandable when people fall into the logical fallacy of argumentum ad ignorantiam, with an “if it ain’t broke don’t fix it” attitude, but even if we don’t know what a future UN solution might look like, we do know what America’s record of managing ICANN is, and it is not something about which you can say “it ain’t broke”. A friend of mine said that it was too stressful talking about these complicated technical and political matters early in the morning while I was driving us to catch a train, but hopefully none of my readers will be browsing my blog in that sort of situation. Anyway, below I will list some past actions of ICANN that are causes for concern, and explain why they were the result of American governmental influence. Continue reading "ICANN, you can't"2010-02-28 22:47
Splitting arbitrary length strings Posted by Hagfish
in Programming at
22:47
Comment (1) Trackbacks (0) Splitting arbitrary length stringsA friend of mine was apparently inspired by my solution to the problem of finding the first 10 digit prime number in the digits of e, and he told me about a seemingly similar problem he faced while trying to manipulate a text file he had created in a custom format. While some techniques from solving the e problem may be applicable, his data format allowed for arbitrary length strings, rather than having this 10 digit limitation, which made the problem suddenly much harder. I will detail the exact problem below, as well as listing some of the methods we used to tackle it. Continue reading "Splitting arbitrary length strings"2010-01-31 22:57How does cryptography work?A lot of my blog posts seem to be about cryptography, or at least mention issues related to it, and I am aware that this may make my posts harder to understand. I am also aware that there do not appear to be any helpful introductions to cryptography out there, or rather none which is accessible to the non-expert but still gives a sense of the underlying mathematics. In my mind I have often imagined that I could write such an introduction, and recently I have been motivated to do so after discussion with a school-age relative who said “Cryptography sounds really interesting”. She may not think that way after she’s read all this, but I hope to at least convince myself that a relatively concise explanation of cryptography, from the ground up, is possible. As cryptography is a rather large field, though, I will only cover RSA public key cryptography. Continue reading "How does cryptography work?" |
QuicksearchCategoriesSyndicate This BlogBlog Administration |