Programming :: C++: Getting And Handling Web Data?
Jan 29, 2010
I'm just starting out on a project relating to web search, to be done in C++. Which library should I use to help with downloading web pages into memory so that I can process them? The big thing is I want to be able to download the pages into variables/structures without actually putting them onto the hard disk.I googled and saw libcurl, but I was confused by some of the examples and wondering if this was really what I wanted.
View 2 Replies
ADVERTISEMENT
Jan 3, 2010
I wonder how error handling is done in C in real applications, by returning a error code when something goes wrong, or by using setjmp and longjmp, or something else?
View 10 Replies
View Related
Mar 12, 2011
I have created a pthread, and installed a signal handler inside that, same way as we do in main( ) function. The thread's signal handler is a separate function. Surprisingly, it is not working, that is the thread's signal handler is not able to catch signals. Here is the code:
Code: #include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <signal.h>
typedef struct data
[Code]...
View 1 Replies
View Related
May 12, 2010
I writed Quote:
#!/usr/bin/perl -w
use Error qw(:try);
try {
[code]....
View 1 Replies
View Related
Jun 30, 2011
I found, in bash, something similar to 'try/except' in python. I've been using something like this:
Code:
if ! 'command';then
echo 'damn, there was an error'
[code]....
View 4 Replies
View Related
Nov 30, 2010
During my read, "Code Complete",the author described the different ways of handling the ADT interface.He has wrote this passage:
Quote:
Option 2: Explicitly provide the data used by the ADT services. In this approach, you declare the data that the ADT uses within each routine that uses an ADT service. In other words, you create a Font data type that you pass to each of the ADT service routines. You must design the ADT service routines so that they use the Font data that's passed to them each time they're called. The client code doesn't need a font ID if you use this approach because it keeps track of the font data itself. (Even though the data is available directly from the Font data type, you should access it only with the ADT service routines.This is called keeping the structure "closed.") The advantage of this approach is that the ADT service routines don't have to look up font information based on a font ID. The disadvantage is that it exposes font data to the rest of the program, which increases the likelihood that client code will make use of the
ADT's implementation details that should have remained hidden within the ADT.
The problem is that it is a bit subtle in terms of coding for me. Can anybody give more concrete example, in working codes, especially in Java?
View 2 Replies
View Related
Jun 1, 2011
I have a script that connects to a windows server, downloads a file, appends to it and then re-uploads the updated file. I want to implement error handling. An email is to be generated indicating whether there was an error or not. This email should include all standard and error output as a body. The current script looks something like this:
Code:
function Email_ServerSupport {
for time in once; do
echo "Subject: Billing - smb copy to accounting" $1
cat /tmp/smbx
cat /tmp/smbxerr
done | mail $EMAILADDR
}
/usr/bin/cp /dev/null /tmp/smbx
/usr/bin/cp /dev/null /tmp/smbxerr
cd /tmp
/usr/sfw/bin/smbclient $LOCATION -A $AUTHFILE >>/tmp/smbx <<EOF
get $OUTFILE
exit
EOF
cat $INFILE >> $OUTFILE
/usr/sfw/bin/smbxclient $LOCATION -A $AUTHFILE >>/tmp/smbx <<EOF
put $OUTFILE
cat /tmp/smbx | grep -v "Domain" | grep -v "putting file" | grep -v "getting file" >> /tmp/smbxerr
if [ -s /tmp/smbxerr ]; then
Email_ServerSupport " ERROR"
exit
else
echo "Transfer successful."
Email_ServerSupport " SUCCESS"
fi
The reason for the grep -v's is because, from my understanding, when using smbclient, ALL output goes to stdout, even errors. For this reason, I need to filter out lines including "domain" "putting file" or "getting file", all of which aren't errors. The problem is that even though the script seems to catch errors successfully now and then, the success email ends up blank (/tmp/smbx is somehow empty). I'm also worried it could miss possible errors I haven't tested. I'm thinking it has to do with the way "EOF" functions. Is there any way to capture output from the "put" and "get" commands? I can't simply redirect the output, can I?
View 1 Replies
View Related
Oct 26, 2010
To parse several XML documents I'm using libxml++. I do programming for linux angstrom-armv5te. Because compiling libxml++ for this distribution and platform was impossible, I simply included the library to my project, which workes fine. Unfortunately I'm not able not use the exception handing which effects that a simple error inside a documents makes my whole program crash. This should not happen.
Is there a way to check the documents validity before parsing or better active the exception handling for doing this.
View 3 Replies
View Related
May 15, 2011
i had a problem with the find command in bash (which i deem is close enough to a promming language, if not please move this thread :P). i tried to reduce the command to the problem. i want the backticks, or $() for that matter; to be evaluated by -exec of find, not by bash. is that a caveat of find?
Code:
$ find testd -exec echo `basename {}` ; #confused me
test
test/a
test/b
[code]...
edit: i found out whats causing this. `basename {}` gets evaluated by bash before find is invoked, returns {} and `find . -exec echo {} ;" is run. now my question is, how to escape this eveluation from happening before.
View 11 Replies
View Related
Jan 20, 2009
I have this little shell script which copies file names taken from inputfile:
Code:
while read line; do
cp -i $line something
[code]...
View 4 Replies
View Related
Nov 12, 2010
i have some perl codes for using ldap,but i don't know why don't work any error handling When i use msg->code for sample. an example:
[Code],,,,
In this case,if $msg->code return zero(or null) every thing work correctly but if it not zero don't give any message(eg."error result").What is problem?
View 1 Replies
View Related
Jun 17, 2010
I have a system setup script for my Slackware installations that pulls all packages and source files from another machine and sets everything up to be identical between machines. The script works as expected but make it entirely unattended. How do I make the bash script deal with automatically selecting "Yes" for, for example "Install x(Yes/No): " when prompted by a make file?
View 3 Replies
View Related
Jun 14, 2011
In a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario:
View 1 Replies
View Related
Jun 11, 2009
I am using read() in c++ to get data from a serial port. However, if no data is available on the serial port the function blocks until dta arrives.Example code:
//------------------------------------------------------------
char m_readBuffer[255] = {0};
char* p_curChar = m_readBuffer;
[code]...
View 1 Replies
View Related
May 9, 2010
I have some data files that should be distributed with my program. Using dist_pkgdata_DATA in Makefile.am, I get these files installed to /usr/local/data/share/package-name. The problem is that data is read-only, and my program needs to modify it. Playing with dist_sharedstate_DATA, dist_localstate_DATA, dist-data_DATA varibles, I got different installation directories, like /usr/local/com, usr/local/var, but data is always read-only.
How can I distribute modifiable data files with my package? I need some common directory for all users, or maybe local data in a user directory.
View 1 Replies
View Related
Mar 4, 2011
I am trying to generic way to convert the string datatype to other primitive data type. To achieve, i used Template . But i getting error and couldn't resolve the issue and error reported is also clueless.
Code
====
#include <vector>
#include <iostream>
#include <string>
[Code].....
View 7 Replies
View Related
May 13, 2010
just noticed when I went to burn a cd (just got a new car and at the moment the stereo does't have a auxiliary port and I'm not about to use a shotty fm transmitter) that k3b spikes the cpu through the roof an freezes when I write/burn/convert a m4a media file... I'm using k3b version 1.91.0.
View 3 Replies
View Related
Mar 28, 2011
I've got this log file and I need to get all sorts of information from it...
24 - [02/Sep/2010:00:01:16 +0200] - 10.1.53.62 - 200
23 - [02/Sep/2010:00:01:26 +0200] - 10.1.53.62 - 200
19 - [02/Sep/2010:00:01:56 +0200] - 10.1.53.62 - 200
[code]....
View 6 Replies
View Related
Jul 17, 2015
I have created a nfq handler via nfq_open() and using the returned qhandle to bind my application program to a specific queue number that is configured in iptables. when i invoke nfq_create_queue() my program is stuck there and the back trace shows it is blocked in recvfrom()
bt
in recvfrom () from /lib/x86_64-linux-gnu/libpthread.so.0
in nfnl_recv () from /usr/lib/libnfnetlink.so.0
in nfnl_catch () from /usr/lib/libnfnetlink.so.0
View 0 Replies
View Related
Aug 3, 2010
What is the maximum amount of ddr that can be installed in a 64 bit ubuntu linux system computer?
View 1 Replies
View Related
Jun 7, 2010
I really have tried Googling this over many, many hours, and I still can't make sense of it all, especially since I keep reading conflicting info.
In 9.10, the Usplash boot splash was replaced by XSplash, which is based on X11, and when we all realised something was up with GDM (when we couldn't find a way to customise the login anymore), I read it was not GDM controlling that anymore, but X11. So, the way I read it (on many different sites), XSplash in 9.10 controlled both the boot splash and the login, even though the hacks for customising the login involve commands with "gdm" in them.
Now, in 10.04, the short-lived XSplash has been replaced by "Plymouth", and I get all that... as far as the boot splash goes. What I don't understand is the login process.
There is talk of GDM2 coming out, and I've seen people asking when this will be implemented in Ubuntu, but if the move is away from GDM altogether towards a boot/login process totally based on X11, will this happen?
More importantly, what is controlling the login now? Is it still GDM, or is it X11 that gdm commands work on or something? (The hacks people used in 9.10 still work in 10.04)
Also, because I have Xubuntu and Kubuntu in the same system, and have had things like KDM taking over login happen after upgrades, I have to ask what is controlling the boot process and login for Ubuntu's siblings? (To me they now look almost identical, so wonder if they're all X11 based)
View 2 Replies
View Related
Oct 20, 2010
I remember having the same problem with kde/Fedora a few years back, and I can't remember the solution. Trying to open any attachment in evolution gives the error "No application is registered as handling this file" and you have to save the attachment, and then open it as normal. I have checked all the file associations, and they are fine, and the same attachment in evolution under Gnome opens fine.
View 5 Replies
View Related
Aug 1, 2011
I have been using so far only 32bit ubuntu, but now for various reasons I have to change to 64bit I need to compile a lib for gpg encryption for handling old keys, namely .I have the idea.c file and had some instruction with which I was able to create the lib from it for the 32bit linux. The intruction was:
gcc -Wall -02 -shared -fPIC -o idea idea.c
this seems not to work under 64bit and the old lib does not work under 64bit either obviously. particularly the compiler tells me -02 option is unknown, does it matter? or what is -02 ?
View 3 Replies
View Related
Feb 16, 2010
I am writing completion function for one PHP framework called symfony. It has command line interface with syntax:
Code:
symfony [options] [namespace:]action
I want to make action be autocompletable. The function is simplest so far:
Code:
function _symfony_commands()
{
[ -r "cache/completion/.sf" ] && cat cache/completion/.sf
}
[code]....
But, if there is : symbol which separate namespace from action problems coming:
symfony doct[TAB]
will be completed to
symfony doctrine:
But nothing happens if you want complete after : symbol. I've found out that for readline there is three words because it splits line with $COMP_WORDBREAKS
Code:
$ echo $COMP_WORDBREAKS
"'><=;|&(:
I played with $COMP_WORDS array and tried every thought I had to make it work, but failed.
What I should do to escape colon and make readline consider it as one word? Or there is way perhaps to workaround it?
View 2 Replies
View Related
Sep 16, 2010
Is there any Kernel parameter available for interrupts handling, In the case of busy server how we can tune the kernel to handle interrupts effectively.
View 4 Replies
View Related
May 19, 2010
Anyone know some links where i can find about data structures using STL ?
View 4 Replies
View Related
Dec 3, 2008
have a tag in XML file in unix like this <EmailAddress>abc@gmail.com</EmailAddress> this tag is there for multiple times in the xml file and the data is in continuous line like below State>UN</State><Zip/><CompanyName/><EmailAddress>FDF@gmail.COM</EmailAddress><PromoType>UNKNOWN</PromoType></Promotion></PromotionList<State>UN</State><Zip/><CompanyName/><EmailAddress>zd4946@gmail.com</EmailAddress>I have to check the data in between bold tags is valid or not ... means have to check whether its a email address or not and have to find the length of the attribute means tag ...script is in kshsorry if its already asked...i checked but i didnt get Exatly matching result for my requirement
View 7 Replies
View Related
Aug 21, 2010
I'm trying to work out the best way to achieve the following.
1)php page that grabs data from a local database. (not a problem)
2)It then needs to send this data to a c program/service running on a remote server. (I probably need it to be able to handle 4+ million reocrds in an array)
3) The c service then needs to process the data and send it back to the initial php script that called it. i was hoping this could be in a an array like structure of some kind. 4)update the db with the results.
I was thinking of using gsoap to write a simple c soap service that php can communicate with. Would this be the right way of doing this or would something like sockets in php be a better way of sending this volume of data as an array or struct to linux c socket if thats even possible.
View 3 Replies
View Related
Jan 21, 2011
I am developing a device that will run Linux as its operating system.The device is a small form factor X86 device with a flash drive exposed as a SATA-device. So it is not very dissimilar from any other PC running Linux.For several good reasons I am building my own "distribution", instead of using an existing one.What confuses me is how mount/umount of the root file system is handled.I boot my kernel with the commandline "root=/dev/sda1 rw" which works fine. But everytime I do poweroff or reboot Busybox complained about no /etc/fstab, so I decided to build one.Should I have an entry for my root file system? It seems like this is shadowed by the rootfs anyway. I.e. if I have the fstab entry "/dev/sda1 / ext2 1 1" mount still reports rootfs on / type rootfs (rw)/dev/root on / type ext2 (rw,relatime,errors=continue)My questions are:Do I need to worry? Will the drive be correctly unmounted by the kernel on poweroff/reboot?If I want to perform file system checking on boot, can I do that without resorting to an initrd?
View 1 Replies
View Related
Jun 15, 2011
I want to run a script when the switch goes down and an other when it goes up. Is there an easy way to pull this off in Debian (preferably with no other than system tools)? I suppose there is no difference (in the OS point of view) between unplugging ethernet cable and the switch losing power.
On an event I get lines like these in the syslog:
Jun 15 17:49:41 debian kernel: [ 5506.956130] igb: eth1 NIC Link is Down
...
Jun 15 17:49:45 debian kernel: [ 5511.168788] igb: eth1 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: RX/TX
In FreeBSD you can pipe log messages (pre-filtered by regex patterns) to a program. What is the easiest way to replicate this on Debian (with as little additional software as possible)?
View 1 Replies
View Related