Moran Assaf Andrew DiBiasio December 6, 2014
In our busy everyday lives, we find ourselves overwhelmed with the amount
of information that we need to keep track of. The Desktop Notification Gadget, or DNG,
application enables you to view your most recent emails and updates and provides weather forecast on a daily basis. This will allow users to not only keep track
of new information they need to attend to in the digital world, but also to plan their day/week by being aware of the upcoming weather forecast.
Tab one which contains emails.
Tab two which contains weather forecast.
- Data abstraction is used to access the user's emails and the weather using http requests.
- lambda is used to create many of our callback functions.
- lists are used to sort the email headers.
- map filter foldr and foldl are used to retrieve emails and to convert emails to strings.
External Technology and Libraries
- net/http-client json This is a json library for handling json. It was needed for our weather feature.
- srfi/13/string This is a string processing library needed to search the users inbox.
- racket/list openssl/mzssl net/imap net/head Needed to establish a SSL connection (secure connection to outlook.com)
- prefix-in htdp: 2htdp/image Is used for our weather images.
- racket/gui/base This library was used to create our GUI.
Along with these Racket Libraries, we also made use of the openweathermap API. This along with the Racket Library net/http-client json allowed us to obtain the information needed
to create a weather forecast for the users given location.
Favorite Lines of Code
Moran's Favorite Line:
(require net/http-client json) ;json library for handling json (define (get-weather-json place) (let-values ([(status header response) (http-sendrecv "api.openweathermap.org" (string-append "/data/2.5/weather?q=" place))]) (read-json response))) (define (get-weather place) (let* ([json (get-weather-json place)] [main (hash-ref json 'main)] [temp (hash-ref main 'temp)] [tempF (round (+ (* 1.8 (- temp 273.15)) 32))] [weather (car (hash-ref json 'weather))] [type (hash-ref weather 'main)] [description (hash-ref weather 'description)] [icon (string-append "http://openweathermap.org/img/w/" (hash-ref weather 'icon) ".png")]) (list place tempF type description icon)))
This code successfully adds our weather feature using the api.openweathermap.org API. I chose this as my favorite line of code because the weather feature was a feature that we did not think we were going
to have time to complete. Completing it successfully and on-time was a rewarding feeling and that is why it is my favorite piece of code.
Andrew's Favorite Line:
(define tabs-panel (new tab-panel% [choices (list "Emails" "Weather")] [parent main-frame] [callback (lambda (tp e) (case (send tp get-selection) ((0) (send tp change-children (lambda (children) (list tab1-panel)))) ((1) (send tp change-children (lambda (children) (list tab2-panel))))))]))
I chose this as my favorite line of code because it is something I thought to add in near the very end of our project. Adding panels to our GUI design was a simple choice that truly made our GUI look and function better.