Category Archives: Misc

Hacker News – Initial GUI

In the previous post, I ran through the installation of Visual Studio and loading a sample project. The post ended with a minimal GUI mock-up for a very simple Hacker News front-end:

hn_start

It’s basically just a few links that come from a RESTful API on the web, which will allow me to get familiar with VS and C#.

Anyway, starting out with a brand new project, the IDE looks like this:

blank_project

Documentation

The biggest problem so far has been documentation. Searching for “making restful calls in C#” on the internet yields many results, and it is really difficult to tell what is still current and what is outdated.

Apparently, there is something called “Nuget” which downloads libraries and links them to your VS solution. One of these libraries is Microsoft.AspNet.WebApi.Client that is needed to call restful APIs on the internet. This post in particular is handy: https://stackoverflow.com/questions/9620278/how-do-i-make-calls-to-a-rest-api-using-c

Visual Studio for Front-End Development in 2018

Visual Studio, my high school sweetheart. It’s been a long time (>10 years) since I’ve even installed it, and after growing tired of the promise of the alleged awesomeness of HTML5 and all the mushy front-end web frameworks, I decided to look at Visual Studio again. WinForms are not so bad, right? I cut my teeth on Visual Basic 3.0 in middle school, and I fondly look back on those memories.

Visual Basic 3

The new Visual Studio journey will be documented here, from installation to app, through the eyes of two decades of corporate experience in everything BUT Visual Studio and Windows. I don’t even have an application in mind, I just want to play and explore (and maybe get an idea along the way). Since we are seeing Microsoft attempt to turn their image around into a user-friendly, design-friendly, open-source friendly (hello GitHub!) corporation, it will be an interesting experience.

VS

Installation

Grab a copy from https://www.visualstudio.com/. Which version do you need? Community, Professional or Enterprise? No idea. Typical Microsoft. Anyway, let’s go with the free Community Edition.

Installation is self-explanatory, I just picked tools I thought I needed, weighing in at 30+ GB of download (!)

First Run

After creating a project (C# -> Universal Windows Platform), the IDE complained that Windows needs be upgraded to Update 1083 to view the layout. Sigh. Another lengthy activity.

Sample Tutorial Project

Microsoft has a tutorial about creating a simple interface, and adaptive layouts. The code is shared on GitHub. Cool.

Be careful, ARM architecture is the default build target. I’m running on x64.

The tutorial calls for the app to be run on a device emulator, for example Windows Mobile, but VS doesn’t have that option. Instead, it has “Simulator, Local Machine, Remote Machine, Device”. Simulator doesn’t ever start up properly. Local machine is the only one that actually starts the sample app. “Download new emulators” brings me to a page where only Windows version emulators are available (no mobile devices).

After an hour or so of fiddling, many hours of downloading, I cannot even run the sample application the way Microsoft intended in their tutorial.

Fine, at least I can still run on “Local Machine”. Let’s look at the code.

The first thing that jumps out is:
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?)

Using System Error

Bonus: the error text cannot even be selected with the mouse.

Ugh. These errors are everywhere. According to this SO post, clean the solution and restart VS. This seemed to work.

Development

After a rocky start, we are ready to make a user interface. Let’s start by implementing a Reddit-like interface for Hacker News and iterating over it.

Next post, I’ll explore a very simple interface as seen below, with the ability to read from the official HN API.

hn_start

Email and Spam Filtering

Have you ever signed up for an online service and suddenly started experiencing a surge of spammy marketing emails? The kinds of emails that are sent directly to you as part of a “customer retention” program after you buy an item like airline tickets, the ones that keep sending you emails about limited-time offers and credit card deals long after your purchase is complete?  Here I’ll discuss some strategies to deal with under-the-radar spam.
Continue reading

Dijsktra (in Prague)

Piggybacking onto my previous post about graphs and DFS and BFS, you may have noticed there is also a weight assigned to each edge in a graph. This is because I will talk about path-finding algorithms, starting with Dijsktra’s Algorithm. There are plenty of resources online, such as Wikipedia’s Description that do a fairly good job of describing the algorithm.

However, none of them explain the algorithm in a real world scenario, so I decided to describe it using a city whose beauty was distracting to my path orientation, causing me to constantly get lost: Prague, Czech Republic.

Graph of Prague

A section of Prague with a graph overlay

If you were planning a trip in a few blocks of that intersection, and all you had was this map, how would you get from, for example, point P to point W? Intuitively, you would look at A and all edges connected to it (without using an illustrated map, i.e. from a table), pick the lowest one and repeat.

Here is a PDF of Dijsktra’s Algorithm in Action and an animated GIF.

Dijsktra Animation

Dijsktra Animation

And finally, the updated code in PHP.

BootCamp Success!

I finally got around to installing Windows XP through Boot Camp and will document my experience here. I am running a 2007 Mac Book Pro 2.4GHz with 4GB of RAM and an NVIDIA GeForce 8600M GT on OS X Leopard. The point is to have a computer on which my wife can play Team Fortress 2 with me. Her idea. Honest. 🙂

As I indicated in an earlier post, my first hurdle was to get my MacBook’s hard drive defragmented enough for Boot Camp to be able to partition it. In theory, the HFS+ filesystem used by Mac OS X does not get fragmented due to how it was designed and how OS X uses the filesystem (read all about it on Apple’s website: http://support.apple.com/kb/HT1634).

As one of my favorite professors once said: “The difference between practice and theory is small in theory but large in practice.”
Continue reading

Linux and OS X miscellaneous stuff

To “burn” a .iso or .img file to a USB device, type:

sudo dd if=bt4-pre-final.iso of=/dev/disk1 bs=1m

where /dev/disk1 is your particular disk. In OS X you can find out by going to the Disk Utility and selecting information on your target drive. In linux, type `dmesg` and that should give you the drive name.

I will be editing this to add more stuff.

Master’s Project/Thesis

Today, I think I finally picked out my Master’s project, with the help of Dr. Michael Shafae. I will be working towards the Netflix $1 Million prize. Yeah, I am probably late given that the contest went live in 2006, but a winning solution (one that beats the Netflix current system by 10%) hasn’t been found yet.

This raises an interesting question of what is going to happen if or when someone comes up with the answer while I am in the middle of my research. On the one hand, I didn’t win the grand prize, but on the other hand I shouldn’t be doing this for the money anyway, but rather for the sake of knowledge.

Luckily, Dr. Shafae suggested that we concurrently work on visualization techniques for the data and publish a few papers relating to the visualization techniques specifically (of course he would suggest that, he’s a graphics professor to begin with!) and, more generally, publish the data mining techniques I will have explored.

Plus, there’s absolutely no reason I can’t try to improve on the techniques beyond the 10% mark (if I ever even get that close).

However, if I ever do reach the 10% mark, and if I reach it within the lifespan of my graduate career, I will be kicking myself forever and ever for not starting it earlier and eventually receiving the $1M.

By the way, the whole reason I went into this (besides, obviously, the prize and a feeling that I have a shot against these BellKor guys), is because Dr. Shafae and I engaged in a conversation about Singular Value Decomposition and its applications in the real world. I was just curious what it was since it was in the textbook and that’s how the whole thing got started.

Anyway, it’s good to finally have a professor on my side since I am really good at starting projects and never finishing them. I am sure he will force me to show progress every week, which is definitely a good thing. In true professor/mentor fashion, he has already shown me how to keep my references organized using Bibdesk (think of it as painting fences, washing cars, and sanding decks).