I need to clean my call recordings of empty files from time to time. I used to do it manually, but that’s not what computers are for - right? So let’s automate it.

We’re going to use Windows Task Scheduler and a little batch, to be run once a day.

Let’s start with the batch.

First, we’ll be processing all the files in a specified folder - to get a simple list of files, we’ll use
dir /B

Then, for every file in the list, we’ll be doing some action. We’ll use for loop. By putting the dir command in signle quotes, we tell the loop to run the command and then treat the output of it as a list of files.
for /F %I in ('dir /B') do echo %I

Now, we hit the first problem - %I contains only the first part of each file name - up to a space. It’s because the default delimiter for “for /F” loop includes space. We need to overwrite it. We’ll also take the %I into double quotations
for /F "delims=" "%I" in ('dir /B') do echo "%I"

OK, let’s take care of the action part. We need to check the file size and delete it if it’s zero. Luckily, “for /F” loop can give us the file size of every file processed, with ~z syntax.
for /F "delims=" "%I" in ('dir /B') do if %~zI EQU 0 del "%I"

Unfortunately, directories also report size of 0, so we need to make sure we’re not deleting any directories by the way - let’s differentiate them by the ending with “\”.

for /F "delims=" "%I" in ('dir /B') do if not exist “%I\” if %%~zI EQU 0 del “%I”

And finally, we put it into a batch file. We need two things:

  1. To tell it in what folder to look the files for
  2. To change “%” to “%%” - that’s the loop’s requirement

Here’s our final version:
cd C:\Users\Jakub\Desktop\test
for /F "delims=" "%%I" in ('dir /B') do if not exist "%%I\" if %%~zI EQU 0 del "%%I"

I’m using Linksys WRT54GL as my home WiFi controller - connecting 3 desktops and 4 mobile devices (2 laptops, a Tablet PC and a Pocket PC) to the Internet and between each other.

Recently, a new housemate has moved in - an old friend of mine. He’s a heavy P2P user, downloading hundreds of files at the same time thorugh eMule. I, as an old eMule user, have configured his client to be perfectly fit to our broadband connection. However, we started seeing huge lags on other machines. I cut down the uplaod speed on eMule, but - surprisingly - it did not help. Neither did cutting down the total connection limit (AKA hard limit).

I sat down and started thinking. There must be a limit somewhere, but it’s not that (like with El Cheapo routers) it’s just getting too many packets and cannot handle them, because cutting down the transfer speed didn’t help. So - what else is there in router that can overflow? NAT table! Could it be?

I googled a bit and it turned out that WRT54GL has very small NAT table - like 512 entries. It seemed it’s a bit too small for 3 people actively using the Internet, plus eMule running in the background. I found a third party firmware for the router - Tarifa. It’s open source, free, easy to install and has the same configuration GUI as the original Linksys firmware.

I tried it and - voila - everything works smooth now. I can change the upload speed of eMule as I wish and it won’t block my network. So, if you have similar problems, give the Tarifa software a try.

I was curious - is Windows still using the services file for determining which port to use when connecting with a specific protocol, or is it hardcoded in the OS?

I mean, if we type http://test.com/ into Start->Run dialog, will it check the standard IANA services file to check which TCP port to use or will it just assume it’s port 80?

Let’s find out!

I created a standard Windows XP Professional SP2 virtual machine. I downloaded Microsoft Network Monitor for capturing TCP/IP traffic.

I did a simple test, by Going to google.com with IE 7 to check if Network Monitor is working fine - it was:

Network Monitor screenshot

Then I edited the standard services file and added an extra dummy service with port number 77:

Services file

Then I tried accessing the newly created protocol, both by Start->Run and by typing it into IE’s address bar.

Run window showing new dummy protocol

Unfortunately, in both cases, there was no TCP traffic initiated.

Conclusion

Windows doesn’t use the standard services file when determining if it knows the protocol, and how to connect to it. This has been verified for Windows XP SP2, but I assume newer version would not switch to the “old” method.

I just created my account on Wordpress.com to be able to use Aksimet. It was the usual signup form (with nice big buttons), then a confirmation mail, and then…

My password shown in clear text, big font, sent over unencrypted http protocol! Even more, a minute later I got my clear-text password sent to me via mail. Hello, it’s 2008, and I think at least some information security should be out there in the world. But hey, who cares…

April 15th, 2008Web -2.0 revisited

Great minds think alike. Some time ago I wrote about Web -2.0 idea: “Let’s reverse the ‘friend’ relation. Let’s make all people friends by default”.

It just came alive: Nclüdr. Enjoy.


© 2007 Jakub Anderwald | iKon Wordpress Theme by TextNData | Powered by Wordpress | rakCha web directory