linux

Seg Fault when using std::string on an embedded Linux platform

Hi, I have been working for a couple of days on a problem with my application running on an embedded Arm Linux platform. Unfortunately the platform precludes me from using any of the usual useful tools for finding the exact issue. When the same code is run on the PC running Linux, I get no such error. In the sample below, I can reliabl...

Python program doesn't quit when finished

I have the following script 186.py: S=[] study=set([524287]) tmax=10**7 D={} DF={} dudcount=0 callcount=0 def matchval(t1,t2): if t1==t2: global dudcount dudcount+=1 else: global callcount callcount+=1 D.setdefault(t1,set([])) D.setdefault(t2,set([])) D[t1].add(t2) ...

how to simulate the dos "CD.." in a small c shell for linux

Hi there, this is for a small project of mine, I'm trying to set the current process working directory to the One directory up as if my current directory is ..\downloads\movies i'd like code to set the directory to ..\downloads I know this is possible by getting the current working directory path and extracting the directory path i need...

Bash shell function error : command not found

Hi all: I am new to bash so please bear with me if this is a dumb question : What I actually want to type in the shell is like this: javac -classpath "emarket.jar" Testclient.java -Xlint:unchecked The fact is, if I manually type the above line into bash, it executes with no error. However, if I craft a customized function in .bashr...

Sharing Multiple Variables Via sys/shm.h

Hi there, I am trying to share two different using one shared memory block using the shm.h library. I wrote the following example, where one shared memory block is created and is big enough to hold two integers. I then attach two integers to it and create two processes. The first process increments the first integer. The second process ...

Automatic structure initialisation in c/Linux

I am back into c/Linux. The question might look stupid, but relevant after working in c# etc. I have some structures inside structures and the hierarchy level is more than 5. In such a case, I am doing an initialisation of every structure at the beginning explicitly. I know c does not have a new() method that will do it for you. Now I w...

Will defunct processes prevent proper running of other processes?

My mongrels were not responding, and neither god restart nor cluster restart made a big difference. I dug a little deeper, than i realized that i had plenty of zombie processes. app 29607 27948 0 19:45 ? 00:00:00 [mongrel_rails] app 30578 21681 0 19:52 ? 00:00:00 [mongrel_rails] app 30704 21405 0 19:53 ...

What is the fastest way to check whether a folder size is greater than a specific size?

What will be the fastest way to check whether a folder size is beyond a specific size say 10 MB, 1 Gb , 10 GB etc, without actually calculating the folder size. Something like quota. A Pythonic solution will be great, but standard UNIX utilities also welcome ...

Is it a bug in Linux time() function or Linux OS calls?

Dear All, I wrote a small program, that creates files at an interval of 1 minute. But the time at which the file is created and last written and the last modification time of the file as shown by ls command differs by 1 second. The code and the output is presented below. please let me know where could be the bug? root@new:/home/sriniva...

Serial port : not able to write big chunk of data

Hi I am trying to send text data from one PC to other using Serial cable. One of the PC is running linux and I am sending data from it using write(2) system call. The log size is approx 65K bytes but the write(2) system call returns some 4K bytes (i.e. this much amount of data is getting transferred). I tried breaking the data in chunks...

Axis Web Service throws error: Exception occurred while trying to invoke service method

I am trying to invoke a web service that I have just hosted on out linux redhat server but it throws the error {http://xml.apache.org/axis/}stackTrace:Exception occurred while trying to invoke service method + "methodname" I host the service in apache tomcat webserver The same service works fine when i host it in the windows xp environm...

Small block allocator on Linux (or RedHat Linux) to avoid memory fragmentation

I know that there is an allocator for user applications than handles lots of small block allocation on HP-UX link text and on Windows XP Low-fragmentation Heap. On HP-UX it is possible to tune the allocator and on Windows XP it considers block of size less than 16 K as small. My problem is that I can't find any information about this ki...

REALbasic speak equivalent for Linux

I have a number of small REAL Studio apps that use the Speak keyword on Windows and Mac to output single words or short phrases. Can anyone recommend a way of emulating this on Linux versions of the app, either with a shell command or a Soft declare? These apps are for family use only so I can install free software on Ubuntu if necessa...

Block All Keyboard Input in a Linux Application (Using Qt or Mono)

Hi, I'm working on a online quiz client where we use a dedicated custom-made linux distro which contains only the quiz client software along with text editors and other utility software. When the user has started the quiz, I want to prevent him/her from minimizing the window/closing it/switching to the desktop or other windows. The quizz...

Can read() function on a connected socket return zero bytes?

I know that read() is a blocking call unless I make the socket non-blocking. So I expect read() call which requests 4K of data should return a positive value ( no of bytes read) or -1 on error ( possible connection reset by client etc). My question is: Can read() return '0' on any occasion? I am handling the read() this way: if ((r...

linux batch rename directories and strip caracter # from name

Hello, i have a directory with a lot of subdirectories with a # infront of them: #adhasdk #ad18237 I want to rename them all and remove the # caracter I tried to do: rename -n `s/#//g` * but didn't seem to work. -bash: s/#//g: No such file or directory Any ideas on this. Thanks ...

What is a good programming language/environment for Linux database applications?

I could use some advice on my move from the Windows world to Linux. For my business, I have used VB6 and Microsoft Access with both Access databases and SQL server in the past. The easy to use forms, report writers and programming language were perfect for CRUD apps and analysis for our small hotel/restaurant business. After using L...

makefile using custom directory and library

Hello, I wrote a makefile: all: server client server: server.o des.o sha1.o /usr/local/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o server server.o des.o sha1.o -I /usr/local/include/ -lgmp client: client.o des.o sha1.o /usr/local/arm-2009q1/bin/arm-none-linux-gnueabi-gcc -o -lgmp client client.o des.o sha1.o -I /usr/local/include/ s...

How can I make the watch command interpret vt100 sequences?

Consider this simple example (which displays in red): echo -e "\033[31mHello World\033[0m" It displays on the terminal correctly in red. Now consider: watch echo -e "\033[31mHello World\033[0m" It does not display the color. Note: I am aware that it is easy to write a loop that mimics the basic behavior by clearing and rerunning. How...

Ubuntu Linux C++ error: undefined reference to 'clock_gettime' and 'clock_settime'

I am pretty new to Ubuntu, but I can't seem to get this to work. It works fine on my school computers and I don't know what I am not doing. I have checked usr/include and time.h is there just fine. Here is the code: #include <iostream> #include <time.h> using namespace std; int main() { timespec time1, time2; int temp; c...