Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

~16.5K People Reached
Favorite Forums
Favorite Tags
c x 31
c++ x 4
Member Avatar for jobs

How do I get datalist to string? >>> days = 24/6 >>> print days 4 >>> hours = 45/7 >>> print hours 6 >>> datalist = [] >>> datalist.append(days) >>> datalist.append(" days ") >>> print datalist [4, ' days '] >>> datalist_str = "".join(datalist) Traceback (most recent call last): File …

Member Avatar for cementovoz
0
854
Member Avatar for jobs

I have a file pointer which was assigned in main. In the main, I just open a file to write stuff to it. I want to pass the file pointer to several functions so that they can write to the file. In the fucntion declaration I just add: somefunc(FILE *file) …

Member Avatar for Narue
0
1K
Member Avatar for jobs

When I execute the following sql,select id from people, inside python and print the result, I get this: ((11L,), (12L,), (13L,), (14L,), (15L,), (16L,), (17L,), (18L,), (19L,), (20L,)) Why does python print L beside the numbers. Just to indicate Long type?

Member Avatar for timogoosen
0
3K
Member Avatar for jobs

I am looking for a good C++ example of a simple MySQL client program written in C++ and runs on Linux, using MySQL++ libraries that does the following (no threading): Accessing Option File Contents, ~/.my.cnf, in user home folder to read settings (load_defaults). Constructing and sending the sql statement that …

Member Avatar for Stefano Mtangoo
0
446
Member Avatar for jobs

Line by line I need to get the whole content in a line from a file. I have looked at fgetc, fgets. According to fgets, I need to specify max number of characters to read. If I have file content like this: 1235690,9087657788888770000,89977553223456789\n I wouldn't know how max characters in …

Member Avatar for Narue
0
258
Member Avatar for jobs

[code=python] data = unpack('>L', sock.recv(4)) [/code] Does this line of code means, incoming data is big endian and so unpack to endianess of local machine and assign to data. If local machine is little endian, then big endian is automatically converted to little endian format?

Member Avatar for jrcagle
0
53
Member Avatar for jobs

I would like to convert url into md5 hash. My question is that md5 hash will create collision at 2^64. If you do long(value,16), where value is the md5 hash string, would value returned from long(value, 16) be unique as long as md5 hashed string is unique? when you move …

0
71
Member Avatar for jobs

I have a CProgramA that need to call CProgramB just before CProgramA terminates. How can this be achieved?

Member Avatar for Salem
0
232
Member Avatar for jobs

strcpy(buf, "my_id_%d_",i) strcpy(buf1, "my_com_id_%d", j) First I want to place value of i into "my_id_1" like so and copy to buf. And do the same thing in second line the code. Now I want to join both buf and buf1 so it will give me a new string "my_id_1_my_com_id_2". How …

Member Avatar for ssharish2005
0
110
Member Avatar for jobs

I am getting an error when I do this in C program: execl("/bin/cp","../data/data_.txt","../data/data.txt",0); error is as follows: ../data/data_.txt: missing destination file operand after `../data/data.txt' Try `../data/data_.txt --help' for more information. I tried this too, it didn't help. execl("/bin/cp ../data/data_.txt ../data/data.txt",0); All I am trying to do is this: cp ../data/data_.txt …

Member Avatar for kv79
0
644
Member Avatar for jobs

int file file = open("./some.txt", O_RDONLY); Above line file=open giving me compile error: 'O_RDONLY' undeclared (first use in this function) What is the problem here? I am running linux and gcc 4.1.

Member Avatar for jobs
0
3K
Member Avatar for jobs

I have a config file which includes how many files I need to create. So my program reads the config file and will create those files. Where I am stuck is I do not know before hand how many File pointers I need. I get to know quantity of files …

Member Avatar for Jishnu
0
903
Member Avatar for jobs

When you read file in C and move to next line and so on. This seems you have to access file top to bottom sequentially without skipping lines. I need a way to read very 5th line or something similar to it. I am just concerned with data that is …

Member Avatar for yagiD
0
104
Member Avatar for jobs

[QUOTE]aptr = malloc(nrows * ncols * sizeof(int)); rowptr = malloc(nrows * sizeof(int *));[/QUOTE] What is the different with have no * inside sizeof(), eg sizeof(int), vs sizeof(int *)?

Member Avatar for Narue
0
342
Member Avatar for jobs

