Add Search to Your Ghost Blog With ElasticSearch

2015 Jan16
O

one of the things that makes ghost great is it's almost forced simplicity. However, with that comes a bit of rigidity. If you want something more than the provided simplicity, you might find your self pulling your hair out. Search is one of the thing that is lacking from the default ghost set up. The last incarnation of my blog had everything indexed in a Xapian search index. I really wanted to bring back a local search index. Luckily, in the 0.5.x series, they pulled some string so that you can use ghost as a plain npm module. This means you can build your own app around ghost. This should make search possible.

Xapian is a search

Read More

Rebuilding The Codedependant Blog

2015 Jan12
I

t has been about 3 years since I launched my blog. At the time the tech was pretty interesting. It was a Django project on mongrel2 app server backed by ZeroMQ and xapian as the search engine. I built out a modular Web UI with a WYSIWYG editor using mootools. But it was rather clunky in how it actually generated HTML and usually required some manual tweaking.

Out With The Old

The WYSIWYG Editor was probably the biggest problem. It took serious liberties in cleaning the HTML and usually resulted in me editing the code by hand in the end. Interesting code blocks with highlighting was a 3 step process and was almost always formatted wrong.

Managing Images was

Read More

Summer of Sockets part 3: Pub Sub With ZeroMQ

2014 Sep13
S

o far we have looked at PUSH/PULL and REQ/REP. One of the more interested socket combinations in ZeroMQ is PUB/SUB. PUB/SUB has multitude of real world applications in distributed systems, Ranging from remote Work Queues, Push notifications for real time web applications, inter-application communications, etc. Like other socket types found in ZeroMQ either each the pub and sub socket types can either bind or connect to an endpoint. It is really a matter of your applications use case. In general, the part of the application that will have the greatest up time would bind to a port and all others would connect.

There are two primary difference with the PUB/SUB sockets over the previously

Read More

SEELI: Object Orientated CLI framework for Node.js

2014 Aug24
C

ommand line tools are a difficult thing to get right. I've never really been too happy with the more popular ones in the [node.js](http://nodejs.org) community. Nothing supplied all of the basic features or implementation style that I wanted. Most of them try too hard to be the interface when all I really want is something that is really good at parsing flags and options, and return input in a plain object. So I wrote my own. Let me introduce you to [Seeli](http://www.npmjs.org/package/seeli) ( *C-L-I* ), and object orientated, evented, and classy framework for building elegant Command line interfaces:

Installation

npm install seeli --save

Object Orientated

To create a new command, all

Read More
filed under:  cli npm packages terminal node.js

Summer of Sockets Part 2: Request and Response With ZeroMQ

2013 Dec29
Z

eroMQ makes it incredibly easy to connect and communicate between individual applications in distinctive patterns. Last time we took a look at the simple PUSH / PULL socket types. The next types we'll take a look at are the Request / Reply ( REQ / REP ) sockets. You can [download](https://bitbucket.org/esatterwhite/summer-of-sockets/src) the source code for the following examples if you would like to follow along.

Request & Reply sockets are probably the most familiar and easiest to reason about for web developers. This most obvious use case with REQ and REQ sockets, is a web server. A client ( REQ ) makes a request to the server ( REP ) and it waits until a response comes back. Unlike the PUSH  socket,

Read More

Summer of Sockets Part 1: Playing With ZeroMQ and NodeJS

2013 Sep03
T

he last few months I've spent working distributed systems for web and tel-com systems. Web applications are notorious for being monolithic, tightly coupled pieces of software under a single code base. This just fine when you application really just needs to work within itself. When your application need to share data with other applications, possibly written in different languages, frameworks, or even off load long running tasks, things can quickly become a challenge. To rectify such problems, most developers reach for a central message queue like RabbitMQ. Now, RabbitMQ is a great piece of technology, as the tag line says, `It Just Works`. However, it posses a couple of interesting problems that has turned me off to it.

Single

Read More

Going "Web Scale" with JavaScript Polymorphism

2013 Jul09
T

he recent trend has been to push more and more work on to the client side as browser become more and more capable. This means that complexity of your javascript can get out of hand very quickly. Being able to scale simple piece up to handle complex and even specialized tasks is an important part of sound javascript application architecture.

One way to accomplish this is through simple polymorphism, or as in many Object Orient Orientated languages, Generic Programming. The general pattern is to have a single light class or module that has a standard set of methods which does nothing more than call methods of the same name on any number of other objects ( classes, modules, etc. )

For

Read More
filed under:  javascript amd polymorphism oop

Fun With MooTool Part 3: Class Mutators

2013 Jun23
T

he Class system in [Mootools](http://mootools.net) a exceptionally powerful for the little amount of code that it is comprised of. A large part of that power comes from the Mutator system. A Mutator can be thought of a lot like a plug-in. However unlike most plug-ins that are executed at run time, Mootools Mutators are executed at the time a class is [actually defined](http://github.com/mootools/mootools-core/blob/master/Source/Class/Class.js#L76) altering the end result of the class

A Mutator is nothing more than a JavaScript function that has access to the internals of the class it is attached to. These functions are stored in a Mutators namespace in the Mootools library.

Read More

Django SQL Tracing Middleware

2013 Jan07
T
here are a number of tools within the Django framework itself as well as he community for inspecting all of the SQL [Django](http://djangoproject.com) is executing. The [Debug Toolbar](http://github.com/django-debug-toolbar/django-debug-toolbar) has be come the defacto standard in that respect. However, most all, if not all of the usual suspects are relying on template tags and rendered html templates / javascript to read the debug information. All fine and good, unless you are building an ajax application that never renders html or makes use of the template hooks.

The simple solution to this problem is to write a middleware class to spit out the sql generated by the database connection for the current request. And

Read More
filed under:  django ansi tracing middleware sql

Pseudo-Immutable Dictionaries in Python

2013 Jan03
E

very so often a situation arises where you need to keeps some small bits of data around where you know the value, and want to ensure that it won't get fudged with in the lifespan of the application. Say, for example, you want to map some Classes to some known values for quick lookup to dynamically generate some output - [Like a dynamic django form](/2012/05/05/dynamic-django-modelforms/) In other words, you want [ENUMS](http://en.wikipedia.org/wiki/Enumerated_type).

Python doesn't have an implementation for ENUMS, and most of the standard data types are mutable, which doesn't sit well in this situation. Usually, the python swiss army knife - The Dictionary is a one size fits

Read More