Category Archives: Computers

Posts on computer science and the web, rants about OS:es, Window Managers, and the like.

Google translate is safe…

It seems Google Translate has little to fear from the competition. The site HowtoSayin.com poses the following question on one page:

How to say “hon wisperd säger ord i mitt öra att förbaskat nära made my toes curl” in…

The short answer: you certainly do not… at least not in Swedish, or English, who both seems to be parents of the above monster child of a sentence…

A full “translation” to English would be something along:

How to say “she whispered says word in my ear that damn near made my toes curl” in…

So, yes… Google Translate is still pretty safe in the translation business…

The last special date in 89 years is right now…

An astrological clock showing time and signs.
photo by Setaou_ on Flickr

As I said around three years ago (September 9, 2009) there have been some special dates since 2001.

Basically moments in time when year (ah well at least the last two digits of the year), month, day, hour, minute (well I guess seconds and milliseconds and so on as well) have been the same. E.g. 01-01-01 01:01:01… for first of January, 2001, one minute and one second past one.

However this moment… the 12th of December, 2012, is the last such moment in 89 years… When there will be 2101-01-01 to have… (January 1st, 2101) So why not do some partying! 😀

Okay, to be infernally strict about it, the party should probably have started say the first of January, year 101 A.D. Or how about years before then? But on the other hand, nobody knew it was 100 B.C. Because if they did, they’d been time travelling. Imagine than… some archeologist finds an inscription saying:

He died a hero in the … lords? unlordly? … year 189 B.C.

Then we’d know… time travel! 😀

Anyway, so then there’d be another party in February 2, 202… all the way to December 12, 1212…. Then I’m guessing if you’d be strict about it, the next big date should be January 1, year 10101 (10101-01-01).

Hey, how about U.S. dates… They’re typed as month-day-year, right? So …um doesn’t matter much, there would still be the same logic. If you really get off on dates, have a look here for a more thorough discussion of the topic!

Okay, anyhow… let’s go have a party! (I’m fearing not many girls will find the speciality of the date that appealing though hahaha!)

Backwards Firefox Update… Bad Firefox!

I just upgraded my Firefox and afterwards Firefox update as usual checked what plug-ins would be compatible or not…

Today Tab Mix Plus wasn’t compatible and Shazam! All my tabs are lost (or at least they are gone for now, I can only assume lost to never be found again…) Not that I really had my bookmarks collection there or anything like that, but still… the tabs represented “unfinished issues”.

So I just had this thought: why does Firefox upgrade first and then checks if the plug-ins will fail or not? Shouldn’t it be the other way around? Firefox update should first check what plug-ins won’t be compatible then ask the user if they want to hold back the upgrade, and if not, then make the upgrade?

This way I could have held back my upgrade until Tab Mix was compatible (which I am pretty sure will happen in hours or days…)

Update: I found a description on superuser.com that details how to perform the plug-in check before running Firefox update… so this becomes a “Bad Ubuntu” post instead… why doesn’t the Ubuntu upgrade perform this check before just forcing Firefox on me? Ah, well…

As it turns out, the option to check for updates as the post (from 2009) states isn’t even available in my Ubuntu installed Firefox. Unclear if it’s available in Firefoxes not controlled by an Ubuntu install (I’ll have to check on my work machine to determine that…) Or perhaps it’s that I have version 17 of Firefox… maybe the option only appears when there’s an update to have? – my Firefox is just updated, but still… my Ubuntu will probably not like it if I start upgrading Firefox on the side.

Update 2: Nope, once Tab Mix Plus was back in the game again, I did regain all my old tabs… and lost the new ones (ugh). Ah well… *shrug* And I didn’t seem to find any way to make blockhead-Ubuntu-update ask before shooting on this one either… At least the tabs are just “on vacation” for a while whenever this happens…

Time to put the IT-business out of its misery?

I just came across this article about the Apple-Samsung battle:

http://www.engadget.com/2012/08/10/apple-samsung-presentation-licensing/

I’ve decided software patents pisses me off… and if they are allowed to be honoured 100% as patent laws intends it… we could just put the IT-business out of its misery and go back to pen and paper (unless there’s a “writing” patent out there somewhere?) … or perhaps we should “call software patents as we see them” and put them out of their misery…?

