Wednesday, August 21, 2019

Functional Program Design in Scala


The second class in the Scala specialization down. I was a little put off by the fact that this is basically a retooled/abridged version of the "Functional Reactive Programming" class, which made it feel incomplete. Regardless, the programming exercises were fun, if a bit lightweight. The lecture material was ... meh.

My solutions on Github: FunctionalProgramDesignScala


Wednesday, July 24, 2019

How to install OpenToonz and Synfig on a Chromebook

Backstory

I've wanted to dabble in digital art for some time now, and I finally got up the motivation to play around with it a bit on my dinosaur laptop. My 8 year old was showing some interest in drawing, and I thought she might have fun doing animation, so I started looking around for animation software. I found several programs, including opentoonz, synfig, and pencil2d. While she was immediately fascinated (and almost just a quickly lost interest), I was annoyed by how difficult it was to try to draw anything with a mouse.

Not long ago we had replaced my wife's aging Lenovo Twist with a Lenovo C330 Chromebook. For under $250 it was quite adequate for her needs. Being that it was a touch screen device, I thought it might be better suited for digital art, so I began looking into whether the programs I'd installed in Ubuntu could be used on it. There wasn't a Chromebook version, per se (boo), but it turns out that Chromebooks can now run Linux apps (yay!), but only if they have a version for ARM processors (boo).  "Welp," I thought, "guess I'll just have to see about building from source." How hard could that be, right?

For any non-techies who just want this to work, don't be scared. It's actually pretty straight forward...

Sunday, April 7, 2019

Generating a bigram language model from the Wikipedia corpus

Motivation


While working through the Scala Principles class, the final unit had an example exercise that involved creating a "mnemonic" for a telephone number by mapping the number to an English "phrase". While a fun exercise, I was unsatisfied with the naive generation of mnemonic phrases. Yes, you could get "Scala is fun" for 7225247386, but you also get:
  • sack air fun
  • pack ah re t
  • pack bird to
  • Scala ire to
  • rack ah re to
  • pack air fun
  • sack bird to
  • rack bird to
  • sack ah re to
  • rack air fun

... which are decidedly less helpful. I thought that if I could implement even a simplistic language model, like a bigram model, to the options, and then rank them, I could make the output a little more useful. So I went looking for some bigram data, and eventually ran across a Wikipedia corpus on corpusdata.org.  The second paragraph points out that prepping the data yourself is hard work and would require many hours, so paying them $295 for it is a steal. Challenge accepted mofos.

Functional Programming Principals in Scala

After a long break (Advanced Algos took a lot out of me), I decided it was time to take another class. When the topic of taking the Scala series of classes from Coursera came up in my programming group, I jumped at the chance. I needed a break from theory, and a chance to do some coding in a new language was just the ticket. This post covers the first course in the series, "Functional Programming Principles in Scala". tl;dr: Take this course, it's great!


Monday, December 10, 2018

Harvard COMPSCI 224 - Advanced Algorithms

For a long time I've been eyeing Jelani Nelson's Advanced Algorithms class. It's taken me a while to convince myself I was prepared to understand the material, and it's taken me even longer to convince myself I had the time to get back into self studying computer science courses. Per my usual MO, I'm supplementing the lectures from Nelson's class with some lectures from MIT on the subject, though those have more of a bootleg feel to them.  Hoping it will be quality content nonetheless.

The goals of the course are to look at different ways to analyze algorithms, and use different "models" to think about algorithms.

Harvard COMPSCI 224:
MIT Advanced Algorithms (6.854): 

Monday, September 24, 2018

Learning Python

Several months ago I embarked on a project at work that made me question my decisions in life.  Well, ok, that's a bit melodramatic.  But it definitely made me question my choice of programming languages.  I thought I had on my hands a simple, straight forward problem.  Loop a couple arrays, can a handful of command line utilities.  Oh I know, I'll use shell script (bash)!  It was not long before I was asking what I'd gotten myself into.

I was too far in to turn back, and I ended up with a 1000+ line monstrosity over a handful of files.  I hated bash... seeing my kludgy attempts at modularity made me want to claw my eyes out. The first few lines of every function were devoted to parsing the parameters. It was an unholy mess, and I knew I needed something better.  I knew I needed Python (ironically, I ended up rewriting it in Java, funny how things work out)...

I put together this post to describe my experience with several learning resources I took advantage of.

Tuesday, May 1, 2018

The Command Line as a Gaming Platform: ANSI Graphics and Midi Music

Introduction


Last September (2017) I got the bright idea that it would be fun to make a game for the command line. I wanted it to be graphical, but only using basic text characters (charmap is my good friend).  I messed around with it a bit in .NET and posted some experimental code to GitHub, and got as far as generating box drawings based on text files:


Tuesday, March 27, 2018

MIT 6.042 - Mathematics for Computer Science (Incomplete)

Back, oh, probably in September 2017 or so, a couple of MOOC buddies and I decided we wanted to tackle 6.042 together.  For my part, I felt that having a better understanding of the underlying principles of proofs would be a huge boon when tackling advanced CS courses that lean on them heavily.  Thinking back to 6.006 in particular, when going through CLRS (which is very proof heavy), I think I would have benefited from better fundamentals in this area.  So, as is my habit, I'm keeping a log of my experience here;  part notes, part stream of consciousness reflection.

We're mostly following the 2015 version of the course, however I really enjoy the 2010 lectures by Tom Leighton, so I'm double dipping a bit there.  The most natural way to divide up the coursework is by "week", corresponding to each of the 12 psets.  We decided on Overleaf for document creation and collaboration, as we agreed it would be best to suck it up and learn a bit of LaTeX if we wanted to get the full "genuine" experience with the pset "submissions".

