This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Graph | |
Vertex = Struct.new(:name, :neighbours, :dist, :prev) | |
def initialize(graph) | |
@vertices = Hash.new{|h,k| h[k]=Vertex.new(k,[],Float::INFINITY)} | |
@edges = {} | |
graph.each do |(v1,v2,dist)| | |
@vertices[v1].neighbours << v2 | |
@vertices[v2].neighbours << v1 | |
@edges[[v1,v2]] = @edges[[v2,v1]] = dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. .. get_env_details initialize postactivate postdeactivate postmkproject postmkvirtualenv | |
postrmvirtualenv preactivate predeactivate premkproject premkvirtualenv prermvirtualenv py3 | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import java.net.*; | |
public class myservertimeout { | |
private static final int LISTEN_PORT = 9000; | |
private static final int ACCCEPT_TIMEOUT = 5000; | |
private static final int READ_TIMEOUT = 5000; | |
public static void main(String[] args){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
/** | |
* myclienttimeout | |
*/ | |
public class myclienttimeout { | |
private static final String SERVER_HOST = "localhost"; | |
private static final int SERVER_PORT = 9000; | |
private static final int CONNECT_TIMEOUT = 5000; // [ms] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
/** | |
* myclient | |
*/ | |
public class myclient { | |
private static final String SERVER_HOST = "localhost"; | |
private static final int SERVER_PORT = 9000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
import java.io.*; | |
import java.net.*; | |
/** | |
* myserver | |
*/ | |
public class myserver { | |
private static final int LISTEN_PORT = 9000; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "apue.h" | |
#define BUFFSIZE 4096 | |
int | |
main(void) | |
{ | |
int n; | |
char buf[BUFFSIZE]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "apue.h" | |
#include <fcntl.h> | |
char buf1[] = "abcdefghij"; | |
char buf2[] = "ABCDEFGHIJ"; | |
int | |
main(void) | |
{ | |
int fd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <errno.h> | |
int | |
main() | |
{ | |
int sock; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
int | |
main() | |
{ | |
int sock; |