This is what different (clueless and unfit?) patent clerks have decided to approve:

  • US 5566337 – owned by Apple, A.K.A. the Observerpattern. Kiss SWT, Swing and almost all other GUI frameworks goodbye – they use observation to handle events such as clicking a button.
    • “In a computer including an operating system, an event producer for generating an event and detecting that an event has occurred in the computer and an event consumer which need to be informed when events occur in the computer”
  • US 5969705 – also Apple – details how an operating system can be “multitasking”… filed 1997 and accepted 1999… I knew Windows 95 wasn’t multitasking, but HEY… there are other OS:es out there… like Linux… that was multitasking LONG before 1999…
    • “Method and apparatus for a first process operative in a computer system controlling a user interface on a computer system display under control of a second process operative in the computer system. An event handler is installed for the second process, the event handler servicing events generated for controlling the user interface display under control of the second process. The first process may then perform a first set of functions in the computer system. The first process generates events for controlling the user interface display, the events related to the functions performed by the first process. The event handler receives the events generated by the first process and updates the user interface on the computer system display according to the events generated by the first process and received by the event handler.”
    • Or I guess we could always handle multitasking by having one process doing all of  the above and then having another process jerking off while that happens… reminds me about the “Multi Agent Programming” course on UNI when we had to implement a Multi agent system for playing chess…
  • Or how about US 5911067 – “Application Switching”
    • “A method and apparatus for transferring control between application programs. A messaging means is provided which allows a first application program to indicate to the messaging means that a second application program should assume control. The messaging means receives the message and performs an orderly shutdown of the first application program and messages the second application program that it should commence operation. Upon valid and proper operation of the second application program, the first application program is caused to be suspended, and the second application program is invoked.”
    • An alternative would be to have one application that can run several “programs” like different Wordfiles… or wait… wouldn’t that be just like an operating system starting an…. Application… oh well.. who needs applications… and anyway… who needs to switch between them? Let’s play “Windows” again… it’s an application… right?

I’m certain many people that doesn’t know so much about computers or programming (like the patent (cl/j)erks who approved these patents) will find the whole discussion abstract and boring. Who cares about some bizarre event-something, or some applications-something… and besides, they were smart and they worked hard for their patents… you’re just being a jealous douche bag for not allowing them their well earned cash in…

In an attempt to strike home the preposterous nature of these patents, here are some examples of patents that will never be accepted, because they are as obviously not fit for patenting to the “common man” as most IT-patents are to IT professionals:

  • Waste product gathering and disposal mechanism:
    • A method for gathering waste products in home or industrial environments, and a process for disposing of them. Following these steps: 1) take a plastic bag, place it in a holder such as a waste bin, or just let it lay on the floor, or some other surface where the bag is readily accessible. 2) whenever there’s “waste” (different forms of materials in need of disposal such as wrappers, paper napkins, fruit peals, etc) put it in the bag. 3) once the bag is full (or in the case of perishable waste, at a set time interval such as “several times a week”) tie the open end of the bag and throw it out…. (“Trashcan” patent for detailing the “throwing out” pending…)
  • Garment renewal process:
    • A method for renewing used garments such as socks and shirts. Follow these steps. 1) Wear garments. 2) Throw garments in laundry basket. 3) when you run out of clean clothes, apply water and detergent + mechanical “swashing around” – rinse and dry… 4) voila – clothes are as good as new…

Now why can’t I have those patents, and why do I not deserve them?

Because they are obvious methods for solving trivial problems. Unfortunately for the IT-business the patents awarded for the same obvious methods for the same trivial problems are not obvious to the people awarding the patents. It seems comparing the IT business with the construction business won’t really be worth anything unless you have “digging patents” to be harassed by when you try to build a house…

Ah well… I want to write a bestseller anyway… perhaps I should do a “Grisham” and write about a patent breaking IT company that feeds their employees to the sharks in order to prevent exposing their evil deeds?

How do you log to the Windows event log from C# .NET?

This seems to do the trick if you want to log to the Windows event log:

private void logError(string message, string source)
{
	System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
	log.Source = source;
	log.WriteEntry(message, System.Diagnostics.EventLogEntryType.Error);
	log.Close();
}

private void logError(Exception exception, string source)
{
	logError(exception.ToString(), source);
}

