Wednesday, February 28, 2007

A Personal Letter to Everyone I Know, Knew, Will Ever Know, Think I Know, Think S/He Knows Me - To EVERYONE!!!

 

Dear family, friends, ex-friends, future-friends, acquaintaces, whatever,

That's it, I've had it!

STOP SENDING ME CHAIN LETTERS !!!

When you think AOL/Microsoft/IBM/whatever is monitoring emails, and you forward them in hope for earning a few bucks - I understand you have as much common sense as my 3-year old (or less).

When you think you can save the life of some poor person with cancer who needs AB blood - it's obvious you haven't been around the Internet for the past 10 years.

When you think luck will come to you by spamming others' mailbox - I truely hope you are never going to meet any Hari-Krishna, because you're soo easy to fool.

When you think you make me feel loved and happy by forwarding some 10-pages long 15-year old load of BS - you're oh! so wrong!

So please please please, I don't want to offend you. If you have something to write to me - be my guest, I'd be glad to read it. If it's something you got from someone who got it from someone who... don't think - leave me out of it! I'd better loose one good joke than have yet another 5 spam (sorry - chain) mails in my inbox!!!

Yours sincerely,

Ilan

P.S: If you really can't help it, and still want to forward this junk (not to me!), I suggest you check out the following first:

http://breakthechain.org/
http://www.snopes.com/
http://info.org.il/irrelevant/  (Israeli)

Wrapper for svmpredict.exe

% predictions = libsvmpredict(test_set, model, varargin)
% options:
% -b probability_estimates: whether to predict probability estimates, 0 or
% 1 (default 0); for one-class SVM only 0 is supported
%
% NOTE1: This function actually executes LibSVM's svmpredict tool. For more
% info check out: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
% NOTE2: Although LibSVM supports more types of labels, this wrapper is
% limited to integer labels only.
% NOTE3: This function assumes that svmpredict.exe is located in a directory
% that lies in your system's PATH.
function predictions = libsvmpredict(test_set, model, varargin)
if isempty(varargin)
options = struct([]);
else
options = varargin{1};
end;

% Dump the test set to a temporary file
testfile = tempname;
fid = fopen(testfile, 'wt');
dumpData = zeros(size(test_set,1), 2*size(test_set,2) + 1);
format = '%d %d:%f';
for i=1:size(test_set, 2)
dumpData(:, 2*i) = repmat(i, size(test_set,1), 1);
dumpData(:, 2*i+1) = test_set(:, i);
if i < size(test_set,2)
format = sprintf('%s %%d:%%f', format);
end;
end;
format = sprintf('%s\n', format);
fprintf(fid, format, dumpData');
fclose(fid);

% Dump the model to a temporary file
modelfile = tempname;
fid = fopen(modelfile, 'wt');
fprintf(fid, model');
fclose(fid);

% Run svmpredict with the given model and write the predictions to a temporary
% file
predictionsfile = tempname;
command = 'svmpredict';

if isfield(options, 'b')
command = sprintf('%s -b %d', options.b);
end;

dos(sprintf('%s %s %s %s', command, testfile, modelfile, predictionsfile), '-echo');

% Load the predictions temporary file and return its content
predictions = dlmread(predictionsfile);

return;

Wrapper for svmtrain.exe

% model = libsvmtrain(training_set, options)
%
% options:
% -s svm_type : set type of SVM (default 0)
% 0 -- C-SVC
% 1 -- nu-SVC
% 2 -- one-class SVM
% 3 -- epsilon-SVR
% 4 -- nu-SVR
% -t kernel_type : set type of kernel function (default 2)
% 0 -- linear: u'*v
% 1 -- polynomial: (gamma*u'*v + coef0)^degree
% 2 -- radial basis function: exp(-gamma*|u-v|^2)
% 3 -- sigmoid: tanh(gamma*u'*v + coef0)
% 4 -- precomputed kernel (kernel values in training_set_file)
% -d degree : set degree in kernel function (default 3)
% -g gamma : set gamma in kernel function (default 1/k)
% -r coef0 : set coef0 in kernel function (default 0)
% -c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1)
% -n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5)
% -p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1)
% -m cachesize : set cache memory size in MB (default 100)
% -e epsilon : set tolerance of termination criterion (default 0.001)
% -h shrinking: whether to use the shrinking heuristics, 0 or 1 (default 1)
% -b probability_estimates: whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0)
% -wi weight: set the parameter C of class i to weight*C, for C-SVC (default 1)
% -v n: n-fold cross validation mode
%
% NOTE1: This function actually executes LibSVM's svmtrain tool. For more
% info check out: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
% NOTE2: Although LibSVM supports more types of labels, this wrapper is
% limited to integer labels only.
% NOTE3: This function assumes that svmtrain.exe is located in a directory
% that lies in your system's PATH.
function model = libsvmtrain(training_set, labels, varargin)
if size(training_set,1) ~= size(labels,1)
error('The training_set and labels should have the same number of rows.');
end;
if isempty(varargin)
options = struct([]);
else
options = varargin{1};
end;

