Wednesday, October 20, 2010

Getting R sweave to work

-- remove the one installed by aptitude and install the one from:
http://www.michaels-website.de/gedit-latex-plugin/


then run:
sudo aptitude install lacheck latex-beamer latex-xcolor pgf prosper ps2eps python-enchant python-poppler rubber texlive

yes, yes, most of these should already be installed but making sure doesn't hurt anything.

Now the gedit plug in works.


Some background:
http://en.wikipedia.org/wiki/Sweave

http://www.statistik.lmu.de/~leisch/Sweave/

http://personal.bgsu.edu/~mrizzo/Rmisc/Sweave/SweaveEx1a.htm

warzone 2100

So after installing warzone2100 on ubuntu I ran into the typical problem where it doesn't see the screen size correctly since I use two monitors and it is totally screwed.

So, by running I got myself a good window to play the game in (and it saves the settings so next time the menu works fine)
warzone2100 --window  --resolution=1024x768

Sweave with Gedit

So, apparently the new cool way to include R code with latex files is using Sweave.

Using the latex plugin with Gedit, it should handle the sweave automatically. However there seems to be a few difficulties that need to worked out to get everything working just right.

My goal here is to layout everything that needs to be done in order to make it work.

Basic command:
"R CMD Sweave 'file.Rnw' "

In Gedit, the latex plugin forgets the "CMD", so to make it work, go edit -> preferences -> plugins -> Gedit Latex Plugin 0.2 rc3 -> configure -> tools -> R Sweave to PDF -> "properties"

Now you can try to edit the command.

For me, this did not work, so to make it work right I did the following,
edit the file
~/.gnome2/gedit/plugins/GeditLaTeXPlugin/tools.xml

There should be a section like

<tool description="Process R Sweave file and create a PDF from the resulting LaTeX source" extensions=".Rnw" id="1" label="R Sweave → PDF">
        <job mustSucceed="true" postProcessor="GenericPostProcessor">R CMD Sweave "$shortname.Rnw"</job>
        <job mustSucceed="true" postProcessor="RubberPostProcessor">rubber --inplace --maxerr -1 --short --force --warn all --pdf "$shortname.tex"</job>
        <job mustSucceed="true" postProcessor="GenericPostProcessor">gnome-open "$shortname.pdf"</job>
    </tool>

In the above section I have already added the "CMD" that was otherwise missing. Then save the file and restart Gedit. (As I was using gedit to modify the file.) And, now it still doesn't work.

Ahh, well command line it is for now.

I'll update it when I finally get it to work.

Tuesday, October 19, 2010

Programs to learn Japanese

Here are some tools for learning Japanese:
kanatest (ubuntu install with aptitude)
langdrill (ubuntu -- seems like only command line, as there is no shortcut in the menu)

kdrill (ubuntu install with aptitude)
-> install "kanjidic" First otherwise it can't find the dictionary.

One article:
http://blogaddins.blogspot.com/2008/08/japanese-learning-tools-on-ubuntu.html
lists:
-> kanatest
-> langdrill

http://wakan.manga.cz/?page=download&lang=en
wakan
-> appears to be for windows.

http://www.japanese.ryukent.co.uk/
Tango Blaster






A few general programs for flash card type programs.
http://jewelmirror.com/
pyFlashCards
An Open Source Flash Cards Software

http://sourceforge.net/projects/jmemorize/
jmemorize

Monday, October 18, 2010

Caps lock Indicator

So my wireless keyboard (mk300 - has mouse too) does not have indicators for: caps lock, num lock, and scroll lock. Actually it doesn't even have a scroll lock key. But that is not important right now.

Anyway as there is no software for ubuntu from logitech like for windows which tells you when one of them is turned on and off.

So I found a replacement:

Indicator-Keylock

A webpage which talks about it:
http://www.omgubuntu.co.uk/2010/09/indicator-keylock-ubuntu/

sadly the person is using apt-get. (You should never use apt-get) Instead, you should always use "aptitude". There are a number of reasons like clean removals but that isn't too important.


sudo add-apt-repository ppa:tsbarnes/indicator-keylock
aptitude search indicator-keylock
sudo aptitude update
sudo aptitude install indicator-keylock
sudo aptitude install indicator-keylock-ubuntu-mono

seemed like I had to then run "indicator-keylock"

Then after restarted it started up on its own. So all seems good.

The indicator has caps-lock up all the time. And otherwise by clicking on it, you can see the rest. Turning one on or off displays an indicator on the screen.

As a replacement as keyboard lights, I like it.

Saturday, October 16, 2010

Setting up Ubuntu 10.04

I am a researcher, but the basic install of Ubuntu doesn't provide everything to be productive in research. This leads me to writing a post about what things I needed to install and how.

I always use aptitude as it is preferred over apt-get. You should use it too.

First: activate the nonfree graphics drivers to activate acceleration. This will be important for running compiz and make the desktop user friendly.

Next: stupid issue. As far as I can tell they removed the ability to always show the path in the file manager. This is beyond stupid. I can read the path much faster than the buttons that show up, so see the path with
"ctrl + L"
This is temporary measure. When I have time I will try to find how to what happened to the option. This is definitely a big minus for linux. This is exactly like the M-crap trying to be user friendly without options. A rule for linux programmers: People use linux because it provides options, if the options arn't there people will stop supporting the community. Everything should have an option just because some programmer doesn't think it will help doesn't mean others don't want it. Options are what make Linux strong.

