Jekyll Docker image missing C headers

So, if you are using Jekyll Docker image and you need to install any Ruby gems that require C headers, such as raindrops in my case, which was a dependency for unicorn, you will find yourself faced with this error:

fatal error: asm/types.h: No such file or directory

Fortunately, there is a quick fix for this. Jekyll docker image allows you to add system dependencies very easily. You just need to mention the dependent packages inside a file called .apk at the root of your project or beside Dockerfile. Since the docker image is based out of Alpine linux, you need to specify the correct package name as in Alpine packages.

Create a file called .apk and add the following line to it.

linux-headers

Now, when you bring up your containers, it will automatically install the linux-headers package which contains all the required header files and proceed to installing the gems successfully.

Custom Table View Cell using Interface Builder with RubyMotion

custom-cell-sample-app

I’m a RubyMotion newbie and I wanted to create a custom table view cell which simply had three labels – a title, a subtitle and a third label on the right side of the cell. I found a few help around for creating custom table view cell programmatically, which helped me do the job, but it didn’t look as nice as I wanted. Moreover, the benefits of using Interface Builder to easily layout and style the labels was something I was looking for. Fortunately, I was able to get around it myself after fiddling about it. Thought I’d share it for those who are looking for similar.

This post assumes you already have a table view controller in your project to which you want to add a custom table view cell. So I won’t go into much detail of adding them.

I use ib gem to use Interface Builder with RubyMotion. If you don’t, I highly recommend you do. My aim is to add a custom cell with three labels inside a table view controller, call it BooksController.

Create the table view controller

Create the table view cell class

Build the interface

Now, open Interface Builder using the rake ib command in Terminal from the root of your project. The ib gem will automatically create the appropriate interfaces and properties for you to be used inside IB.

Set Custom class for the table view controller in IB

Assuming you have a table view controller added to your storyboard, choose the table view controller and open Identity inspector on the right. Set the class to your controller name – “BooksController” for me.

Set datasource and delegate of the table view controller

Perhaps this is already done for you or drag them from Outlets inspector to the controller itself.

Set Custom class for cell

Now choose the table view cell on the storyboard and set the class to the class you created – CustomBookCell in my case.

Set Identifier for cell

In the Attributes inspector, set the Identifier of the cell to the identifier you specified in the code – BookCell for me.

Set tableview cell Style to Custom

In the Identity inspector, set the Style to Custom from the drop down.

Add three Labels to cell

Now add the three labels we need on the cell by dragging them from the Object library.

Style the labels as necessary

Feel free to make them look good.

Add auto layout constraints

Once the labels are in place, it is a good idea to set the auto layout constraints. This is easy as pie with IB and another great reason to use IB. Simply select the three labels together and choose from menu Editor -> Resolve Auto Layout Issues -> Reset to Suggested Constraints.

Drag outlets from Connections inspector to the labels as required

Finally, open Connections inspector and now you should see the outlets you created in your custom cell class under Outlets. Drag them to their respective labels.

Save and quit Interface Builder and fire up the app in simulator. You should now see the table view with your custom cell.

A sample app for this is available on Github.

Word of the Day – 9/12/14


WORD OF THE DAY


ABET(Verb)
/əˈbɛt/
Displaying
Meaning:
To help, support or encourage, especially in crime or wrongdoing.
Encourage or assist (someone) to do something wrong, in particular to commit a crime.

Usage:
She abetted the thief in his getaway.
His accountant had aided and abetted him in the fraud.
He was not guilty of murder, but guilty of aiding and abetting others.
Now he had betrayed the hometown people by aiding and abetting their enemies.

Pronunciation http://www.macmillandictionary.com/dictionary/british/abet


IDIOM/PHRASE OF THE DAY


EAGER BEAVER

Meaning:
A person who is very enthusiastic and works very hard.
A person who is extremely zealous about performing duties and volunteering for more.

Usage:
The young assistant gets to work very early. She’s a real eager beaver.
New volunteers are always eager beavers.

Word of the Day – 5/12/14


WORD OF THE DAY


INSOUCIANT (Adjective)
/ɪnˈsuːsɪənt/

Meaning:
Free from concern, worry, or anxiety; carefree; calm.
Showing a casual lack of concern.

Usage:
On the plane, I was unlucky enough to sit in front of an insouciant mother who did not seem to care about her child kicking the back of my seat.
The stresses of adult life made Carrie long for the insouciant days of her childhood.
Despite all of our hints about the poor service, the waiter was so unconcerned and insouciant, I really didn’t feel like leaving any tip!
He looked insouciant throughout the trial.

Pronunciation http://www.macmillandictionary.com/dictionary/british/insouciant


IDIOM/PHRASE OF THE DAY


UNDERDOG

Meaning:
The competitor least likely to win a fight or contest.
One that is at a disadvantage.

Usage:
I always root for the underdog instead of the favorite.
As a lawyer, she consistently represented the underdog.

A : Kevin Klumsy is the British entry at the Wimbledon Tennis Championships this year. He’ll be the underdog as usual.
B : Why do you say that ? He might win !
A : Well, for a start he’s very shortsighted and has a wooden leg!

Word of the Day – 2/12/14


WORD OF THE DAY


STUPENDOUS (Adjective)
/stjuːˈpɛndəs/

Meaning:
Extremely impressive.
So large or great that it amazes you.

Usage:
We climbed the mountain for stupendous views of the west coast.
In view of her fear of water, Jayla’s rescue of the drowning child was a stupendous act of courage.
David felt tiny standing among the stupendous redwood trees in Sequoia National Park.