Put it in your class, or in a special logging class.

Read more:

Internt/Egna SharePoint – Miniprojekt Utveckling/Design Lookup fält programmagiskt… / ContentTypes

Is Java pass-by-value or pass-by-reference?

The question if Java passes parameters by value or by reference seems to be one of the things newcomers to the Java language stumble upon quite often.

In general the answer is simple: Java is always pass-by-value.

What does this mean?

Pass-by-value means that you get a copy of the passed in object to work with, as opposed to a reference to it.

Let’s exemplify.  Assume we have a method that manipulates a List object:

public void updateList(List list) {
    ..;
}

Now, assume we’d like to replace the passed-in list with another list we’ve created inside the method.  We might like to do something like:

public void updateList(List list) {
    List myList = new ArrayList();
    // add objects to myList
    list = myList; // replace list with my new list? *WRONG*
}

However, if we test this new method we’ll find list has not changed at all.

This is because list is a copy of the object we passed-in to the method, and not the passed-in object itself.  list has been passed-by-value!

So, are we unable to change variables that are passed-in to a method in Java?  Can we only change them by returning a new object?

No.

And this is where the confusion sets in, because while we’re unable to replace the passed-in object list with another object, we’re perfectly allowed to manipulate it’s member objects.

Basically this means if we want to replace a passed-in list with our own list we must do:

public void updateList(List list) {
    List myList = new ArrayList();
    // add objects to myList
    list.clear(); // empty passed-in list
    list.addAll(myList); // replace passed-in list with my new list!
}

Since we never try to replace list itself, the whole method works just fine and does what we expect.

Black pointer: Never lose track of your mouse pointer again

I’ve tried several ways to keep track of my mouse pointer.  It’s kind of hard from time to time.  Adding more than one monitor does not help at all!

Recently a colleague gave me the tip to make the mouse pointer black… and larger. I tried this and found that the mouse pointer was much easier to spot.  No surprise there, really.  After all, white on white tends to become a bit hard to keep track of, tiny silhouette outline or not.

I was told how to do this in Windows (Control Panel > Mouse > Pointer, but that’s another story).

In Gnome (I’m running Ubuntu 8.10) you do it in the System > Preferences > Appearance dialog (see below).  In my version of Window’s there’s no settings under Appearance > Mouse.

Appearance Preferences

Next you click the “Customize” button:

Customize Theme

In the new dialog select the “Pointer”-tab and select the color of pointer you want.  In order to resize it, see the “size slider” below the list of pointers (there seems to be three distinct sizes to choose from).

Click “Close” once you’re done, and voila, you have a new and much easier to spot mouse pointer!

Sun Tzu’s Art of War – Agile…

A quote from the Art of War that might have some baring on Agile development techniques:

31. Water shapes its course according to the nature
of the ground over which it flows; the soldier works
out his victory in relation to the foe whom he is facing.

32. Therefore, just as water retains no constant shape,
so in warfare there are no constant conditions.

But then again, we all know war is agile, right?

Or another quote I heard (source unknown, original language Swedish):

Meeting all requirements in programming is like walking on water.  It’s easy if the water and the requirements are frozen…

Random thought: Extreme situations

One of the more deadly things you can do is to act normally in an extreme situation.

This goes for extreme weather situations, being taken hostage, living on a planet that may be dying, etc.  etc.  Basically I believe panic will make you react in a predefined way, while keeping your cool will make you react according to the situation.  A few times panic might save you (running from a violent person instead of trying to talk sense to them) while in most cases not panicing will probably get the best result.

Interesting thought: aren’t we presented with “extreme” situations now and then, and once we’ve managed through them, they’re not extreme anymore.  Take for instance, first day at school, first love, first day as a parent, first day of retirement, or being a victim of a crime, being in a car accident, or other accident, being falsely accused, getting fired and being unemployed, etc. etc, there are a buss load of extreme situations out there.

So, the thing is to keep from getting pissed at  your boss for firing you, and trying to get a good letter of recommendation out of it (after all, who say’s you’re getting kicked cause your boss dislikes you?)  Or to stop being a kid yourself once your little ones are on their way, or to get out of that car wreck, and try to get everyone else in it along, before something worse than a roll and a spin happens.

So, it’s all about controlling panic then… or?  Hmmm…