Python Twisted / Cyclone, 'Hello, World!' application, on Openshift

September 10, 2015

I am working on Mac OS X, some of the commands in this tutorial may not be identical on your OS

Prerequisites

Be sure to complete the openshift setup as described [here](https://developers.openshift.com/en/getting-started-overview.html)

Create Application (Gear) on OpenShift Cloud

𝝺 rhc create-app cyclonetest python-2.7
There may be a few prompts about ssh keys, don't be alarmed

Install Application Dependencies

𝝺 cd /path/to/application 𝝺 echo "cyclone==1.1" > requirements.txt 𝝺 pip install -r ./requirements.txt

Create “Hello, World!” Application

𝝺 cyclone app -n > app.py

Verify Application Works

Start Application

𝝺 cyclone run --app=app.py

Test the app

Using cURL

𝝺 curl http://localhost Hello, world

Using
Read more...

Know Your Tools, Don't Embarass Yourself

December 20, 2014

TL;DR

Your tools are powerful, your probably not using them to their potential. Learn those tools and you will save yourself time later.

What happened?

About a week or two ago, I started running into problems with my QA team and had a terrible time reproducing some issues in our iOS app. At first I checked for inconsistencies with the build server. Everything looked ok, so I started digging a little deeper. After far too long I came to the conclusion that the only logical reason I could be out of sync was becuase of some files that I wasn’t checking in. Below I outline what I did, and how I could have done it better, but that is not the point of this post.

Why did it happen?

I have always used SourceTree for my git and mercurial repos. I think it’s a great tool and I will continue to use it,...
Read more...

Enable WoWLAN ( Wake on Wireless LAN ) on Windows 8.1

October 26, 2014

What is WoWLAN?

WoWLAN or Wake on Wireless LAN provides network enabled devices the ability to be brought out of sleep by other devices on the network. WOL or Wake On Lan has been around for a while and used in many different scenarios. WoWLAN really just adds WOL functionality to wireless interfaces instead of just hard wired ethernet connections.

Who uses WoWLAN?

The first time I was asked about WoWLAN was at work, when a customer wanted to wake up their Mac Mini with iRule. Mac Mini’s are used a fair amount as HTPC’s and keeping them awake isn’t a very big deal, but allowing it to sleep is the default functionality.

I know this article is about setting up WoWLAN on Windows 8.1, but this was one of the reason's I started looking into it. The walkthrough will not show you how to set it up on a Mac Mini.

The previous scenario...
Read more...

Profile Your Android App Before You Need To

September 14, 2014

Android Tools

The android sdk comes with a few tools that aren’t used as often as the main IDE Android Studio or Eclipse ADT. Some of these tools are not included with Android Studio and must be run individually.

The rest of this post will assume users are using Android Studio. The methodology / workflow is a bit different using Eclipse ADT

It’s important to learn and use these tools before you NEED them.

The two tools I have used in the past and had great success with are :

  1. Heap Dump Analyzer
  2. Thread & Method Profiler

Heap Analayzer

How this can help

The heap analyzer can be used to view what memory is allocated. It should help you identify any memory leaks. Yes, Java has a garbage collector, but No, that does not make it immune to memory leaks. Even if you aren’t too concerned with memory leaks,...
Read more...

Where is my Android Application, Foreground or Background?

June 23, 2014

The Problem

Detecting if an Android application is in the foreground or the background seems like it might be obvious, but it actually isn’t as easy of a problem as I thought.

Working on older devices

Android has come a long way from it’s 2.X days, but there are still a lot of users out there looking for good apps that have 2.3.X devices ( I have given up on 2.2 ). So, I was looking for the best way to see if an app is in the foreground or the background. There are few different approaches discussed on this stackoverflow post : Android: Is Application running in background?. The solution I came up with is mostly adapted from that post, but it involves implementing reference counting in the activities manually.

Copying an existing solution

ActivityLifecycleCallbacks are all that one really needs to make their application aware of when an activity lifecycle event happens. So,...
Read more...

Variadic Objective-C Functions ( variable function parameters )

April 23, 2014

What are variadic functions?

Well, to be honest, I wasn’t exactly sure the name of these kinds of functions for years after I started programming. Just knowing the terminology will make your life a lot easier when googling for this same kind of thing in different programming languages.

In computer programming, a variadic function is a function of indefinite arity, i.e., one which accepts a variable number of arguments. Support for variadic functions differs widely among programming languages. (stolen from Wikipedia)

In the simplest of terms, it is a function that takes any number of arguments vs a function that takes a defined number of arguments.

iOS Library usage

There are multiple places that you run into variadic functions when doing iOS development. They are fairly simple to understand and use. The variable parameter can contain a comma seperated list of values and must be Nil terminated. Example below demonstratest creating a UIAlertView...
Read more...

Build Bridges, Don't Burn Them

April 4, 2014

Building the Bridge

I started my career at a software shop that worked on enterprise software and was very successful at it. I was placed as a build and install engineer, which was never a problem for me. Althought the work was fun, one thing that really wasn’t my cup of tea was “Corporate America”. I don’t like rules for the sake of rules, or rules because thats “how it has always been”. For example, I didn’t like wearing a shirt and tie, now I actually wear sweats and a tee shirt everyday (I’m nicknamed Captain Sweatpants!). While I learned a lot and will always cherish my days as a DevOps engineer, I wanted to move to a smaller team that moved swiftly.

Landing a job at a startup, I was in a much faster paced environment with a lot more freedom and responsibility. I loved it, and loved it way too much. I was addicted to work. Working...
Read more...

NancyFx with Entity Framework

March 2, 2014

Example Project on Github

Introduction

NancyFx has recently become one of the most popular web development tools for C# developers. It is largely inspired by ruby’s sinatra, but this didn’t mean much to me as I don’t write any ruby stuff, but it is much more of a flask than a django if you come from the python world. Getting back into C# and learning various web platforms and tools, I have found NancyFx to be intuitive and it stays the hell out of my way. If I want to do something my own way, I just do it. It’s one of the nicest web development libraries / frameworks I have used, I highly recommend it. Shortly after any decent amount of web development a database is needed, I opted to go with a Microsoft supported framework in Entity Framework. That leads me to this article, after a few hours trying to figure out...
Read more...

Share Jinja2 Templates with the Browser using Nunjucks

February 9, 2014

Example Project on Github

Introduction

After writing a small little web application with python and flask, I realized I needed templates. Flask comes with jinja2 support built-in so I opted to take that route and started adding simple templates. It wasn’t long that I realized that in any AJAX heavy application I would need to use the templates both on the front-end (client-side) as well as the back-end (server-side). After some research I found a great library called nunjucks. It’s a port of jinja2 to javascript that can be used in the browser and in node.js,

Setup

The setup for sharing jinja2 templates in the browser is fairly simple. It should take less than 10 minutes in a brand new project. Just follow the steps below and you should be up and running in no time.

Serve Templates to the Client

Flask by default serves things in the static folder. Add...
Read more...

jQuery Hello World Plugin with Structure

December 28, 2013

jQuery, a necessary language extension

My first brushes with Javascript were through GWT (Google Web Toolkit). I was unaware of how closely related and intermingled JavaScript and jQuery have become. Many job postings list jQuery in the section right along with other languages. Even if you decide not to use jQuery, or decide to use a lighter alternative like Zepto.js, the principals for plugins and overall architecture are lessons that can be applied elsewhere.

Motivation

Recently, having started a new job and picking up a lot of frontend work, I have been working with a lot of jQuery and jQuery plugins. 3rd party libraries, other devs, and I all have our own styles. So I set out to provide some structure and organization into my life. Here is my attempt at writing a jQuery “Hello World” plugin to use as my template for future jQuery plugins.

Let the code do the talking

All the...
Read more...

Object-Oriented Javascript … A First Attempt

October 1, 2013

Non-JavaScript Background

I come from a C/C++ background which later became Objective-C and Java (iOS and Android). I haven’t done a ton of web work, but most of the web stuff i have done I used the Google Web Toolkit, which provides Java to JavaScript transcompilation. I have never gotten into the nitty gritty of the JavaScript language, so I am writing this as a cry for help, PLEASE! help me become a better JavaScript developer.

PLEASE READ
 I am no JavaScript expert, nor do I claim to be one.  I simply was tasked with writing some JavaScript at work, and I would like to be critiqued on my work. Any / ALL comments, concerns, and pointers are welcome. I hope the community can help me work out the kinks in my first days with Javascript

Javascript Objects

After researching a bit on how to define JavaScript...
Read more...

Using GWT Super Dev Mode / Source Maps

August 24, 2013

Updated with various improvements from Google+ comments

One of the biggest gripes I have run into with the Google Web Toolkit is the ability to debug without having to re-compile, clear cache, and be stuck on the Java side of the debugger ( if you use JSNI, you can’t really debug it with Eclipse plugin). Also, the browser plugin often gets broken with new versions of Chrome, and Firefox. It is not the most “seemless” experience, so I looked for a better option. Super dev mode works nice in Chrome, which is what I use for GWT development.

GWT has now added support for source maps ( more info on source maps here). In my eyes it is the future of all Languages that compile to Javascript. When supported, it will allow GWT to be debugged in any browser. I believe Firefox and Chrome currently support it. I wouldn’t be surprised...
Read more...

Windows Github and Bitbucket setup

August 4, 2013

After I installed the Windows 8.1 update, and I kind of destroyed my machine and had to re-install Windows fresh. This was pretty easy, but I lost all the configuration I had setup for developing with Github and Bitbucket.

So, here is the quickest way I found to get setup and ready to contribute on Github and Bitbucket.

Installation of Tools

SSH

To solve my ssh requirement, which I use for both git and mercurial, I simply installed Putty, which I belive is pretty standard for ssh on windows. I opted to go with the Putty Installer. It should install a few different tools that will be necessary in the future.

Chocolatey Alternative
cinst putty

Git

Git for Windows has an installer which makes the git installation pretty simple. There are a few options that you can choose from and I recommend taking the time...
Read more...

Rookie Talk at Detroit Google Developers Group

July 25, 2013

How I got the gig

As a younger developer, I had never really pursuited speaking about technical topics. I recently graduated from University of Michigan : Dearborn, so full-time work and school doesn’t leave a ton of free time. This opportunity kind of fell in my lap. Randomly, my boss received an email from the Detroit Google Developers Group. They were looking for speakers on non-Android related topics (the group has primarily been dominated by Android related topics). Someone had referred them to iRule because we use GWT (Google Web Toolkit) pretty heavily throughout our solution. At the end there is a link to the speakerdeck slides.

First Time Speaking

I have never thought of public speaking as one of my stronger points, so I was pretty nervous about talking in front of a crowd. I don’t claim to be an expert or think my ideas are gospel. I am writing from the short and brief...
Read more...

Moving to the New Android Build System

July 16, 2013

New Android Build System

If you haven’t seen / heard of the new android build system ( still work in progress ), then you should definitely go read up on it. There is some great material on the Android Tools Project Site.

Building Android projects with Ant

Ant has it’s strengths, but the lack of IDE integration (can’t run task and attach debugger and a pain to use with Eclipse) is really what has made me an early adopter of the new Gradle based build system. I currently have an ant script that is powered by the default build that is packaged with the androd sdk. I hijacked a few tasks to add the versionName and sourceVersion (build ID) to the output file. Also, in the midst of the madness, I get the current revision number from Mercurial and use that as my build ID. It has become very useful for traceability...
Read more...

Building this blog

June 1, 2013

Engine / Site Generator

I work on Mac OS X at work, but often times find myself learning new technologies or “messing around” on a Windows 8.X machine. So, I looked at a C# blog engine. Didn’t really find anything that was really simple to host and easy to modify (I am lazy, anything that required significant work, I gave up on).

After reading a few other posts about setting up blogs, I read about static-site generators. Did a little research, and Jekyll seems to be the most popular, probably because of its origins and support on Github. This made my choice a lot simpler. Something that is used widely and has a lot of support, it even comes with free hosting from Github (Thank you, Github).

Look and Feel

I was looking for something that was simple, easy-to-use, and good-looking. The obvious candidate Twitter Bootstrap looked good, but I wanted to be different. Many...
Read more...