Digital Stronghold




November 5, 2009

Delete files and directories recursively in Java

This post will teach you how to delete files and directories in Java recursively. There is nothing special in this post but I’m sure this will be useful especially for those who are just starting out their programming career in Java.

boolean deleteRecursively(final File file) {
    if (file.exists()) {
        final File[] files = file.listFiles();
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                deleteRecursively(files[i]);
            }
            else {
                files[i].delete();
            }
        }
    }
    return (file.delete());
}

This code was not tested. Please read the Java 6 File API documentation [here] for more information.

"Confidence means non-paralysis, a willingness to act, and act decisively, to start new things and cut failing ventures off." - Tom Peters

October 18, 2009

vrms - Virtual Richard M. Stallman

Though I am aware that there are non-free packages lurking in my box, I want to be precise, thanks to Virtual Richard M. Stallman.

          Non-free packages installed on linux-conqueror
	
fglrx-modaliases          Identifiers supported by the ATI graphics driver
linux-generic             Complete Generic Linux kernel
linux-restricted-modules- Non-free Linux 2.6.28 modules helper script
linux-restricted-modules- Restricted Linux modules for generic kernels
nvidia-173-kernel-source  NVIDIA binary kernel module source
nvidia-173-modaliases     Modaliases for the NVIDIA binary X.Org driver
nvidia-180-modaliases     Modaliases for the NVIDIA binary X.Org driver
nvidia-71-modaliases      Modaliases for the NVIDIA binary X.Org driver
nvidia-96-modaliases      Modaliases for the NVIDIA binary X.Org driver
nvidia-glx-173            NVIDIA binary Xorg driver
skype                     Skype - Take a deep breath
tangerine-icon-theme      Tangerine Icon theme
virtualbox-3.0            Sun VirtualBox
	
           Contrib packages installed on linux-conqueror
	
nvidia-common             Find obsolete NVIDIA drivers
nvidia-settings           Tool of configuring the NVIDIA graphics driver
	
  13 non-free packages, 0.9% of 1505 installed packages.
  2 contrib packages, 0.1% of 1505 installed packages.

Well, I need these.
- NVIDIA - Who wants to use the generic vesa driver (+ mesa) for playing games?
- Skype - I have relatives to keep in touch with.
- Virtual Box - I use Windows 7 to run web applications classified as For Microsoft Internet Explorer Only.

October 7, 2009

Linus’ discussion about goto statements

As discussed by Linus Torvalds 6 years ago,

From: Linus Torvalds
Subject: Re: any chance of 2.6.0-test*?
Date: Sun, 12 Jan 2003 12:22:26 -0800 (PST)

On Sun, 12 Jan 2003, Rob Wilkens wrote:
>
> However, I have always been taught, and have always believed that
> “goto”s are inherently evil. They are the creators of spaghetti code

No, you’ve been brainwashed by CS people who thought that Niklaus Wirth
actually knew what he was talking about. He didn’t. He doesn’t have a
frigging clue.

> (you start reading through the code to understand it (months or years
> after its written), and suddenly you jump to somewhere totally
> unrelated, and then jump somewhere else backwards, and it all gets ugly
> quickly). This makes later debugging of code total hell.

Any if-statement is a goto. As are all structured loops.

And sometimes structure is good. When it’s good, you should use it.

And sometimes structure is _bad_, and gets into the way, and using a
“goto” is just much clearer.

(more…)

August 26, 2009

The Linux Foundation Visa Platinum Rewards Card

With every purchase made you help the Linux Foundation. The funds raised will be used for technical events and travel grants for open source community members. Grab your Linux Foundation Visa Platinum Rewards Card now!

June 15, 2006

Orders received!

ADZU Open Lab will be switching to Edubuntu 6.06 Dapper Drake! Wee! Expecting Ubuntu sovereignty in the University! More power Ubuntu Linux Development Team.

A Freedom Toaster empowered by Shuttleworth Foundation is badly needed in our University.

The network administrator, Sir Greg, also suggested Xubuntu 6.06 in the College Internet Access Area (CIAA). Well, it’s easy as one-two-three.

Theme designed by Joset Anthony Zamora


Digital Stronghold

↑ Get Headline Animator