char stmt_buf[1024], buf[(1024*2)+1]; stmt_buf ="SELECT id, title FROM post LIMIT 5;"; I get an error: connect2.c: In function ‘main’: connect2.c:217: error: incompatible types in assignment

Member Avatar for Narue
0
102
Member Avatar for jobs

I am running linux. This problem maybe implemented many times over. I am not hitting right google search term. I need a way to send email from my c program, if that program fails to excute some other part of the code. Any gurus like to shed some light on …

Member Avatar for Ancient Dragon
0
83
Member Avatar for jobs

I have a C program I am writing and need this program to write to syslog and have the logs in a separate file for my program. Eg. My program is called "example.c", then I want to have a log file called "example.log" in /var/log. Do I define log file …

Member Avatar for WaltP
0
1K
Member Avatar for jobs

[QUOTE]The function time() retrieves the current calendar time from the system's clock. It has the following prototype: time_t time(time_t * tp); In systems in which no clock is available, the function returns -1.[/QUOTE] Part 1: I found this on the internet. I have a question about the above quote where …

Member Avatar for Ancient Dragon
0
98
Member Avatar for jobs

Can someone tell me what value would each of the line of code will have, when you go through this code: Here is the full code: server.conf: [CODE]interface=192.168.0.2; log=/var/log/example; [/CODE] example.c: [CODE=c] conf_fd=open("/etc/example/server.conf",O_RDONLY); read(conf_fd,conf,100); close(conf_fd); /* Get server IP */ buffer=strtok(conf,";"); buffer1=strtok(NULL,";"); strtok(buffer,"="); server=strtok(NULL,"="); server_ip=inet_addr(server);[/CODE] What is the value at …

Member Avatar for ssharish2005
0
98
Member Avatar for jobs

I am looking at the code which has the following: read(conf_fd,conf,100); Can someone tell me what these parameters are passed to read function?

Member Avatar for WaltP
0
88
Member Avatar for jobs

I need to create a program and have it create a lock file so that only one instance of the program can be run at any one time. I came across this code: [CODE=c] for (tries = 0; tries != maxtries; ++tries) { fd = open("/tmp/some.lock.file", O_WRONLY|O_CREAT|O_EXCL, 0644); if (fd …

Member Avatar for Duoas
0
138
Member Avatar for jobs
Member Avatar for jobs
Member Avatar for jobs

Why can't you do this? [code=python] a = [] a.append('1').append('2') [/code] You can only do this: [code=python] a.append('1') a.append('2') [/code]

Member Avatar for tharippala
0
70
Member Avatar for jobs

I am looking at this recipe: [url]http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/440509[/url] When I tried to do it, doesn't work. why? [CODE]>>> from sets import Set >>> new_list = [2,34,5,5,6,6,7,2] >>> print new_list [2, 34, 5, 5, 6, 6, 7, 2] >>> new_list = Set(new_list).elems Traceback (most recent call last): File "<interactive input>", line 1, …

Member Avatar for vegaseat
0
549
Member Avatar for jobs

what is %r mean? [code=python] "%r tag requires exactly two arguments" % token.contents.split()[0] [/code]

Member Avatar for vegaseat
0
86
Member Avatar for jobs

Can someone tell me what is the different between default_age and self.default_age? Only one default_age variable is created for all instance of class Student and self.default_age means very instances of class Student gets a variable default_age? How do you specify a static class(singleton class) in python? [code=python] class Student: default_age …

Member Avatar for BearofNH
0
174
Member Avatar for jobs

Why can't I have two different link objects? I create _link and _link2 as empty objects. When I do this: _link2 = _link, it just creates alias _link2 to link object. Same object have 2 aliases _link2 and _link. Is there a way to copy the content of _link to …

Member Avatar for jrcagle
0
107
Member Avatar for jobs

[code=python] s1 ='999' s2 = '99.99' mypat = re.compile('(^([0-9]+[.]+[0-9]+)|([0-9])$)') rate= mypat.search(s1) print rate.group() >>> print rate.groups() ('9', None, '9') >>> rate=mypat.search(s2) >>> print rate.group() 99.99 [/code] I need to get price = float(rate.group()). Price=999 or Price=99.99. I think there is a problem when s1='999', when I do this: [code=python] >>> …

Member Avatar for ghostdog74
0
102
Member Avatar for jobs

Why you specify type and name of the exception in your custom exceptions, but not in python built in exceptions? except IOError: print "no file by the name ccy_rates*.txt" except MyError, e: print e.msg

Member Avatar for bumsfeld
0
79