- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
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 … |