Computing

You are currently browsing the archive for the Computing category.

Optus, Optus, Optus. You really like screw­ing over your cus­tom­ers right? I really didn’t appre­ci­ate hav­ing to work out why my home net­work printer stopped work­ing right in the middle of exams — because you screwed with DNS to earn a few easy quid. (Same goes for you, Tel­stra.)

19 Nov 2009 by Enoch Lau | No comments

The Inter­na­tional Free and Open Source Soft­ware Law Review – about time, although, of course, it’s more for law­yers than FOSS enthusiasts.

18 Oct 2009 by Enoch Lau | No comments

When the SUITS web server went down a couple of weeks ago, the skies darkened and there was much out­pour­ing of grief.

In the words of one com­mit­tee member:

At approx­im­ately 1445 today, suits­beta shut itself down, never to wake up again. Attempts were made to revive it by power­ing it up, but alas it failed to POST. Our thoughts go out to its fam­ily and friends.

Another expressed regret:

It was nice know­ing you suits­beta. We’re sad that you toiled alone and in sick­ness for your last few months.

But it was well-​​loved:

Although I did not log into suits­beta many times I did appre­ci­ate the machine and the con­tri­bu­tion it made to this soci­ety. Few can claim to have sus­tained such con­tinu­ous ser­vice to the soci­ety and its mem­bers, never ask­ing for recog­ni­tion or relief.

How­ever, death can give rise to hope:

The memory of suitsbeta’s cranky innards will live on in the cron mes­sages, reboot requests, and data­base errors that pep­per my email archives. May the metal be reborn and the warn­ings silenced.

Tags:

Update: It turned out to be a prob­lem with the Light­box plu­gin I was using. I’ve replaced it with another plu­gin that provides sim­ilar func­tion­al­ity, and the error has now gone away. Les­son learnt: hav­ing many scripts on the same page can be a recipe for dis­aster. Thanks Nuffn­ang for help­ing me work through this issue.

I recently added a Nuffn­ang ad to the side­bar — I hope none of you mind too much!

Any­way, all was going well until Inter­net Explorer threw a span­ner into the works (well, well, which browser always throws a span­ner into the works?).

It appears that on Inter­net Explorer 7 and earlier (using my par­tic­u­lar Word­Press tem­plate at least), the addi­tion of the Nuffn­ang ad code can cause the page to fail to load with an Oper­a­tion abor­ted error:

opabort

This error is par­tic­u­larly trouble­some: after the hope­lessly unin­form­at­ive dia­log box is dis­missed, the page dis­ap­pears and gets replaced by a nav­ig­a­tion error page. (Thank­fully, this hideous beha­viour was changed in IE8, which might explain why I didn’t pick it up earlier as that is my installed ver­sion. But it still begs the ques­tion, why do people insist on using Inter­net Explorer?)

I’ve let Nuffn­ang know about the poten­tial prob­lem, and with any luck, it will be resolved soon.

In the mean­time, I’ve made some changes to the ad code:

<!-- nuffnang -->
<script type="text/javascript"><!--mce:0--></script>
<script type="text/javascript"><!--mce:1--></script>
<!-- nuffnang-->

What this does is that it first checks whether the browser is Inter­net Explorer. If it is not, the Nuffn­ang script can be called upon dir­ectly. If it is Inter­net Explorer, an iframe dis­play­ing /nuffnang.html is added to the doc­u­ment. /nuffnang.html just con­tains a copy of the ad code as provided by Nuffn­ang placed into an oth­er­wise blank HTML page.

Why? Isol­at­ing the Nuffn­ang ad code in a blank page by itself seems to avoid the error con­di­tions as described by KB927917. But even if an error were to develop, the error would be con­fined to the iframe and the rest of the page can still be displayed.

If you’re hav­ing sim­ilar dif­fi­culties, give the above a go and see whether it works for you.

Tags: ,

I recently star­ted doing soft­ware devel­op­ment on a cas­ual basis for GPlates, at the School of Geosciences, Uni­ver­sity of Sydney. Think back to high-​​school sci­ence class where you learnt about Pangaea and Gond­wana­land and how the Earth’s tec­tonic plates have ever-​​so-​​slowly shif­ted over mil­lions of years. GPlates is soft­ware that allows sci­ent­ists to “wind the clock back” on these plate move­ments and visu­al­ise what the Earth might have looked like all these years ago. It’s open-​​source, so if you’re curi­ous, grab a copy and play with it.

I’m quite glad to have met the GPlates team. It’s dif­fi­cult, I think, to find qual­ity soft­ware engin­eer­ing in Aus­tralia, and GPlates devel­op­ment is led by a bunch of developers who are pas­sion­ate about writ­ing qual­ity, well-​​designed, best-​​practice C++ code. It’s cer­tainly not your aver­age in-​​house or aca­demic research soft­ware. And it sure is more intel­lec­tu­ally safis­fy­ing than work­ing in cor­por­ate IT.

Tags: ,

