Friday, December 10, 2010

Watching All Files in Mediawiki

As per the discussion here, the change discussed at the Mediawiki site should be able to provide the functionality of notification on each file change. I verified that this change works.

Tuesday, December 7, 2010

Logging into Ubuntu from another Ubuntu Machine and View Remote Display

Lets call the machine on which we want the display to be shown as client machine, and the machine from which the display will be shown as the server machine. 
SSH supports X forwarding. To enable X forwarding on the server, first install ssh using 

sudo apt-get install ssh
Then, edit /etc/ssh/ssh_config to set 

ForwardX11 yes
On the client, you need to start a new X server by running: 

sudo xinit -- :2
Then on the client, run 
ssh -X server -l user 
After logging in onto server via ssh, do "echo $DISPLAY". This variable should have been set by ssh. Then run "gnome-session" on the server. You can now see it displayed onto your client. 
Do "Ctrl+Alt+F7" to go back to the X server working with your client, and "Ctrl+Alt+F8/F9" to toggle to the display received from the server.
After logging into the server, you might get errors like: 
/usr/bin/xauth: error in locking authority file /home/user/.Xauthority.
The following resolved the issue for me: 

xauth -b quit

Friday, November 26, 2010

Monday, November 8, 2010

Freesshd for using SCP to a Windows Machine

To install Freesshd, run the install using admin privileges, else you will repeatedly get less-privilege-related errors.

In your windows firewall, check that Freesshd service is allowed.

Open Freesshd and check that login is allowed for the user you want to use ssh with.

Saturday, November 6, 2010

Hudson on Ubuntu

http://wiki.hudson-ci.org/display/HUDSON/Installing+Hudson+on+Ubuntu

Worked fine for me, except that Hudson has a dependency on Java. For installing Java I followed:

http://www.cyberciti.biz/faq/howto-ubuntu-linux-install-configure-jdk-jre/

Monday, November 1, 2010

Turning off annoying beep on Suse Linux

This does not work.
First thing was to turn off the annoying beep. Followed the instructions at http://www.cyberciti.biz/faq/how-to-linux-disable-or-turn-off-beep-sound-for-terminal/ 

