Friday, March 7, 2014

Computer Science Degrees - What's Lacking

I've been continuing to take classes despite working as a full-time developer. I work in the .Net world, but my heart is more in Python. Still, I wanted exposure to plenty of others and I'm currently in my second class on C++.

What I have noticed in the various courses I have taken at institutions of higher learning is that they don't teach anything remotely close to the real world. I know this is a common claim and people cry out against the undergraduate program not preparing people for the real world. I get that. But I have always dismissed them.

Being a better, more rounded thinker is more important than job training, is it not? Surely it is.
I'm not sure why no one slapped me. I've had that discussion a number of times with people. I should have been slapped. Now don't get me wrong. I value and love my education. I have a degree in Politics from the University of New Hampshire. I am versed in various literature and can hold discussions on a number of topics (at one point I could almost do so in French).

But this is a false dichotomy. It's as if the premise only allows well-rounded education or job training. That's ridiculous.

I believe what Computer Science majors need is less Assignment-based instruction and more Project-based instruction. Random assignments that are isolated from each other, meaning accomplishing one has no effect on accomplishing another, don't provide the type of reinforcement that maximizes the mind we need molded in academia. Completing a larger project with multiple parts is far more useful to the student. These parts interact with one another. One of the best lessons to learn early on is that changing code in one place can have small or large effects on other parts of code.

It's difficult to learn that in assignments that are 50-150 lines. But if you're building on top of the product/project you're working on all semester, you will naturally run in to those types of consequences and suddenly your student will begin to think very differently. I value those that can think holistically about a product rather than the frustratingly common linear thinker that says to the team "Well, I'll just change this and then it'll be fixed." I love it when I hear someone say "Well, if we change that there could be implications to these other parts."

Admittedly, I think there's a lot of cruft in undergraduate coursework these days. Taking art history doesn't make you a better thinker per se. You don't experience art in an art history class. You learn what you need to say about a particular painting/sculpture/etc. in order to demonstrate knowledge about the piece. We cannot say that a mathematics major is more well-rounded for taking such a course. Well-rounded according to whom? And how pompous to believe that one semester of being told what to think about paintings and what is meant to be conveyed by them makes an individual more well-rounded.

There's value in education for the sake of education. I don't argue against that and in fact, as a serial student, I'm quite fond of education for its own sake. However, the prototypical pedagogy associated with the usual assortment of subjects and course material falls short when it comes to Computer Science. Programming is a craft. It takes years to master. There are many other disciplines where this is similar, so why not change the teaching style?

Students experience a couple of introductory courses and then are expected to understand high level concepts. In my opinion, going through academia has the primary purpose of learning how to think which implicitly means application. Anyone who argues against that should be beaten with a stick. Socrates explored the meta, but he focused his knowledge on teaching and applying - even if the application was theoretical (see The Republic). If our goal is to teach people how to think, let's make use of the discipline. Sorting arrays is great. It's very helpful to understand a binary versus bubble sort and why one is faster or better in certain scenarios.

But we're a community of people that build things. We command the electron to do our bidding. We engage in digital alchemy. We are the citizens of an industry governed by Moore's law and yet we tacitly accept that there's not a better way to gain an education in our medium?

I reject that.

Let's build better coursework by building projects with students. When a student ends a semester with a (probably) working application that has been built in stages with a decent feature list there is a sense of accomplishment and a demonstrable grasp of the concepts this project instilled.

Friday, January 31, 2014

Motivations, Projects, and Resolutions

The new year is a time to reflect and decide on what to focus your energy. Or, in some instances, reflect on what projects you didn't finish. I like to look back and evaluate what projects from the past year deserve more energy, deserve to be let go, or need more development before they're viable. 

I keep a small notebook that fits comfortable in my jeans pocket for writing down ideas. Some I'll flesh out and try to find the minimum viable product (MVP). Some I simply like to flesh out and think about the 'cool' factor. Things that increase cool factor:

Real-time

"Post and response ... is kind of boring. I think most people have become accustomed to see the spinning wheel load your results."
This has got to be a trendy thing, but it also makes software so nifty these days. Things like 'real-time collaboration' or sharing or feedback. They all make software feel not only faster but engaging. Post and response, where you post data and are then rendered a results view, is kind of boring. I think most people have become accustomed to see the spinning wheel load your results. 

I know at my day job I see that wheel all the time when I'm doing tests. We're in the midst of launching a new version of our UI for the main part of our product and while it's beautiful and super fast, there's one part of the software that actually now takes longer to load - the piece that hooks into a government integration (of course). The overhaul didn't cause this per se. It was very well designed and load times across the board are reduced. But its new architecture requires a certain flow and as such, all operations for this one piece have to be re-rendered frequently. To ensure data integrity on what's coming back from the government service, I have to query them (the government) to get the latest results. This all occurs in real-time but the service is slow and unfortunately doesn't provide a fast way to get the relevant data. It was totally over-engineered. At some point I plan to change that, but for now I'm kind of stuck. Some of the load times have doubled in the new system for this one piece. 

