- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
54 Posted Topics
Hello, how does an Interpreter work ? I read up on it and it seems you just parse each line and then (somehow) execute the lines. I suppose the code needs instructions on how to execute each line ? | |
When I have a simple server-client code, how do I get the client to send the server a time request and the server responds, and the client then displays the offset and the delay ? The communication should be in NTP. I think that means there are 4 time stamps, … | |
I have a few questions. Server-client code with a (distributed) hash table. Give the peers their own port, own node-ID, predecessor and successor ( node-ID, IP and port of them). That's a snippet of it. port= argv[1]; ownNodeID = atoi(argv[2]); sucNodeID = atoi(argv[3]); sucIP = argv[4]; sucPort = argv[5]; preNodeID … | |
I have a small code utilizing a hash table. Now I want to convert it, basically, to a distributed hash table. Hoever, I can not find out how you actually code one or what changes you make to an existing hash table...??? Can anyone please help me, please? I can … | |
It's a server-client code. The client should wait for the server, and if there's no response, then send a new request. There's a 2 second wait. It's UNIX. I've been looking at some select() examples, but I'm not really sure... I found this example. #include <sys/types.h> #include <sys/socket.h> #include <sys/time.h> … ![]() | |
If I want to have a datagram socket, what do I have to change here ? It's a stream socket right now. Just change it where it creates the socket ? `sockfd = socket(PF_INET,SOCK_STREAM,0);` | |
I found this site http://www.guyrutenberg.com/2007/09/22/profiling-code-using-clock_gettime/ If I have a server-client code and this: clock_gettime(CLOCK_REALTIME, &time_a); // create socket clock_gettime(CLOCK_REALTIME, &time_b); // close socket If I have a and b wand want to measure the time it takes to communicate, what's the best way ? Still not fully understanding the exact … | |
I have some experience with client-server codes. TCP and udp client. I want to know how a stream socket works with HTTP. This client is for a server-client code where the greatest common divisor is calculated and displayed. #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <errno.h> #include <string.h> #include <sys/types.h> … | |
I want to create a simple stream socket server. I haven't found a website that explains it well. So how do I create a simple stream server ? One connection is fine. | |
Hello, Billabong is just a small board game. You have kangaroos that you move clockwise around a lake. It looks like this: http://www.deskovehry.com/fotky/billabong/billabong-06.jpg First you need to draw the board etc. The example looks like this: static private void printField(String[][] field) { System.out.print(" "); String letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; for (int … | |
I'm new to Python, but I can use a library to do this, right? Like this one: import pprint import scipy import scipy.linalg # SciPy Linear Algebra Library A = scipy.array([ [7, 3, -1, 2], [3, 8, 1, -4], [-1, 1, 4, -1], [2, -4, -1, 6] ]) P, L, … | |
Hello, I'm looking for a CSV parser and I found this example.... package com.ibm.ccd.api.samplecode.parser; import java.io.BufferedReader; import java.io.StringReader; import java.util.ArrayList; public class CSVParser { String oneRes; private String line = ""; private int nbLines = 0; private BufferedReader reader; public CSVParser(BufferedReader reader) { this.reader = reader; } public String[] splitLine() … | |
To be honest, my programming skills stink. The College textbook I have been using dosen't do it for me. And I learn better by looking at examples. However, I have not been able to find a website that offers an extensive archive of C++ code examples. From the basics such … | |
I can nto find anything that explains semaphores well. From what I understand, you can create an array of the type sem_t , for instance. Like a "semaphore array", I guess. And you use loops somehow to create them. Or can somebody explain this to me, please? I'm trying to … | |
for i := 1 to n do for j := 1 to n do C[i, j] := A[i,j] + B[i, j] #include <iostream> #include <iomanip> using namespace std; int SIZE = 10; double Sum(double matrixA[SIZE], double matrixB[SIZE]) { int i = 0; int j = 0; double rows, columns; double … | |
import java.util.Arrays; public class binary_search { public static void main(String[] args) { int ar1[] = new int[128]; int p, key=78; p=Arrays.binarySearch(ar1, key); System.out.println("element found at index "+p); Arrays.sort(ar1); p=Arrays.binarySearch(ar1, key); long start = System.currentTimeMillis(); Long elapsed = System.currentTimeMillis() - start System.out.println("Time to do stuff (in milliseconds): " + elapsed ); … | |
I'm having difficulties writing the rpc function. Specifically, I don't know how to pack a function name and input argument into a message body, send the message, set and unpack reply, and return result and error code. I know how to create the socket, request aconnection from the server etc. … | |
How di I use I/O redirection to load the input into an array ? % a.out < inputfile That's what I found. I don't know if that's all you need or if there's more.. | |
I was told you can access the index of an array and save it in a variable. Like, as you know, every element is referenced by an index number. 0,1,2,3,4 etc.. I don't want to save the content, I need the index number. I will need to know the position … | |
The input looks like this: Start 0 Run 40 Disk 0 Run 20 End Each word and number means something. The number is the time and the word a command. What's the best way to loop through it and evaluate it? So it's 2 different elements per line that should … | |
I have a linked list where the input is read into. The 2 types of input have to go into a queue. 1 queue for each type. I suppose that the output line of the linked list can be used to read it into the queue ? I know it … | |
I think this has something to do with process scheduling. (1st process) Start 0// starts at 0ms Run 10 // runs for 10 ms Disk 0 // no idea what this does, but it takes 10 ms Run 30 // run 30 ms End // terminates (2nd process) Start 5 … | |
How many lines will the following codes print out, and why? main() { fork(); printf ("Hello!\n") fork(); printf("Good Bye!\n"); } // main What's the fork() doing here? Does it change the number of lines that will be output? > > The purpose of fork() system call is to create a … | |
Ok, so I'm trying to fix this.. [CODE]# include <cstdlib> # include <iostream> # include <iomanip> # include <cmath> # include <omp.h> using namespace std; int main ( void ); void jacobi ( int n, double a[], double b[], double x[], double x_old[] ); void r8vec_uniform_01 ( int n, int … | |
Does anybody know of a good site where I can learn how to do linked lists and use multiple linked lists together? The sites I found weren't any good. I'm not getting it. I'm just the kind of person who needs to get it spoon-fed and detailed sometimes.. I would … | |
I'm talking about Flow of Control, Functions, Parameters, overloading, arrays, classes, Pointers and dynamic data structures,exception handling, operator overloading and perhaps including linked data structures. I am not liking the programming exercises the book has at the end of each chapter. But I will have to program something to really … | |
I read that you can use a while loop to read the input from a text file and create a doubly linked list? How do I do that? I would appreciate if someone could show me. Thank you! | |
I'm trying to code something that's a little complex, imo. It's a C++ program that will count the number of operations of recursive functions and will compare it with O(g(n)). This count value will basically estimate time complexity function T(n). You have to find the g(n) to get O(g(n)) that … | |
Hi, how do I exactly do this? [quote]1) Read an integer from the input. (Reading will automatically stop after the first non-digit character, accounting for possible sign characters.) 2) DO read the next character WHILE the read character is whitespace, then validate it as an operator and store it. 3) … | |
Ok, I've asked something similar before, but I still have not been able to understand this... so I just want to have a txt file with math operations in it. Basically, it's just integers multiplies and added. Nothing else. 1*5+10 10+12 Each line can contain any multiplication or addition. The … | |
The input is in a text file and it being read by the code and stored in "line" by using getline. The input is just math operations.. 1*8+2 etc. Only * and +, nothing else. But the file can also contain invalid strings such as "1++" "1+2*+4" "2 + A … | |
Let's say I have a string with 1+5*9+4 etc.. whatever it may be. How do I use C++ do calculate this? I know recursive functions work here, but how? I figured I could loop ..searching for the * first ( higher precedence ) and then the +. No idea. Would … | |
Ok, I want to read integers from a text file...a large sum of integers. The input is a regular text file, where each line is terminated with an end-of-line character. The file is gonna contain any valid ASCII symbol between 32 and 127. A number of strings ( no negative … | |
I did this code ( this here is just a piece of it), and there's supposedly an incomplete function in there. I'm not sure what how to solve this. I suppose the boolean is wrong? I indicated where the problem is in the code. [code] public class Person { private … | |
Hello, I would like to have a program that solves Gaussian elimination. I need it for reference, I think it would be nice to have a tool like this. Now, I know there are many codes I could use online, but I need a code that formats my equation. Like, … | |
So, I have this array and pointer: char array [6]; char *ptr; And this list of array [6] addresses and contents: 0x5010 a 0x5011 b 0x5012 F 0x5013 H 0x5014 X 0x5015 Y I'm looking for the values of the following: a) &array[0] b) array[0] c) *ptr d) (*ptr)+2 e) … | |
So, I have to store ( in a variable?) the number as a Roman Numeral ( M = 1000, D=500 etc.) Convert it to decimal and store in decimal. Print the number as a Roman numeral or decimal number as requested by the user. I suppose it's 2 separate functions, … | |
I'm still a beginner, so please bear with me;) I'm supposed to write a code that generates the Fibonacci series. Here is the sample program output: Please enter n (This program generates 0 to Fn) : 5 0 1 1 2 3 5 So, that's what I did.. [CODE] .data … | |
I'm trying to do the following using a linked list. [quote] delete("is",2) print 1:This 2:is 3:an 4:an 5:icorrect 6:sntence delete("an",3) print 1:This 2:is 3:an 4:icorrect 5:sntence delete("icorrect",4) print 1:This 2:is 3:an 4:sntence insert("incorrect",4) print 1:This 2:is 3:an 4:incorrect 5:sntence delete("sntence",5) insert("sentence",5) print 1:This 2:is 3:an 4:incorrect 5:sentence neighbors("is") 2:is previous:This … | |
I'm trying to code a sentence editor. So, basically the input comes form a file, and the code sorts the words. The input in the file is I not do know, theoutput is I do not know. This is what's gonna be in the input file, but it can be … | |
Ok, I'm wanting to do the following... A C++ program that can edit a sentence with word insertions and deletions. You can assume the sentence has words and numbers separated by spaces and punctuation symbols. The input is a regular text file, where each line is terminated with an end-of-line … | |
I want to do the following: [quote] You will create a C++ program that will count the number of operations of two common recursive functions.This operation count will be basically estimate time complexity T(n). You have to find the g(n) to get O(g(n)). The program takes as input n, some … | |
Hello, the compiler has a problem with my "std::string line". It's in there twice, but I didn't know how else to do it. The program is like a lexical analyzer. What's the best way to fix this? [code] #include <iostream> #include <fstream> #include <string> #include <iostream> #include <string> #include <cctype> … | |
It's a program that works sort of like a lexical analyzer, but it's just supposed to pull any given data from a .txt file and display it. Nothing else. I'm not satisfied with the array I have so far. /**************************************************************** Array holding all keywords for checking. *****************************************************************/ char *keywords[]={"procedure","is","begin","end","var","cin","cout","if", "then","else","and","or","not","loop","exit","when", … | |
Hello, it's been a while since I took my last programming class, and I must say I don't know how to do the following. I want to create a program that pulls data from a txt file and then lists that data. The data is simply C++ variable names, reserved … | |
Helllo, I am supposed to do the following: [quote] Mathematically, a set is said to be consists of well-defined elements. For instance, the following are well-defined sets. A = {1, 2, 3, 4, 5, 6, 7} B = {2, 3, 4, 8, 9} A set may be described using other … | |
Hello, I got an car inventory program that stores the names of cars etc. I thin a class arraylist would work better. Like an array that can "grow" and "shrink". But I do not know how to convert the code from array to arraylist. It should still keep the member … | |
Hello, I'm trying to do the following program in JAVA. I find JAVA very confusing. Liked C++ much better. Anyway, here's what I'm trying to do: [quote] Develop a program for a small auto dealership. This program will keep track of the auto inventory using an object of the class … | |
Hello, These 3 codes had 5 syntax errors in each of them, but I don't think I found them all. Can somebody help me with this? [code] class AA { public: void print( ) const; int sum(); AA(); private: int x; int y; }; class BB { int one; int … | |
Hello, I need some help with this code. First of all, the program just closes after I enter the rows. It's not supposed to do that. Then, the coordinates (cards) 1,1 and 2,3 need to face up when I start it. How do I do that? I hope someone can … |
The End.