User Tools

Site Tools


blog:spring2016:dsaunde6:journal

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
blog:spring2016:dsaunde6:journal [2016/02/08 04:47] dsaunde6blog:spring2016:dsaunde6:journal [2016/04/21 03:51] (current) dsaunde6
Line 40: Line 40:
  
 ..the list goes on. It's simply a powerful messaging system that lives up to it's expectations and then some. ..the list goes on. It's simply a powerful messaging system that lives up to it's expectations and then some.
 +
 +====MARCH 13, 2016====
 +===Go: Good for systems & web programming===
 +Go is a relatively new programming language. With design cues from the original creators of C, Go was designed to be a modern successor, with garbage collection, documentation system, and most importantly, concurrency. In a world with growing demands and the fall of Moore's law, concurrency is playing a huge part in the modern world of programming. As expected, Go has excellent systems programming capabilities, just as C does. But unlike C, Go also excels in the field of web programming, which C tends to have difficulties with when using standard library components. For example, a wiki like this one can be contained in a [[https://golang.org/doc/articles/wiki/final.go|single file]]:
 +<file go>
 +// Copyright 2010 The Go Authors. All rights reserved.
 +// Use of this source code is governed by a BSD-style
 +// license that can be found in the LICENSE file.
 +
 +package main
 +
 +import (
 + "html/template"
 + "io/ioutil"
 + "net/http"
 + "regexp"
 +)
 +
 +type Page struct {
 + Title string
 + Body  []byte
 +}
 +
 +func (p *Page) save() error {
 + filename := p.Title + ".txt"
 + return ioutil.WriteFile(filename, p.Body, 0600)
 +}
 +
 +func loadPage(title string) (*Page, error) {
 + filename := title + ".txt"
 + body, err := ioutil.ReadFile(filename)
 + if err != nil {
 + return nil, err
 + }
 + return &Page{Title: title, Body: body}, nil
 +}
 +
 +func viewHandler(w http.ResponseWriter, r *http.Request, title string) {
 + p, err := loadPage(title)
 + if err != nil {
 + http.Redirect(w, r, "/edit/"+title, http.StatusFound)
 + return
 + }
 + renderTemplate(w, "view", p)
 +}
 +
 +func editHandler(w http.ResponseWriter, r *http.Request, title string) {
 + p, err := loadPage(title)
 + if err != nil {
 + p = &Page{Title: title}
 + }
 + renderTemplate(w, "edit", p)
 +}
 +
 +func saveHandler(w http.ResponseWriter, r *http.Request, title string) {
 + body := r.FormValue("body")
 + p := &Page{Title: title, Body: []byte(body)}
 + err := p.save()
 + if err != nil {
 + http.Error(w, err.Error(), http.StatusInternalServerError)
 + return
 + }
 + http.Redirect(w, r, "/view/"+title, http.StatusFound)
 +}
 +
 +var templates = template.Must(template.ParseFiles("edit.html", "view.html"))
 +
 +func renderTemplate(w http.ResponseWriter, tmpl string, p *Page) {
 + err := templates.ExecuteTemplate(w, tmpl+".html", p)
 + if err != nil {
 + http.Error(w, err.Error(), http.StatusInternalServerError)
 + }
 +}
 +
 +var validPath = regexp.MustCompile("^/(edit|save|view)/([a-zA-Z0-9]+)$")
 +
 +func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
 + return func(w http.ResponseWriter, r *http.Request) {
 + m := validPath.FindStringSubmatch(r.URL.Path)
 + if m == nil {
 + http.NotFound(w, r)
 + return
 + }
 + fn(w, r, m[2])
 + }
 +}
 +
 +func main() {
 + http.HandleFunc("/view/", makeHandler(viewHandler))
 + http.HandleFunc("/edit/", makeHandler(editHandler))
 + http.HandleFunc("/save/", makeHandler(saveHandler))
 +
 + http.ListenAndServe(":8080", nil)
 +}
 +</file>
 +With efficiency like that, Go is able to handle [[http://marcio.io/2015/07/handling-1-million-requests-per-minute-with-golang/|HUGE]] amounts of traffic. Popular solutions such as PHP or Ruby on Rails tend to struggle more when it comes to traffic of that density.
 +In summary, Go is a powerful, fast, and modern nod to C.
 +
 +====APRIL 4, 2016====
 +===Reddit's "Robin" chat system is an effective concept===
 +[[http://reddit.com/robin|Robin]], a product of a reddit April Fool's Day joke, is incredibly popular. Users decide whether to //stay//, //grow//, or //abandon// the room, with those who abstain from voting automatically opting with //abandon//. When a majority choose to //stay//, the room becomes a subreddit containing all the users who participated in the room. When the majority choose to //grow//, the room will merge after a period of time with a room of similar size. These rooms can be huge, as I was in one with over 1000 users. The largest right now is 3000 users. But what is unique about this chat system is that it encourages unity between the choices of users and adding a competitive aspect to communication. Even though it's scheduled to end April 8, I am looking forward to a permanent solution.
 +, a product of a reddit April Fool's Day joke, is incredibly popular. Users decide whether to //stay//, //grow//, or //abandon// the room, with those who abstain from voting automatically opting with //abandon//. When a majority choose to //stay//, the room becomes a subreddit containing all the users who participated in the room. When the majority choose to //grow//, the room will merge after a period of time with a room of similar size. These rooms can be huge, as I was in one with over 1000 users. The largest right now is 3000 users. But what is unique about this chat system is that it encourages unity between the choices of users and adding a competitive aspect to communication. Even though it's scheduled to end April 8, I am looking forward to a permanent solution.
 +
 +====APRIL 20, 2016====
 +===Ubuntu MATE: A GNOME legacy worth using===
 +[[http://ubuntu-mate.org|Ubuntu MATE]] is an excellent //Ubuntu//-based distribution for both the beginner and expert Linux user. "That's a bunch of nonsense!", you might say - but hear me out, there's some decent points I have to make. I should start with the fact that even though MATE is considered "new", the code itself is fairly mature, considering MATE is a progression of the //GNOME 2// desktop environment. MATE "happened" because the changes that GNOME 3 brought to the table were considered to be an overall nuisance, with a troubling user interface, much higher resource demands, and a now **required** dependency on //systemd//, which by itself has created a lot of controversy and anger among the Linux community. MATE sticks to a traditional desktop design that many are familiar with and enjoy using. This causes less confusion with beginners and allows for more productivity among the experts as there is less resource demand (useless visual effects). Point said, MATE has a very mature/stable codebase and has a setup that is familiar to the beginner and friendly to the expert. Also of note is that MATE is very "tweakable", having a reputation similar to that of //XFCE// and //KDE//. One can easily change the appearance and mechanics of their desktop environment, and allow for basic visual effects and panel plugins. This allows for countless setups that are tailored to the demands of the user. One could say MATE fills the void between KDE and XFCE - more lightweight than KDE but prettier and easier to use than XFCE. Continuing on, MATE is very portable without the systemd requirement and the lightweight footprint, allowing it to not only be used on Linux distributions but //*BSD// systems as well. This works well for those who enjoy a more "traditional" UNIX environment. Even though Ubuntu MATE does use systemd and Linux, it does provide Ubuntu's powerful fork of APT and all software associated with it, with thousands of software packages available with a couple keystrokes and maybe some mouse usage. Overall, Ubuntu MATE is worth a try.
blog/spring2016/dsaunde6/journal.1454906839.txt.gz · Last modified: 2016/02/08 04:47 by dsaunde6