Tuesday, December 23, 2014

Firefox Register protocol

Firefox 3.5 and above

(Works without installed Gnome libraries)
  • Type about:config into the Location Bar (address bar) and press Enter.
  • Right-click -> New -> Boolean -> Name: network.protocol-handler.expose.foo -> Value -> false (Replace foo with the protocol you're specifying)
  • Next time you click a link of protocol-type foo you will be asked which application to open it with. 
 http://kb.mozillazine.org/Register_protocol#Firefox_3.5_and_above

Friday, November 28, 2014

matlab fix bad ticks, fix plot print preview,

%%% nice tick format %%%%%%%%%%%%%%%%%%
% Query xTick numerical values.
yTick = get(gca,'yTick');
% Create strings out of yTick numerical values with a prescribed precision.
% The format string '%a.bf' means to present the values within a field that
% is wide enough to fit 'a' digits with 'b' digits after the decimal point
% in the format of a 'f'loating point number.
yTickLabel = arrayfun( @(y) sprintf('%1.3f',y), yTick, 'uniformoutput', false);
% Use xTickLabel on the plot.
set(gca, 'yTickLabel', yTickLabel);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
src: http://www.mathworks.com/matlabcentral/answers/103188-how-do-i-format-tick-labels

To prevent Matlab from messing it once again at the print level:


Thursday, November 27, 2014

latex invisible section

Something like this:
\newcommand\invisiblesection[1]{%
  \refstepcounter{section}%
  \addcontentsline{toc}{section}{\protect\numberline{\thesection}#1}%
  \sectionmark{#1}}
...

\invisiblesection{Blah}
 
http://tex.stackexchange.com/questions/68272/make-section-headings-invisible 

Tuesday, November 25, 2014

makebst bst dbj file modify by hand

During the makebst-session:
COLLECTION/PROCEEDINGS TITLES (if quoted title)
(*) Quote collection and proceedings titles too
(x) Collection and proceedings titles not in quotes
Choose x.
It's unnecessary to redo the whole session (like I did four times), just open up the dbj-file and comment out the wrong answers, and remove the comment-sign (%) at the correct answers. Just remove one comment-sign at the relevant answer, sometimes there's a purpose to have a second comment-sign at some answers.
Then open up your terminal and call on the edited dbj-file that generates the bst-file.
latex foo.dbj
Where foo is the name you choose in the beginning of the session.

http://tex.stackexchange.com/questions/22902/adjusting-booktitle-in-inproceedings-in-a-makebst-file

Saturday, November 8, 2014

Beep in shell script

SRC: http://askubuntu.com/questions/19906/beep-in-shell-script-not-working

Solution 1)
First run sudo modprobe pcspkr and then beep should work.
The reason this doesn't is because by default Ubuntu no longer loads the hardware driver that produce beeps.
If this works for you then to enable the loading of pcspkr permanently edit the /etc/modprobe.d/blacklist.conf file (using gksudo gedit perhaps) and comment out line that says blacklist pcspkr so it looks like this:
# ugly and loud noise, getting on everyone's nerves; this should be done by a
# nice pulseaudio bing (Ubuntu: #77010)
# blacklist pcspkr
 
Solution 2) 
Not being a fan of the pcspkr beep, I use a beep from one of the system sounds with the installed pulseaudio server's paplay command.
First find a sound you like (you can browse /usr/share/sounds for some available ones for example) and create a reference to it
export BEEP=/usr/share/sounds/KDE-Im-Message-In.ogg
Then have it available as a command
alias beep='paplay $BEEP'
Now just run beep whenever you need it. For example, to alert you when a command is finished:
find . | grep treasure ; beep

Friday, October 24, 2014

Searching for marked (selected) text in Emacs

M-W (to get a copy of the selected text) C-s C-y . Then repeat C-s as needed. Similarly for C-r.

Src: http://stackoverflow.com/questions/202803/searching-for-marked-selected-text-in-emacs

Monday, October 13, 2014

KDE navigation shortcuts

The Go Menu

GoPrevious Page
View the previous page of the document.
GoNext Page
View the next page of the document.
GoBeginning of the document (Ctrl+Home)
Go to the beginning of the document.
GoEnd of the document (Ctrl+End)
Go to the end of the document.
GoBack (Alt+Shift+Left)
Go back to the previous view of the document.
GoForward (Alt+Shift+Right)
Move forward to the next view of the document. This only works if you have already moved back before.
GoGo to Page... (Ctrl+G)
Open a dialog which allows you to go to any page of the document.

Source: https://docs.kde.org/stable/en/kdegraphics/okular/menugo.html

Monday, October 6, 2014

Latex: Roman numerals for tables

\renewcommand*\thetable{\Roman{table}}
 
http://latex-community.org/forum/viewtopic.php?f=5&t=1654

Wednesday, October 1, 2014

Bibtex bold / boldface in journal article volume

Declare a function "embolden" if it is not already defined in your .bst

FUNCTION {embolden}
{ duplicate$ empty$
    { pop$ "" }
    { "{\bf " swap$ * "}" * }
  if$
}

Use it in the following pres-existing passage of your .bst:

FUNCTION {format.vol.num.pages}
{ volume embolden field.or.null

Note, the order of declaration is important, so declare the first function upstream of the function where it is used.

Inspiration: aip.bst from http://www.ctan.org/tex-archive/biblio/bibtex/contrib/phy-bstyles

Tuesday, September 30, 2014

Saturday, September 27, 2014

bibtex tricks

description of format: http://www.bibtex.org/Format/
trees locations: http://www.tex.ac.uk/cgi-bin/texfaq2html?label=what-TDS

Friday, September 26, 2014

perl multiple "or" statements

Apparently in perl, multiple "or" are synced if the result is used in a replacement. E.g.:

s/(a|b)some_text(x|y)/\1new_text\2/g

will only find and replace

a(some_text)x
b(some_text)y

and no permutations of these !

Thursday, September 25, 2014

bring emacs closer to your bash shell

Environment variables:

http://stackoverflow.com/questions/9663396/how-do-i-make-emacs-recognize-bash-environment-variables-for-compilation

(let ((path (shell-command-to-string ". ~/.bashrc; echo -n $PATH")))
  (setenv "PATH" path)
  (setq exec-path 
        (append
         (split-string-and-unquote path ":")
         exec-path)))

Autocompletion: 

https://github.com/szermatt/emacs-bash-completion

(autoload 'bash-completion-dynamic-complete 
  "bash-completion"
  "BASH completion hook")
(add-hook 'shell-dynamic-complete-functions
  'bash-completion-dynamic-complete)
(add-hook 'shell-command-complete-functions
  'bash-completion-dynamic-complete)

ImageJ stdev

The standard deviation function in ImageJ (1.47v tested) is computing the sample standard deviation (divided by N-1).

Saturday, August 23, 2014

kde wallet: forgot password

Go into /home/*your_username*/.kde/share/apps/kwallet and delete the file/s in there, then restart kwallet. That should work.

Source: http://www.linuxquestions.org/questions/linux-software-2/kde-wallet-forgot-password-334423/

Reset a lost administrative password

By default the first user's account is an administrative account, so if the UI is prompting you for a password it's probably that person's user password. If the user doesn't remember their password you need to reset it. To do this you need to boot into recovery mode.
Boot up the machine, and after the BIOS screen, hold down the left Shift key. You will then be prompted by a menu that looks something like this:
enter image description here
I've noticed on some systems that timing when to hit the left Shift key can be tricky, sometimes I miss it and need to try it again.
Hit the down arrow until you select the 2nd entry from the top (the one with the recovery mode in the description) and then hit Enter.
Now you should see this menu:
enter image description here
Using the arrow keys scroll down to either root or netroot (doesn't matter in this case) and then hit Enter.
You should now see a root prompt, something like this:
root@ubuntu:~#
At this stage you should have a read-only filesystem. You have to remount it with write permissions:
mount -rw -o remount /
Now we can set the user's password with the passwd command. (In this example I will use jorge as the example, you need to substitute whatever the user's username is):
root@ubuntu:~# passwd jorge
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
root@ubuntu:~#
Type in what you want the new password to be at the prompt. After it's successful reboot the machine and the user will be able to log in with their new password.

Source: http://askubuntu.com/questions/24006/how-do-i-reset-a-lost-administrative-password

Monday, August 18, 2014

Forward X over ssh

X11 forwarding needs to be enabled on both the client side and the server side.
On the client side, the -X (capital X) option to ssh enables X11 forwarding, and you can make this the default (for all connections or for a specific conection) with ForwardX11 yes in ~/.ssh/config.
On the server side, X11Forwarding yes must specified in /etc/ssh/sshd_config. Note that the default is no forwarding (some distributions turn it on in their default /etc/ssh/sshd_config), and that the user cannot override this setting.
The xauth program must be installed on the server side. If there are any X11 programs there, it's very likely that xauth will be there. In the unlikely case xauth was installed in a nonstandard location, it can be called through ~/.ssh/rc (on the server!).
Note that you do not need to set any environment variables on the server. DISPLAY and XAUTHORITY will automatically be set to their proper values. If you run ssh and DISPLAY is not set, it means ssh is not forwarding the X11 connection.
To confirm that ssh is forwarding X11, check for a line containing Requesting X11 forwarding in the ssh -v -X output. Note that the server won't reply either way.

Src: http://unix.stackexchange.com/questions/12755/how-to-forward-x-over-ssh-from-ubuntu-machine

Wednesday, August 6, 2014

Comparing ISO-8859-1 and ISO-8859-15

The character encodings ISO-8859-1 and ISO-8859-15 are very similar and easily confused. This leads to several typical problems. The following chart show the differences between these encodings and are useful for debugging the associated problems.

ISO-8859-1 vs. ISO-8859-15

The ISO-8859-1 character set is full; Every code point is assigned to a character. In 1999, ISO needed to make the Euro currency symbol available. There were also a few other characters that were desired. So ISO created ISO-8859-15, which is identical to ISO-8859-1 except for 8 characters. ISO-8859-15 is often used on Unix systems in Europe, especially in France.

Typical Problems

  • Due to the great similarity between the two code pages, it is difficult for encoding detection programs to correctly distingush the ISO-8859-15 encoding from ISO-8859-1. Ensure that files or Web pages are labeled and labeled correctly.
  • Mislabeling text encoded in ISO-8859-15 as ISO-8859-1 will cause just the 8 characters listed in the comparison table to display and be converted incorrectly. For example, "Å’" will appear to be "¼".
Source: http://www.i18nqa.com/debug/table-iso8859-1-vs-iso8859-15.html

Monday, August 4, 2014

Logitech Unifying devices setup

According to the instructions, first turn on the wireless device, and only after that plug in the nano USB receiver.

Thursday, July 31, 2014

Dual-boot: Windows boot loader disappears after dist-upgrade

Before panicking, reboot and visit the BIOS boot sequence. GRUB might have been promoted and Windows bootloader demoted during the dist-upgrade process. You could simply rearrange the boot sequence to your convenience.

Kubuntu Window Decorations Crashing

rm ~/.config/Trolltech.conf
rm -r /var/tmp/kdecache-$USER

Kubuntu: absent window decorations (buttons) after upgrade

 sudo service kdm stop

optionally: [sudo apt-get update && sudo apt-get install -f]

sudo apt-get install --reinstall kde-window-manager kde-window-manager-common

sudo reboot

Tuesday, July 29, 2014

Ubuntu: How can I install just security updates from the command line?

The package unattended-upgrades provides functionality to install security updates automatically.
You could use this, but instead of configuring the automatic part you could call it manually. For this case, the following should do it:
sudo unattended-upgrade
This assumes that the package is installed by default, which it probably is. If not, just do:
sudo apt-get install unattended-upgrades
(watch out: the package is with final "s", the first command, not)
See also /usr/share/doc/unattended-upgrades/README.


http://askubuntu.com/questions/194/how-can-i-install-just-security-updates-from-the-command-line

Propagate all arguments in a bash shell script

Use "$@" instead of plain $@ if you actually wish your parameters to be passed the same.
Source: http://stackoverflow.com/questions/4824590/propagate-all-arguments-in-a-bash-shell-script

Tuesday, July 22, 2014

How to write a rebuttal letter

http://blogs.nature.com/methagora/2013/09/how-to-write-a-rebuttal-letter.html 

How to write a rebuttal letter

A well written rebuttal letter is critical in any resubmission. 
Once the initial reaction, be that joy, anger or frustration,  to receiving feedback from editors and reviewers about one’s work has subsided, it’s time for our authors to make one of two decisions:  continue to go after a Nature Method paper  or take their work to another journal.
A realistic look at how the reviewers’ requests can be met will go a long way in helping to determine whether a revision is likely successful and to avoid a futile resubmission.
If authors want to resubmit in cases where the editorial decision was negative, and referees were critical and asked for a lot of additional information, the first step, before embarking on any revision, should be an appeal (see the post on “How to write an appeal letter” for more details) and rebuttal letter to the editor to discuss whether a proposed list of additional information is likely to address the referees concerns.
Authors who receive a positive editorial decision and who are confident that they can address the reviewers’ points nevertheless have to submit a rebuttal letter with their revision.
The rebuttal letter is an author’s chance to directly reply to the reviewers, announce plans to improve the work, clear up misunderstandings or defend aspects of the work. How it is written can make a big difference in whether or not an appeal is granted and how the reviewers judge the revision.
The DOs:
  • Do acknowledge that the reviewers spent a substantial amount of time looking over the paper – rebuttal letters that thank the referees for their time and comments set a positive tone and ensure that the exchange takes place on a productive footing.
  • Do acknowledge that a misunderstanding may be due to poor presentation on your part, not lack of expertise on the reviewers’,  and phrase your reply accordingly,  taking the opportunity to clarify.
  • Do copy the full text of each reviewer’s comments in your rebuttal and reply to every concern raised by each reviewer immediately after each point in a concise manner that clearly states how you plan to address it (experimentally or editorially) or point to data that already addresses it which the reviewer appears to have missed.
  • If you cannot address a point at all, explain why not.
  • Do number the comments or at least break them into paragraphs, and use different fonts or text colors to distinguish the reviewer comments and your reply, rather than write a single reply to an entire review in summary form.
  • Do include relevant citations with full references or dois so they can be easily looked up, rather than just cite by First Author et al.
  • Do include pertinent new data as embedded figures, tables, or attachments,   indicate where in the manuscript you added the information; give page numbers, figure panels, Supplementary material etc., so editors and reviewers don’t have to go on a search for the new data. If any of this information will not be included in the revised paper explain why not.
  • Do be succinct and to the point and avoid epic discourses.  In the case where more than one referee has raised the same concern, it’s best to cite “see response to point 2 from Reviewer #1”, for example.
  • Do remember that each reviewer sees all comments and your replies so be equally respectful to all.
The DON’Ts:
  • Don’t vent or accuse the reviewers of bias or incompetence. We have read countless times that “ ref 2 is lacking expertise and completely misses the point” etc. and one wonders what the goal of such blanket statements is. They serve no productive purpose and instead potentially bias all referees, even the positive ones, against the work.
  • Don’t plead that for personal or monetary reasons critically important experiments can’t be performed. While we hear the plight of underfunded labs we don’t make exceptions for these reasons.
  • Don’t ignore specific requests by referees without comment and selectively only answer a few queries.
  • Don’t rephrase a referees’ point to give it a slightly different meaning that you can more easily address.

Monday, July 21, 2014

%% temporarily remove, reset page numbering
\pagenumbering{gobble}

some text without pagenumbering....

%% return page numbering, knowing we are on "new" page 2
%% note: the command order is important
\pagenumbering{arabic}
\setcounter{page}{2}


inspiration: http://tex.stackexchange.com/questions/54333/no-page-numbering

Friday, July 18, 2014

Cross-Referencing Line Numbers in LaTeX

http://seananderson.ca/2013/04/28/cross-referencing-reviewer-replies-in-latex.html

\usepackage[pagewise]{lineno}
And wherever you want to start the line numbers in your document add:
\linenumbers
Now we'll set up two new commands in the preamble. First, create a new command to label your changes:
\newcommand{\R}[1]{\label{#1}\linelabel{#1}}
Then, create a new command to cross-reference your changes:
\newcommand{\lr}[1]{page~\pageref{#1}, line~\lineref{#1}}
Now, say you wanted to revise a sentence to deal with Reviewer comment A1. You can just add something like this within the manuscript:
\R{A1} A sentenced we have revised...
In the reply document, you can reference this change like this::
We have revised the text. Please see \lr{A1}.

Wednesday, July 9, 2014

Your local machine IP via bash

ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'

gdb basics for release executables

even the release version can be "debugged"

$ gdb my_program

(gdb) run my_argfiles

...segfault...

(gdb) backtrace

Wednesday, June 18, 2014

Qwt over Qt4

sudo apt-get install libqwt5-qt4
sudo apt-get install libqwt5-qt4-dev

Manually install a LaTeX package (Debian/Ubuntu Linux)

The following four steps permit manual installation of packages on Debian/Ubuntu (and presumably other Linux) systems.
  1. Download the package from CTAN (e.g., footmisc.zip).
  2. Extract the files and place them in an appropriate directory (e.g., /usr/local/share/texmf/tex/latex/footmisc/). This location is preferable to the main installation tree (/usr/share/texmf-texlive/tex/latex/) as the files are more likely to be preserved during upgrades.
  3. Generate the .sty file by running latex on the appropriate source files (e.g., latex footmisc.ins and latex footmisc.dtx).
  4. Update the ls-R file in this source tree (e.g., cd /usr/local/share/texmf/ ; sudo mktexlsr). Because /usr/local/share/texmf/tex/ is not searched recursively by kpathsea (cf. kpsepath tex), the ls-R file at the root directory of this search path must be updated to make the system aware of the new package.
http://tex.stackexchange.com/questions/38978/how-can-i-manually-install-a-latex-package-debian-ubuntu-linux

Friday, June 13, 2014

matlab nice figure export

http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig

How to use 'find' to search for files created on a specific date?

Jeromy Anglim wrote a tutorial about this, as late as today. The essence of which is to use -newerXY and ! -newerXY: Example: To find all files modified on the 7th of June, 2006:
$ find . -type f -newermt 2007-06-07 ! -newermt 2007-06-08
To find all files accessed on the 29th of september, 2008:
$ find . -type f -newerat 2008-09-29 ! -newerat 2008-09-30
Or, files which had their permission changed on the same day:
$ find . -type f -newerct 2008-09-29 ! -newerct 2008-09-30
If you don't change permissions on the file, 'c' would normally correspond to the creation date, though.

stackoverflow.com/questions/158044/how-to-use-find-to-search-for-files-created-on-a-specific-date

Tuesday, June 3, 2014

beamer poster - deprecated option

\documentclass[final,hyperref={pdfpagelabels=false}]{beamer}

The "hyperref={pdfpagelabels=false}" is a deprecated option that prevents proper compilation, producing the error:

! Undefined control sequence.
\beamer@frameslide ...duration=}\thispdfpagelabel
                                                  {\insertframenumber } \xde...


remove this option, yielding:

\documentclass[final]{beamer}

Saturday, May 31, 2014

ITK Configuring and Building for Ubuntu Linux

http://www.itk.org/Wiki/ITK_Configuring_and_Building_for_Ubuntu_Linux

Monday, March 17, 2014

Generating high-quality portable PDF files

ps2pdf -sPAPERSIZE=a4  -dCompatibilityLevel=1.3  \
 -dEmbedAllFonts=true  -dSubsetFonts=true  -dMaxSubsetPct=100  \
 -dAutoFilterColorImages=false  -dColorImageFilter=/FlateEncode  \
 -dAutoFilterGrayImages=false  -dGrayImageFilter=/FlateEncode  \
 -dAutoFilterMonoImages=false  -dMonoImageFilter=/CCITTFaxEncode  \
 document.ps  document.pdf
 
See: http://www.volkerschatz.com/tex/hiqpdf.html 

Friday, March 14, 2014

Sudo a shell script

$ sudo /full_path/script.sh

Saturday, March 8, 2014

Common Errors in Technical Writing

See:

http://www.ece.ucdavis.edu/~jowens/commonerrors.html

Wednesday, February 26, 2014

How to Make Your Computer’s Browser Use Less Data When Tethering

See:
http://www.howtogeek.com/138658/how-to-make-your-computers-browser-use-less-data-while-tethering/

Thursday, February 13, 2014

Transferring files over SSH

Generally, if you want to download, it will go:
scp user@remote_host:remote_file local_file
where local_file might actually be a directory to put the file you're copying in. To upload, it's the opposite:
scp local_file user@remote_host:remote_file
If you want to copy a whole directory, you will need -r. Think of scp as like cp, except you can specify a file with user@remote_host:file as well as just local files.
Edit: As noted in a comment, if the usernames on the local and remote hosts are the same, then the user can be omitted when specifying a remote file.

Source: http://stackoverflow.com/questions/343711/transferring-files-over-ssh

Friday, February 7, 2014

Single-columned Table or Figure after two-columned Text

Use * suffix for the floating element.

 ex:

text text ...................
text text ...................
\begin{table*}[htb]
\caption{}
\begin{tabular}{C{2cm} C{2cm} C{2cm} C{2cm} C{2.1cm} C{2.4cm}}
..........
..........
\end{tabular}
\end{table*
}


 Source: http://www.latex-community.org/forum/viewtopic.php?f=35&t=22525

Thursday, January 9, 2014

Title page with the LaTeX article class

Use the titlepage class option.
\documentclass[titlepage]{article}

\usepackage{lipsum}

\begin{document}

\title{(title)}
\author{(author)}
\maketitle

\begin{abstract}
\lipsum[1]
\end{abstract}

\lipsum[1]

\end{document}
 
http://tex.stackexchange.com/questions/36929/how-can-i-get-a-title-page-with-the-latex-article-class 

Thursday, January 2, 2014

One bibliography from multiple .bib files

The correct way to load multiple bib files is to use

\bibliography{file1,file2}
 
Note the lack of space between the comma and the files!

Src: http://tex.stackexchange.com/questions/84099/bibliographies-from-multiple-bib-files