Tuesday, April 3, 2012

Assigning shortcut keys in Keynote: Mac

I needed to make a picture of neural network. The picture is too much work as it has a lot of connected blocks to be constructed.
So, in order to reduce the pain, I looked for shortcuts.

I wanted to assign shortcut keys to connect the blocks. So, I went to :

  • System preferences
  • Keyboard
  • Keyboard Shortcuts
  • Application Shortcuts
  • From there I had to browse the keynote and put the exact word. In this case "Connection Line", and assign the shortcut.
  • This method is true in general. So, if I wanted to assign any set of keyboard shortcut to any task, it should work. 
  • Profit!! :)



In order to connect the blocks, I would need to select two blocks, then press the shortcut key.
I wonder if there is a way to make connection between all selected blocks. (There seems to be none...)

Currently, If I have to connect two blocks, it is set to:
CMD+SHIFT+K

Tuesday, February 14, 2012

Screen Capture in Mac using Terminal

I figured, there should be some kind of terminal script out there which enables us to take the screen capture of the desktop. This will become real handy when we need to produce consistent screenshots for the Google Earth Images for my results. Furthermore, in order to crop it nicely, there is a code too!
http://usefulcodes.blogspot.com/2011/11/using-imagemagick-shell-command-to-crop.html
screencapture ~/Desktop/test.png


Friday, January 6, 2012

Do not Repeat the task

In one of my work, the funny thing happened. The matlab could not save some of the finished task. It might be memory issues or what not... I am not sure. So, I wanted to run the program in such a way that it would not repeat the finished task while still running the new work.
This script does it!
:)


% inDIR is the directory containing the save work
if exist([inDIR],'dir')>0

disp(['not doing ::: ', inDIR])

writeout = ['echo "not doing ::: ', inDIR, '">>notes.txt'];
system(writeout)

% do nothing
else

% do it command here!!
end

Wednesday, November 9, 2011

Load matfiles


Load the required files from a directory


clc
matDIR = '/.../matfiles/';
% workDIR = '/Volumes/3TB/.../AquaLand20/';
files = dir(matDIR);

% Remove the '.DS_Store' from the list
if strcmp(files(3).name, '.DS_Store')
files(3) = [];
end


% count =3;
row = 1;
for count= 3:length(files)

FNamebase=files(count).name;

inDIR =[matDIR, FNamebase];

if exist(inDIR)>0

load([inDIR ]);
time(row) = toc;
iter(row) = j-1;

disp(['Loaded! ',FNamebase]);

row = row+1
end
end

Tuesday, November 8, 2011

Using Imagemagick shell command to crop figures

How to crop figure and save as png.
This is useful for cropping similar figures located in a folder.

Copy the code, save as cropfig.sh
and then run the cropfig.sh in your terminal...

#!/bin/bash
width=1800;
height=1680;
x_offset=502;
y_offset=40;
filelist=`ls | grep '.png'`
for image_file in $filelist
do
preextensionfilename=`convert $image_file -format "%t" info:`
convert $image_file -crop ${width}x${height}+${x_offset}+${y_offset} \
${preextensionfilename}_${width}x${height}.png
done


Thursday, November 3, 2011

Remove the .DS_Store from the file list

Sometimes, working on the filelist is troublesome because of the .DS_Store

WhereAqua = pwd;

files = dir(WhereAqua);

% Remove the '.DS_Store' from the list
if strcmp(files(3).name, '.DS_Store')
files(3) = []
end


There is another way too!
fileLIST = dir;
N = length(fileLIST); % fileLIST.name
 status = mkdir(pwd, 'hdfClass'); 

if exist('.DS_Store','file')
! rm .DS_Store
fn =  fileLIST(4).name;
else
fn =  fileLIST(3).name;  

-->