Skip to content

Recent Articles

13
Mar

“Whatever happened to programming”

I came across a wonderful blog post entitled “Whatever happened to programming”, with a second part here.

I think it tackles a very important question, specifically discussing how a lot of the work nowadays is spent putting libraries together and making them work, which doesn’t make the whole programming experience very fun and it also significantly affects “the flow”. The flow is something I would like to write about some more in the future, because it’s very important for me and I can’t seem to get it anymore in a lot of the work I do. I used to think it was just me, but now I’m starting to wonder if this isn’t perhaps a much bigger issue.

Bookmark and Share
13
Mar

Are domains becoming obsolete?

This post will be a bit of speculative philosophical techy meditation, but bear with me please.

There are all sorts of problems with getting a domain nowadays. If someone is not cyber-squatting it, it might just be taken already (for a legit reason) and even if it all works well, it still costs you money. But we’re hanging on to our domains as the one and only solution for remembering websites. Why? Well, because it’s easy to remember www.alexflorescu.com, not that easy to remember 69.89.27.228, although both addresses will take you back here.

Nonetheless, we’ve seen a steady raise in the power and usage of search engines. While the first time I ever connected to the Internet I had a BOOK with websites and then went through years of carefully mastering the art of search engines to ever get anywhere, now I rarely even use bookmarks anymore. I know what the website I’m looking for *is* and I just use Google to get to it. It’s simply more convenient and faster.
I’ve seen a lot of people that don’t even use the address bar anymore. They type everything in the Google search bar that arrives by default on the Firefox homepage. Some of these users do not even acknowledge the existence or role of the address bar; they don’t know what it is, they’ve never used it, if it were removed they would not even notice it.

So then what is the remaining purpose of domains? Why bother when people won’t even remember the domain at all? Oh yes, they will most probably remember the title if anything, but they can use that to get to your website any day by just googling it and it’s the title they remember, not the domain. If these two happen to be different, the title will stick, the domain won’t (I’ve had this happen to me once).

Taking into account the complication and the security issues inherent to domains, I think dropping the whole idea altogether is something that should at least be considered. Of course, then we are faced with the problem of putting all the power to navigate the Internet in the power of a few (if not only ONE) huge corporations. But don’t be naive, we’ve already done that. Now let’s just make the best of it.

Bookmark and Share
6
Mar

How to share files from a Linux machine to a XBox 360

A few weeks back I finally decided to do something with an old computer that was just sitting around, so I put Ubuntu on it and made myself a fileserver. Next step was making all the stuff on the file server visible to the 360 so I could play music and video directly on it directly from the file server. uShare seems to be the answer for that.

There are several websites explaining how to do it, but I found this one to be the simplest. Just a few steps and you’re ready to go.

Bookmark and Share
4
Mar

A Java destructor that’s not really a destructor, but that actually works!.. sort of..

Issue:
Recently I ran into a rather weird problem. I needed certain operations to take place when my program finished running, irrelevant of the manner in which that happened (normal exit, error, crash etc.) Doing this in Java seemed to be a lot more complicated than what I was expecting.

finalize():
There is a method in java called finalize() which you might think does exactly this, but don’t let yourself be fooled. finalize() is called when the object implementing it gets collected by the Java garbage collector. This is not guaranteed to happen when all references to the object are removed (that is simply a condition for collecting, but it doesn’t imply that as soon as the last reference is removed, it will happen immediately or ever), nor is it guaranteed to happen at all before the program exits. In other words, you can’t use it for something you need done, because you have no way of knowing if it will ever get called. Actually, I find it very difficult to imagine why you would ever need to use finalize, but never mind that.

More specific issue:
So is there no way to make this happen? Well it really depends on what exactly you need done. If it is important for you to have code run when an object get destructed (or rather when you think it does), but you still have other code to run in your program following that operation, then I don’t have an answer for you, but probably in those situations there are numerous easy ways to work around the issue and you don’t really need to worry about something like this.

On the other hand, if you had my problem, you just need code to run before the program officially terminates. Enter…

Shutdown hooks
When your program exits, the JVM starts all threads registered as shutdown hooks at the same time and when they are all done, it wraps up and exits. So to do this, just initialize a new thread, put your code in it and register it as a shutdown hook.


class Test {
...
...
private Thread onShutdown=new Thread() {

public void run() {
System.out.println("My program just finished running!");
}
};
...
...
//anywhere in the code
Runtime.getRuntime().addShutdownHook(onShutdown);
....
}

Notes:
- when I say anywhere in the code I really mean that, but obviously, there will be some significance for you regarding where you want to put it and of course, if your code crashes before it reaches the part where you register the hook, the hook won’t run (d’oh!! why did I even say this? oh well)

- If you are working with Eclipse in Windows, you’ll notice that the above hooks don’t work when you press the terminate (red stop) button. That’s not your fault and not really Eclipse’s fault either. It seems to be related to the (bad?) way in which java.lang.Process.destroy() is implemented under Windows. Nonetheless, the hooks do work in Windows, just not when terminating with Eclipse.
More details about this issue.

Bookmark and Share
4
Mar

Plaintext passwords

Whenever some website emails me MY OWN PASSWORD in plaintext, I feel like pulling my hair out.

1. You should not be storing passwords in plaintext!!! NOT! EVER! There is no excuse for that, no excuse, I don’t care how small and insignificant your website is, that is unacceptable, simply unacceptable!
2. You should never email such significant information over an unsecured channel such as email. Again, NOT EVER.
2b. Because you do the stupidity of emailing me my password, anyone looking over my shoulder can see it too, they don’t even need to know what a sniffer is. WOW, thank you!
3. Why would you ever email me my own password? WHY?! It’s like calling me and telling me my name, then asking me what my name is then telling me my name again to see if I still remember it! No actually, wait, that would not be as moronic because my name is NOT A SECRET ONLY I SHOULD KNOW!

So, kids, that’s why you should NEVER have the same passwords for things that are really important like email and bank accounts and crappy websites that can’t even do hashing and salting.

Bookmark and Share