Social

"Social also means having a community. If you build a community, meaning forming a common culture around a topic, idea, belief, etc., then you're more likely to attract more people from that pool."
Ideas these days tend to have some social component. Sharing an achievement in a weight loss tracker or a ride you just completed. Not to mention the calls to action to share that you're using a given product. Moreover, it's almost more popular now to use social authentication instead of having a database containing usernames and passwords that you have to protect. This makes sense - now the concern is not on you if the password store is compromised, you simply send out an alert email to your affected customers saying "due to the recent ... at <social network>, we'd recommend you change your password to protect your data at our site. Please click <here> to view details about the announcement from <social network>."

Social also means havinthem g a community. If you build a community, meaning forming a common culture around a topic, idea, belief, etc., then you're more likely to attract more people from that pool. Word of mouth campaigns are more budget friendly for you than spending time and money trying to advertise your project to form communities of one. It's always a good idea to test your idea against the possibility of building a community with it. Not all ideas can work that way - some are targeting very specific use cases and that's ok.

Feedback

"Feedback isn't just about getting criticism and praise from your users - it's about getting data on how they use the product."
Having an excellent feedback system users want to utilize instead of avoid is valuable. For one, your feedback loop is tight and you understand the people using your product. Getting flooded about feature X having a bug or needing new functionality? Awesome. No money just went out the door to get a 1 in 50 response rate. Fix it and fix it fast and tell your users how much you appreciate their help in making the product they use better. This reinforces the community idea mentioned above. Empower users to be able to provide you feedback in an unobstrusive way - don't hound them. Let them choose.

Feedback isn't just about getting criticism and praise from your users - it's about getting data on how they use the product. Think about analytics early. When your users creates a new item using your service and sends an invite through the service to a friend's email, track it. And track whether that friend signed up. Now you've got analytics on conversion rates from first-party referrals.

Motivations and Resolutions

This year I have some simple goals:

1. Write more blog posts

I need to be more consistent. I have a number of article topics I have written down in my notebook I would like to complete. I keep listening to podcasts that mention you have to just sit down and write to form the habit, and that's something I need to do. I am out of practice at that. Now when I sit down at my computer at night, once my son is asleep and the house is quieter, I tend to go straight to projects. I need to start scheduling time to write at least once a week, specifically in the realm of tutorials or sharing experiences about how I solved a particular problem.

2. Engage on Twitter

I was one of those that used to make fun of Twitter's core concept - share in a limited character amount. I tend to be verbose. Sometimes overly verbose. I took almost every writing intensive course offered in the political science department at the University of New Hampshire because writing several papers a week was easy for me - I could always crank out more words. Twitter limits that and forces you to focus tightly on what you want to communicate. I've been using it for a few months more actively and I find wonderful and copious amounts of information on topics that interest me. I'd like to build a bigger network there of like-minded people so that I can continue to tap that resource for inspiration, help, and the comfort of being of member of that community.

3. Pay It Forward

I have received help from a number of community members as I have learned what I know. My formal CS education is extremely limited. I'm currently completing pre-requisites to enroll in a Masters in CS program, but I earned my software developer position as a self-taught programmer. This means I've accumulated a lot of knowledge by the generosity of others. So I'd like to return the favor. I plan to be making posts discussing implementation strategies, coding tutorials, and some design information.

4. Release a Web Application to the Public

I have been working on an application for a few months, mostly figuring out what I want it to do and doodling on my sketchpads, but I've been coding in small bits here and there over the past month. I'd like to finish this application and get it out to the public. Mainly, I'd like to be a user on this site. So I believe others will want to as well.

I hope those reading this reflected on the last year and have come to decisions about what they'd like to do in 2014. If you'd like to talk to me about code, or hire me as a freelancer, please contact me on Twitter, Google+, or at my website

Tuesday, December 3, 2013

Planning, Podcasts, and Purchases: The One About Design

I've decided to take a more structured approach to how I'm building my latest project. It's easy to get excited about a new project and want to run rather than crawl or walk your way into it. But I've had a few lessons over the last couple of years that I imagine most (aspiring) code monkeys programmers go through.

  1. Planning is better than refactoring x factorial times (yes, that would be a large number).
  2. Refactoring is better than scrapping the project (there are exceptions).
  3. Having an overall idea of UX from the beginning is helpful to steer the project.
