Saturday, December 8, 2012

Sharing a folder Fedora 16 via FTP

Today I was trying to share a very large folder ftp. One Idea was to copy the complete folder to /var/ftp, but this is a bad way when Linux kernel supports mounting a directory from multiple locations.

1. Installing FTP server
    On fedora its as simple as yum install vsftpd
2. Start the service
    service vsftpd start
3. Adding this to startup
    chkconfig vsftpd on
4. Mounting the directory using
    mount --bind [directory to mount] [directory in which it would be mounted]
As I was trying to mount sdb drives to the specified folders, I was unable to open them via ftp although they were working fine using nautilus. I googled then I found a solution of setting SELinux to Permissive mode using setenforce 0

Since mounting operation needs to be done after every boot, I made a simple text file:

mount --bind /media/H/ /var/ftp/Shared
mount --bind /media/I/ /var/ftp/Another

setenforce 0
A snapshot of the same
Deep inside directory tree

Tuesday, October 23, 2012

Core Dump Resolved

This is a follow up blog to my previous one: Core Dump

As a part of the design, I was passing an element of a second degree vector, for instance, the vector was:

vector < vector < pathDetails > > someName;
I was passing someName[ i ] to function createLightTree. As described in my previous blog, It was repeatedly giving core dumps (std::bad_alloc), so I decided to use a temporary vector for passing values to the function.

So I used another vector

vector < pathDetails > temp
and passed to my function createLightTree, and it worked!!!.

I am still wondering why this happened, as in some of my recent codes, I passed vectors of size 1 GB and it was working fine, the only difference being my distro (last time I used Ububtu and I use Fedora now), but I guess gcc us universally constant with respect to its standards.

Another possible reason could be, the "pass by value concept" the compiler might be copying all of 3-D object to pass on to the designated function.

And at the same time, her ek friend jaroori hota hai, special thanks to my friends who helped me get out of this.

Monday, October 22, 2012

Core Dump

Earlier I had encountered many runtime errors in my programs like Segmentation Fault, stack crashing etc. Segmentation fault was a bit difficuilt to track till I learnt the debugger.

Recently while working with files IO in my simulation of a network I encountered core dump. Later I learnt that the directory path given by me was incorrect. As a next step of simulation the same problem cropped up, I called a function with function signature:

pathDetails createLightTree ( string id, vector <pathDetails> trees, int iteration );
and definition:
{
    std::cout<<"Test line"<<endl;
    pathDetails sample;
    return sample;
}


pathDetails is a structure having related integer constraints required to simulate a Multicast Optical Network

It has been frustrating as I am not able to execute even the first dummy line. The error message is:

terminate called after throwing an instance of 'std::bad_alloc' what(): std::bad_alloc
Aborted (core dumped) 

Here is the screenshot of the same:

Saturday, March 31, 2012

topcoder

In a recently installed Fedora 16 of my friend, topcoder arena was not able to start. One possible solution was installation of Oracle Java because Iced Tea Java dosen't have proxy support. Even after installation, javaws was unable to start. One possible solution could be the $PATH variable. I checked, it was like:

[saurabharaiyer@localhost ~]$ echo $PATH
/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/saurabharaiyer/.local/bin:/home/saurabharaiyer/bin:
[saurabharaiyer@localhost ~]$

There was no javaws in the above folders, the default location of javaws is
  
/usr/java/jdk1.7.0_03/jre/bin

So we just need to change the path variable.

PATH=$PATH:/usr/java/jdk1.7.0_03/jre/bin

one reference I later found: http://roshansingh.in/blog/2009/11/11/running-topcoder-applet-behind-proxy/