Enough ranting. Back to how to get everything setup.


Non-work related:
chromium-browser
flashplugin-nonfree

compiz:
compizconfig-settings-manager
compiz-fusion-plugins-extra

setup compiz:
desktop wall -> bindings within wall (will work anywhere)
move left <- ctrl + alt + button 4 (mouse wheel up)
move right <- ctrl + alt + button 5 (mouse wheel down)

viewport switcher:
desktop-based viewport switching (these only work when mouse is over desktop)
move next - button 5
move prev - button 4


Now I have google chrome and flash.

First is Latex. Install the package "texlive_latex_base" and this will get everything ready to setup Latex documents.

R - satistical software.
"r-base" - this installs a lot, like g++ and many other useful programing tools. After installing R, I don't need to worry about c tools as they will already be there.
Packages:
-> caTools - provides write.gif
-> to add others later when I get the list together

How about editors? (I want something to edit both R code and latex and some other c/java/others on the side)

gedit - best
plugins stored in "~/.gnome2/gedit/plugins"
-> rGedit - for R
rgedit.sourceforge.net
install the files into the plugins folder, activate, and good to go.
I setup the extra plugins: comment code, and snippets (super powerful)

-> gedit-latex-plugin - for latex (so far excellent)
http://www.michaels-website.de/gedit-latex-plugin/


Others:

geany -- pretty good (I am not currently using it but it is my backup editor)
-> options file stored in "~/.config/geany/geany.conf"
->-> user based and easy. Huge bonus.
-> "ctrl + E" for comment



Scite -- equivalent to notepad++ which is my favorite in windows.
-> need to modify the global options file to work with R
-> /usr/share/scite/SciTEGlobal.properties    remove "#" on the line for #import r
->-> requires root to modify so minus many points. And it doesn't accept "import r " on any other options file. This pretty much breaks usefulness for me. They fail the easy to setup.
->Plus you have to specify use monospaced font "ctrl + F11" (not default)
->-> who would ever program without using a monospaced font???
->->-> fails the test of wanting to use for too many reasons


Others in order I would be willing to try:
Eclipse -- it is very popular but seems like over loaded. I prefer simiple
rkward (bad since it is based on kde. Not my preference)


Graphics:
gimp
gimp-gutenprint
gimp-gap
gimp-ufraw and gimp-dcraw conflict so pick one

Version control:
tortoisehg - (installs mercurial)
tortoisehg-nautilus
-> run: "nautilus --quit" to get the icons working

compressing:
p7zip
p7zip-full
p7zip-rar

Communication:
skype
-> add the canonical repository under other software

Interesting games:
-> neverputt
-> neverball (both of these are a bit annoying but sometimes so is work)

Others to look into getting working again:
libsensors

Installing Ubuntu 10.04

After starting with Ubuntu 8.?? a few years ago, I had setup everything the way I wanted it over an extended period of time. Then, I upgraded to Ubuntu 9.?? using the upgrade method within Ubuntu. That is when the problems started. Simple things like starting the computer became troublesome, because some program would hang and make it impossible to make it to the desktop without killing the window manager and forcing it to restart.

Recently I decided to start over and install Ubuntu 10.04 on a separate hard drive and see how well I could setup everything again.

The install procedure:
1) create a usb drive bootable with the image of Ubuntu 10.04
2) disconnect all other hard drives except for the one I wanted to install Ubuntu 10.04 on. This is important as the installer does not make it easy to tell it which drive is the one I am booting from, and I find that using the startup selector in bios is much easier than trying to configure a boot loader. (As a side note I have successfully had 3 separate operating systems on separate hard drives and never once had difficulties picking which one to start up. However, the one time I tried to configure a boot loader, I had spent days trying it to work correctly. So, for me this is easier.)
3) Using the live image, I used shred on the hard disk. Shred is a utility that makes it impossible to recover previous data that may have been on the drive.

sudo shred -v -zn2 /dev/sda

That will write random numbers twice and finish by writing zeros. The zeros are supposed to cover up using shred, but I saw that the device id was also being rewritten by zero's so it becomes pretty clear that the drive had shred used on it. So I decided that finishing with random numbers may in fact be better. Use something like

sudo shred -v -n2 /dev/sda

(Note if using sudo is annoying we can always use
sudo -i
Just make sure to exit before closing the console. It appears that not exiting first may make it possible to access root.)

4) install using the usb. Choose install instead of preview/test. Choosing standard partitions resulted in no choice to modify what the default is as could be done in previous installs. The advanced option did allow for custom but it did not provide any help in getting started. Previously it would give you a good starting point to work from if you wanted to change some options.

In short, I am a bit disappointed in the changes made to the installer. Although, it worked correctly without errors so that is a huge plus and I am willing to accept a few lost features to avoid having lots of problems. As it did provide an advanced option, I will accept that they do allow for customization. So, I really don't mind the way it turned out.

Installation complete....
And, everything works. Well, not everything. I need to install a number of programs to get back to where I can do work.

Installing basic programs to be productive, in the next post.