So with that said, I decided to start thinking about this project from a top level view. I wanted to plan out the UX somewhat with some sketches. Using a pen and doodling on legal pads and napkins really forced me to think about what I wanted. The trend these days is toward simplicity. Skeuomorphic designs are transitioning to more flat designs. Microsoft is probably my favorite example of that.

At the same time, I have been listening to a lot of podcasts since the summer. I haven't been a podcast listener before, but at some point over the summer I decided that I was no longer going to be listening to music or NPR. Car time meant learning time. And thus I feasted on episodic backlogs of some shows. One in particular is a fantastic listen. For starters, it's entertaining. But it has some really excellent tips that span languages and paradigms. I'm referring to The Windows Developer Show by the Lowdermilks (Ryan and Travis - if they ever read this, I went alphabetical with your names...it could have just as easily have been Travis and his co-host Baby Man).

The brothers both work at Microsoft in different programs. Ryan's a Developer Platform Evangelist, or the guy you go to if he's your area rep to learn about / ask for stuff. The local DPE here in Denver is awesome (go Jerry Nixon!) and based on what you hear on the show, Ryan sounds just as passionate about helping out his developer community. Travis is on the team that works on Visual Studio and he does UX. So you have a nice blend of design inspired views mixed with development views. And, of course, both cross over. At the end of every show, they do a developer tip of the week (Ryan) and a Designer tip of the week (Travis). Going through the older shows and working my way up to present, I came across a design tip that I found fantastic: UI Stencils

If you haven't seen this site and you do anything related to development, check this site out. I had seen it before but it had drifted to the back of my mind as "not for me." I was so wrong. Developers are able to accomplish a ton in a short period of time with some of the web frameworks and libraries that are out there now. Working with Rails lately has certainly shown me how productive I can be late at night even when I'm not all there. But a lot of us (read: me) need to put more thought and effort into the designs we're putting out there. My office doesn't have an in-house designer. The developers all do it. And that's fine and we get the job done, but I know we'd have a much more modern, sleek, and interesting interface if we had someone that was actually a designer. Perhaps our three-man development team should read Travis' book.

So enter UI Stencils and their awesome-sauce. They sell tools to help make designs. I bought this sketchpad and a couple of these browser stickies. And I'm hooked. Talk about awesome. It has been a wonderful experience to force myself to think about things in pen and paper because it's unforgiving. I'm sure not everyone will agree with that, but forcing myself away from the keyboard and actually drawing out how I think it should work saves me time. I can draw a column setup and play around with where I want something on a piece of paper much faster than I can get that layout perfect on a web page even with Bootstrap or Foundation.

I've done mockups in html before with a framework, and it works. But I find I obsess more about whether I got the pixels lined up instead of whether the UX is well done. The pen and paper allows me to abstract the concerns away. It makes me think "is this intuitive" instead of "what css class will make it do that thing?" 

As if it weren't awesome enough that I'm getting mental exercise benefit out of this, it turns out that the folks at UI Stencils are freaking awesome

Often when I order food online, I'll ask for something random in the notes section. Ya know, that section that's really for comments about your order. Like "leave off the blue cheese." Instead, when I order Chipotle online I say "make with love." And for some reason, at almost every Chipotle that gets that request, they draw a heart on the burrito's foil wrapper. I like that. It's fun customer service and engenders customer affection. I've asked Domino's to draw a dinosaur on the box before. And my pizza showed up with a T-Rex in sharpie on it. It was awesome.

I have a two-year-old son who currently happens to be obsessed with three things:
  1. Dinosaurs. His first love. He often turns on Walking with Dinosaurs and then ushers Mom and Dad out of the room so he can run around the living room roaring. It's fantastic.
  2. Penguins. Or as he calls them, cheep cheeps. He has a stuffed baby emperor penguin that his aunt gave him and he takes that thing everywhere. He absolutely adores it.
  3. Cats. Or neee-ooows. He's taken to pretending he has a cat that lives in his pocket lately. In fact, this past weekend he gave me one to live in my pocket. I have always wanted a cat that goes with me everywhere. Thanks to my son, I now have one.
When I placed my order with UI Stencils, I was feeling rather silly. My wife was giving me this as an anniversary present and I thought it would be interesting to ask a bunch of design driven persons if they would draw something on the package for me. In the notes section, I put the following:
Can y'all draw a special picture on the box for my son? He loves dinosaurs, penguins, and cats... Just sayin', that'd be awesome.
At the time I thought when the package arrived, if they did something like that, then my son would be excited to open the package with me and get to keep his special part of it - the picture. When the package arrived, I couldn't help but burst into that silly, joyous laughter you get when someone or something just makes you feel fantastic. Someone was nice enough to draw all three pictures.
The Package

Naturally, I couldn't wait to show my son.