Pronunciationhttp://www.macmillandictionary.com/dictionary/british/stupendous


IDIOM/PHRASE OF THE DAY


AT THE DROP OF A HAT

Meaning:
Immediately; instantly; without any hesitation.
Do something suddenly and easily, often without any preparation.

Usage:
I’d quit my job at the drop of a hat if I didn’t have a family to support.
People will file lawsuits at the drop of a hat these days.
John was always ready to go fishing at the drop of a hat.
He’d buy her expensive clothing at the drop of a hat and worry about how he would pay for it later.

Word of the Day – 28/11/14


WORD OF THE DAY


CONTEMPLATE (Verb)
/ˈkɒntɛmpleɪt,-təm-/

Meaning:
To think deeply or carefully about (something).
Look thoughtfully for a long time at.
To have in mind as an intention or possibility.

Usage:
She sat on the beach and contemplated the incredible beauty of nature.
He contemplated the meaning of the poem for a long time.
He is not known for his ability to think through important issues and contemplate the consequences.

Pronunciationhttp://www.macmillandictionary.com/dictionary/british/contemplate


IDIOM/PHRASE OF THE DAY


IN A NUTSHELL

Meaning:
In brief; in summary.
Describe something as briefly as possible.

Usage:
It’s a very complex situation, but the problem is, in a nutshell, a lack of sales.
The president is in trouble and the reason, in a nutshell, is that people no longer trust him.
I’ll give you the story in a nutshell because we don’t have much time.

Word of the Day – 25/11/14


WORD OF THE DAY


HARBINGER (Noun)
/ˈhɑːbɪn(d)ʒə/

Meaning:
A person or thing that announces or signals the approach of another.
A forerunner of something.

Usage:
Warm weather is the harbinger of spring.
Oil prices are seen as an indication of current inflation, and gold prices a harbinger of future inflation.
Everyone knows the groundhog is the harbinger of a change in seasons.
When the two enemies called a truce, everyone saw this action as a harbinger in their relationship.

Pronunciationhttp://www.macmillandictionary.com/dictionary/british/harbinger


IDIOM/PHRASE OF THE DAY


TOUCH BASE

Meaning:
To talk to someone;to confer with someone briefly.
To talk to someone in order to find out how they are or what they think about something.

Usage:
I need to touch base with John on this matter.
I’ll touch base with him later today to tell him about the meeting.
I had a really good time in Paris. I touched base with some old friends and made a few new ones.

Word of the Day – 27/11/14


WORD OF THE DAY


VENDETTA (Noun)
/vɛnˈdɛtə/

Meaning:
A blood feud in which the family of a murdered person seeks vengeance on the murderer or the murderer’s family.
A very long and violent fight between two families or groups.

Usage:
The right-wing press was waging a vendetta against the mayor.
He waged a personal vendetta against his rivals in the Senate.
Some opposition politicians have accused the government of waging a vendetta.
She said an investigator told her such information was necessary to determine whether she had a vendetta against the physician.

Pronunciationhttp://www.macmillandictionary.com/dictionary/british/vendetta


IDIOM/PHRASE OF THE DAY


BITE YOUR TONGUE

Meaning:
To make a conscious effort to not say anything, usually for the sake of politeness or peace.
To stop yourself from saying something that you would really like to say(in order to avoid hurting or offending someone).

Usage:
I wanted to tell him exactly what I thought of him, but I had to bite my tongue.
I had to bite my tongue throughout the whole silly conversation.
She asked me if I liked her play. I just bit my tongue and nodded.

Word of the Day – 20/11/14


WORD OF THE DAY


ABYSMAL (Adjective)
/əˈbɪzm(ə)l/

Meaning:
Extremely or hopelessly bad or severe
Very profound; limitless
Very deep(literary meaning)

Usage:
Only three weeks ago, an apartment in St Kilda Road, bought for $260000 in 1997, was sold for an abysmal $274000.
Even in this century of technical advancement, we find a good number of primitive tribes living in abysmal ignorance.

Pronunciationhttp://www.macmillandictionary.com/dictionary/british/abysmal


IDIOM/PHRASE OF THE DAY


BE LIKE A DOG WITH TWO TAILS

Meaning:
Used to emphasize how delighted someone is.
To be very happy.

Usage:
Ben’s team won the match. Their manager was like a dog with two tails.
When Jessica won first prize, she was like a dog with two tails.

Word of the Day – 18/11/14


WORD OF THE DAY


NEGOTIATE(Verb)
/nɪˈɡəʊʃɪeɪt/

Meaning:
Obtain or bring about by discussion; try to reach an agreement or compromise by discussion.
Find a way over or through (an obstacle or difficult route).
Transfer (a cheque, bill, or other document) to the legal ownership of another person, who thus becomes entitled to any benefit.

Usage:
The customer wanted to negotiate over the price.
The organization can negotiate a loan based on its assets and future contracts.
She cautiously negotiated the hairpin bend.
When the payee transfers or negotiates a bill, he is generally asked to indorse it.

Pronunciationhttp://www.macmillandictionary.com/pronunciation/british/negotiate


IDIOM/PHRASE OF THE DAY


BOTTOM LINE

Meaning:
The most important part of something; the most important thing to consider.
The final result or outcome
A company’s profits or losses

Usage:
The bottom line is that people’s health is at risk if they smoke.
The bottom line is what counts in most companies these days.
Of course, we are taught that integrity is an important value and is, in fact, the bottom line of morality in society.