Skip to main content

Posts

Showing posts from October, 2008

strtok Simple Usage Example string words seperate

How to get string words separate? Separate each word from string of /share/test/
Here is simple code snippet which also demonstrate use of string token (strtok() function);
Below is simple C code;
#include
#include

int main()
{
char df_buf[120];
char *name1,*result;
int i;
char *tmp;
char str_array[7][50];

strcpy(df_buf,"/share/test/path/");
result=strtok(df_buf,"/");

//printf("%s\n",result);
while(result!=NULL)
{
tmp=strdup(result);
strcpy(str_array[i],tmp);
result=strtok(NULL,"/");
printf("%s and %s\n",result,tmp);
i++;
}
printf("i=%d\n",i);
printf("%s\n",str_array[0]);
printf("%s\n",str_array[1]);
printf("%s\n",str_array[2]);
return 0;
}The output will be
share
test
path
ie /share/test/path string is separated into words;

Delete Last Char in String C program Simple Way

How to delete the last character in a string?
Lets say I have a string "/data/share/" I want to delete the last character from the string ie "/" so that output will be "/data/share"; Here are some methods to do this in C language.
one way could be use of strncat() function;
char*strncat(char*restricts1, constchar*restricts2, size_tn);
The strncat() function appends not more than n characters from s2, and
then adds a terminating `\0'.
#include
Another simple way is,
say the string variable is str_p
Then simply put
str_p[(strlen(str_p)-1)] = '\0';
And you are done;

Source Code Browsing In Linux-CTAGS usage

How to use ctags command in linux? explained in simple steps.
CTAGS is a good utility for source code browsing in Linux through vi editor. To use ctags , at the source code directory enter

# ctags -uR *

This will create tags file in the source code.

Open a file in that source code using vi editor & set the tags file for that file using " ESC + :set tags=tags" ( path of tags file . if it is at different level then give the entire path like ../tags or ../../tags ).

Once the tag file is set for that file, then you can look the at function definitions, variable declarations, .......... by placing the cursor on that function call or variable & press "CRTL + }" and for coming back to same place press "CTRL + t" key sequence.

Follow CTAGS documentation for more insight.

Encyclopedia of Life

Highly attractive and important website. clipped from www.eol.org The Encyclopedia of Life (EOL) is an ambitious project to organize and make available via the Internet virtually all information about life present on Earth. At its heart lies a series of Web sites—one for each of the approximately 1.8 million known species. Each site is constantly evolving and features dynamically synthesized content ranging from historical literature and biological descriptions to stunning images, videos and distribution maps. Join us as we explore the richness of Earth’s biodiversity!
clipped from www.eol.org clipped from www.eol.org clipped from www.eol.org clipped from www.eol.org clipped from www.eol.org

SAMBA Access From Windows Error

When I was trying to access samba shares from windows I was able to access the shares with entered user name and password but that was happening only once; as windows was storing the session details; I was not able to login with different user name other share access; I was getting error
"Multiple connections to a server or shared resource by the same user,
using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.."

one solution to this is reboot the windows system and try again. But that's very rude solution.
Simple solution is
Open a Command Prompt and type these commands:

net use (to see all existing connections)
net use * /del /yes (to delete all existing connections)
Great..

About NTFS Tools and Library ntfsprogs Download

NTFS file system one can make use of it from ARM-Linux using below two methods one is install and down load user space modules and other approach is install and download kernel space drivers.

ntfsmount is part of ntfsprogs package. It relies on libntfs, thus it has more features than kernel driver.
ntfsmount supports file overwrite with changes to file size, has limited file and directory creation/deletion support, can operate with named data streams and supports special Interix files (symlinks, block and character devices, FIFOs and sockets).

Requires FUSE- Filesystem in userspace
download FUSE
http://fuse.sourceforge.net/

Download NTFS Tools and Library for ntfsprogs
The ntfsprogs package contains userspace tools: mkntfs, ntfscat, ntfsclone, ntfscluster, ntfscp, ntfsfix,
ntfsinfo, ntfslabel, ntfsls, ntfsresize, ntfsundelete, etc and a shared NTFS library. This package does not require nor contain the NTFS kernel driver.
http://www.linux-ntfs.org/doku.php?id=downloads

for Kernel driver
The NTFS…

Never Say Die: Why We Can't Imagine Death

The common view of death as a great mystery usually is brushed aside as an emotionally fueled desire to believe that death isn’t the end of the road. And indeed, a prominent school of research in social psychology called terror management theory contends that afterlife beliefs, as well as less obvious beliefs, behaviors and attitudes, exist to assuage what would otherwise be crippling anxiety about the ego’s inexistence.

Yet a small number of researchers, including me, are increasingly arguing that the evolution of self-consciousness has posed a different kind of problem altogether. This position holds that our ancestors suffered the unshakable illusion that their minds were immortal, and it’s this hiccup of gross irrationality that we have unmistakably inherited from them. Individual human beings, by virtue of their evolved cognitive architecture, had trouble conceptualizing their own psychological inexistence from the start. clipped from www.sciam.com Almost everyone has a tendency t…

Beautiful Women in Beautiful Dresses by J.W. Waterhouse

- oh and a mermaid clipped from www.jwwaterhouse.com clipped from www.jwwaterhouse.com Waterhouse's works are perhaps the best of the Pre-Raphaelites (although really a Neoclassic). His combination of mythology, poetry and mystique femme fatale is absolutely outstanding and soulfully touchingclipped from www.threadsofrohan.com  Fair
Rosemund
Psyche
opening the Golden Box
 Destiny
Ophelia
Lady of
Shallot
Ophelia
The Lady
Clare