Happy Progeny
And a discussion about the pictures.
Neeow
Needless to say, I'm absolutely going to go around recommending them to anyone in the dev/design world. I can't wait to place my next order. These guys are fantastic and the quality of the products they sent out is wonderful too. The sketchpads and stickies are on paper that has weight to it. It doesn't feel cheap and it's a joy to write on.

So since you made it this far, take a minute and go check out their site. Some of the videos on the product pages showing how to use them are pretty fun time lapses. There's definitely a lot of value as a developer to step back and look at a project from a design point of view. And I think in the future, I'm going to approach more projects this way. Thanks to the Lowdermilks and UI Stencils for changing the way I think about the process.

Friday, November 22, 2013

Ruby on Rails - I'm kind of late to the game

Recently I started a new side project. This one I'm going to finish all the way through. Like many people who enjoy programming as a profession and hobby, I tend to start a lot of projects where I learn something and move on. The project tends to serve its purpose and then I'm able to tackle something bigger or that is more interesting to me at the moment.

This idea is different. I want to use it on the regular. And I'm sure others will too. So naturally I was ready to roll instantly and hit the ground running. Normally I work on a project with another person, +Clint Shuman, but he hasn't been as available lately since his wife recently gave birth to their son.

Lately I've been approaching all problems the same way: nail, meet hammer. I decided when approaching this one to try building a couple of things in two frameworks - django and rails. Rails has scaffolding, which is a lot of code I'm probably going to replace, but I can get pieces up and going with CRUD almost instantly. This is really handy when I'm just trying to establish relationships and see how things are going to work. Django is still quick with class-based views (CBV), but there's just something about how rails works that is nice.

I told Clint I was learning rails and the first thing he said was "Traitor." I admit to feeling that way somewhat. Python is a fantastic language. I can't help but wish I could combine the rails framework with Python. And Django is completely open-ended. Implement any app any way you want. Sure, there are conventions, but Python is certainly configuration first. Rails is pretty much the opposite. In fact, the saying that goes along with the framework is "Convention over configuration." Since I don't know the language very well this doesn't bother me. Forcing me to do something a certain way is fine because I probably don't understand fully what's happening right now. It will be interesting to see how much I like this notion the longer I spend working with the framework.

But for a beginner, Django can be difficult. The tutorials that are out there are ok, but not fantastic. It always seems like reading helper information on Django expects you to know a lot already. And that's just not realistic. Rails has been around for ten years now and is widely used because it became the popular thing to do. The plethora of tutorial and screencasts for it makes the prospect of learning it much easier.

Still...I miss Python at night. I'll come home soon, Python. For now, I have a project I want to see completely through to finish. That is, hosted and live for everyone. And I'm going to do the whole thing in Rails.

Tuesday, October 1, 2013

WYSIWYG Editor in Windows Forms Applications - Leveraging TinyMCE

Recently I was tasked with working on creating a version 2.0 application for an internal tool we use at work. We have a team that creates web content for our clients and this application allows them to compose that web content. In the redesign, we decided it would be fantastic if people could use a simplified HTML editor to generate content for the prompts and various information we output on the web pages. Currently, individuals are required to know (read: ask others for help) the HTML and it makes for a frustrating experience in using something that doesn't actually expose the HTML to the end user. Those who are using the app shouldn't be required to understand block elements or how to open a link in a new window. It should be painless and inputting that content should be fast.

Rather than forcing someone to use HTML tags, they should be able to highlight and toggle as if they were using a text editor. Well, I got as far as making the three buttons for bolditalic, and underline and realized I was reinventing the wheel. I had just added TinyMCE to our text areas for custom text our clients entered in our development environment. It was incredibly easy to use and it has a permissive license.

TinyMCE Sample - http://www.tinymce.com/
Naturally, there had to be a way to implement TinyMCE inside a Windows form and save a lot of time creating monotonous string handling code. And of course there was.

I recognize I'm writing this tutorial when there are others that offer help (one I used for help) on getting this set up. The one I used for help is pretty much the information that's here. That was the only other tutorial I found that was worth while. If you get tired of reading my outline of the solution, go read that one. If you want to continue with me, then go get TinyMCE. I actually downloaded it and stored it to a local resource, but you could always just use the CDN if you want. I'd recommend local.

Once you have that done, let's start a visual studio project. I'll use Visual Basic for this example but the C# code is almost identical (add curly braces, stir, and call me in the morning).

There are only 3 real pieces to this entire thing.

  1. Web browser control pointed at your local HTML file with the JavaScript stuff all in it
  2. A method to set the content inside the TinyMCE editor
  3. A method to get the content out of the TinyMCE editor