I just got my Google Wave developer sand­box account! I can’t wait to play with it, but I think I’m going to have to put my excite­ment on ice until I fin­ish my exams in a week’s time. Boo.

Tags:

To kill a singleton: I found this to be a use­ful dis­cus­sion on how to write a singleton class in C++ that ensures the singleton is prop­erly des­troyed (for even mul­ti­th­readed applications).

18 May 2009 by Enoch Lau | No comments

Update: Thank you to all who have con­trib­uted to the dis­cus­sion below. For the impa­tient, here is a sum­mary of what you might like to do:

  • If you hate Sydney Mail, fear not: you have options.
  • To redir­ect your Sydney Mail email to another email account, you can either a) use a “redir­ect” rule in Sydney Mail or b) get your email cli­ent (such as Gmail) to pick it up via POP3 (for this, see the main post below). Both a) and b) do the job.
  • To send email from within Gmail as if you were send­ing it from Sydney Mail, add your Sydney Mail address under the Addresses tab in Set­tings in Gmail.
  • How­ever, some recip­i­ents, such as those using Out­look, may see that the sender of your email is “xyz@​gmail.​com on behalf of abcd1​2​3​4​@​uni.​sydney.​edu.​au”. If you don’t like this, you can fix this by get­ting Gmail to send email via SMTP. To find out the address of the SMTP server, see these instruc­tions.

“Sydney Mail is a new and sig­ni­fic­antly improved stu­dent email ser­vice,” announced the email from the uni­ver­sity proudly.

The truth is that the uni­ver­sity has delivered some­thing that’s bet­ter, but is rather defi­cient in its own right: they’ve out­sourced email to Microsoft so it’s all now run off Out­look Web Access. I could go on and on about why I would never use it, but I’ll just show you how to avoid using it.

The exist­ing email sys­tem allows you to for­ward to a per­sonal email address, and the uni­ver­sity provides instruc­tions for how to do it on the new sys­tem. Don’t fol­low those instruc­tions! It is true that email will be for­war­ded from Out­look to your per­sonal email but what hap­pens is that the emails are lit­er­ally for­war­ded! If Bob sends you an email, when it pops up in your per­sonal email, the From field will show your uni­ver­sity email as opposed to Bob, which is incred­ibly inconvenient.

The solu­tion? Get your mail cli­ent to retrieve mail from Out­look via POP3. If you’re using Gmail like me, go to Set­tings > Accounts. Look for the “Get mail from other accounts” sec­tion and click the “Add a mail account you own” link. A win­dow will then pop up; try the fol­low­ing settings:

Settings

Email sent to your uni­ver­sity email won’t get for­war­ded instantly like it used to, but it’s a much bet­ter solu­tion than the one offered by the university.

Tags: , , , , ,

Here are the solu­tions to the C++ maps exer­cise I posed in this post.

The first set of prob­lems relates to the fact that the Employee class has no default con­structor. Here’s why. In the line

	id[0] = Employee("John Smith");

what doesn’t hap­pen is that the key 0 gets asso­ci­ated with the new Employee object you just cre­ated. What does hap­pen is that the id[0] part tries to default ini­tial­ise an Employee object, and then assign using operator= the Employee object you cre­ated on the right hand side. That’s all fine if you have a default con­structor, but our Employee class doesn’t have one (because I’ve defined another con­structor but not the default con­structor). Without chan­ging the class defin­i­tion to add a default con­structor, you will need to expli­citly insert the key-​​value pair into the map, like this:

	id.insert(make_pair(0, Employee("John Smith")));

But what about this line?

	cout << id[0].name << endl;

Surely, it wouldn’t be try­ing to call the default con­structor here, because I am merely retriev­ing the value of id[0], which I know has already been con­struc­ted? But at com­pile time, how would the com­piler know whether the call to id[0] will res­ult in a new object being con­struc­ted or not even if you do? To get around this prob­lem, you’ll have to go around the long way:

	cout << id.find(0)->second.name << endl;

So the moral of the story is write a default con­structor (if it makes sense to do so)! Note that operator[] is also unavail­able when you have a const map. (Why?)

For the second lot of prob­lems, the root of the prob­lem is that you are using Employee as the key type of the map. You can only use a class as a key if you can order objects of that class, so you’ll have to write an operator< for Employee.

Tags: ,

Why doesn’t the fol­low­ing code com­pile? Without chan­ging the defin­i­tion of the struct Employee, can you make it com­pile so that it does what it’s meant to do?

#include <iostream>
#include <map>
#include <string>
 
using namespace std;
 
struct Employee
{
	string name;
	Employee(const string& s) : name(s) { }
};
 
int main()
{
	map<int, Employee> id;
	id[0] = Employee("John Smith");
	id[1] = Employee("Mary Jane");
	cout << id[0].name << endl;
 
	map<Employee, int> id2;
	Employee a("A"), b("B");
	id2[a] = 100;
	id2[b] = 200;
	return 0;
}

Answers here.

(I gave this exer­cise to my C++ stu­dents a couple of weeks ago.)

Tags: , ,

« Older entries