From 12258a43a59df9d42fde2782e05b45b4f190b87a Mon Sep 17 00:00:00 2001 From: Doug-Richardson Date: Thu, 30 Mar 2017 22:02:27 -0400 Subject: [PATCH 1/3] Messing around with framework GUI Thought it would be worth uploading this small test file showcasing some application for the framework gui. I added comments to try and explain some of the functionality of how I understand some of the procedures to work. --- Gui_Exploration.rkt | 129 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 Gui_Exploration.rkt diff --git a/Gui_Exploration.rkt b/Gui_Exploration.rkt new file mode 100644 index 0000000..ff4d2d3 --- /dev/null +++ b/Gui_Exploration.rkt @@ -0,0 +1,129 @@ +#lang racket +(require racket/gui/base) +;;Step 1. Create a window to draw into +(define frame(new frame% [label "Example"])) +;;I don't know what frame% means, but new must be a procedure +;;(send frame show #t) Running this command displays the frame +;;send appears to be a command to be a procedure that takes a frame +;; followed by a command and a boolean. +;;the boolean is fed into the command in this case +;;if you said #f it would close the window +;;that is usefull +;;Below is a slight expantion on example code +;;letting the button be a toggle +(define frame2 (new frame%[label "Example2"])) +(define msg (new message% [parent frame2] [label " Nothing "])) +(define thingy #t) +(define button-to-click (new button% + [parent frame2] + [label "Click"] + [callback (lambda (button event) + (if thingy + (begin (set! thingy #f) + (send msg set-label "Something")) + (begin (set! thingy #t) + (send msg set-label " Nothing "))))])) +;;Frames are okay ish for error messages but the real stuff is +;;in canvas stuff +(define my-canvas% + (class canvas% + (define/override (on-event event) + (send msg set-label "Canvas mouse")) + (define/override (on-char event) + (send msg set-label "Canvas keyboard")) + (super-new)));;Don't know what that one means + +(define canvas-thing (new my-canvas% [parent frame2]));;unfortunately +;;we still need to re-size it manually +;;Now I wonder if we could create a procedure to make any text +;;appear +(define frame3 (new frame%[label "Example3"])) +(define blank (new message% [parent frame3] [label " "])) +(define (make-text string) (begin (send blank set-label string))) +;(send frame3 show #t) +;(make-text "Hello World") works exactly fine. +;;Now lets do something more complicated +;;We want to create a procedure that creates a new line +;;each time it is called so... +(define frame4 (new frame%[label "Example4"])) +;;now blank4 should be a procedure to create multiple lines in the frame +(define (make-text-line string) (begin (new message% + [parent frame4] + [label string]))) +;;display with +;;(send frame4 show #t) +;;add text with +;;(make-text-line "Hello World!") +;;This works for not but there are a few problems +;;first of all the window starts really small and doesn't restrict +;;resizing. Second it is always in the middle of the frame +;;Third, once text is on screen there is no way to get it off +;;But we can do better +(define frame5 (new frame% + [label "Example5"] + [width 300] + [height 300])) +(define canvas5 (new canvas% [parent frame5] + [paint-callback + (lambda (canvas dc) + (send dc set-scale 3 3) + (send dc set-text-foreground "blue") + (send dc draw-text "Don't Panic!" 0 0))])) +;;above is the example code to write some simple text, however +;;we can apply this to what we learned above to make something abit +;;more +(define frame6 (new frame% + [label "Example6"] + [width 600] + [height 700])) +(define (make-color-text string color) + (begin (new canvas% + [parent frame6] + [paint-callback + (lambda (canvas dc) + (send dc set-text-foreground color) + (send dc draw-text string 0 0 #f))]))) +;;display with +;;(send frame6 show #t) +;;write text with +;;(make-color-text "Hello World!" "purple") +;;Okay that doesn't exactly work as planned... +;;the problem with this is that each message is it's own canvas now +;;not only that but it means we can only print each line in it's +;;own color. So new plan is to make it so it adds on new strings +;;to one canvas, adding \n as nessessary. Except nevermind since +;;\n doesn't exist in this apparently + +;;Lets switch back to text and we can change it later +(define frame7 (new frame% + [label "Example7"] + [width 600] + [height 200])) +(define (make-blank-line i) + (new message% + [parent frame7] + [label " "])) +;;80 space characters +;;the i is only there to make the build-list command happy +(define Message-list (build-list 10 make-blank-line)) +;;10 make-blank-lines +;;that build-list command is super usefull for something like this +(define (move-down-list list) + (if (eq? '() (cdr list)) + '() + (begin + (move-down-list (cdr list)) + (send (car (cdr list)) set-label (send (car list) get-label))))) +(define (send-word string) + (begin + (move-down-list Message-list) + (send (car Message-list) set-label string))) +;;display with +;;(send frame7 show #t) +;;add text with +;;(send-word "Hello World") +;;Now using the send-word command I can make each word appear on the +;;screen in the place where it used to be. Starting at the top of the +;;screen and working it's way down the more text is added. +;;on the bottom line, after adding 10 lines of text, it will remove the bottom +;;most line \ No newline at end of file From ba43f1225255be0b153bd15aa4b7f10125e3511a Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sun, 2 Apr 2017 00:50:49 -0400 Subject: [PATCH 2/3] started work on README.md --- README.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a36bcf6..b684d44 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,10 @@ -# Project Title Goes Here (10 words maximum) +# Project Title Goes Here (10 words maximum): Hermes ### Statement Describe your project. Why is it interesting? Why is it interesting to you personally? What do you hope to learn? +Hermes is a multi-client chat program akin to IRC written in Racket. Building +Hermes is interesting as it exposes us to various design problems namely networking, +synchronization, scheduling, and GUI design. ### Analysis Explain what approaches from class you will bring to bear on the project. @@ -22,6 +25,11 @@ The idea here is to identify what ideas from the class you will use in carrying **Your project will be graded, in part, by the extent to which you adopt approaches from the course into your implementation, _and_ your discussion about this.** ### External Technologies +As stated previously Hermes will be designed using a client/server model. The +server instance could be running locally or on a remote machine. The same +applies for clients. We can think of the clients as connecting to an external +system, Hermes! +* authentication via databases You are encouraged to develop a project that connects to external systems. For example, this includes systems that: - retrieve information or publish data to the web @@ -32,6 +40,10 @@ You are encouraged to develop a project that connects to external systems. For e If your project will do anything in this category (not only the things listed above!), include this section and discuss. ### Data Sets or other Source Materials +We won't need to download any data sets. An artificial dataset will be generated +consisting of conversations between clients, plus any additional commands that aren't +messages for testing. + If you will be working with existing data, where will you get those data from? (Dowload from a website? Access in a database? Create in a simulation you will build? ...) How will you convert your data into a form usable for your project? @@ -41,6 +53,16 @@ If you are pulling data from somewhere, actually go download it and look at it b If you are using some other starting materials, explain what they are. Basically: anything you plan to use that isn't code. ### Deliverable and Demonstration +There are two big deliverables for this project. Code for the server(Hermes, +get it?), and the clients which not only has code for interacting with Hermes, +but also a GUI for interactivity with a user like myself. + +We plan to demonstrate Hermes by running the server code on a remote machine. +We will connect to the server via our PCs running client code. We will ssh into +the remote machine to see the server running. Since Hermes is a multichat anyone +can join in the demonstration by connecting their computers to the remote +machine! + Explain exactly what you'll have at the end. What will it be able to do at the live demo? What exactly will you produce at the end of the project? A piece of software, yes, but what will it do? Here are some questions to think about (and answer depending on your application). @@ -49,7 +71,11 @@ Will it run on some data, like batch mode? Will you present some analytical resu Will it be interactive? Can you show it working? This project involves a live demo, so interactivity is good. + ### Evaluation of Results +Evaluating Hermes is very simple. Can at least two clients hold a meaningful +conversation remotely?... + How will you know if you are successful? If you include some kind of _quantitative analysis,_ that would be good. From 0a83011cb9f3f9f05c228c5ad3137ff3d199154d Mon Sep 17 00:00:00 2001 From: Ibrahim Mkusa Date: Sun, 2 Apr 2017 00:57:40 -0400 Subject: [PATCH 3/3] updated README.md --- README.md | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index b684d44..52b79ae 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Project Title Goes Here (10 words maximum): Hermes +# Hermes ### Statement Describe your project. Why is it interesting? Why is it interesting to you personally? What do you hope to learn? @@ -109,19 +109,8 @@ Here each group member gets a section where they, as an individual, detail what Please use Github properly: each individual must make the edits to this file representing their own section of work. -**Additional instructions for teams of three:** -* Remember that you must have prior written permission to work in groups of three (specifically, an approved `FP3` team declaration submission). -* The team must nominate a lead. This person is primarily responsible for code integration. This work may be shared, but the team lead has default responsibility. -* The team lead has full partner implementation responsibilities also. -* Identify who is team lead. - -In the headings below, replace the silly names and GitHub handles with your actual ones. - -### Susan Scheme @susanscheme +### Douglas Richardson @Doug-Richardson will write the.... -### Leonard Lambda @lennylambda +### Ibrahim Mkusa @iskm will work on... - -### Frank Funktions @frankiefunk -Frank is team lead. Additionally, Frank will work on...