Open you ~/.inputrc file (i.e. /home/you/.inputrc file
$ cd
$ vi .inputrc
Append following line:

set bell-style none
Save and close the file.
After this I needed to reboot for the beep to go off (most likely logoff and then login would be sufficient). 

Mediawiki Migration to Ubuntu

Install Mysql-server, php5, apache2 on Ubuntu.

From:

http://sujithemmanuel.blogspot.com/2007/04/how-to-migrate-mediawiki.html

MediaWiki Migration
Old Server: mysqldump -u root -p wikidb > wikidb.sql
tar -cvf wiki.tar wiki ;this is the wiki folder on document root
New Server, login into mysql and run: create database wikidb
(Note that both mysql versions should be same.)
grant create, select, insert, update, delete, lock tables on wikidb.* to wiki@localhost identified by 'YourPassword' ;

MediaWiki Upgrade copy all the new files to wiki folder and then
run php update.php from maintenance folder after updating AdminSettings.php

If you're using SMTP, run "pear install MAIL Net_SMTP"
Place mediawiki content under /var/www. Start apache2 server.

Thursday, October 28, 2010

Connecting to Thecus N4100+ NAS Server

The Thecus Server is used as a backup storage. Our task was simple: to copy over some files from our PC to the backup storage on Thecus. However the Thecus User Manual did not help us: we followed the steps according to the manual to open the auto-discovery dialog on the PC, but the server machine could not be detected on the network (in retrospect this seems to be because the server was in a different network).

Finally what worked:
  • We connected the server via a ethernet cable directly with the PC.
  • We set the ip of the PC to 192.168.1.111, so that it is in the same network as the Thecus server.
  • At this point we could access the login dialog by opening 192.168.1.100 on a browser on the PC. We reset the Admin password by pressing "Reset" button for 10 secs just after powering Off and then On the server.
  • Entered "admin" as username and password to login. But this won't work for multiple attempts. We pressed Ctrl+F5 on the browser on the PC to stop using the cached data on the browser. Only after this the login worked.

Tuesday, September 28, 2010

Settings on a New Ubuntu Box

I install the following packages:

General
Dropbox
Vim
Wicd for networking
Google Chrome browser - sync
Mendeley Desktop
autofsck (for disk check at shutdown, not startup)
Wicd Network Manager

For Development
KDevelop -- for this on Ubuntu 10.04
g++
sun-java6-jdk
netbeans
eclipse
ant, cmake
doxygen, graphviz (needed for doxygen)

My Bashrc
alias rm='mv --target-directory ~/.Trash' # safe erase
alias gnome-terminal='xterm' # or the other way around







alias make="make -j 2"
alias vim="gvim"



Other changes:
In vimrc
gdbinit

Monday, September 27, 2010

Installing KDevelop4 on Ubuntu 10.04

Follow http://www.kubuntu.org/news/kdevelop-4. It worked fine for me. After this, I installed the vim plugin, ooh la la.

Sunday, September 26, 2010

Backup of Hudson Config for Building Crackpot

Some time before I set up Hudson for continuous integration of Crackpot. Here I want to back up all the configurations for ready reference (physical backup of Hudson home dir is already set).
  • Dependencies for Building
  • Config for Building Crackpot
  • Hudson Settings
  • Setting Hudson as a Service
Dependencies for Building
  • Visual Studio for devenv
  • cmake
  • cygwin to execute shell
Config for Building Crackpot

Under Build > Execute Shell, put:

  # define build and installation directories
   BUILD_DIR=$WORKSPACE/crackpot_root_dir/build
   SOURCE_DIR=$WORKSPACE/crackpot_root_dir

   # we want to have a clean build
   cd "$BUILD_DIR"

   # initializing the build system
   cmake  -G "Visual Studio 9 2008" "$SOURCE_DIR"

   # fire-up the compiler
   # NOTE: put denenv in system path
   devenv.com Crackpot.sln /clean Debug /project ALL_BUILD
   devenv.com Crackpot.sln /build Debug /project ALL_BUILD
   devenv.com Crackpot.sln /build Debug /project RUN_TESTS

  # define source directories
   SOURCE_DIR=$WORKSPACE/crackpot_root_dir

   # we want to have a clean build
   cd "$SOURCE_DIR"

   doxygen

Hudson Settings

Environment Variables: 

key: PATH
value: %PATH%;C:\Program Files\CMake 2.6\bin;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE;C:\Windows\System32;C:\Program Files\doxygen\bin

Shell executable:

C:\cygwin\bin\sh.exe

Setting Hudson as a Service

There was some issue with using the Hudson built-in way to set as service. I followed this and this

Tuesday, September 14, 2010

Process Getting Killed Using Ubuntu 10.04 as VMWare Guest OS

I installed our memory-intensive software on Ubuntu running on VMWare. This process was getting killed quite quickly after start. After some internet search, I understood that this is due to the OOM-killer in the kernel. To disable to OOM-killer, I added to my /etc/sysctl.conf:

vm.oom-kill = 0 
 
I got this and a lot of other useful information related to oom-killer from this forum. But most of what is said there regarding oom-killer configurations does not apply to Ubuntu 10.04.

Wednesday, September 1, 2010

Using SVN Externals to work with Multiple Repositories

I am writing a library called HSL. This library will be a third-party library in Crackpot and used for encoding heuristics. In order to work with Crackpot code along with HSL, I will be using the "svn externals" mechanism.

http://svnbook.red-bean.com/en/1.5/svn.advanced.externals.html

Why not simply have a copy of the external library in local repository? The primary benefit is that changes made to the local copy can be committed to the external repository.


Mechanism:

~/tmp/co$ svn propedit svn:externals .
No changes to property 'svn:externals' on '.'
~/tmp/co$ svn propget svn:externals .
thirdparty/hsl/hsl_alpha_version  -r5 https://heuristic-selection-library.googlecode.com/svn/trunk

~/tmp/co$ tree
.
`-- thirdparty
    `-- hsl
        `-- hsl_alpha_version
            `hsl



Problems:



Monday, July 26, 2010

poisson_distribution broken in boost and g++?

I needed to generate samples from poisson distribution in c++. poisson_distribution happens to be a function included in C++0x. When I wrote the code and ran it using g++ 4.4.3 with std=c++0x, the code hung inside the poisson_distribution generator (i,e. operator()). I then converted my code to using boost 1.40 instead of g++. It still hung!

Then I decided to try out the code from MSDN documentation at http://msdn.microsoft.com/en-us/library/bb982217.aspx. This example hangs with both boost and g++!

I set a breakpoint inside the generator code. A product was being accumulated (starting from 1.0) and to be able to break it was checked to be less than a quantity less than 1.  However the product was increasing, not decreasing, soon reaching to inf.

Friday, July 23, 2010

Extracting Libraries from Boost

I needed to use the Boost Spirit Library. I do not want to have to add all boost libraries into my project. To separate out only the dependencies of Spirit, I used the bcp tool:

bcp --boost=./boost_1_43_0/ spirit ./boost-spirit

This worked fine and sent to output to boost-spirit directory.

Friday, July 9, 2010

Latex Notes

Bounding Box / Image
The primary and nasty problem I face with inserting jpg or png images into latex is related to "boundary box" (I do not recall the specific error messages as the last time I inserted a jpg image was long back). I have tried many things before but they have not worked for me. Here I am writing about another way to insert images without headaches, which might work (still untested):
  • Find the image size. On unix, use the imagemagick "identify" command. 
identify a.jpg
a.jpg JPEG 133x100 133x100+0+0 8-bit DirectClass 35KiB 0.000u 0:00.000
  • Use the size to specify the bounding box:
 \includegraphics[bb=0 0 133 100,scale=0.5]{a.jpg}  
Bibliography Style for Website

@misc{stroustrup10,
author = "Bjarne Stroustrup",
title = {C++ Applications},
howpublished = "Website",
year = {2010},
note = {\url{http://www2.research.att.com/~bs/applications.html}. Accessed July 2010.}
}



Font/Itemize Labels


Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst


Header/Footer

Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst

Presentation Effects
 
Tips: http://www.schneeflocke.net/index.php?section=latex/index#latexsrclst

Latex Symbols

http://www.artofproblemsolving.com/Wiki/index.php/LaTeX:Symbols
http://www.ctan.org/tex-archive/info/symbols/comprehensive/symbols-a4.pdf


Building Latex

Rubber: A single-point output builder from latex document: http://www.pps.jussieu.fr/~beffara/soft/rubber/
Comparison with other latex build systems: http://stackoverflow.com/questions/1240037/recommended-build-system-for-latex/


References

Not too short Introduction: http://mirror.math.ku.edu/tex-archive/info/lshort/english/lshort.pdf
Latex in Inkscape: http://jblevins.org/log/latex-in-inkscape

Thursday, July 8, 2010

Recovering Windows Data After Crash

This must be familiar. My lab's Windows Vista crashed suddenly without reason and would not boot up again. Fortunately I had backed up my data (using Windows Backup) on a separate disk drive. I used an Ubuntu Live CD to boot and then I was able to recover data from zipped files from where windows had backed it into zipped files. Perhaps not surprisingly or surprisingly, I was unable to mount and access the disk drive that previously ran Windows.

Saturday, June 26, 2010

Profiling Java Application with Netbeans on Ubuntu

Currently this requires installing the "Java Profiler" plugin from within the IDE > Tools > Plugins. Then follow the same steps as for profiling in Windows.

Profiling Java Application with Netbeans on Windows

For profiling with netbeans, I followed the steps as described in the Netbeans IDE 6.8 under "Profile > Profile Project" and "Profile > Attach Profiler". At first, I created a new ant target as:


<target name="run-prof">

<exec dir="${deploy.dir}" executable="cmd" os="Windows 2003" output="runmaster.output.txt">

<env key="HOME" value="C:code">

</env>

<arg line="/c run.bat">

</arg>

</exec></target>


and then to attach the target to the profiler, I replaced the call to "run.bat" with a call to "run_nbproject.bat" as described under the "Attach Profiler" widget. I also set the filters to include "jboss.*".

Tuesday, June 8, 2010

Using JNI with JBoss

For using JNI with JBoss, it is necessary to put the JNI Java wrapper inside the deployment directory of the JBoss server.

I also used the following settings for JNI to work:
  • set java.library.path to include the path to the .so file 
  • set java.ext.dirs to include the path to the .jnilib file (not sure if this is needed)
I did not set the java.library.path variable directly. I wanted to append to this variable and could not find an easy way. Instead the LD_LIBRARY_PATH variable is appended by the JVM into java.library.path. I exploited this. I included the path to the .so in the LD_LIBARY_PATH.

Monday, May 31, 2010

Installing OpenCV for Java on Ubuntu 10.04

In this article I discuss how I set up OpenCV with Java on my Ubuntu 10.04. Primarily, I followed the process described at http://ubaa.net/shared/processing/opencv/ but with several changes (when I was stuck in the middle due to the old version used in the installation at the site). 

First, I installed OpenCV on Ubuntu using sudo apt-get install libcv-dev

Then, I put the openCV wrapper files known as "Processing OpenCV Library" from (this is the version that worked on my installation):

http://ubaa.net/shared/processing/opencv/download/2.0/beta/opencv-linux_2.0b.tar.gz

in a dir1 and then added to my JVM options java extensions directory as specified on the Processing page: -Djava.ext.dirs=dir1


I also had to install libcvaux-dev to resolve some link errors: sudo apt-get install libcvaux-dev.   

For the Face Detection to work, I had to set the cascade using OpenCV::cascade function before the OpenCV::detect call. After this, the example FaceDetection.java worked for me.

Sometime soon I needed the class file for PImage at run time. For this, I downloaded Processing from http://processing.org/download/processing-1.1.tgz. Then I put the directory containing core.jar (dir2) also in the java extensions setting above. That is,
-Djava.ext.dirs=dir1:dir2

Monday, May 24, 2010

Linux: Commands Used for Deprecating ConditionType etc

I had to rename ConditionType to ConditionType_Deprecated, and similarly for ConditionInstance, ContributionType and ContributionInstance.

I did the following:

find . \( -name "*.h" -or -name "*.cpp" \) | xargs sed -i "s/ConditionInstance/ConditionInstance_Deprecated/g"

But then the header file inclusions were also renamed. To undo these:

find . \( -name "*.h" -or -name "*.cpp" \) | xargs sed -i "s/ConditionInstance_Deprecated\.h/ConditionInstance.h/g"

Neither do we wanted the name changes for the functions with names like getConditionInstance. These had to be undone too.

Sunday, May 23, 2010

draw line arrows in inkscape

Useful information here:

http://zzlinux.blogspot.com/2005/10/draw-line-arrows-in-inkscape.html

In short, you need to select line > fill and stroke > stroke style. 

My gdbinit file

set print pretty on
set print object on
set print static-members on
set print vtbl on
set print demangle on
set demangle-style gnu-v3

python
import sys
sys.path.insert(0, '/home/amit/downloads/gdb_printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end
#source ~/bin/gdbinit_stl
#source ~/bin/gdbinit_boost

Ubuntu Update to 10.04

Every time I upgrade the Ubuntu version, I am faced with one or more issues. This time the audio and video worked fine and the desktop looks are much improved. The bootup is much faster. There is a new chat interface integrated with the desktop, which is cool, as is Ubuntu One.

However I faced the following issues. I upgraded on my desktop computer as well as my laptop -- so the list of issues is a merged list of the issues with both the laptop and the desktop.

1. gcc compile output messages miss the names of the variables after the upgrade. After a lot of failed google searches, I set LANG="" as described here. This set the problem right. 
2. There were problems with the windows borders missing. I read on the net this was due to compiz not starting. I added compiz into "Startup Applications" and rebooted for this to work. 
3. Installing KDevelop was a pain as the package has been removed from the repository. I followed this.

This has been the list in 3 days after the update. I will update this list as I find new problems.

Wednesday, May 19, 2010

UML Reverse Engineering Tools for C++ on Linux

I am looking for a UML tool for Ubuntu. It should be able to import C++ code.

I heard good reviews about Umbrello on the net. I installed Umbrello on my Ubuntu laptop. However at the time of writing, it is too slow/hangs with a high CPU usage. Due to lack of time, I won't be able to reopen a closed bug in this regard.

I have previously used ArgoUML, which I tried again. But its C++ import feature is not fully implemented.

UMLGraph takes a specification of classes to generate UML diagrams. In this aspect, UMLGraph is like Graphviz, but Graphviz is a more general diagramming tool. UMLGraph is good for java syntax.

StarUML (Wine) had issues with functioning mainly because it was running on wine.

BOUML provides C++ import and code generation. It allows users to place various components into the diagram manually. Then, for example in a class diagram, I can select the classes I want and view them. Thanks to the creator Bruno Pagès for his comments. 

Friday, May 14, 2010

find + xargs problem with whitespaces

Problem with spaces in filenames? Use null character for the output of find:

find /tmp/space* -print0 | xargs -0 grep "hello"

Sunday, March 21, 2010

Hostname in Ubuntu

"ping myhostname" was not working on my Ubuntu machine. I found on the net, for example here that I need to perform the following to get it working:

sudo aptitude install winbind

Then edit /etc/nsswitch.conf by type in "sudo gedit /etc/nsswitch.conf" without the "quote" in the terminal and add wins to the hosts line in the position shown
here:
Code:

hosts: files mdns4_minimal [NOTFOUND=return] wins dns mdns4
I did it but the problem did not go away. Later I found elsewhere on the net that /etc/hosts needs an entry 127.0.1.1 myhostname for the name resolution to work.

Sunday, March 14, 2010

Mediawiki Templates

The equivalent of latex newcommand is templates in mediawiki. To use a new template:

Create a new page named "Template:Concept" for example. On the page, write:

'''{{{1}}}'''

Then on any other page, wherever {{concept|foo}} occurs, it will be replaced by foo in bold.

Tabs in Vim

Vim tabs:

  • :tabe (new tab opens)
  • gt (next tab)
  • gf (open the file under cursor in a new tab)

Vim Regex Simplification

\v can be used to simplify the regex. For example to search for {foo} one can use \v\{(\w+)\}.


Source: http://briancarper.net/blog/vim-regexes-are-awesome

Sunday, January 24, 2010

Using Pidgin Messenger on Ubuntu

Pidgin can work well with XMPP (Google Talk), Yahoo IM, IRC, etc.

Security

I understand that the login connection with Google Talk and Yahoo are SSL encrypted. However the conversations on Yahoo are not encrypted. On Gtalk the conversations are encrypted. Read more here.

Caveats


To use Google Talk with a custom domain, one must use talk.google.com as the "Connect Server" (Add Account > Advanced).

To disable the "drive-me-nuts" notifications whenever a user signs-in, configure the "Libnotify Plugin".

Tuesday, January 5, 2010

Setting up https + lighttpd

I used the method described here. Actually it turned out to be a little simpler than setting up SSL with Apache.