Thursday, May 31, 2007

Fix the window size!

Are you using Firefox and /or Tab mix plus? I am using it and pissed off by the window resizing when opening certain windows. This problem is usually caused by JavaScript. To fix the window size, go to Options->Content->Enable JavaScript->Advanced->Move or resize existing windows, and make sure you uncheck the box. That is it. Now the world becomes better...

Chinese version:

固定Firefox窗口大小

http://time360.blogspot.com/2007/05/firefox.html

Monday, May 28, 2007

Free software 21: launch programs and documents using keyboard












A part of computer users like to use keyboard rather than mouse. Usually they move the mouse when they launch programs or open documents. Now, it is time to free the mouse, it travels too much!

Key Launch and launchy are two small programs that help you launch programs or documents by keywords. For example, if you want to launch MATLAB using your keyboard, simply call the programs and type 'MATLAB'. That is so easy! Even type the wrong words, you may still get what you want.

Generally, launchy is smaller with less function, and takes less computer resource. But it is enough for normal use. Key Launch is more powerful, which means you'd better have a good computer.

(Images shown in this post come from their official websites.)
Key Launch's official website is: http://www.konradp.com
Launchy's official website is: http://www.launchy.net

Monday, May 21, 2007

Start MATLAB in your last working directory

For most MATLAB users, probably, it is more convenient to start MATLAB in the last working directory. There is no option to set in the preferences, an alternative way to do so is using startup.m and finish.m.

When MATLAB starts, it automatically executes startup.m if the m file exists; and it runs a script finish.m when quiting. Therefore, we creat/edit these two files to make sure MATLAB starts in the last working directory.

************************************************
The content of startup.m:
if ispref('StartupDirectory','LastWorkingDirectory')
 lwd = getpref('StartupDirectory','LastWorkingDirectory');
 try
     cd(lwd)
 catch
     disp('Sorry, but I could not go to your last working directory:')
     disp(lwd)
 end
end

***********************************************************
finish.m:
setpref('StartupDirectory','LastWorkingDirectory',pwd)

*************************************************************

Reference: http://www.mathworks.com/matlabcentral/files/5793/StartupInLastDirectoryDirections.html

Thursday, May 10, 2007

Convert images to avi video in MATLAB

Yesterday I wrote a function that converts images in a directory to avi video based on Wu's code. Here is the simplified version.

function varargout=im2avi(ext, imdir, scale, framerate, filename, playflag)
% im2avi converts image sequenses to avi video
%
% SYNTAX
%
% Inputs: imdir: image sequense directory
% ext: the extension name of the image such as 'jpg', 'tif',
% scale: image resize, like [320 400] or 0.9
% framerate: avi video frame rate
% filename: save avi as
% playflag: play the avi video; if it is 0, no play, if >0,
% play the avi 'playflag' times.
%
% EXAMPLE: im2avi(ext, imdir, scale, framerate, filename, playflag)
%
% NOTES: based on im2avi (author: Zhe Wu @ Univ of Rochester)
% Wenbin, 09-May-2007

warning('im2avi:warning','Do NOT close or open any image window during the process!\n')

filearray=dir([imdir filesep '*.' ext]);
s=size(filearray,1);

frameind=0;
mv =struct('cdata',{}, 'colormap', {});
figure, h =gcf;

for i=1:s
frameind=frameind+1;
imgname=[imdir filesep filearray(i).name];
im=imread(imgname) ;
im=imresize(im, scale);
imshow(im);
mv(frameind)=getframe(h);
end
close(h)

movie2avi(mv, [imdir filesep filename '.avi'], 'fps', framerate);
% movie2avi(mv, [imdir filesep filename '.avi'], 'fps', framerate, 'compression', 'None');


if nargout >0
varargout{1} =mv;
end

if playflag>0
movie(mv, playflag);
end

Chinese version:

用MATLAB转换图片到avi视频

http://time360.blogspot.com/2007/05/matlabavi.html

Tuesday, May 01, 2007

Free software 20: Anti-spam

Spams are quite annoying and are deep in our email box. I receives at least 20 junk mails everyday. A good way is to choose a good email provider, like Yahoo, Google, or Hotmail. If you prefer to use your email clients, here are the free choices to enhance the antispam function provided by the email clients. (I know there are some other free antispam softwares. But I won't introduce the free software that has non-free brothers or sisters.)

(I haven't tried them all, but I think the first 3 should be reliable.)