Forms and Trust

I was forwarded a link to BELIA BRUNEI BERBAKTI – “Wira Kebajikan” a.k.a. Devoted Bruneian Youth - “Heroes of Welfare” (thanks Brunei Times for the translation in this article) and it seems that they have a good intentions but after all the NSA prism stories and the general rise in privacy awareness, we should be careful about the data we give away.

Part of their sign-up form is shown below and part of the required details are:

  • Gender
  • Full Name
  • Date of Birth
  • Age
  • IC Number
  • IC Colour
  • Address
  • Phone Number

Image

I’m personally not comfortable giving away so much details to an organisation that I know little about. But it also raises the question of why is all this information necessary? Perhaps some transparency as to why all these details are necessary. I under the reason for name, gender and contact details but not the rest.

I also wonder if I’m more averse to this because it is an online form. If it were a physical form, I think I would be more accepting (I possibly have even given up such details before in the past without thinking too much of it). Note to self: when organising future events be transparent with details.

MongoDB – Quick Start Installation and Usage

2 weeks back I attended yet another RHoK Melbourne event and ended up working on a project with NodeJS & MongoDB: both unfamiliar territories for me and thought it would be a good opportunity to create a quick start guide: here is the MongoDB one

Installing and Running the Server

  1. Get the binaries on the download page (http://www.mongodb.org/downloads) and get the necessary download for your platform (Windows/Linux/OS X/Solaris). Following commands will be based on OSX but similar actions can be one on other platforms
  2. In a terminal, navigate to where you downloaded the package and extract it
    cd ~/Downloads
    tar -zxf mongodb-osx-x86_64-2.4.8.tgz
  3. Create a folder to store your database
    cd mongodb-osx-x86_64-2.4.8
    mkdir db
  4. Start the server specifying the folder created
    bin/mongod --dbpath=db

Terminology coming from the typical relational database world

Relational Database MongoDB
Database / Schema Database
Table Collections
Row Record
Field / Column Field

Quick start of the MongoDB Shell

  1. Connect to the server
    Navigate to the folder where the files are extratcted, run the mongo Javascript shell  (which has tab completion)

    cd ~/Downloads/mongodb-osx-x86_64-2.4.8
    bin/mongo
  2. List / show databases
    show dbs
  3. Select a database (no need to created a database)
    > use unicorn
    switched to db unicorn
    > db
    unicorn
  4. Show collections (tables)
    show collections
  5. Inserting a record (row in a table)Collections do not need to be initialised, they are auto generated.
    Below shows the output of the Mongo shell. system.indexes contains indexes for collections

    > show collections
    > db.unicorns.insert({name: 'Aurora', 
       gender: 'f', weight: 450})
    > show collections
    system.indexes
    unicorns

    Mismatched fields

    db.unicorns.insert({name: 'Aurora', gender: 'f', weight: 450})
    db.unicorns.insert({name: 'Leto', gender: 'm', 
        home: 'Arrakeen', worm: false})

    Arrays

    db.unicorns.insert({
        name: 'Solnara', 
        loves:['apple', 'carrot', 'chocolate']})
  6. Listing / Querying records
    > db.unicorns.find()
    { "_id" : ObjectId("52b65132eb122da0e6dd19a9"), "name" : "Aurora", "gender" : "f", "weight" : 450 }
    { "_id" : ObjectId("52b6519127026146f128de90"), "name" : "Leto", "gender" : "m", "home" : "Arrakeen", "worm" : false }

    Items have _id auto generated. No need to set an auto increment field.

    Filtering and field selection

    db.collection.find(
       {andedFilters}, 
       {fieldWith1AsShow0asHide}
    )

    Search by name and show only name and worm  fields

    > db.unicorns.find({name: 'Aurora'}, {name: 1, worm:1, _id: 0})
    { "name" : "Aurora" }
    > db.unicorns.find({
        $or: [{name: 'Aurora'}, {'name': 'Leto'}]}, 
       {name: 1, worm:1, _id: 0}
    )
    { "name" : "Leto", "worm" : false }
    { "name" : "Aurora" }

    Paging and Limiting results

    db.unicorns.find().skip(1).limit(2)

    Record Counting

    db.unicorns.count()
    db.unicorns.find({'name' : 'Aurora'}).count()

    Distinct

    db.unicorns.distinct('name')
    db.unicorns.distinct('name', 
       {$or: [{'name' : 'Leto'}, {'name':'Aurora'}]})
  7. Query Selectors
    1. Comparison:
      1. $gt / $lt ($gte / $lte): Greater/Less than (or equal).
      2. $ne, $in / $nin: Not equal. In / Non in
    2. Logical: $or, $and, $not, $nor
  8. Updating:
    Update first matching record

    db.unicorns.update(
      { name: 'Aurora' }, 
      { $set : { weight: 10 } } 
    )

    Update all matching records

    db.unicorns.update(
      { name: 'Aurora' }, 
      { $set : { weight: 10 } },
      { multi: true }
    )

    Update matching record but insert if doesn’t exist

    db.unicorns.update(
      { name: 'Roooooodles' }, 
      { $set : { weight: 10 } } ,
      { upsert: true }
    )
  9. Deleting:
    Deleting all records:

    db.unicorns.remove()

    Delete all matching records

    db.unicorns.remove({name: 'Aurora'})

    Delete only first matching record

    db.unicorns.remove({name: 'Aurora'}, true)
  10. Drop collection
    db.unicorns.drop()

Other Considerations

  1. No joins. But has embedded documents
    > db.unicorns.insert({name: 'Aurora', gender: 'f', weight: 1450, owner: {'name': ['You', 'Me']}})
    > db.unicorns.find({'owner.name': 'Me'}, {'name': 1, 'owner.name': 1, _id: 0})
    { "name" : "Aurora", "owner" : { "name" : [ "You", "Me" ] } }

Further References

Brunei Geek Meet and RHoK (Random Hacks of Kindness) Brunei

Image

Today marks the first meetup of Brunei Geek Meet (http://www.meetup.com/BruneiGeekMeet/), a meetup where I hope to start fostering the meetup culture that I’ve been experiencing here in Melbourne. We aim to be run by the community for the community. I believe that everybody has something to share and I want Brunei Geek Meet to be a platform for people to contribute to the community as a whole: be it as a learner, as a presenter, as a mentor, as a discussion starter, etc. We are more technology oriented (but are open to geeks of any kind!) and we intend to have talks, code labs, hacknights/days and other events where people can attend, learn and contribute in their own ways.

I am also please to announce that we have a license to hold a RHoK event in Brunei. With the tagline “Hacking for Humanity” RHoK believes in providing a platform for people (particularly technologists) to do social good and make the world a better place.

Image

This is done by hackers working to solve a community problems which can be used in the region of the problem, and even to a bigger audience of the World. When I first attended RHoK, it brought me back to the days I was working on the SMARTER eCVS and I want RHoK Brunei to be of the same nature: for us to see a local need and for technologists to team up to work on a solution.

With that, I would like to extend an invitation to any individuals or organisations that are facing or know of problems that could use a technological solution to get in touch with me and so we can kick off some discussion on how the developer community of Brunei could help. My contact details are tim@thewheatfield.org / @thewheat. I truly hope that you can be a part of RHoK and help contribute to the betterment of the Brunei developer community by providing a real world problem that we, as a community, can get together and help solve.

Considering Android Development: A bit of basics and then some

Considering Android Development Slidedeck

This was the talk I gave at GDG Brunei DevFest 2013 and I aimed for the content to be basic and accessible with a workable app, so that the attendees could use it as a starting off point for the hackathon, should they want to learn how to build an Android app.

I should have published the APK on the Play Store before the talk so that people could have downloaded the app and see what I was building as part of the talk

Source code: https://github.com/CornerGeeks/GDGBruneiDevFest2013/

GDG Brunei DevFest 2013 – Hackathon

It was the 9th and 10th of November that GDG Brunei DevFest took place and I was lucky enough to be physically there to help run the event and Hackathon. It was a fun, and as with all things tech, there were technical difficulties but you live and you learn.

We split the hackathon into 2 sections: 1 for competing and 1 for learning. I tried to take the OpenTechSchool approach by giving them some resources and being around if they had any questions. I have to say that I really did enjoy going from table to table to see what people were working on and interact with them.

The hackathon document we shared is available at http://gdg.com.bn/hackathon_doc and is a work in progress. Below is some feedback I have for the teams that participated in the hackathon and I myself do welcome any feedback on the way we ran the event and the document shared.

RTB Connect

  • A good consolidation of links, but need to work on focus and polish (be more than just a collection of links to the website)

ITB+

  • Feature complete (minus the demo fail, given benefit of doubt that it works) and solves their problem at hand
  • Had good future expansion idea of using GCM for messaging
  • Suggestion to possibly use 3rd party logins (e.g. Facebook / Twitter / OpenID) as seemed like yet another login mechanism
  • Felt that the novelty and community aspects were lacking

Prograstinators : Foodish

Order Easy

  • A good use of WordPress as the CMS
  • Extra points from me for using the Raspberry Pi!
  • Seems like a good business solution but felt community aspect was lacking

Panda Codes

  • Would suggest trying to use some responsive web design frameworks like Twitter Bootstrap / Zurb Foundation to make it usable for mobile
  • I think I saw that if a user registered, they could see the entire user registration listing. Regular users shouldn’t see such information and that should only be shown to admins
  • -Presentation tip: prefill the form fields before hand. Took quite a while to fill in the form, and with a 2 minute presentation limit, it just wastes time

Find me Food

  • Good effort and hope you all learned how to build a web app. Keep at it and learn

MJL

  • A nice native Android app look
  • Liked the crowd sourcing nature to solve a problem which contributed to the novelty and community aspects
  • Obviously wasn’t fully complete but the finish and design did look nice and seems to be on the right track
  • Looking forward to seeing it on the Play Store

WTS

  • Nice use of GPS location and extracting data from Google maps
  • A good effort and the social good is there

If any of the participants would like to plug their own company / apps / on-goings, feel free to post a comment below. We also hope to have more events like this in the future, with a community aspect to it, so if you have ideas just throw them in and we’ll see what we can do! Hope to see you all at the next corner…

Melbourne Fringe Festival – Unofficial Offline Guide

Melbourne Fringe Festival Unofficial Offline Guide
http://thewheatfield.org/mff/

A couple of weeks back it was time for the Melbourne Fringe Festival again and I was keen to see some shows and there was a heck of a lot of events to go to that it was pretty overwhelming to search through and I had issues with actually looking for events. Thought it would be a good time to learn some Python and use Zurb Foundation.

Source Code available at https://github.com/thewheat/melbourne-fringe-festival

Image

Problems I faced when using the Melbourne Fringe Festival website

  • A lot of data 300+ events and with max items per page, there was still 9 pages
  • Searching relied too much of going to the event detail page, and having over 300 events, this would be very time consuming
  • Had to go to event detail page to view:
    • description of event (had to view page in order to find what the event is about: title and subtitle was not enough information)
    • dates
    • prices
    • venue
  • Couldn’t search by budget

Features of the Unofficial Offline Guide

  • Viewing all events on 1 page
  • Show all necessary info on list page (event description, dates, prices, venue)
  • Search by date, category, venue, cost
  • Offline access
  • Should work with lower end phones (pauses between searches)Image