Friday, September 13, 2013

Changing ulimit of open files

I wanted to increase the limit on the number of open files, as needed to install a particular new application.

The output of `ulimit -n` was 1024. I had expected that `ulimit -n 2048` command would set the value. Instead, I got the error `bash: ulimit: open files: cannot modify limit: Operation not permitted`.

I tried increasing the ulimit as root: `sudo su -`, and then `ulimit -n 2048`. While this set the limit for root, it did no change for the non-root user.

I also added the following lines to `/etc/security/limits.conf`:
`  soft nofile 2048`
`  soft nofile 4096`

I understand that the above is needed to make the change to ulimit persistent.

Finally, what did work to allow ulimit set as root to be set as non-root user, is appending line `session required pam_limits.so` in the file `/etc/pam.d/common-session`.

Saturday, December 29, 2012

Find CPU, RAM Size, Cache Size, etc., on Ubuntu Linux

cat /proc/cpuinfo to get the CPU info.
cat /proc/meminfo to get the RAM info.
lscpu to get the L1, L2 cache size.

Tuesday, August 21, 2012

Expected Primary Expression Before '>'

Using gcc 4.x, the above error may be encountered in template code. This discussion is useful for the case. 

Thursday, May 17, 2012

Starting Testing GAE Python App with Webtest

Recently I wanted to write automated tests for my GAE WSGI app (the app is written using web2py, but this detail may or may not be relevant to this post). Behavior-driven design, implemented by, e.g., Lettuce, seems to me as an ideal way to write tests---reasons seem to be well-described in this article by Scott Bellware. In python, Webtest is a good way to test WSGI apps. There are a couple of hurdles:

  • it seems that GAE app.yaml cannot be used to get a WSGI app needed to run Webtest-based tests. One get-around for this hurdle is to use WSGIProxy.
  • another (easier) problem is that Webtest redirects stdout and stderr streams, so the print function cannot be used for debugging. This problem can be circumvented using logging

Friday, May 4, 2012

Managing Multiple .bib Files

I am using latex for multiple papers and to merge the contents into a thesis. I have multiple .bib files, say one for each paper. Unluckily, this does not look like a good situation to be in. There should better be only one .bib file that I should use for all the papers, since then I do not need to worry about duplicates; for example, correction of an entry need not be redone if the entry is duplicated in other bib files.

To extract the subset of the consolidated bib file that a particular paper uses, it is possible to use JabRef.  

Here it is also worth to point out that a situation when a cited reference is missing from the bibliography can be detected using the following (assume "make" calls the latex command, namely: latex doc; bibtex doc; latex doc; latex doc):

make | grep -i "warning--" | less

This at best is a hack, but I could not find a better way till now. In particular, there seems to be no easy way to make missing bibentry as an error.  

Backing Up My Ubuntu Desktop Settings and Files

I am using the method at http://askubuntu.com/a/99171. Will shortly need to move my desktop and then I will update how it went. 

Friday, April 20, 2012

Easy way to install gcc-4.6 on Ubuntu 10.04


sudo apt-add-repository ppa:ubuntu-toolchain-r/test/ubuntu
sudo apt-get update
sudo apt-get install gcc-4.6
sudo apt-get install g++-4.6


From here. The alternative is to download gcc sources and install like this

Thursday, April 19, 2012

svn: making trunk identical to a branch

So, I created a branch, made changes within the branch over a period and periodically kept merging from trunk into the branch. 

Now I want to make the trunk identical to the branch. The best approach for this is as described at http://stackoverflow.com/a/1008805/19501, namely use the three-way merge option:
...you want to merge "FROM trunk@HEAD TO branch@HEAD" with the working copy pointing to trunk. In essence:
"Give me all the changes I'd need to make trunk identical to branch".

Thursday, April 5, 2012

Copy one sparse matrix into another in Python


Copying Xf into features. In this case, Xf is a scipy.sparse.csr_matrix and features is a dok_matrix.

        nz_indices = Xf.nonzero()
        for ix, jx in zip(nz_indices[0], nz_indices[1]):
            features[ix, jx] = Xf[ix, jx]

Notes: 

1. When I checked, the assignment of a 0 to an element of a dok_matrix resulted in a crash. So 0 assignments have to be avoided. 

Tuesday, March 20, 2012

Installing Graphite-Sim

I wanted to use a multi-core simulator for scalability testing of our parallelization. Graphite-sim seems to provide the functionality of simulation. However, there were a series of problems during the installation of Graphite-sim:

When I downloaded and tried to install the 32-bit version on my Ubuntu linux host, the compilation failed. It seems that contrary to the documentation, only the 64-bit version currently works, as can be seen on the forums. I tried to fix the compilation for a few times, but soon it became clear that the code was not fixable by me.


Next, I tried to work out if a 64-bit Debian guest VM can be installed so that the guest can contain Graphite-sim. Indeed this is the way that the Graphite-sim documentation seems to be tested. As per
http://ubuntuforums.org/showthread.php?t=1165598 I ran the command provided to ascertain whether my hardware can support a 64-bit vm. I installed virtualbox-ose package from synaptic.
I downloaded Debian-64 from http://www.debian.org/releases/lenny/debian-installer/ . Initially I tried installing ia64 businesscard version, but the VM would not recognize it as a boot iso. Later Ifound out on one of the forums that amd64 businesscard version should be used.