Best part? The heavy lifting is all JavaScript in the HTML page. For those that found this page via a search engine, the short version is make a method in the JavaScript for getting and setting the content of TinyMCE. Then use your big boy programming language (just kidding, I love you JavaScript) to access that information. The reason you need the get and set methods is because you're probably going to be doing something with the content that's being filled in or displayed. 

In my case, I'm pulling html content out of a database and shoving it in TinyMCE so non-technical folks can easily create styling for text. Once they're done, I invoke the get and then store the result back into the database.

Ok, enough with details. Let's see the code you'll need to produce.

HTML

Replace the bold lettering with what you need.
<script type="text/javascript" src="file:///yourpath/tinymce/tinymce.min.js"></script>


<script type="text/javascript">
    function GetContent() {
        return tinymce.get('tinyMceEditor').getContent();
    }

    function SetContent(htmlContent) {
        tinymce.get('tinyMceEditor').setContent(htmlContent);
    }

    tinymce.init({ whole host of options });
</script>

<body>
  <form method="post">
  <textarea name="tinyMceEditor" cols="1" rows="1" style="width:100%; height: 100%"></textarea>
  </form>
</body>

That's pretty much it. You'd do well to add your usual html tags to it so it is recognized as html. But yeah. That's all the html it took to get working. The cool part is setting up the other set of code for this.

Drop a web browser control on a form, tell it to navigate to your html doc. Awesome, TinyMCE loads right? So that's fantastic. But let's add the two methods it takes to get and set content. Which are crazy simple.

Public Sub SetTinyMceContent(ByVal htmlContent As String)
        Dim contents() As Object = {htmlContent}
        TinyMceBrowser.Document.InvokeScript("SetContent"contents)
End Sub

In case it's not apparent, the TinyMceBrowser object is my browser control. Now the get content method.

Public Sub GetTinyMceContent()
        Dim html As Object = TinyMceBrowser.Document.InvokeScript("GetContent")
        Dim content As String = html.ToString()
End Sub

That's it. Now obviously you probably want the Get as a function that returns a value unless it's just going to run off and perform its procedure. But that's really all it takes. I have more code in these methods to perform stuff related to our database, but these two lines in each method are where the magic is happening.

Ta da. Short. Sweet. Simple tutorial on how to bring some slick JavaScript text editor action to your Windows applications.

Monday, May 6, 2013

Initial Impressions of Light Table IDE

Light Table is a programming integrated development environment (IDE). But it's a little different compared to what is currently out there. The author, +Chris Granger, has focused on what we are creating rather than getting to the creation. If that concept doesn't quite make sense in your head, don't worry. It's visual. Think real-time flow of your program. If you want to watch how a value changes as it moves through your program you can see it in real-time. Bret Victor gave a great talk on the idea called Inventing on Principle. Light Table extends this concept and the roadmap for development has a lot of nifty fun features of programmers.

I love UX/UI. Especially when it makes stuff easier/faster/better. Light Table is basically IDE porn.

I don't think I can really describe it better than that, but I'll try to explain some things I like and where it has some room for improvement. I have been using it as a primary editor for VB.Net, Python (Django), and a little JavaScript for nearly a week. VB.Net is my day job, the others are for projects at home. For the most part I work in Sublime Text 2, which is a fantastic editor. If you haven't checked it out before the go grab it and start playing. It's extensible, built in Python, and has tons of plugins available. And yes, I write VB in it. It supports VB Script which is good enough. I switch back and forth between Visual Studio and Sublime Text 2 depending on what I'm working on.

Welcome Screen
1. Light Table Welcome Screen
So clearly minimalism is heavily at play here. I'm a fan of minimalism, so this works for me. What you see at the top are tabs. They're unobtrusive. You'll notice I'm in full screen mode here, or as I like to call it: Stop messaging me on Google Talk mode. You can hit ctrl + enter and it pops up the command prompt so you can be handsfree. Which I like. Granger is a fan of VIM so there are vim bindings that can be enabled. But I like his theory that the future of editing code can't always just be that the vim, emacs, etc style of only text visualization is the answer forever. 


Command Bar
2. Command Bar via ctrl + enter
The UI is clean and simple. After all, you don't need a ton of features to get your work done. The workspace tab allows you to bring files into the "workspace" which is kind of like open folder for Sublime Text 2. What's different is that you can add files or folders to this workspace from all over the place. Then those files all show up on the quick open stuff under navigation which we'll get to.


Light Table Workspace
3. Light Table Workspace
So any of those files on the left, or if you have multiple folders can be removed from the workspace without affecting your files on disk. Handy feature. But also, you can just add another folder or files to the workspace. And everything is available to open. Double-clicking any of the files on the left will open them for editing in the current tabset on the right. Tabsets are like groups of tabs. You can subdivide so you can have multiple tabsets each with multiple tabs.

