Programming :: Catch System-level Exceptions?
Jan 24, 2011The following C++ program doesn't catch the exception:
Code:
#include <iostream>
using namespace std;
[code]...
The following C++ program doesn't catch the exception:
Code:
#include <iostream>
using namespace std;
[code]...
I am new to Linux development and want to know within Linux which is the best IDE for system level programs in C like kernel modules/device drivers and other H/W level programs. I used to use Sun Studio Compiler in Opensolaris world.
View 1 Replies View RelatedI want to know what are the advantages and disadvantages for accessing spi(serial peripheral inerface )from kernel level and user level. like methods of doing it, speed ,memeory utilization etc
View 1 Replies View RelatedI have a Socket library, written in C++, in which the method used to send data never has the opportunity to handle an errno of SIGPIPE. Thus I thought perhaps I should setup a signal handler to receive the signal, but this too is not being called.Is there something that I am missing or doing that is completely wrong? Below is the relevant code. Note that a SIGPIPE signal is generated when the Server is unable to send data to the Client (e.g. the client has terminated).Server code:
Code:
#include <TCPServerSocket.hpp>
#include <string>
[code]...
right now i am writing bash script for simple everyday todo tasks.script consisit of two files, fisrt is just script (which can delete/append /clear) and second one is todolist.txt which stores my notes.I am litlebit confused about sed!!for example, If my todolist.txt have these lines:
- Writing my Homework
- take my girlfriend to launch
- Take a break
How can sed take my input $@ and delete all line with name "Homework"..i trayed with many sed combination like:
Code:
sed s/$@//g
sed 'd/$@/'
and many more combination with ""/'' or bracket but nothing helped
I want to catch some outputs in two different log files in bash, file simple.log and all.log So far, the script is started like this:
Code:
xterm -e "(./myscript.sh | tee -a simple.log) >& all.log"
What I want is:
- In simple.log, I want all the stdout but WITHOUT errors.
- In all.log I want BOTH stdout and stderr.
So all is ok, and the output becomes:
all.log
Code:
starting copying files
mv: cannot move ... : permission denied
copying completed
simple log
Code:
starting copying files
copying completed
But, in the new xterm, I'm loosing stdout. There is no output.How can I have the files logged as they are but also have the stdout in the xterm.
But unable to catch the SIGTERM signal if I do shutdown, as man pages says shutdown genrates the SIGTERM and SIGKILL signals, but we cant handle the SIGKILL signal. My code is working fine if I genrate the SIGTERM signal by Kill command, and also for SIGINT signgal genrated from the CTRL+c key.
Here is my code:
/* Example of using sigaction() to setup a signal handler with 3 arguments
* including siginfo_t.
*/
#include <stdio.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
[Code]...
How do you catch user input while the script is running? Or, how would you make two scripts run at the same time, but use input from one script to the other? The program I'm trying to make, echos text on the screen continuously, but while thats happening, I want the user to be able to input something, so the program can detect the input and display something else. So I thought maybe I could make two scripts run to do each task.
View 5 Replies View RelatedI have the following working script. It checks the directory for txt files, if files are there, it copies to another directory or gives error. I would like to exclude "file not found" errors and send them to /dev/null. All other errors should go to the email address as usual.
Code:
#!/bin/bash
function err
{
if [[ $? -ne 0 ]]
[Code]....
I'm getting the following error Kpackagekit when I'm trying to refresh the packages, so I can manually check if there are any new updates. I have totally uninstalled the software, and reinstalled, but this has no effect. The following is what I see in a seperate popup.
Error Type:
Error Value: coercing to Unicode: need string or buffer, exceptions.SystemError found
File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 2216, in
main()
File : /usr/share/PackageKit/helpers/apt/aptBackend.py, line 2213, in main
run(args, options.single)
[Code]...
I am running the 64bit version of 10.04 on a dual core 2GB acer laptop.
When ever I am starting my system at run level 5, it stops booting the machine at a particular point. After starting all the services & before taking user account and password, the fan speed of the cpu increases at faster rate and then after sometime the system automatically stops down.
I have also checked with other run levels, it works fine. I have also gone thru run level 3 and then used the command "startx" but still its not working and the system stopped automatically by making the fan speed up to a high. Primary memory 2 GB.
I first created a fork on github from an existing git repo. Then I made changes to my fork and pushed them to github again. After that the person from who I forked included my changes in his code but made some alterations on it. What I want to do know is having the exact code he has in the repo. This way I am sure that I actually develop on the same code.
I wonder how I should do this. I tried using git mergetool but I had some conflicts. So if I resolve the conflicts and make some mistake here, then I still wouldn't have the code the original repo(the repo where I forked from) has. what is the correct way to do this?
When someone is speaking into the mic, I'd like a "level meter" such as the one that comes with gnome sound recorder, that flashes up and down when a sound is made or somebody talks.This will be done in Javascript, using the brand new "Rainbow API", i.e. inside the browser.I know nothing about audio programming, so - where would I get *started* with something like this? Could anyone tell me at least WHAT to Google?
View 3 Replies View RelatedDoes anyone know how to (permanently) get rid of this?
As you might have guessed, typing the root password and pressing OK has no effect.
This is NOT a laptop!
I've been able to kludge a kill script which finds the correct pid for the kdeserver (or gnome server) after my system comes up in run level 5 so I can drop back to run level 3 mode. Lots of experimentation showed me that using telinit 3 and telinit 5 would occasionally leave the video memory in a mess and I would have the black screen of death.
I set the security parameter setting to autologin for me since I am the only user of my machine, but I still have to kludge the default setting under sysconfig (the DEFAULT_WM) under Window Manager to pick a certain window manager, so it takes time to manually switch the desktop.
Right now I can leave the gui and drop back to cli, but painful experimenting showed me that killing the X server is a no no. Right now I kill the kde server, which sends the SIGTERM to the X windows manager, which then figures out that it has to shut down.
Questions: Is there a better way of doing this? Apparently openSUSE figures that we have multiple users logging into the gui desktop, so the gui is always kept running and a login window with the desktop manager option forces the user to login in. With autologin, this never happens, but no choice of desktop is possible on the fly.
Can some type of script be set up to painlessly enable this to happen? And what is the best way of bringing either the Gnome or KDE desktop manager down gracefully? I do get lots of error messages as the system attempts to recover and X shuts down. It appears that apparently the single user with autologin is left out in the cold.
I want to install a software called TinyOS which is an operating system designed for wireless sensor embedded networks in my account. The problem is it has instructions to install the software as an administrator since i'm not an admin of the department network i can not able to install. Is there any method to install this software as an user level rather than admin level.
View 3 Replies View RelatedHow can I adjust the levels at which the battery is considered to be critically low?ight now it seems this is set at 5 or 10%. I want to make it 20 or 25%This is for Gnome. I am using Lucid x86
View 1 Replies View RelatedI'll just say I am a complete Linux beginner, but I have done vbs, js, php, html web type stuff so I'm not a complete beginner to programming.However I've been trying to learn C and python but it's not making a huge amount of sense.I am wanting to make a simple low level program that copies an image from a mjpeg stream on 192.168.0.1/videostream.cgi for example to a variable then save that variable to a file on my system.I am aware that there are programs out there that would do this but I still want to make my own.
View 1 Replies View Relatedhello everyone, im having a problem when my computer enters in the run level 4 as the default when i start slackware. The strange thing is that it not seems that is a X window problem, it looks like more like a configuration problem in some part of the kde script to initialize the log in, because if i manually start the X service it works fine, i dont know what is the source. Thank you in advance for the help.
View 3 Replies View RelatedI was recently requested to try and convert a running system to RAID level 1. I did not succeed in this task. However, I am still interested in accomplishing this task in a test environment.What I did was create a RAID device with a device missing e.g.
mdadm --create /dev/md0 --level=1 --raid-devices=2 missing /dev/sdb2
Once the RAID was up and running I created the /etc/mdadm.conf file so that it would activate the RAID device on boot. Once the device was created I copied all the data from the running root filesystem to the /dev/md0 device. The only directory that I didn't copy was the /proc directory. When I rebooted the machine I had a kernel panic and the system couldn't find /dev/root. I would greatly appreciate it if someone could provide some information/tips regarding the problem.
How-To set the mixer volume level at system startup or login. A funny story that led up to this how-to first...
I made the obvious mistake of leaving my volume level set to nearly maximum. Of course, Ubuntu's default behavior is to restore the mixer to its last known state - a point of much irritation at that moment. This had been a problem in the past as well, and today was the last straw. So, I did some research, for quite some time I might add, and decided to be a good community member and share my findings. It seems that there are all sorts of opinions around the web. The dominant opinion is that a mixer should always be restored to its last known state, that this is all well and good, and why would you ever want it to work any other way. Lots of people suggested that the startup sound be disabled, which was not a terrible solution, but was still a work-around as it means that the next sound bite to be played is the alarming one.
Needless to say, I wanted to find out what I would call the "proper" way to set the mixer level at startup. As my laptop uses PulseAudio, and my office desktop uses ALSA audio, the methods were different. My focus was for PulseAudio as that was the original purpose. I note here that my method for ALSA is less detailed as it is not the default for Ubuntu audio these days. So, if you are using ALSA, you might have to be a little creative to make my ALSA note fit your needs. I have attached 2 files to this post, one for ALSA and one for PulseAudio.
Are the programs written on schedulers ,thread library , process management, memory management, et al called systems programs ? How are they different from the programs that implement functions like open() , printf() , scanf() , read() .. they have a prefix sys_open, sys_close, sys_read etc , right ? Is there any difference of hierarchy between the programs that implement system calls and system level programs like that implement thread library, process management , memory managemnt etc..
View 5 Replies View RelatedI wrote a C++ program that uses two different parsers. The first parser is reading program arguments from command line:./mybin arg1 arg2 ...then during program execution there's an interactive prompt asking for more parameters:
...
>> (second bunch of arguments here)
...
I'd like to run my program inside a bash script, but I don't know how to give the second level arguments.
Most kernels are written in low level programming languages such as C and Assembly. Would it be possible to write a kernel in a high level language such as Python? Many high-level languages are themselves written in C.
View 5 Replies View Relatedi was recently building on a simple socket program i had written in python basically like a little chat client but i added a server_socket.close command to kill the server on disconnect and now im getting all sorts of indentation errors
Code:
#! /usr/bin/python
2 import socket
3 server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
4 server_socket.bind(("localhost", 5000))
[code]....
IndentationError: unindent does not match any outer indentation level
The algorithm for reading and writing disk blocks use the algorithm getblk to allocate buffers from the pool. In the algorithm getblk, if the kernel removes a buffer from the free list, it must raise the processor priority level to block out interrupts before checking the free list. Why ?Where can i find the C implementation of the above algorithm for buffer allocation in the linux source code ?
View 1 Replies View RelatedIf I have three (3) servers that are suppoed to be configured exactly alike, is there a tool or set of scripts that I can use to capture the information and do a system level comparison?
View 1 Replies View RelatedWe all know linux kernel base layer is made up of structures, in which every object of kernel is well defined. Structure members correspond to object properties required to define object behavior.
For example if we take case of File system.It composed of four objects , superblock objects, inode objects, file objects and dentry object.Each having well defined structure which is being operated by system call handler and by system call service routine in the kernel mode.
Now my question is even in kernel mode we do not have some mechanism by which we can get access to pointer of these structures.We have some macro.
If I want to manipulate structure on my on way, or performing some more operation defined by me.For example after the crash of Hard Disk Drive, having ext2/3 file system, If i want to know all the inode pointers, and block details.
Can I have some way out to do desired operation ??
mechanism to operate on these base label structures, even in kernel mode ..
I need to implement operating system level visualization to isolate a application on RHEL 5.5. Which one tool in following for implementation Linux-VServer, lxc, OpenVZ or anyone else.
View 2 Replies View Relatedwhen i do a paravirtualised install coz fully grey out (how do you get round this) and ftp install path is ftp://192.168.1.1:65354/bie764.iso
i get error:
Unable to complete install 'exceptions.ValueError Invalid install location: Opening URL ftp://tj:tj@192.168.1.1:65354/bie764.iso failed.
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/create.py", line 724, in do_install
dom = guest.start_install(False, meter = meter)
[code]...
does it not accept ftp passwords.. what ftp server program (with autostart so it works with crossover linux as i know no other way start apps with that. can try to insta wine but need rpm) will work