This file contains hidden or 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
| /** | |
| * Given the file descriptor this function, | |
| * writes A, waits 2 second, writes "c," | |
| */ | |
| void child_one_func(int fd){ | |
| write(fd, "A - 1", 5); | |
| sleep(2); | |
| write(fd, "C - 3", 5); | |
| close(fd); |
This file contains hidden or 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
| int main(){ | |
| /** | |
| * Create the epoll() | |
| * | |
| * From man pages | |
| * Since Linux 2.6.8, the | |
| * size argument is ignored, | |
| * but must be greater than zero; | |
| */ |
This file contains hidden or 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
| int main(){ | |
| /* Create the kqueue() */ | |
| int kq = kqueue(); | |
| /* Double-array of fds for the pipe() */ | |
| int **fds = malloc(2 * sizeof(int *)); | |
| /* Create an array for the changelist and eventlist kevent structs */ | |
| struct kevent *evlist = malloc(sizeof(struct kevent)); |
This file contains hidden or 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
| void OpenBKZ::on_graphicsView_rubberBandChanged(const QRect &viewportRect, const QPointF &fromScenePoint, const QPointF &toScenePoint){ | |
| /* Code */ | |
| } |
This file contains hidden or 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
| void OpenBKZ::on_graphicsView_rubberBandChanged(const QRect &viewportRect, const QPointF &fromScenePoint, const QPointF &toScenePoint){ | |
| /** | |
| * fromScenePoint.y() & fromScenePoint.x() are zero upon release, | |
| * I.E when the user has finished their highlighting. | |
| */ | |
| if(fromScenePoint.y() != 0 && toScenePoint.y() != 0){ | |
| this->start = toScenePoint.y(); | |
| this->end = fromScenePoint.y(); | |
| return; |
This file contains hidden or 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
| searchWord(){ | |
| if(this->end_search < this->start_search){ | |
| int temp = this->start_search; | |
| this->start_search = this->end_search; | |
| this->end_search = temp; | |
| } | |
| this->start_search /= (this->fontsize / 2); | |
| this->end_search /= (this->fontsize / 2); |
This file contains hidden or 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
| errorAdjustment(QString line){ | |
| QString check(line); | |
| int space = line.size() / (2 * fontsize); | |
| line.remove(this->end_search + space, 85); | |
| line.remove(0, this->start_search - space/2); | |
| QStringList term = line.split(' ', QString::SkipEmptyParts); | |
| QStringList words = check.split(' ', QString::SkipEmptyParts); |
This file contains hidden or 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
| def LS(array): | |
| sumxy = 0.0 | |
| sumx = 0.0 | |
| sumy = 0.0 | |
| sumxx = 0.0 | |
| x = 0 | |
| y = 1 |
This file contains hidden or 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
| int sock_fd = socket(AF_INET, SOCK_STREAM, 0); | |
| struct addrinfo directives, *result; | |
| memset(&directives, 0, sizeof(struct addrinfo)); | |
| directives.ai_family = AF_INET; | |
| directives.ai_socktype = SOCK_STREAM; | |
| directives.ai_flags = AI_PASSIVE; | |
| /* Translates IP, port, protocal into struct */ | |
| if(0 != getaddrinfo(NULL, "8080", &directives, &result)) |
This file contains hidden or 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
| int sock_fd = socket(AF_INET, SOCK_STREAM, 0); | |
| struct addrinfo info, *result; | |
| memset(&info, 0, sizeof(struct addrinfo)); | |
| info.ai_family = AF_INET; | |
| info.ai_socktype = SOCK_STREAM; | |
| if(0 != getaddrinfo("localhost", "8080", &info, &result)) | |
| exit(1); | |