Next, I installed the debian on the virtualbox, but while doing so, I had to enable "Intel Virtualization Technology" in the BIOS settings to overcome an error "VT-x is enabled but is not operational". Besides, amd64 was not installing on the VMWare virtual machine but could install on Virtualbox.

To summarize, the following steps should work using a Ubuntu Linux host:

  • Install Virtualbox OSE (Open Source Edition). 
  • Enable "Intel Virtualization Technology" in the BIOS settings of the host machine.
  • Download the amd64 (64-bit) businesscard iso.
  • Install the iso as a guest on Virtualbox.
  • Follow up with the instructions at https://github.com/mit-carbon/Graphite/wiki/Getting-Started
and the following would not work (YMMV):
  • Installing on a 32-bit machine
  • Installing ia64 guest on VMware/Virtualbox OSE.
  • Installing amd64 on VMWare player. 
I can see that many of the exact specifications of my configuration are incompletely specified, such as the host hardware, VMWare player version, Virtualbox version, etc. Unluckily I do not have the time to find out and list these here right now.

Monday, March 19, 2012

Latex Issues

I faced an issue while using dvips + ps2pdf to generate pdf from latex. Seems to be this bug (prob in dvips):
http://bugs.ghostscript.com/show_bug.cgi?format=multiple&id=690427

As a getaround, I switched to using dvipdfm.

Wednesday, May 18, 2011

Setting up Git

https://help.ubuntu.com/community/Git

There is a local machine and a server which will act as a Git Server.

On the git server:
sudo apt-get install python-setuptools git-core gitosis

On the local machine:
ssh-keygen -t rsa
scp the public key to Git Server at /tmp/pub-key

On the git server:
sudo -H -u gitosis gitosis-init < /tmp/pub-key

Thursday, March 24, 2011

To get a Static IP Address from a DHCP Server (On Linux)

Thanks to Ivan.


Edit /etc/network/interfaces

Change settings to:

# The loopback network interface
auto lo
iface lo inet loopback

# This is a list of hotpluggable network interfaces.
# They will be activated automatically by the hotplug subsystem.
mapping hotplug
script grep
map eth0

# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.35
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.1.255
gateway 192.168.1.254

Log4J Configuration

After a lot of headaches and retries, the log4j.properties config file that worked for me is this: http://www.benmccann.com/dev-blog/sample-log4j-properties-file/ . Simply placing this under src/main/resources works. I am using standard maven settings. 

Tuesday, February 15, 2011

Problems in Viewing Docx On Ubuntu?

After having a lot of trouble in viewing Docx, I installed odf-converter-integrator from http://katana.oooninja.com/w/odf-converter-integrator/download . This helped a lot although the output was not perfect.

Sunday, January 23, 2011

Changing Timezone on Ubuntu

dpkg-reconfigure tzdata
 
http://webonrails.com/2009/07/15/change-timezone-of-ubuntu-machine-from-command-line/

Saturday, January 22, 2011

Disk Check during Shutdown on Ubuntu (and not during startup)

Just installed autofsck. This goes into the "my base installations" list. 

Friday, January 14, 2011

Juniper VPN on Ubuntu

There are certain issues with Juniper on Ubuntu. The following getaround works well for me though:

http://ubuntuforums.org/showpost.php?p=10346501&postcount=416

Sunday, January 9, 2011

Some Windows Commands

From command prompt, Taskkill /pid to kill a task. 


Tasklist /v to get a list of running tasks. 


netstat -ano to get the list of used network ports and the pid using the port.

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

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.

Monday, December 21, 2009

Debugging Java

On the JVM, start with options:

'-Xdebug -Xrunjdwp:transport=dt_socket,address=41422,server=y,suspend=n'

and then use jdb to connect to the port 41422.

Installing JDK 1.5 on Ubuntu

First download JDK from Sun site (also requires filling up a form). Then follow the steps at:

http://www.debian-administration.org/article/Installing_Sun%27s_Java_environment_on_Debian_systems

In particular one important step is running:

fakeroot make-jpkg jre-1_5_0_03-linux-i586.bin

Tuesday, December 15, 2009

Using Multiple Java versions

For building Katta, I needed to use Java 6 (compilation did not work with Java 1.5). Now I have two java versions installed on my dev laptop. To make use of Java 6, I just needed to set JAVA_HOME and PATH appropriately (export PATH=$JAVA_HOME/bin:$PATH) and then the compilation worked fine.

Thursday, November 26, 2009

My gdbinit file

GDB config file, includes STL Support (works with gdb 7.0):

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

Monday, November 16, 2009

Date output for a distinct filename

On unix,

> date +%Y-%m-%d-%H-%M-%S
2009-11-16-16-33-48

outputfile=/tmp/my-application-output-`date +%Y-%m-%d-%H-%M-%S`.txt

Friday, November 6, 2009

Ubuntu: Upgrade from 9.04 to 9.10

