Category Archives: Coding

10Aug/14

AngularJS: Exploring ng-repeat, ng-show, and more

I have been meaning to to explore the capabilities of AngularJS a little more, so I whipped up this small demo app.  It takes your zip code (hard-coded into the JavaScript file), queries a YQL API, and displays a listing of the nearest NPR stations.  It is not the most unique piece of code but it gives me a chance to explore a few concepts.

Continue reading

05Aug/14

Milwaukee I/O: A Project Postmortem

Milwaukee I/O Front PageSlightly over two months ago, I attended the 2014 HackMKE Civic Hackathon.  I had attended one other hackathon in the past and I figured that it was time to attend another one.  I tried to put together a Starkmedia team but the majority of my coworkers are “9 to 5 programmers” and had no interest.

I decided that I would show up by myself, without a plan for what I would create.  I would simply dedicate myself to helping  wherever I could.  I ended up working on building an FAQ database, based upon a site called Honolulu Answers.  The idea was that you could post questions about life in Milwaukee and people would offer answers.

Continue reading

22Jul/14

CouchDB: How to enable CORS in CouchDB

I was playing around with consumption of a CouchDB JSON feed when I received the familiar “Cross-Origin Request Blocked” error.  The question is, “How do you enable CORS in CouchDB?”

If you open the ‘Configuration’ tool, you will find ‘enable_cors’ under ‘httpd’.  You want to change that value to ‘true’.

Enable CORS - CouchDB - Part 1

 

Next, if you scroll down to the bottom of the page, you will find an ‘Add a new section’ link.  You want to click on that and add an ‘origins’ option with the value of ‘*’ in the ‘cors’ section.  You can set the ‘origins’ value to an actual URL but this will enable CORS for everybody.

Enable CORS - CouchDB - 2

 

I would like to give a ‘tip of the hat’ to RichITExperience for having this answer.  It looks like nobody else had any good info about this.

 

14Jul/14

CouchDB: Requiring users of your database be valid users

So, you just created a CouchDB database, added a user to it, and want access to be limited to that user?  There is a simple way of doing this.  Let’s use a previous example, for this demo.

As you can see below, by default, you do not need to be authenticated, in order to interact with a database.

Secure Couch DB 1

 

You can use the “Configuration” tool, on the right sidebar, to do that.  If you look under “couch_httpd_auth”, there is a boolean called “require_valid_user”.  By default, the value is “false”.  You can change that to “true”.

Secure Couch DB 2

 

Once the value is set to “true”, it will require you to do an http authentication for your requests.

Secure Couch DB 3

 

This is definitely an unrefined, blunt way of securing your databases.  It works, though.

11Jul/14

CouchDB: Creation, population, and querying of a DB

If you are like me, you probably have not had much of a reason to use NoSQL but you have been interested in it.  I recently decided to check out CouchDB.  CouchDB is an Apache project that was created in 2005 by Damien Katz.  CouchDB is interesting in that it stores your data with JSON documents and allows you to query via HTTP.  This means that CouchDB provides it’s own web service.

Continue reading