Index for 2015 course: link
Discrete Math playlists that were helpful:




Thursday, January 25, 2018

Microsoft 70-487: Secure a Web API

Exam Objectives

Implement HTTPBasic authentication over SSL; implement Windows Auth; prevent cross-site request forgery (XSRF); design, implement, and extend authorization and authentication filters to control access to the application; implement Cross Origin Request Sharing (CORS); implement SSO by using OAuth 2.0; configure multiple authentication modes on a single endpoint


Quick Overview of Training Materials


My code samples are here: GitHub


Tuesday, January 23, 2018

Sunday, January 21, 2018

Microsoft 70-487: Implement a Web API

Exam Objectives

Accept data in JSON format (in JavaScript, in an AJAX callback); use content negotiation to deliver different data formats to clients; define actions and parameters to handle data binding; use HttpMessageHandler to process client requests and server responses; implement dependency injection, along with the dependency resolver, to create more flexible applications; implement action filters and exception filters to manage controller execution; implement asynchronous and synchronous actions; implement streaming actions; implement SignalR; test Web API web services


Quick Overview of Training Materials

Exam Ref 70-487 - Chapter 4.2
[Book] Designing Evolvable Web API's with ASP.NET - Chapter 13 (Model binding)
[MSDN] Web API Documentation:
   - JSON and XML Serialization in ASP.NET Web API
   - Content Negotiation in ASP.NET Web API
   - Parameter Binding in ASP.NET Web API
   - HTTP Message Handlers in ASP.NET Web API
   - Dependency Injection in ASP.NET Web API 2
   - Exception Handling in ASP.NET Web API
   - Testing and Debugging ASP.NET Web API
[MSDN] ASP.NET Web API 2: Http Message Lifecycle poster
[Blog] Web API 2 using ActionFilterAttribute ...
[Blog] ASP.NET MVC and Web API - Comparison of Async / Sync Actions
[CodeProject] Web API Thoughts 1 of 3 - Data Streaming
[CSharpCorner] Asynchronous Video Live Streaming with ASP.NET Web APIs 2.0
[Blog] Testing routes in ASP.NET Web API

Tuesday, January 16, 2018

"Effective Java" book outline

Effective Java was written by Joshua Bloch in 2001, and the second edition released in 2009 shortly after the release of Java 6.  I received a copy of the second edition from my manager as recommended reading.  While it was sometimes a little dated, it still made for easy reading, and it felt like most of the recommendations would still be pretty relevant.  As it happens, there is now a third edition that covers Java 7, 8, and 9 which may be worth checking out...

Overall I was impressed with the advice given in the book.  In order to make better practical use of it, I wanted to create a basic "outline" view that I could easily find and scan, making reference back to the book if needed.  That is really all this post is.  I thought about adding "notes"... either to each item or to each section, but they just cluttered it up.  I want this to be more a quick cheat sheet of the guidelines, not a full blown Readers Digest edition of the book...


Friday, December 29, 2017

Resources for diving into Git internals

One of the things my boss asked me to do before I leave Farm Bureau for the bustling Bay Area was to put together some resources related to using Visual Studio Team Services.  One of my co-workers on the database team also asked me to put together some resources for learning git.  So, to that end, I pieced together a few things that would make my absence less disruptive. 

As part of the process, I ended up uncovering a few presentation that delved pretty deep under the covers.  Now, these are lessons that are best consumed by one who is already pretty familiar with git basics, but I think the reward is a deeper, richer understanding of git behavior that can make us more effective with the tool. I'm not going to rehash everything that is in the videos (just watch the videos, they're excellent), I'll just provide a link and a brief synopsis.


Tuesday, November 7, 2017

Microsoft 70-487: Design a Web API

Exam Objectives

Define HTTP resources with HTTP actions; plan appropriate URI space, and map URI space using routing; choose appropriate HTTP method (get, put, post, delete) to meet requirements; choose appropriate format (Web API formats) for responses to meet requirements; plan when to make HTTP actions asynchronous; design and implement routes


Quick Overview of Training Materials



Friday, October 20, 2017

Microsoft 70-487: Configure a web application for deployment

Exam Objectives

Switch from production/release mode to debug mode; use SetParameters to set up an IIS app pool; set permissions and passwords; enable and monitor ASP.NET App Suspend; configure WCF endpoints (including HTTPS protocol mapping), bindings, and behaviors; transform web.config by using XSLT (for example, across development, test, and production/release environments); configure Azure configuration settings


Quick Overview of Training Materials

Exam Ref 70-487 - Chapter 5.3
[MSDN] How to: Set Debug and Release Configurations
[MSDN] Understanding Build Configurations

[MSDN] Configuring Parameters for Web Package Deployment
[MSDN] Web Deploy Parameterization
[TechNet] Using declareParam and setParam
[Blog] MSDeploy with Declare and Set parameter files

[MSDN] Configuring Permissions for Team Build Deployment
[MSDN] Basic Security Practices for Web Applications
[MSDN] Best practices for deploying passwords
[Blog] Davidson Sousa - Setting folder permissions using Web Deploy
[Blog] Sayed Hashimi - Setting Folder Permissions on Web Publish
[Blog] Kevin Leetham - Modifying directory permissions with Web Deployment

[MSDN] Enable and monitor ASP.NET App Suspend on Windows Server 2012 R2
[MSDN] ASP.NET App Suspend – responsive shared .NET web hosting

[MSDN] How to: Transform Web.config When Deploying a Web Application Project
[MSDN] Web.config Transformation Syntax for Web Project Deployment
[GitHub] Xdt transform samples

[MSDN] Configure web apps in Azure App Service
[MSDN] Configure Azure cloud service roles with Visual Studio