Tech Talk: Elasticsearch

At work, we do tech-talk every few weeks and this week I was asked to do a tech-talk on Elasticsearch.  I have been learning and using Elasticsearch to implement a 60 million document search solution over the last few months.  It has worked really well and has been a joy to use.  It’s been fun to work in a different domain for awhile and get a handle on the world of search.

Elasticsearch is an impressive search server packed full of features.  I initially evaluated a few of the search solutions out there, most notably Apache Solr, and decided upon Elasticsearch because of its ease of use and rock solid distributed architecture.  I love the REST JSON API, schema-less indexing and full document source retrieval ability.

As I’ve implemented Elasticsearch to support a new feature we are rolling out, I’ve already thought about other areas of our application that could take advantage of a search index; to take load off of our RDBMS and provide a performance boost to our stack.  Also, I see Elasticsearch as a fantastic way to handle Business Intelligence and Big Data concerns with tools like Kibana sitting on top of it.

Here is my slide deck from the tech-talk this week:

Presentation: Using Technology Effectively in a Bible Study

Last weekend, I was invited by Houston’s First Baptist Church to give a presentation on “Using Technology Effectively in a Bible Study” at their Midnight Madness event.  This is an annual training event for leadership and is intended to equip Bible study leaders to be effective.  There were lots of interesting sessions and if I wasn’t presenting I would have definitely wanted to attend a few sessions.

Preparing for this session was a good learning process.  Although I already had a rough idea for some content, based on my own experience using technology in a Bible study, I needed to polish up some areas and dive in a bit deeper with researching tools and technologies.  I found some interesting tools along the way and was able to frame the the session around answering the “how” and “why” questions.  The attendees to my two sessions were varied in their experience and comfort level with using online technologies so I had to be accommodating to that.  Overall, I am glad I volunteered to give the talk and am thankful for the opportunity to have served the church.

I decided to use Google Slides and a Chromecast for the presentation.  One reason I thought the Chromecast would be good is because I wanted to demo a few apps on my Android smartphone throughout the presentation and switching between casting from my laptop for Google Slides and my Nexus 5 (Cast Screen) is seamless and clean.  Something I found along the way was that I could open speaker notes when casting a Google Slides presentation which allowed me to see my notes, slides and a timer.  This allowed me to have two “views” which I didn’t think was possible with Chromecast but it turns out to be perfect for a presentation.

I covered these areas of use for technology:

  • Communication
  • Sign-Up Tools
  • Podcasts
  • Websites
  • Misc Tools

Here is my slide deck:

[Direct link]

Conditional Serialization with Json.NET

In ASP.NET MVC, I typically use View Models along with the Json.NET library to get JSON back to the client.  When I want some members to be omitted from serialization I will simply add the [JsonIgnore] attribute to the target property.  This works great for static omission but sometimes I come across the need to perform conditional (i.e. at runtime) omission.  To do this, you can use the largely undocumented [bool ShouldSerialize{MemberName}()] approach.

Simply add a bool return method named ShouldSerialize{MemberName} to the model class.  The {MemberName} portion of the name should match the member name that will be conditionally omitted.  Json.NET will check for the existence of this method and conditionally serialize the corresponding member value.  I also like to use an additional property (with [JsonIgnore]) that I set externally which is used by the ShouldSerialize methods.  In the example below, this property is called SerializeSensitiveInfo.

Run a program as another domain user in Windows

This is a short post, and mainly for my own reference in the future.  I run a MacBook Air at work and have Windows 7 running on a VirtualBox VM.  It’s a long story as to why, but my Windows VM is not joined on our work domain (Active Directory).  Most of the time this isn’t a big deal but occasionally there are times I really do need to run a program in the context of my Active Directory domain user.  A good example is SQL Server Management Studio, because to connect to servers with “Windows Authentication” it assumes you are already running SSMS in the context of the Windows user you will be connecting with.  Since my box isn’t even connected to the domain, this is a problem.  To get around this, I changed my SSMS shortcut to use the following command.  This command opens a command prompt, asks me to enter my password, and then opens a program in the context of the user I specify.

C:\Windows\System32\runas.exe /netonly /user:MYDOMAIN\username “C:\Program Files (x86)\yada\yada.exe”

ASP.NET Web Forms Model Binding

I prefer to work with ASP.NET MVC but currently work with a hybrid code base that includes plenty of Web Forms pages laying around.  One of the nice new features ASP.NET 4.5 brought to the Web Forms world is called Model Binding.  This makes binding data to a form very clean and plays nicely with Entity Framework, Code First.  It took some reading and experimenting to get up to speed with it so I created a Gist (below) that demonstrates a simple example of using Model Binding to populate a GridView.  Note that sorting / paging are built-in automatically and I am passing a TextBox field in for filtering the results.