Overall the upgrade was okay. Was not entirely smooth, as 1-2 applications automatically got uninstalled and I had to install them again. Seems Canonical, the company behind Ubuntu, supports not everything I installed. In particular, openerp-server which was difficult to install in the first place, caused some issues with the upgrade and I have to uninstall it. Will install it again later.

Update : I dont know if it is just me or the new Ubuntu has better music drivers. I am using Rhythmbox, and I think the quality of music is better after the upgrade.

Its like falling in love with Ubuntu all over again.

Epiphany: The Fastest Browser on Ubuntu

I accidently landed upon Epiphany recently and I am loving its speed.

Ubuntu: Missing Skype from Panel?

I accidently made some change in my panel, and after that there was no way left to access skype after O minimized it. To correct this, I proceeded as per http://ubuntuforums.org/showthread.php?t=194980 . Just add "Notification Area" in your panel.

The same would work for dropbox and other application that might have recently disappeared from the panel. 

Wednesday, November 4, 2009

Starting an EC2 Instance for Company-wide Development Tasks

I spent quite a bit of time today setting up an EC2 instance that will soon host a private svn and trac. First, I installed "Elasticfox" firefox extension and ec2 tools from Synaptic Package Manager.

Created a generic account (amazon does not allow EC2 instances to be transferred from an account to another, so don't use your personal account to set up an instance for your company) using a generic email, say sales@mycompany.com.

Then go through the process of setting up your AWS account and starting using EC2 (you'll need credit card for this). This process is quite straightforward thanks to the amazon ui (at a few places there are ambiguities though). 

Now next I have to set up svn and trac on the EC2 instance. For the company-wide password management, probably LDAP would also be needed. Seems like an onerous task. Lets see tomorrow.

Tuesday, October 27, 2009

Turning Off the Annoying Windows Beep (on Server 2003)

I followed http://www.howtogeek.com/howto/windows/turn-off-the-annoying-windows-xp-system-beeps/ and yes, while doing it, I had to restart the server!

Monday, October 26, 2009

Installing Hudson as a Service on Vista

Keep in mind the issue discussed at
http://www.mikebosch.com/?p=137

Doxygen Doxyfile Changes I Usually Do (To the Default Generated File)

RECURSIVE = YES
EXTRACT_ALL = YES
REFERENCES_RELATION    = YES
REFERENCED_BY_RELATION = YES

the following for browsing through sources:
SOURCE_BROWSER = YES
INLINE_SOURCES = YES
EXTRACT_PRIVATE = YES
EXTRACT_STATIC = YES
EXTRACT_LOCAL_CLASSES = YES

for collaboration diagrams:
HAVE_DOT =YES

Sunday, October 25, 2009

Mediawiki SMTP Setup On Windows

Mediawiki is surely not fun to work with. There are thousands of configurations needed to set up the basic/essential functionalities like SMTP. To use secure SMTP with gmail SMTP server, I had to install PEAR as per http://articles.sitepoint.com/article/getting-started-with-pear/2 and then run "pear install --alldeps Mail-1.1.14". After this I restarted my web server (apache in my case). So much for SMTP.

Windows sleep command

Poor man's sleep command in windows:

PING 1.0.0.0 /n 1 /w 5000 #sleep 5 sec

Tuesday, October 20, 2009

Installing Secure SVN Server on Windows

I set out to set up a SVN server on Windows with secure authentication.

I started out with setting svn server as per http://www.codinghorror.com/blog/archives/001093.html. Then I followed http://turnleft.inetsolution.com/2007/07/how_to_setup_subversion_apache_1.html.

In the middle I got stuck with htpasswd command as it would not execute, saying "Illegal character :". Something to do with the file path. So I installed cygwin, including openssl (followed http://daveonsoftware.blogspot.com/2007/06/installing-cygwin-with-openssl-package.html). After this the htpasswd command worked fine.

Then, as per http://raibledesigns.com/wiki/Wiki.jsp?page=ApacheSSL I set up apache with ssl.

I tried to start Apache, but won't. In Event Viewer I saw it returned error code 1. As per http://www.issociate.de/board/post/474531/2.2.6_won%27t_start_-_The_Apache2.2_service_terminated_with_service-specific_error_1_%280x1%29..html I debugged httpd.exe using command line. It said "DAV is not allowed here". The following configuration (amendment over the "turnleft" solution above) worked (I have replaced SVNParentPath by SVNPath too):

<location /svn>
DAV svn
SVNPath C:/svn/repository
AuthType Basic
AuthName "Subversion Repository"
AuthUserFile conf/svn-passwd.pass
AuthzSVNAccessFile conf/svn-authz.conf
Require valid-user
</location>

Creating a service under windows

http://www.codinghorror.com/blog/archives/001093.html describes how to create a service under windows:

sc create svnserver binpath= "c:\svn\bin\svnserve.exe --service -r c:\svn\repository" displayname= "Subversion" depend= Tcpip start= auto

sc config binpath = ...

Thursday, October 15, 2009

Latex Figure Numbering Incorrect

As per http://www.terminally-incoherent.com/blog/2007/04/14/latex-fixing-wrong-figure-numbers/, latex figure caption should be put before label, otherwise you will probably get the figure numbers incorrect, as I did.

Tuesday, October 13, 2009

Useful Synchronized Notes

Tomboy Notes is a simple note-taking utility, I first discovered while using Ubuntu Linux. The good thing is, tomboy can also be used together with Dropbox to synchronize notes between computers -- this is quite simple, just set the preferences of Tomboy Notes to sync to a local folder within the local Dropbox directory.

Dropbox

Dropbox is a nifty tool to share files between computers. In a nutshell, anything within a folder is synchronized on to the Dropbox server. The content on the Dropbox server is also available on other computers in which you install Dropbox. By default, it gives 2GB of free space.

Thursday, October 8, 2009

Using Xterm on Ubuntu

gnome-terminal does not have much configurable font size. I started using my old love among terminals called xterm. http://dnh500.blogspot.com/2007/05/use-xterm-in-ubuntu.html is good about how to edit your menu to make xterm readily usable. http://ubuntuforums.org/showthread.php?t=702664 is about configuring xterm.

My simple .Xdefaults file:

! you should run> xrdb < ~/.Xdefaults
xterm*font: -*-lucidatypewriter-medium-r-*-*-12-*-*-*-*-71-iso8859-*
xterm.vt100.background:black
xterm.vt100.foreground:grey

Wednesday, October 7, 2009

VMWare Player with Ubuntu on Windows Vista

Just a short note. This is quite easy: just follow the instructions at http://johnbokma.com/mexit/2005/11/07/vmware-player-ubuntu-installation.html

Probably a more straightforward way is to download from http://www.vmware.com/appliances/

Saturday, October 3, 2009

Trying out Medical on Ubuntu 9.04

Checking out Medical (sourceforge project of the month). Depends on OpenERP. Trying to install OpenERP. But seems to be non-trivial task. OpenERP has problems and can't install with Ubuntu 9.04. Will forget about using Ubuntu for Medical, and try Windows later.

Wednesday, September 30, 2009

Hudson: Memory Leaks and Other Issues

Continuation of earlier post at http://triviaatwork.blogspot.com/2009/09/hudson-too-has-problems-subversion.html


Out of Memory
The memory usage of Hudson build system rose to 800MB or so after I left it to run for a couple of weeks. Some component seems to be causing leaks. There have been earlier complaints about memory leaks in Hudson, for example, http://www.nabble.com/hudson-memory-leak-td23221034.html but not sure whether these issues were confirmed and/or solved. As per Hudson "Memory Leak Document" at http://wiki.hudson-ci.org/display/HUDSON/I%27m+getting+OutOfMemoryError, I have restarted JVM with the suggested option of "-XX:+HeapDumpOnOutOfMemoryError". I am not running Hudson under distributed build. It is possible that some plugin is eating the memory.

Doxygen Plugin
With doxygen plugin I get:

FATAL: error

hudson.AbortException: The directory 'C:\Users\g0700201\.hudson\jobs\\workspace\docs\doxygen_html' doesn't exist.

        at hudson.plugins.doxygen.DoxygenDirectoryParser.retrieveDoxygenDirectoryFromDoxyfile(DoxygenDirectoryParser.java:278)

CCCC Plugin


I dont know how anybody ever got this plugin to work. Will cccc I get:

Parsing cccc results

hudson.AbortException: Parsing file error

        at com.thalesgroup.hudson.plugins.cccc.CccccParser.invoke(CccccParser.java:76)

        at com.thalesgroup.hudson.plugins.cccc.CccccParser.invoke(CccccParser.java:50)

Saturday, September 19, 2009

Using Thunderbird within NUS / Setting up LDAP

One of the difficult-to-use functionalities of Thunderbird (popular with Linux/Ubuntu users) seems to be the LDAP address book. The reasons for this unfriendliness may be diverse (one of them usually is MS likes to define its own standards). I tried setting up the LDAP using several combinations like the below copied from NUS Computer Center site:
  • Choose Add Dir.
  • For ldap-server, enter ldapstf.nus.edu.sg (for staff address book) or ldapstu.nus.edu.sg (for student address book)
  • For search-base, enter DC=stf,DC=nus,DC=edu,Dc=sg (for staff address book) or DC=stf,DC=nus,DC=edu,Dc=sg (for student address book) Set use-implicitly-from-compose and Pine will lookup names you type in the To: line while composing messages in the directory. If there are multiple names that match you will be prompted to select from a list of matching entries.
Believe me I tried a lot of different combinations but I could not succeed (at the time of writing). Finally the following getaround satisfactorily worked for me:

I had setup thunderbird with IMAP. I installed the add-on "Email Address Crawler" https://addons.mozilla.org/en-US/thunderbird/addon/9995 which crawls all mails and reads addresses into the address book. Then I ran the crawler on my Inbox and Sent Mail. This was enough for all the email addresses I usually use.

I also checked the option: "Preferences > Composition > Addressing >  Automatically Add Outgoing Email Addresses to My: ".

Monday, September 14, 2009

Hudson Too Has Problems (Subversion Update Mode)

Check out the updates below as well.

I was wishing that hudson would not have many bugs, as its GUI is quite sleek. But turns out it is not so. I'm facing a curious problem: although I've set to "svn update", hudson always tries to delete the workspace at the end of the build, and always fails. This problem has been reported before here: https://hudson.dev.java.net/issues/show_bug.cgi?id=86&historysort=new.

The bug report says the issue is already fixed, but I am facing the same problem even now. It may be triggered because I am using "local directory" option to check out svn code into a particular subdirectory in the workspace (then it is an another bug).

On a side note: The fix of the above bug report is scary -- just a "/" can cause such a mess -- this probably means the code is not too well written; that's why I'm facing a similar bug.

Update:  Sept 22, 2009
I am quite happy with hudson so far, although I had trouble here and there. In summary I face the following troubles currently:
  1. Hudson deletes the svn checked out code (using CMakebuilder), even when "use svn update" is marked. To work around, I've reverted to clean build, and reduced the frequency of checkout. Update: It turns out the problem was due to CMakebuilder plugin, which cleaned up the directory, not hudson.
  2. I'm not sure how to use Hudson CMakebuilder plugin on windows. To work around, I modified the shell script provided at http://schneide.wordpress.com/2009/04/07/cmake-builder-plugin-for-hudson/. Then Hudson complained that it can't execute sh, so I installed cygwin and appended its bin directory into my PATH environment variable. I don't have time to try cmakebuilder again after installing cygwin, but that might also work fine. I believe that the CMakebuilder plugin has created more problems for me than it solved. It needs to be rewritten. I will try to do it next week. 
  3. I can't install Hudson as a Windows Service through the dashboard. I'm getting AccessDenied error as below, even though the current user has Admin privileges.

    WMI.WmiException: AccessDenied
    at WMI.WmiRoot.BaseHandler.CheckError(ManagementBaseObject result)
       at WMI.WmiRoot.ClassHandler.Invoke(Object proxy, MethodInfo method, Object[] args)
       at WMI.Win32ServicesProxy.Create(String , String , String , ServiceType , ErrorControl , StartMode , Boolean , String[] )
       at winsw.WrapperService.Run(String[] args)
       at winsw.WrapperService.Main(String[] args)

But overall Hudson has worked for me quite well, and with almost no hassle.

Sunday, September 13, 2009

Installing CDash

The cmake guys have the CDash tool for producing test reports. It is difficult to find comprehensive information about the details of installing CDash (on the same lines, it is difficult to find information about using CMake).Here I am dealing with CDash 1.4.2. I did the following:

Warning: Read Conclusion at the end of this post now.


* download Apache and PHP  as described at http://public.kitware.com/Wiki/CDash:Installation. Make sure you enable the PHP modules as listed on the Kitware link.
* configure PHP and Apache as described at "Configuring PHP" and
"Running PHP 5 as an Apache Module" respectively on this page: http://www.thesitewizard.com/php/install-php-5-apache-windows.shtml
* Download CDash and copy to apache htdocs directory (remove the CDash version number if any)
*Create cdash/config.local.php as on the Kitware link.
* Now I tried to open http://localhost/CDash/login.php in my web browser. This returned "Fatal error: Allowed memory size of 134217728 bytes exhausted" at line 180 of config.local.php. Reading this file revealed that the file recursively included itself. So I commented out the lines as follows:

//$localConfig = dirname(__FILE__).'/config.local.php';
//if ( file_exists($localConfig) )
//  {
//  include($localConfig);
//  }

After this change, the url opened file. The only remaining thing now is to set up the database.
* I installed MySQL as at Kitware link. During installation I set an administrator account called 'root'. I use this account to login into MySQL. Then I run:

mysql> create database cdash;
mysql> create user 'cdash'@'localhost' identified by 'passwd';
mysql> grant all privileges on cdash.* to 'cdash'@'localhost' with grant option;

I make the corresponding changes in cdash/config.local.php to set the:

// Hostname of the database server
$CDASH_DB_HOST = 'localhost';
// Login for database access
$CDASH_DB_LOGIN = 'cdash';
// Password for database access
$CDASH_DB_PASS = 'passwd';
// Name of the database
$CDASH_DB_NAME = 'cdash';
// Database type (empty means mysql)
$CDASH_DB_TYPE = 'mysql';

There were errors even now, as I tried to register a new user. Then I tried to open http://localhost/CDash/install.php -- this indicated:

Database Type:mysql
Database Hostname:mysql
Database Login:cdash
Database Name:cdash

Admin Email: __________
Admin Password: ______

This is different from what I wanted -- I wanted the Database hostname to be "localhost". I could not figure out how CDash set it to mysql (I think this is a bug; which does not augur well for CDash. Probably it has a lot of bugs). Anyway, I proceeded with creating an Admin by filling Email and Password. This worked.

There is still some problem with opening http://localhost/CDash/index.php. This just shows some php script -- so the PHP script is probably malformed.

Conclusion: I think it would be too much effort to work with CDash as even installation is so tedious. I'll move to using Hudson for now, which from my limited previous experience was rather user-friendly.

Friday, August 28, 2009

Second Interaction with Tesseract OCR

I had quite some fun during the first interaction with Tesseract. While some of the outputs of the recognizer was good, others were not reasonable at all. I want to debug it -- but the best possible way seems to be their new viewer in java. To make it run, I followed the instructions as given on the above link (the only problem was that they call piccolo-1.2.jar/piccolox-1.2.jar while the downloaded file was named piccolo.jar/piccolox.jar).

After this I tried running
tesseract phototest.tif test1 segdemo inter
as per their instructions, but it would not work. I realized this is because of missing file at /usr/local/share/tessdata. Therefore, I did:

sudo cp -R /tessdata/* /usr/local/share/tessdata/

But this undid the change done previously (in the first installment) for english recognition. Therefore I had to copy the eng data files again:

sudo cp -R /tessdata/eng.* /usr/local/share/tessdata/

After this I ran the viewer on my own image. It worked but it kept on saying

ScrollView: Waiting for server...
ScrollView: Waiting for server...
ScrollView: Waiting for server...
ScrollView: Waiting for server...

Some problem with starting the server. I retried with the image they provide in as instructed on their page and it worked. If it does not work for you (it did fail for me once or twice), make the change as described under "Java problems" on the link above and make, copy the new tesseract binary to /usr/local/bin.

Sometimes I had to manually kill the previous java GUI as it would not allow the GUI to start the next time.

I still have not not been able to run the viewer with my own images. Some catch there.

Thursday, August 27, 2009

Rdesktop woes: Connecting from Linux to Windows Vista

I use rdesktop on Ubuntu to connect to Windows Vista on univ lan. Some time after I connect, the connection hangs. A little search on Ubuntu forums revealed that setting Control Panel > Mouse > styles to (none) can reduce/eliminate the hanging. Even now the connection intermittently freezes, but the frequency is much lesser and the duration of freeze is lesser too.

I also installed "GRDC" Gnome RDC client, which works quite well (as well as windows rdesktop client).

Still in lookout for a better solution to connect to Vista, without the freezes.

Excluding Multiple Directories using Doxygen EXCLUDE tag

After a lot of search I found at http://developer.kde.org/documentation/library/howto.php how one can specify multiple excluded sub-directories in the following format:

EXCLUDE = {directory 1} {directory 2} ...

Doxygen is such a nifty tool. The pleasure would have been additional if the config files contained very simple format examples.

Default Doxyfile for Code Understanding

The most often use-case of doxygen for me is to quickly understand the source code. Several of the configurations within the default-generated doxyfile are different from the way you would like it to be to generate detailed information for understanding the code. Below I paste the diff that can be used to patch the default generated doxyfile to configure it for code understanding. The config below assumes we have installed the "dot" tool (installing dot is a good idea anyway as it is a nifty graph display tool).

28c28
< project_name =" ---"> PROJECT_NAME = project_name
300c300
< extract_all =" NO"> EXTRACT_ALL = YES
305c305
< extract_private =" NO"> EXTRACT_PRIVATE = YES
310c310
< extract_static =" NO"> EXTRACT_STATIC = YES
473c473
< show_directories =" NO"> SHOW_DIRECTORIES = YES
590c590
< recursive =" NO"> RECURSIVE = YES
683c683
< source_browser =" NO"> SOURCE_BROWSER = YES
688c688
< inline_sources =" NO"> INLINE_SOURCES = YES
700c700
< referenced_by_relation =" NO"> REFERENCED_BY_RELATION = YES
706c706
< references_relation =" NO"> REFERENCES_RELATION = YES
738c738
< alphabetical_index =" NO"> ALPHABETICAL_INDEX = YES
977c977
< generate_latex =" YES"> GENERATE_LATEX = NO
1342c1342
< have_dot =" NO"> HAVE_DOT = YES
1390c1390
< uml_look =" NO"> UML_LOOK = YES
1482c1482
< dot_transparent =" NO"> DOT_TRANSPARENT = YES

First Interactions with Tesseract OCR on Ubuntu Linux

I am on Ubuntu 9.04. My primarily goal here is to informally evaluate how Tesseract performs on some documents, including handwritten samples. After downloading, building and installing tesseract as at http://code.google.com/p/tesseract-ocr/w/list I ran tesseract over a jpg file containing the sample text.

$> tesseract text_image.jpg result
Unable to load unicharset file /usr/local/share/tessdata/eng.unicharset

I made the changes as per comment by caitifty on Feb 28, 2009 (sigh, there is no permalink) at http://code.google.com/p/tesseract-ocr/wiki/ReadMe . The change is to replace/add the tessdata directory at /usr/local/share/tessdata . After this, I get

$> tesseract text_image.jpg result
Tesseract Open Source OCR Engine
name_to_image_type:Error:Unrecognized image type:text_image.jpg
IMAGE::read_header:Error:Can't read this image type:text_image.jpg
tesseract:Error:Read of file failed:text_image.jpg
Segmentation fault

It appears that it does not recognize jpg file input. So I use imagemagick's "convert" tool to convert to tif format that tesseract seems to recognize.

$> convert text_image.jpg text_image.tif

and then

$> tesseract text_image.tif result
Tesseract Open Source OCR Engine
Image has 8 * 3 bits per pixel, and size (1000,171)
Resolution=200

$> cat result.txt

The last command produced the recognized text. The results were quite good.

Wednesday, August 19, 2009

Sourceforge: Recovering Wikispaces Dump after Migration to Mediawiki

Are you confused with what they at sourceforge say about the process to recover wikispaces dump? https://sourceforge.net/apps/wordpress/sourceforge/2009/07/29/wikispaces-being-removed-from-sourceforge-net-2009-07-30/

Don't be. It is easy. I did this (as described at https://sourceforge.net/apps/trac/sourceforge/wiki/SFTP):

:~$ sftp {user name},{project name}@frs.sourceforge.net
Connecting to frs.sourceforge.net...
The authenticity of host 'frs.sourceforge.net (216.34.181.57)' can't be established.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'frs.sourceforge.net,216.34.181.57' (RSA) to the list of known hosts.
{user name},{project name}@frs.sourceforge.net's password:
sftp> help
sftp> cd /home/groups/c/cr/crackpot
sftp> ls
cgi-bin htdocs persistent wikispaces-dump.zip
sftp> get wikispaces-dump.zip
Fetching /home/groups/c/cr/crackpot/wikispaces-dump.zip to wikispaces-dump.zip
/home/groups/c/cr/crackpot/wikispaces-dump.zip 100% 648KB 49.8KB/s 00:13
sftp> quit

Monday, August 10, 2009

Flickr with Linux (Aug 10, 2009)

I am trying to upload a large number of photos onto my pro flickr account. I tried the following tools:
* Postr
* Fireuploader (firefox plugin)
* jUploader

Postr and Fireuploader appear buggy and have a somewhat unintuitive interface. I struggled with them a lot. Finally I read somewhere on the net about jUploader.

I downloaded jUploader (not present in Synaptic Package Manager on my ubuntu). After authentication, the first problem I faced is that it does not recognize "JPG" (uppercase) extension. So I had to change all my filenames to lowercase using

rename 'y/A-Z/a-z/' *

I also changed the default permission on upload from public to private from its menu. Then I just dragged and dropped my photos onto jUploader, selected all photos, added to photoset and clicked on upload. It worked just fine after this. Although not perfect, jUploader was close.

Note: I faced the problem of "I don't recognize this file format" because there was no privilege to read the image file as my current user.

I installed the flock browser, which also worked just fine (or should I say marvellously fine).

Friday, July 31, 2009

Rotating Wallpaper/Desktop Background in Ubuntu

Drapes is a cool tool to automatically periodically rotate ubuntu wallpaper. Just install it and then configure by System > Preferences > Desktop Drapes

Thursday, June 18, 2009

Some Refactoring Notes

Used to indent code:

find . \( -name "*.hpp" -or -name "*.cpp" \) | xargs astyle --indent=spaces=4 --brackets=block --indent-labels --pad=oper --one-line=keep-statements --convert-tabs --indent-preprocessor

Generating Code::Blocks Project using Cmake:

cmake -G "CodeBlocks - Unix Makefiles" ..

Regular Expressions used during refactoring using Code::Blocks:

search replace

utility::shared_ptr<([\w ]*)> \1\&

What Sucked

There is no machine learning in the editors. Therefore, every task has become repetitive.

Wednesday, June 17, 2009

Understanding boost::ptr_container

Pointer containers are exception-safe container of pointers. Using them can be slightly frustrating for the users of the standard library containers, because the interface of ptr_containers are slightly different from that of standard library containers.

For example, you would probably expect from a vector of pointers to return a pointer when you perform indirection:

std::vector v;
int* p = v[i]; // ok

But ptr_vector returns a reference:

std::vector v;
int* p = v[i] ; // error: does not compile
int& p = v[i]; // ok

But the interface of ptr_vector is suited to work with algorithms:

find(v.begin(), v.end(), 3); // works only with ptr_vector

Transform Iterators

The transform_iterator can used with maps to traverse over just the keys or just the values contained in the map. An adaptor can be written to convert a usual iterator of a map into an iterator that traverses only over the value. This adaptor would have to be rewritten for ptr_map and its relatives because of its different interface.

Erasing An Element Using auto_type

typedef boost::ptr_set S;
S s;
int* j = new int(3);
s.insert(j);
s.insert(new int(5));
s.insert(new int(7));
S::iterator it = s.find(3);
s.release(it);
std::cout << *j << std::endl; // produces 0xfeeefeee using VS

If the second last line is changed to

S::auto_type r =s.release(it);

the correct value 3 is printed. r acts just like auto_ptr: it holds a reference to the object and thus prevents it from destruction. The user has the responsibility to destroy r when the object is no longer needed. r can also be dereferenced:

std::cout << *r << std::endl; // prints 3

and the pointer can be released using r.release().

Known Issues

Currently, you also cannot store a pointer to a const inside the ptr_container.

Comparison with std container of pointers

TODO

Comparison with std container of shared pointers

TODO

Conclusion

The different interface of ptr_containers can be frustrating for new users but hopefully not so much after reading this article. The newer interface makes clear that the ptr_container has exclusive ownership and thus reduces bugs when compared to using a standard container of pointers.

Wednesday, June 10, 2009

Latex Image

Useful converter of jpeg to eps (the converted eps can be used with graphicx package):

jpeg2ps -h -r 600 image.jpg > image.eps

Thursday, May 28, 2009

Connecting to Wired Connection on Linux, Else to Wireless

This did not seem to work on my linux system. It would always first try to connect to wireless and when that failed, it would just sit there. I had to manual do ifdown and ifup on the wired interface. I asked about this question on the ubuntu mailing list, and they recommended wicd.

Wicd connects to a wired connection if there is any, else allows you to connect to a wireless. It works just fine, but does not connect to the wireless automatically (not sure though, probably only sometimes). But I what I needed works just fine with wicd and I am totally satisfied.

Thursday, May 7, 2009

Upgrading to Jackalope

The new version 9.04 of Ubuntu is out. I followed http://www.shivaranjan.com/2009/05/01/ubuntu-linux-how-to-upgrade-to-ubuntu-904-jaunty-jackalope-from-ubuntu-810-intrepid-ibex/ to upgrade. Now this was some time back, and now I vaguely remember initially I had some sound problems. Other than that, it has been running just fine without any problems whatsoever.

Wednesday, May 6, 2009

Back to Wired Connection

I am on Intrepid Ibex. After a long time, I decided to use wired connection instead of wireless. But nothing would happen when I would connect the wire. I tried "sudo /etc/init.d/networking restart" but does not work. Finally I did "sudo ifup eth0" a couple of times. It is then that wired network started working.

Friday, April 17, 2009

Beamer Font Problem

I installed the latex-beamer package on my ubuntu, and the example at http://latex-beamer.sourceforge.net/ compiled with warnings like

LaTeX Font Warning: Font shape `OT1/cmss/m/n' in size <4> not available
(Font) size <5> substituted on input line 87.

Further, in the dvi output the headings did not appear well. Compiling with another example from http://www.math.utah.edu/~smith/Beamer showed the same problem.

This was a RED HERRING. Finally, when I built the ps from the dvi, all worked just fine.

Thursday, March 26, 2009

Python

I am trying to run matplotlib but seems it is not installed on my windows (ActivePython 2.6) package. Therefore I was looking for a good way to install it. Now, it is a part of several scientific libraries and these libraries have different installers.

One good way to install is using easy_install, but it looks not possible for python 2.6. Finally I gave up on easy_install. I downloaded the matplotlib library (for python 2.5 as there is none corresponding to 2.6).

Finally I concluded that there is little support for python 2.6 and I uninstalled the 2.6 version and installed the 2.5 version.

Wednesday, March 25, 2009

Installing Mingw

I tried installing Mingw for ease of writing scripts (an alternative is Powershell, but I am not quite familiar with it). Mingw installer is quite fragile.

First, you have to make sure the directory where you are installing has no space character in its name. Next, they "recommend" installing in C:\Mingw.

Third, when I tried a custom install with g++ and mingw-make included, there was a problem: the link connection to mingw-make download site never worked. This lead to problems during installation. I retried the installation (giving the same installation path), but the same problem occurred again and again. Finally I did a standard installation, which worked just fine.

I will retry installing the mingw-make by updating mingw later on (right now the connection breaks).

Saturday, February 7, 2009

Skype with Ubuntu Woes

I spent a long time trying to fix this issue of skype with ubuntu ibex. Seems to have been fixed now after following the steps described in a comment at the following link (the comment is posted below):

http://tips4nongeeks.blogspot.com/2009/01/skype-sound-problem-in-ubuntu.html#comment-form

I'd encourage you to "try" this - I don't have much technical insight into why this works, so it might not work for your case. For mine it did. I am using Acer Aspire laptop.

Hello friends,

after messing with commands and stuff around to try to
solve the famous skype echo, I finally solved this pain in the ass!!
for intrepid ibex ubuntu.

If you follow this step by step your skype should work, at least I garantee that you will learn something.

so first of all don’t use the commands to remove any package
from your ubuntu specially pulseaudio, is useless and you will have an other pain in the ass trying to find what package to install:

1) for the audio playback echo (when trying to make a call),

-go to the small skype logo located in the bottom left corner
when you are loged in skype-> go to options-> sound devices

- change all default options to “pulse”.

Now you should be able to make a call test without the message
‘audio playback problem’ or stuff like that.

And you will have the next typical echo that your microphone
will not be working.

2) for the microphone echo (im using a headset):

-go to the upper panel in your window where is all the application-places-system options, in the right upper corner you will find a small speaker icon-> right click with the mouse-> open volume control-> preferences-> select all options specially those like headset- capture-capture1-capture2- input source- etc. those are not working !!!!

-now in the volume control ->label “options”-> change default options for “Mic” and “Digital Mic1″.

-in the next label “recording”-> maximum volume for all the stuff.

- The device should be “HDA alsa mixer”

-finally confirm in ->system-> preferences-> sound preferences, that the sound capture is set to “HDA analog (ALSA)” similar to the previous point.

Now you can try to record something with the ’sound recorder program’
it should work.

And the best Skype should work, no shity messages no shity problems (although when I use the inbuild mic instead of my headset the sound is so so).

I hope my suggestions are useful.

best of luck,

bye.