Removing white margin around figures generated in Matlab
A very good post on how to do this can be found at this blog.
Posted: October 26th, 2010 under Matlab, Programming.
Tags: EPS, matab figure, PDF, remove, white margin
Comments: none
35.167°N 33.35°E
| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Oct | ||||||
| 1 | 2 | 3 | 4 | 5 | ||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 |
| 13 | 14 | 15 | 16 | 17 | 18 | 19 |
| 20 | 21 | 22 | 23 | 24 | 25 | 26 |
| 27 | 28 | 29 | 30 | 31 | ||
A very good post on how to do this can be found at this blog.
Posted: October 26th, 2010 under Matlab, Programming.
Tags: EPS, matab figure, PDF, remove, white margin
Comments: none
Hi,
I run into a problem the other day, with my Bash history not working between terminal sessions. If i had one session open and typed some commands, then those commands wouldn’t appear in another session, or even after i closed the current terminal session.
It seems that the problem was due to wrong permissions in the /home/user/.bashrc_history file. The owner of the file was the system root and not my user account. To check if this is true just do the following listing:
[bash]
la -ls /home/<user>/.bashrc_history
[/bash]
If you get the following it seems that the root is the owner of the history file, therefore anything that you write on the terminal cannot be appended to that file.
[bash]
$ ls -la /home/<user>/.bash_history
-rw——- 1 root root 210 2010-11-23 16:32 /home/<user>/.bash_history
[/bash]
To fix this just change user and group ownership for the history file as follows:
[bash]
sudo chown <user>:<user> /home/<user>/.bash_history
[/bash]
Posted: October 5th, 2010 under Linux.
Tags: Bash, between sessions, fix, history, write permissions
Comments: none
The following code snippet shows how to iterate a HashMap in Java:
[java]
//Instantiate a new hashmap with integer objects as key and value respectively:
Map<Integer,Integer> map = new HashMap<Integer,Integer>();
// Obtain the entry set, since it avoids the HashMap.get(key) lookup that would otherwise be called if we were accessing the value of a HashMap entry, using a key that was retrieved from a keySet iterator
Set<Entry<Integer, Integer>> entrySet = map.entrySet();
Iterator<Entry<Integer, Activity>> iterator = activitySet.iterator();
while ( iterator.hasNext() ){
// Get the key.
Integer key = iterator.next().getKey();
// Get the value.
Integer value = iterator.next().getValue();
// Print them on the standard output.
System.out.println( "Key: " + key + " Value: " + value );
}
[/java]
Posted: October 2nd, 2010 under Java, Programming.
Tags: EntrySet, HashMap, Iterating, Iterator, Java, KeySet
Comments: none
If often get the question how can we obtain positive, random numbers in Java. The following is a small Java code snippet on how to achieve this:
[java]
// Instantiate a new random number generator.
Random rand = new Random();
// This will pick a random integer in the range of 0 – 2147483647 (2^31-1) inclusive the 0. The upper limit number will not be picked.
int posRandInt = rand.nextInt( Integer.MAX_VALUE );
// To return a random integer starting from 1, simply add 1 to the result of the nextInt() method.
posRandInt = rand.nextInt( Integer.MAX_VALUE ) + 1;
[/java]
Posted: October 2nd, 2010 under Java, Programming.
Tags: integer, Java, positive, random
Comments: none
The following command uses the power of the Linux find application in order to scan all sub-directories in a given directory and delete all the files that match a specific extension.
[bash]
find . -type f -name "*.txt~" -exec rm -f {} \;
[/bash]
Posted: July 23rd, 2010 under Bash, Linux.
Tags: Bash, delete all files matching an extension, find, Linux, remove
Comments: none