% Dump the training set to a temporary file
datafile = tempname;
fid = fopen(datafile, 'wt');
dumpData = zeros(size(training_set,1), 2*size(training_set,2) + 1);
dumpData(:, 1) = labels(:, 1);
format = '%d';
for i=1:size(training_set, 2)
dumpData(:, 2*i) = repmat(i, size(training_set,1), 1);
dumpData(:, 2*i + 1) = training_set(:, i);
format = sprintf('%s %%d:%%f', format);
end;
format = sprintf('%s\n', format);
fprintf(fid, format, dumpData');
fclose(fid);

% Run svmtrain with all given options and write the model to a temporary
% file
modelfile = tempname;
command = 'svmtrain';

if isfield(options, 's')
command = sprintf('%s -s %d', options.s);
end;

if isfield(options, 't')
command = sprintf('%s -t %d', options.t);
end;

if isfield(options, 'd')
command = sprintf('%s -d %f', options.d);
end;

if isfield(options, 'g')
command = sprintf('%s -g %f', options.g);
end;

if isfield(options, 'r')
command = sprintf('%s -r %f', options.r);
end;

if isfield(options, 'c')
command = sprintf('%s -c %f', options.c);
end;

if isfield(options, 'n')
command = sprintf('%s -n %f', options.s);
end;

if isfield(options, 'p')
command = sprintf('%s -p %f', options.p);
end;

if isfield(options, 'm')
command = sprintf('%s -m %f', options.m);
end;

if isfield(options, 'e')
command = sprintf('%s -e %f', options.e);
end;

if isfield(options, 'h')
command = sprintf('%s -h %d', options.h);
end;

if isfield(options, 'b')
command = sprintf('%s -b %d', options.b);
end;

if isfield(options, 'wi')
command = sprintf('%s -wi %f', options.wi);
end;

if isfield(options, 'v')
command = sprintf('%s -v %d', options.v);
end;

dos(sprintf('%s %s %s', command, datafile, modelfile), '-echo');

% Load the model temporary file and return its content
fid = fopen(modelfile, 'r');
model = fread(fid, '*char')';
fclose(fid);

% For some reason, the data read has superfluous newlines (it seems to have
% doubled the newline characters or something like that).
model = regexprep(model, '\r', '');

return;

LibSVM Matlab Wrappers

As I mentioned in previous posts, I've been using SVMLight for quite some time now. It's been good while it lasted, but I'm now in the search for a stronger SVM library, especially one that handles multiple labels well. I've been introduced to LibSVM, which seems very promising. In theory, they have libraries for various systems and languages, including Matlab. However, I've had quite some trouble making it work with Matlab, so instead of breaking my head into solving the problem, I've decided to work around it in a quick-and-dirty manner (my favorite...).

What I did, is simply wrap the LibSVM's executables in a simple way, so it can be executed using Matlab functions (given the executables are located somewhere in your PATH).

The following two posts will include a wrapper for svmtrain.exe and svmpredict.exe

Please let me know if you encounter any problems using them.

Ah, of course, they are provided AS IS, no warranty or anything alike. I also don't take any credit for it, nor any responsibility as to how/who/when/where/etc. it can be used. For this - please check with the authors of LibSVM.

Monday, February 26, 2007

NTFS File encryption does not like virtual drives

I like the NTFS file encryption feature - you simply define a folder as being encrypted, and any susequent file you add to it is automatically encrypted. This means that, depending on permissions, other users may see that the file exists, but they won't be able to get the content. Even the system Administrator won't be able to read the file's content!
(There are various other goodies related to encrypted files, such that you can't copy them and such, but that's besides the point).

But I also like virtual drives. For example - my 3 PC's have a virtual drive called Z: that maps to a shared folder in one of the machines (called C:\Shared - to be precise).

So I had a couple of files in an encrypted folder (accidentally on the machine that hosts the folder mapped to by Z), and wanted to transfer them to another machine. I sent them to Z, and then I wanted to decypt them so I would be able to retrieve them from my second machine.
Just to make sure the scenario is clear: I'm connected with the correct user (the one who encrypted the files), and simply want to decrypt the files. The only thing is that I want to do it from a virtual drive (Z:).

 

BABOOM!!!

"An error occurred applying attributes to the file:
....
The system cannot find the path specified."

Of course, once I tried to decrypt from C:\Shared instead of Z:\ - everything went fine.

Not nice, really not nice.

Sunday, February 25, 2007

My daughter can do magic !!!

Purim is getting near, and this year, our eldest daughter Gal (almost 3) is going to dress up as a fairy. So yesterday we decided to try out the costume - pink dress, purple skirt on top of it, purple wings, silver crown and, inevitably - silver star-tipped wand.
Once she was completely dressed she started playing with her wand, in it went more or less like this:

Gal: Hocus, pocus, bili-bili-bocus: Grandma and Grandpa.
(nothing happens)
Gal: Where are Grandma and Grandpa ?
Ma&Pa: Huh?
Gal: Where are Grandma and Grandpa ???
(our little brains try to understand why she suddenly starts asking about her grandparents. after a minute or so, the smart of us gets the point)
Ma: Were you expecting Grandma and Grandpa ?
Gal: Yes - I said "Hocus, pocus, bili-bili-bocus" and Grandma and Grandpa didn't come!!!

(At this point I understand what's going on. So I step aside, secretly call Grandma and Grandpa, and ask them to come, and give us a call when they're outside so she can conjure them again, and this time succeed).

Ma: You know, you need to practice a lot for this kind of spells to succeed. Come on, let's practice...

(After half an hour, and a phone call from Grandma and Grandpa telling us they are outside)

Ma: Come on, let's try conjuring Grandma and Grandpa again
Gal: Hocus, pocus, bili-bili-bocus: Grandma and Grandpa.

The face she did when she saw them entering the house, was worth all the gold in the world...

Tuesday, February 20, 2007

Reflector 5.0 is out - awesome!!!

Usually, you don't feel much difference when Lutz Roeder releases a new version of his can't-live-without-it tool. You open it, it says that there is a new version, you click OK, and you don't feel any difference. You're using a new version of Reflector, but don't see where the big deal was.

Today, however, things went completely differently. I downloaded the new version (using the Automatic Update feature which works like a charm), and was already surprised that the downloaded files was so big (1 MB).
Then I opened it... This guy is a genious:

  1. Integrated help from MSDN - when you look at a method's decompilation, you automatically see, at the bottom of the screen, the MSDN information about that method. Even cooler - the links inside that pseudo-MDSN pane work inside Reflector, and navigate to the correct place showing you the decompilation automatically!
  2. Expand Methods - When you look at a class, there is a link at the bottom called "Expand Methods" which will expand all the methods in one screen, effectively providing you with a complete decompiled class.
  3. Enhanced Analyzer feature - I LOVE the "Assigned By" feature, which shows you which methods change a field!
  4. Integrated search in MSDN and Google (I wonder how long it will take for Microsoft and Yahoo! to go complaining about the lack of configurability of the search engine...)
  5. Shell integration - run reflector.exe /register in a command prompt. Do it! NOW!!! You did it? Sure?!?! Well, assuming you're smart enough to have taken this advice - from now on, when you right-click on a managed dll, you'll have a "Browse with .NET Reflector" option, which will automagically open the dll with, huh, well Reflector of course. Actually, you don't even have to go through right-click - it's set as default when you double-click the dll...
  6. More features here. I wouldn't be able to put it better - The Best Tool Ever Got Even Better!!!

Cool!

Thanks Yossi for pointing it out.

Sunday, February 18, 2007

Microsoft Office errors are soooo descriptive....

Source: http://www.microsoft.com/products/ee/transform.aspx?ProdName=Office&EvtSrc=OfficeErrorMessages&EvtID=10046&LCID=1033&ProdVer=11.0

 

Details

Product:
Office

Event ID:
10046

Source:
OfficeErrorMessages

Version:
11.0

Message:
Links to additional information about the error message you saw are available below.


Currently there are no Office Assistance articles available for this error message.

Wednesday, February 14, 2007

What's up with YNet ???

For the past few days, every once in a while, when I open YNet, my browser takes up 100% CPU and I have to kill my whole iexplorer session to continue working properly. I've installed IE7 only a few weeks ago, so I don't know whether it's IE7 or YNet's fault, but it's starting to really get on my nerves!!!

Tuesday, February 13, 2007

4th Israeli bloggers dinner

If you're interested, make sure to let Omer know about it.
I really hope I'll be able to make it...

Anyways - kuddos to Omer for setting this up, again. It also looks like the deal he managed to get is a good one - I'm hungry only from thinking about it...

Political confession

I'm generally a left-wing voter - the two last elections I voted Meretz. I can't say I'm happy with their behavior, nor that I agree with all their opinions, but it's as close as it gets.

Anyway, I must admit that in the 18+ years I've been living in Israel, there has been no minister as good at his job as Ariel Atias, our minister for communications - from Shas - quite the oposite of my political beliefs. This guy is AMAZING - he is 100% focussed on improving service to the citizen, and doesn't mind fighting all the big communications, in most cases ending with the upper hand.
Just to name a few:

  • Force companies to make it very clear to the customer, while signing a contract, what happens at the end of the contract (not just in small letters).
  • Limit the ability of companies to force customers to buy their phones through them.
  • Forced Bezeq to provide a free phone book over the internet (144).
  • Asked the companies to give reductions to people living in the north, during the war.
  • Still working on making our phone numbers company-free (i.e. changing company doesn't force you to change your number). This has been postponed several times, but I hope it will succeed in the end.
  • Opened the stationary phone market to concurrence.
  • Force companies to provide 3 non-paid seconds before being routed to a voice message box.
  • His new baby - force companies to announce customers BEFORE they increase their prices.

And that's just part of it. A good article about him was recently published in YNet. Give us a handful ministers and politicians like him - and this could really be a nice place to live.

I was born on the same day as Albert Einstein

Yep, that's right, just 96 years later. You can see it all here, Together with Billy Crystal, Sir Michal Cain, Johan Strauss, Telemann and Jerry Greenfield - you can say I'm in good company.
Cool.

Monday, February 12, 2007

House security flaw

My neighbor's alarm is working - drives us nuts. I went to see if they are connected to some security center, and saw 4 or 5 placards of the same company. I called them, gave the neighbors' full name and address (either would have been sufficient). They told me that the neighbors are not customers of theirs. So how come there are so many of your signs all around the house? - I asked. They answered that probably my neighbors installed their alarm system through the security company, but they are not active client of the phone service ("moked"). Hmmm, so basically, if I were a prospective burglar, I could call each of the phone services in the area giving them the details of the house I want to break into, and in a few minutes I would have a pretty good notion of the level of security I would have to deal with...

You may ask - why is it the service provider's fault? What should they do different? Well, for starts, they could say something like "we will check whether they are our customers, and if not we will contact the police.", leaving me no way to know which it will be.

Visual Studio 2005 is *NOT* a LIAR!!!

UPDATE: I didn't think of it, but apparently the Memory Usage I see on VS indicates the amount of memory used by Resharper. I'm sorry if I offended anyone by this post - I don't mind picking on people and things here and there, but not when I'm wrong...

Did you ever notice the note on the lower left side of VS2005 window? At the moment of writing this post it says: "Memory Usage: 53.1 Mb". Sounds good, doesn't it? A quick look at the Windows Task Manager for the devenv process tells me the true story:
Mem Usage: 273,028
VM Size: 231,884 (note that this is the better measurement to assess how much memory is used by your process).

LIAR !!!

Sunday, February 11, 2007

Sacha Barber

I've never met this guy, but Sacha Barber keeps writing article after article on The CodeProject about AI, .NET and what's in between. In January only he published no less than 10 (!!!) high-quality articles (his rating averages around 4.5/5 for most articles).

I don't know how he manages to do this, but I sure hope he'll be able to keep them coming. Great work!

Musings: Why I think Google missed a big opportunity and ISP's are stupid

Huh? Why I what? Let's take it one step at a time:

GMAIL - a big (huge?) opportunity missed by Google

For almost a decade, there was one de-facto leader in the free webmail industry: Hotmail. Yeah, yeah, I know, there were others, most importantly Yahoo! Mail, but still - Hotmail was the first and until GMail came around (2004) I think it's fair to say Hotmail was the most prominent player. A monopoly? - certainly not.
At Google, some clever people understood that the free webmail industry is lacking some important features, and they took the challenge: GMail offered an inconceivably large mailbox (they started with 1GB, now it's almost 3GB), backed with Google search facilities, slick simple web interface, POP3 access, etc. They did one big mistake - left it in Beta phase for 3 years, based on invitation-only registration (at the beginning each user had very limited invitations available). I remember that when it started, people were searching with every lost friend whether he may have an invitation left in order to register. And it remained this way for long - much too long.
Why? Maybe it's because it was developed as part of Google's 20% time each employee can use to develop whatever she likes - and it took too long for management to give it proper priority? Maybe because they were afraid of getting out of disk-space if too many users would register? Bandwidth? Spam fear? Bugs that needed to be resolved?
Whatever the reason may have been, it's in the past and they missed the opportunity to become THE email world-leader, almost as they are the leader in web search. Because now, everyone (except ISP's, see below) offers large mailboxes with Ajax interfaces, and it really doesn't matter whether you get 1,2 or 5GB - most people never use more than 100MB, and by the time they will need more, storage cost will drop enough for it to be unworthy noting.
A last thing about GMail. Actually, it's about Google Accounts - there is a small security flaw... I recently created an account for a family member. She wanted the password to be some date. I know, it's bad security practice, but bear with me for a second, ok? Now, let's say the date required was 31 January 1999. When I typed as password "31011999", the passwords strength indicator says it's "Good". When, however, I typed as password "01311999" (i.e. MMDDYYYY instead of DDMMYYYY), the indicator says it's "Strong". Do I need to say more?

ISP's - why are they so stupid?

I don't know how it goes in other countries, but here in Israel, the default mailboxes you get from your ISP is extremely small (around 5MB). The result is that people don't use their ISP's mailbox for any important purpose, and prefer using their free webmail, such as GMail, which can also be accessed through POP3. There is even a movie that shows how to do the configuration, if you're not a techie.
Why do I think they are stupid? Let's look at the mobile phone analogy. In Israel there are several cellular companies, each with its own prefix. If I want to change my mobile provider, I know it will incur changing my phone number - so I will do it only if it's really really really worth it. I don't have to tell you the headache and costs incurred: service providers, clients, business cards, invoices, friends, etc. - all must be updated with the new number. Even the Israeli minister of communication understands the problem, and is actively trying to force the various phone companies to support changing provider without changing the number - until now without success.
With mail addresses it's similar - people hate changing mail addresses. Granted - it's much easier to change your email address than to change your phone number, and cheaper (keeping a forwarding account will cost you less than 1$/month), but still, after a couple of times you get sick of it and will try to avoid it as much as possible. Also, it is much more complicated, if not impossible, to force an ISP to support emails that belong to another provider. So basically, ISP's could bond their customers by giving them excellent email services (large mailbox, fast access, search facility, web access, etc), but they just don't see it. I'd even go further - they should provide FREE emails to everyone, not only to customers. Why? Well if I were a potential customer of some ISP, and I would see that most emails around me belong to that ISP, I would assume it's a big company that gives good services - and would be more likely to be drawn by it.
Ah, one last stupidity - I recently had to create an account at Netvision for a friend of mine. They still limit the usernames to 8-characters (only alpha-numeric I think). Hmm, WAKE UP !!!!

Wednesday, February 07, 2007

YNet's encyclopedia

YNet expose a pretty interesting encyclopedia. Of course, I usually first search in the Hebrew Wikipedia. However, sometimes the value I'm searching is missing, or incomplete, and I want an answer. Their encyclopedia costs 19NIS/month. It's not much, but if I need to use it, say, only once every other month on average, it's a little expensive. What I would suggest is to provide a similar paying mechanism as they do with the cars pricelist - you call a special phone number, get an access code over the phone, and can keep using the site as long as the communication is not disconnected. This allows for people like me, who only need the service occasionally, to be part of their paying customers, without too much hassle and for reasonable prices.

GoogleFight

Today I was introduced to a Google goodie (not affiliated to Google) I wasn't aware of - GoogleFight. It's a simple site that lets you compare the number of results Google returns for two different queries. So you can easily compare the popularity of things (or people) - apparently, despite SVM's superiority in most cases, Neural Networks are much more popular than Support Vector Machines. "Madonna" is 4 times more popular than "Britney Spears". There is much more "good" than "bad" in the world. You get the idea...
Alternatively, you can check expressions and improve your writing - the American way of writing "color" is so much more popular than the English "colour". It's better to "speak english" than to "talk english", etc.
Nice...

Monday, February 05, 2007

.NET WTF - InstallUtil.exe gets corrupted ?!?!?!

I'm currently playing with a service - installing, uninstaling, connecting from remote machine, etc. Suddenly, out of the blue, when I tried uninstalling the service (by the book, using InstallUtil.exe) I get the following error:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\InstallUtil.exe is not a valid Win32 application.
(in the command prompt I even get a message "Access Denied")


Being a restart-freek, I first tried to restart the machine - no change.
So I started googling my way, found several people complaining about this with no concrete reason/solution, until I found someone saying that replacing the installutil.exe file solved the problem. I looked at the .NET folder, and sure enough, InstallUtil.exe lies there, with size 0 and Date Modified - a few minutes ago !!!

?!?!?!     W  T  F     ?!?!?!

Of course, replacing the file with an uncorrupted one solved the problem (lucky for me I have two machines with .NET installed).