Setting Layout Weight Programmatically

01 September 2013 - Filed under android

What is layout_weight?

Layout weights are a very useful layout mechanism to help create UIs that scale more easily. The Android Developer Guide says the following:

layout_weight is used in LinearLayouts to assign importance to Views within the layout.

All Views have a default layout_weight of zero, meaning they take up only as much room on the screen as they need to be displayed.

Assigning a value higher than zero will split up the rest of the available space in the parent View, according to the value of each View's layout_weight and its ratio to the overall layout_weight specified in the current layout for this and other View elements. This means you can easily have items in your linear layouts take up the same ratio of space as the layout width or height scales.


getContent() throwing IllegalStateException?

01 September 2013 - Filed under android

While debugging my HttpResponse object in my Android application I kept coming across an the error while attempting to get my response content via response.getEntity().getContent():

IllegalStateException: Content has been consumed

I puzzled and puzzled until my puzzler was sore, and then I realized that I had put result.response.getEntity().getContent() in my watch window in an effort to debug the result. Turns out this is a bad idea!


TCPServer Error: Address already in use

30 August 2013 - Filed under jekyll

At some point in your Jekyll travels you may get your sever in a state such that the TCPServer connection remains in use, even after killing Jekyll. When attempting to kick Jekyll back into action, an error such as the following may be seen:

[2013-08-30 11:58:44] WARN  TCPServer Error: Address already in use - bind(2)
error: Address already in use - bind(2). Use --trace to view backtrace

To fix this you must determine the process ID associated with the TCP port Jekyll is using (by default 4000), kill it and then restart Jekyll.


Committed fragment transaction not being created

29 August 2013 - Filed under android

In my Android application I have two fragments that are related to each other; one fragment contains 'tabs' which when pressed will load content into the second fragment. Originally, I had a piece of code that (1) loaded in the tab fragment, (2) committed the fragment transaction, and then (3) attempted to call a method implemented in the newly loaded fragment.


How I setup my Jekyll Blog

11 August 2013 - Filed under jekyll

A few years back I had a Wordpress blog, and while it made it easy to setup and post, it required a lot of maintenance, was harder to control specific page formats, and was really bloated for what I needed. After a little research, I decided to go with Jekyll as a blogging platform. It is a ruby application that generates a static web site, but it is flexible enough to allow for a lot of customization.

There is quite a bit of documentation out there for setting up a blog with Jekyll, but below are all the steps I took to get my blog 'up and a runnin':