|
I have been trying to find a way to replace symbolic links with the files that they are pointed to. It turns out the solution required a little script:
#!/bin/bash
echo Processing $1
dir=$(dirname "$1")
reltarget=$(readlink "$1")
if [[ $reltarget == /* ]]; then
abstarget=$reltarget
else
abstarget=$dir/$reltarget
fi
rm -fv "$1"
cp -afv "$abstarget" "$1" || {
# on failure, restore the symlink
rm -rfv "$1"
ln -sfv "$reltarget" "$1"
}Replace a link with its target by using the script like this: ReplaceSymLink.sh file1 or in combination with the find command like this: find -type l -exec ReplaceSymLink.sh {} \;(assuming that you have placed the script somewhere that is in your executable search path) Add new comment
Last Updated (Saturday, 28 January 2012 00:54) Unfortunately, my experience with dual-monitors in Linux has continually been filled with frustration. I have a relatively simple setup: my laptop, a monitor at work, and a monitor at home. The possible configurations are:
I have not had any luck getting reliable behavior out of Linux:
After all these problems, I discovered xrandr, a command-line tool for changing and enforcing a display configuration. The possibilities are useful: ie, running a script to change configurations. Or running a command at startup to change configurations. Typing "xrandr" will output your current display configuration. I can set the configuration all at once like this: xrandr --output LVDS1 --auto --output VGA1 --auto --righ-of LVDS1 Or do incremental changes like this: xrandr --output VGA1 --right-of LVDS1 xrandr --output VGA1 --rotate left I just installed XFCE so I will give it a few days before I make my verdict, and having xrandr will be a big help. It could probably be used in KDE too, though. There is also a gui: "grandr" Last Updated (Saturday, 14 January 2012 14:14) Adding a nomenclature section to a LaTeX document is very easy. It can be used for math nomenclature, abbreviations, or symbols. First, call the package in your preamble: \usepackage{nomencl}
\makeindexThen add the \printnomenclature statement wherever you want to nomenclature list to appear. I also changed the default title and added a line to the table of contents with yet another title: \renewcommand{\nomname}{LIST OF SYMBOLS, NOMENCLATURE, OR ABBREVIATIONS}
\printnomenclature
\addcontentsline{toc}{chapter}{LIST OF SYMBOLS}Now you can add individual nomenclature definitions in your document. They should look like this: This is found by rotating the body coordinate system around $\hat{\vect{y}}_B$ through an angle $\alpha$\nomenclature{$\alpha$}{Angle of attack}. The result is...
\begin{align}
\express{\vect{a}}{B} &= \matr{R}_1(\phi) \matr{R}_2(\theta) \matr{R}_3(\psi) \express{\vect{a}}{E} \label{eq:2:RBE1}
\end{align}
\nomenclature{$\vect{a}$}{A generic vector}
\nomenclature{$\express{\vect{a}}{B}$}{A vector expressed in $\rframe{B}$}Compiling your document changes slightly: latex filename.tex makeindex filename.nlo -s nomencl.ist -o filename.nls latex filename.tex Last Updated (Thursday, 12 January 2012 19:24) First, the Beamer user guid is the first place you should turn to for help. Like every user guide for latex packages, it is well-written and complete. Beamer has some built in themes. They are split into themes in general (dealing with slide format) and color themes. You can mix and match slide formats with color themes. A good matrix of the possibilities is here. Changing themes is as easy and changing these two lines: \usetheme{Madrid}
\usecolortheme{default}This is the combination I am currently using and seems to be very nice. There are many options you can manually set in the beamer package. For example, you can customize the bullets by adding these lines before \begin{document} \setbeamertemplate{itemize item}{\textbullet}
\setbeamertemplate{itemize subitem}{\textbullet}
\setbeamertemplate{itemize subsubitem}{\textbullet}Beamer also has the impressive ability to embed a speaker's notes into a presentation, then display the presentation on one screen (probably the projector) and the notes on a second screen (probably your laptop). This can be enabled by adding these lines to your document: \usepackage{pgfpages} % for multiple-screen presentations
\setbeameroption{second mode text on second screen}
% \setbeameroption{second mode text on second screen=left} % might not let animations workIt's easy to add a text box to beamer with colors that match the theme, a title bar, and a shadow. The syntax is: \begin{block}{Block Title}
line 1
line 2
\end{block}Last Updated (Thursday, 12 January 2012 01:35) I stumbled across this bit of code and it was too good not to write down. Do you want to know the value of "\textwidth", for example? You just have to type in \the\textwidth in your document. The problem is it will return points. So how can we convert from points to cm? The answer: by using the fp package and this bit of code: \newlength{\TOarg} \newlength{\TOunit}
{\catcode`p=12 \catcode`t=12 \gdef\TOnum#1pt{#1}}
\newcommand\TOop[2]{\setlength{\TOarg}{#2}%
\FPdiv\TOres{\expandafter\TOnum\the\TOarg}{\expandafter\TOnum\the\TOunit}%
\FPround\TOres\TOres{#1}}
\newcommand{\TOspace}{\ }
\newcommand\TOpt[2][2]{\setlength{\TOunit}{1pt}\TOop{#1}{#2}\TOres\TOspace pt}
\newcommand\TOin[2][2]{\setlength{\TOunit}{1in}\TOop{#1}{#2}\TOres\TOspace in}
\newcommand\TOcm[2][2]{\setlength{\TOunit}{1cm}\TOop{#1}{#2}\TOres\TOspace cm}
\newcommand\TOmm[2][2]{\setlength{\TOunit}{1mm}\TOop{#1}{#2}\TOres\TOspace mm}
\newcommand\TOem[2][2]{\setlength{\TOunit}{1em}\TOop{#1}{#2}\TOres\TOspace em}This provides several commands, like The width of this document is \TOpt[0]{\textwidth}, that is, \TOcm{\textwidth}, whereas the height is \TOcm[3]{\textheight}, i.e. \TOin{\textheight}. Here we have some equivalences between different units:
\begin{center}
\renewcommand{\arraystretch}{1.5}
\begin{tabular}{r*{4}{@{\ =\ }r}}
1pt & \TOpt[0]{1pt} & \TOin[3]{1pt} & \TOcm{1pt} & \TOmm{1pt} \\
1in & \TOpt{1in} & \TOin[0]{1in} & \TOcm{1in} & \TOmm[1]{1in} \\
1cm & \TOpt{1cm} & \TOin[3]{1cm} & \TOcm[0]{1cm} & \TOmm[0]{1cm} \\
1mm & \TOpt{1mm} & \TOin[3]{1mm} & \TOcm{1mm} & \TOmm[0]{1mm}
\end{tabular}
\end{center}where the optional [3] argument specifies the number of decimal places to print. Very handy! I had a tricky time adding my BibTeX bibliography in Beamer. At first, I got an error about having to do with "\newblock" It turns out that command is not defined in Beamer and must be manually added with this line near the top of your document: \def\newblock{\hskip .11em plus .33em minus .07em}Then, after citing references in the normal manner in the text, the bibliography slide can be created via: \begin{frame}
\bibliographystyle{../setup/mla-good}
\bibliography{my_ref_database}
\end{frame}
A BibTeX reference can possibly be manually added to a slide using the code snippet below, but it will generate an "Undefined control sequence - \end{frame}" error that I haven't figured out how to get around. So far I have not discovered any reliable to way insert a full bibliography (like above) AND insert individual, full references in random slides. So I ended up typing out the few references I needed to insert in the middle of my presentation, rather than continue with the error this code generated. \nobibliography*
\begin{itemize}
\item \bibentry{Collar1948}
\end{itemize}
Last Updated (Tuesday, 10 January 2012 04:49) It's useful to see what IP addresses are used up on your network sometimes. This can easily be done with fping. An example looks like: sudo fping -s -g 192.168.2.100 192.168.2.130 -r 1 Install it first, if necessary: sudo apt-get install fping Last Updated (Monday, 09 January 2012 02:26) I've been getting the following errors whenever I try to update my package manager in Linux Mint 12: : GPG error: http://archive.canonical.com oneiric Release: The following signatures were invalid: BADSIG 40976Eom> W: GPG error: http://archive.ubuntu.com oneiric Release: The following signatures were invalid: BADSIG 40976EAF4 W: GPG error: http://deb.opera.com stable Release: The following signatures were invalid: BADSIG A2019EA84E7532C.com> This fix was found here:
sudo -i apt-get clean cd /var/lib/apt mv lists lists.old mkdir -p lists/partial apt-get clean apt-get update It worked perfectly on the first try!
Last Updated (Saturday, 07 January 2012 03:10) Installation was easy in Linux Mint 12: sudo apt-get install kde-full This gave me KDE 4.7.3. Upon reboot, I selected KDE from the drop down menu containing all the desktop manager choices like Gnome, etc. First thing I noticed: heavy CPU usage by the process virtouso-t. Turns out it is the Nepomuk program which needs to index my computer. I quickly disabled after looking into it and deciding I didn't want to use it. Then I found I needed to set up my keyboard shortcuts again. The windows key (META key) does not bring up the menu launcher. Keyboard shortcuts for things like this are easy to define. Just right click on the menu launcher and select Application Launcher Settings -> Keyboard Shortcut and define a new shortcut. What is harder is defining a custom keyboard shortcut with a custom command. Open the Application Launcher menu and type "khotkeys" and press enter. In the application that opens (titled Custom Shortcuts - KDE Control Module), select Edit on the bottom left, then New -> Global Shortcut -> Command/URL. Add your shortcuts as desired. Applying the Solarized color scheme to Konsole was easy by downloading these color scheme files and placing them in ~/kde/share/apps/konsole. The color of the panels and so worth can be changed by altering the theme. The default view in the Dolphin file manager can be annoying and hard to figure out how to change, but it's actually pretty simple. You can reset the default mode in View->Adjust View Properties. There is a checkbox labelled "Use as default for new folders" - this is actually the option to reset the default view for folders that haven't been visited before or have no specific view settings already applied to them. I had some trouble finding the program to add/edit menu items. Turns out it wasn't in the default menu (!) but I got to it through the command line with "kmenuedit". (Then I added it to the menu). To make Banshee close when I click the close button, I had to edit the preferences and uncheck the option for "Show Banshee in the Sound Menu". Otherwise, you have to pause of stop the media before closing. ---------------------- After a couple days, I'm liking KDE. I have a panel up top for my programs and the menu button, and a panel on the bottom for stuff I don't use much but is nice to look at, like CPU monitor, taskbar, widgets. I like the main panel being at the top since my mouse is already in the top 1/4 of the screen a lot when I'm using programs, it's not hard to get to the panel to switch to a different program. I like the customizability of KDE and it seems like it was meant for experienced users, not newbies. That means that instead of make everything super simple and foolproof, everything is super customizable and controllable. And everything is very polished too, it looks very nice. Another thing that's it's handled very well is my ever-changing dual-monitor setup. I take my laptop from work (where I have a docking station + ext monitor) and home, and it handles either situation very well. Overall, I'm a fan. Last Updated (Tuesday, 10 January 2012 14:17) Animating a series of gifs is easy with gifsicle. A typical command looks like: gifsicle --delay=10 --loop frame*.gif > outputanimation.gif Last Updated (Wednesday, 04 January 2012 03:19) |
Designed by i-cons, modified by Judson.