From there we can move on to the navigate tab. It basically shows you all files in all folders. Let's look at a django project.


Light Table Navigate
4. Light Table Navigate
One of the great things about more and more programs is the support for fuzzy search. This makes using command bars and file openers incredibly easy but it also makes search in general better regarding programming languages. You may have 10 methods with Get as the beginning like GetMyFoo, GetNewBars, etc. But if you want GetMyFoo, you can just search for Foo. Fuzzy search will find it. That concept can be expanded on drastically in practice and in different concepts (command bar for instance, file names, settings, and your code itself) and you get some pretty awesome results. I've loved that in Sublime Text 2 and I'm loving using it in Light Table.

The default them is also pleasant for code. It's not terribly high contrast but I find it's easy on my eyes in a dark room. And let's be honest. We program in the dark a lot. But my other favorite monokai is on there and switching is a command and a few keystrokes away so I don't mind switching back and forth.

5. Light Table Default Theme
If you watch the videos you'll see some of the wonderful things Light Table can do, but I think the best thing going for it right now is the incredibly responsive development. I'm not sure if +Chris Granger is working solo or if he has assembled a team, but I watched the repo on GitHub for issue tracking and I'm getting a lot of mail which is Q&A and feature suggestions and bug fixes. I love that part of it. I'm actually learning more about the editor just by watching the "issues" emails come across.


I think that's all I'll go into for now. I'm using it as the IDE of choice for a Django project at the moment and it'll be interesting to see what ultimately I like and dislike at the end of that. Code Mirror's underlying editor has a few bugs with the syntax in VB, but I have a feeling some of the features the community requests will be easy to address once the plugin system is live, which is forthcoming in 0.5. I'm already wondering if I can build out some Django tools for the editor, even though I'm not sure what that would look like. It supports virtualenvs for python, although I haven't tried it. Django work means I'm not really doing eval much unless I'm just quickly testing pieces of a function.

I'll post again once I have had the opportunity to really spend a lot of hours in it. For now, I really enjoy it. I miss some of the conveniences of Sublime Text 2, but they're not anything that can't be resolved. And for an alpha...this product has definitely caught my attention. I look at it and all I can think is how amazing this is going to be.

Thursday, January 31, 2013

Windows 8: Good, Bad, and the In Between

I'm just going to admit it up front: I am a complete sucker for a good UI. UX is important as well but if you give me a really ugly UI and say "But the UX is amazing!" I'm less likely to be interested. Love it, hate it, whatever, the new Windows style of interface is attractive. Live tiles are a clever method for content consumption that is far more interesting than a straight feed reader. Even though that's basically the purpose.

Sure you can put whatever you want there, but essentially it's a feed. The ease of programming for the Windows 8 style of application is also welcome. Granted, I really don't know anything about XAML. I can mostly read what's going on but I'm currently having to read up on what it is I want to do if I'm not going to be dropping things in from the toolbox. But it's fun. And you get Visual Studio.

I like Eclipse a lot. My Java class and C class both had me using Eclipse (IDE was optional but Eclipse was a natural choice) and I found myself productive in it and all that. But when it came to playing with Android, the experience felt extremely clunky. I know there are many that will disagree, and that's fine. Preference is subjective. Visual Studio feels streamlined. When I drive a car, gadgets are fun but I really only care if they enhance my driving experience. I don't need a million buttons to do things. I don't have to have volume control on my steering wheel, but it's handy. I don't need extensive configuration. My car's purpose is a point A to point B type of thing for me and I like to feel the drive. I feel the same about the tools I use to fulfill my role of code monkey.

Visual Studio deploys easily between tests for Desktop (windows 8 store), Tablet, and Phone. The simulators are clean for tablet and phone. And you don't have to wait for what feels like an eternity for them to boot. That's my favorite part.

As for the operating system itself, I don't understand all the complaints. Granted, I'm an individual that hits the windows key and then immediately begins typing to get my desired program. I don't like having to run through context menus to find it. So for me to use Windows 8, I had almost no learning curve. Yes to get to my wireless settings I have to go through the charm bar. So what? Hide the stuff I don't need to see all the time. I'm fine with that. I spend most of my time on the desktop. I really don't see the Start menu dash unless I'm doing a search to find the program I want.

This isn't some sort of colossal failure or a war on users. Why is it we idolize the screens we see on Star Trek and such and then when we're presented with something that moves more toward that direction we reject it?

I've never been a fan of the ribbon for Office, but I actually like it for Windows Explorer. New folder? Boom. Dedicated icon for that. Search filtering. Dedicated icons. I feel like it's an improvement. It adds a little bulk to the top of the window but it isn't an unwelcome feature.

Windows 8 really shines with touch interaction though. I like the paradigm shift. The choice of blending tablet with desktop is nice because you can grab a tablet PC (that is, one running Windows 8, not WindowsRT) and have it on the couch while you're watching television, but then snap it in to whatever docking method your particular hardware supports and you're back to your usual mouse and keyboard. Love that.

Friday, November 2, 2012

New Project - Active/Responsive Ambient Lighting

So, while browsing the wonderful web one day recently a friend of mine, +Clint Shuman, sent me a link to an RGB LED grid that acted as a responsive ambient light for a TV. Awesome right? I love stuff like this. It's simple, but it really adds an interesting touch to movie night. Naturally, we immediately set out to program our own version.

The concept of active ambience is pretty interesting. The fire in that Avatar video link really enhances the feeling of having that torch flipped around. I definitely like that but there are a few limitations to this implementation of ambipi.

First, it is Windows only. Although Windows is a perfectly pervasive and acceptable OS, it is not the only one - nor is it frequently the choice of my media enthusiasts. A home theater build using Linux is often a less expensive and adaptable solution. Further, the limitation of using XBMC that is specially compiled for this feature limits the playing pool to a release cycle based on this feature. One can't simply update to the latest and greatest XBMC the whenever they please (ambipi extensions, not boblight for those thinking of it).

Which leads to the main hurdle: what about active ambience for other uses of the machine? VLC? Video conferencing? And the list continues. I want a solution that works with the display output and not only one application (although it has plenty of extensions). Adalight and others certainly have achieved this, but I would like to solve the problem in python and make it as cross platform/device as possible with additional configuration. Ultimately, how nifty would this type of thing be on displays, at trade shows, etc? Pretty eye catching.

So enter python and some good fun playing with websockets to test the results. I don't have any LEDs to plug into my Raspberry Pi, so Clint and I setup a cherrypy server with a websocket to communicate back to the server. The webpage has a configurable grid of squares. Although we started with a 3x2 grid, we have moved on to a 5x3 as we feel it'll produce a better ambience. The test with 8x8 went well but for now I just want to focus on getting a basic setup working flawlessly. Originally we made a full grid with all pieces of the screen updating (that is, all 15 boxes in a 5x3) but then decided to do a perimeter only since we won't have LEDs in the center behind the display. A perimeter of boxes on a 5x3 results in a 12-count. The grid generation algorithm was changed to simply build a full row if it was the first or last row and since the algorithm is only run once, there's no performance hit.

At first, we were at about 8 fps using screencaptures for each individual grid. This is super slow (200-300 millisecond response time based on grid size). So we changed the algorithm to capture the screen once and then resize it before sending it off to be analyzed by bounding box. This significantly improved performance and currently we're around 15-20 fps depending on how tempermental my CPU is feeling. Oddly my computer at work runs at about 45 ms pretty consistently while at home I'm more consistently in the 80-100 ms range. I still haven't figured out why that is, but I did just upgrade to Windows 8 so maybe there are some issues I haven't found yet relating to that (work is Windows XP).

Ultimately, I'd like to move to the win32api and see if I can get any improvement over the Python Imaging Library (PIL). For linux, we currently have GTK being used. It's possible we'll go to native C and use X to grab the window if needed, but we'll need to run some tests. GTK is staying pretty consistent with where PIL is (45 ms). I thought GTK would be far faster, but perhaps there's room for improvement with the algorithm.

The current plan (for me, Clint will use an Arduino) is to have my computer serving the image data over UDP to a Raspberry pi. Alternatively, could leave the Pi plugged in but that does involve the limitation of putting the computer next to the pi and therefore next to the tv. I don't currently have any spare computers lying around so a network method is preferable.





Sunday, October 28, 2012

Learning C

I don't have years of programming experience. The time that I devote to learning languages tends to be allocated to Python or something work related (.Net). However, I'm currently enrolled in a course focused on introductory C. At times I feel as though I have stepped into a time machine.

I used to play this video game and the people who were really obsessed maxed all their stats as much as they could. There were intense calculations that could be done. People could spend hours figuring out the best way to spellcraft their armor or weapons so that every possible point or stat could be claimed. More hours would be spent "farming" locations for "drops" to create the perfect armor set. It sounds like a complete waste of time, and maybe it was, but it was certainly fun. I was one of those obsessed people that did everything they could to maximize their "utility."

C reminds me of this mindset. I can completely see how people who are obsessed with performance or being in control of as many aspects of a program as possible would love C. You get to control almost everything so you get to optimize almost everything. You manage your memory. You fine tune everything. No doubt C is fast, but for once in my life I find myself enjoying the automatic management I get from lots of other, higher-level languages. Obtaining input in C presents a good example:

#include <stdio.h>

void main ()
{
    int inputChoice;
    do {
        printf("Please make a selection from the choices (1-4): ");
        scanf("%d*[\n]");
        if (inputChoice < 1 || inputChoice > 4) {
            printf("Error - you have entered an invalid choice.");
        }
} (while inputChoice < 1 || inputChoice > 4);}




This is how we collect input in C. We have to protect ourselves, and an easy way for a beginner like myself in C to protect against bad data is to use a do loop. Oh, that section with *[\n]? Yeah. That prevents the system from trying to store the newline character (\n). Yep. You have to handle that.

The thing is, I completely understand how awesome this must have been for a long time. But now it's just not necessary to me to spend a lot of time doing all this when I can literally do it in one line of code in another language. Take python for example:

inputChoice = input('Please make a selection')

I'm cheating because there's no error handling. But we can add that with a couple of lines admittedly. The point isn't so much the length. It's having to handle things like the newline character. You also can't test data types in C. 

Sunday, September 23, 2012

Higher Education Is A Gateway Drug

If you're like me, then you've been told your whole life the same thing:
Be good. Get good grades. Get into a good school. Get a good job.
That's a lot of repetition for the word "good." But all of those conditions are not sufficient to produce the final result. This mantra is espoused by parents and society (teachers, advisors, etc.) as if it's a logical conclusion:
IF you're good and get good grades and get into a good school  THEN you'll get a good job.
This is pretty faulty logic. For the P,Q logic geeks out there you can of course pick this apart pretty quickly. But the point here is that the good job doesn't necessarily come from the previous conditions. They help, sure, but there's an X factor somewhere. We can call it luck, ambition, drive, personal draw (the nature of someone being drawn to another or "taking a liking to" another), and I'm sure many others.

One thing is clear: getting a good education isn't about getting a job. It's about becoming a better thinker. I'm not sure when we decided that time spent in a college or university was job training, but that's how people treat it now. I have been guilty of treating university education as job training. It usually presents itself in the following form:
Why do I have to take class X? I'll never have to use that in my future job.
Well no kidding. If your focus is to only learn what you need for use on the job, go get a technical certificate and just work in the real world instead of going to university. The point of higher education is not to make better workers. That's job training, technical training, conferences, and the like. Pursue those avenues for making a better or more knowledgeable worker. The purpose of higher education is to make better thinkers. It frustrates me to no end to hear about how an individual believes they have no need to take an English (that is, composition/rhetoric) course because it doesn't apply to their mathematics degree.

Yes, it does.

Effectively communicating applies to all degrees and careers. If you can't write, you're at a disadvantage. If you can only perform basic math, you're at a disadvantage. You also look foolish in a meeting where you're discussing projections when you don't understand how someone arrived at a particular conclusion based on some basic algebraic formula. I remember thinking to myself in a class on Natural Resources why would I possibly ever need to know what the silver lining on a cloud is called.

The reality is that having an education has intrinsic value. Humans have incredible powers of perception, but if you don't have a broad base of information you can't draw the same conclusions. The age of Google and instant access to information has enabled us to do more but has simultaneously resulted in lowered expectations of what we need to know. Rather than thinking about all the new things you can learn, instead our society takes the approach of not needing to know something because they know where to find it.

That's good for the over-achieving crowd. But it's bad for those who are disinterested. Those who can use that knowledge and conclude something more quickly are at an advantage in career competition. That's not to say one should attempt to learn everything and always have it at the ready. There are exceptions such as high level theory/equations/etc. But if you have to learn a basic concept before using the higher one, you couldn't plan on what higher level concept you needed. Competition for limited resources. Not much has changed in the world regarding that basic tenet of existence.

So what's the point? Higher education isn't job training. It's teaching folks how to think. Becoming a better thinker has its own intrinsic value. Getting a major in a field focuses that thinking in a particular subject area. But thinking isn't job training. And that's lucky for those getting an education.

However, it's a gateway drug. I made an error in choosing my undergrad, Political Science. Not because I don't love the subject, but ultimately my path in life changed enough that the degree wouldn't be put to use in my career. Except that I focused heavily on writing in my undergrad and I'm an effective communicator. I work in technology now, at a software company. And though I completed a year of classes for an MBA, I'm currently enrolled and seeking my second Bachelor's - in Computer Science. I'm not positive I'll complete the MBA, but as I began with Political Science and intended to pursue a JD/MBA, now I have altered my path to pursue a BS in Computer Science and potentially an MBA as well.

Education is intrinsically valuable. It is also a means to an end and we therefore often view it as onerous or irrational in some cases. But our collective goal should be to increase knowledge and understanding, not merely technical merits. The latter are important, but they're not enough. Those committed to attaining credentials fit the post's title. B.A. then M.B.A. and concurrent B.S. That's definitely beginning a collection...