Flex box intro – css finally fun to use

Flexbox is new style element in css that controls positioning, as of recently it has decent support in browsers ie. all modern browser are supporting it.

This maybe doesn’t sounds as huge as this thing is, but it is enormous! It removes need for floats and helps greatly with grid systems.

It actually allows positioning elements on the screen, aligning them both horizontally and vertically. This makes much easier to position and size elements, create layouts etc. Probably need for css grids is no longer as pressing. Main idea is to allow elements to be sized individually and let the container figure out how to position them.

W3 working draft for flexbox http://www.w3.org/TR/css3-flexbox/

I find this guide very helpful with visual examples:

Here are some things it solves and how to use it:

let’s make container new type ‘flex’

.container {display: flex; /* or inline-flex */

next we can say which way we want to lay out elements

.container {
     flex-direction: row | row-reverse | column | column-reverse;

you can specify how to wrap inside content

     flex-wrap: nowrap | wrap | wrap-reverse;

you can define that container can grow or shrink, which allows elements to take more space or shrink when needed.

.item {
    flex-grow: ; /* default 0 */

.item {
    flex-shrink: ; /* default 1 */

Next are very interesting interesting, it let’s us justify and align content and it is very powerful:

.container {
    justify-content: flex-start | flex-end | center | space-between | space-around;

.item {
    align-self: auto | flex-start | flex-end | center | baseline | stretch;

.container {
    align-items: flex-start | flex-end | center | baseline | stretch;

There are more examples on how to do complete layout in CSS guide I linked before, also Mozilla described really well


Honestly from this perspective, I don’t see why we had to wait this much to solve this issue.


Customizing Visual Studio looks

I’ve been tinkering with colors and font sizes in VS for a while. This is mostly because I have copy on desktop and laptop, so when I move from one to another, I discover things look different then what I was used to. Anyhow, the way I like things is Consolas font, with size 12-ish or so.

Today it crossed my mind to google and see if there are already premade dark settings for Visual Studio. It turns out there is and there are few quite good ones.

First I came across recommendation to try to use Insolsolata font, which I tried enthusiastically. Unfortunately, it gets rendered crappy, so I had to abandon it. It squishes text quite a bit, which I can understand why some people might like. So I am back to Consolas and this is very solid choice, I was happy to change to it in all my code editors.

As for themes, I did originally wanted dark background but I found Tanzim Saqib’s choice really pleasant and to my taste.


There are also good links on Scott Hanselman post and I like Brad’s Dark Theme as well, so when I feel like change I can always switch to that.

Oh, yes, it is worth mentioning that you update these settings by using import/export settings option from tools menu (kind of lame not to have theme option in VS)

T-Shirt strategy and netbooks

So the T-Shirt strategy goes like this:

* should I buy one really expensive t-shirt, which looks really good at the price of approximately $100-150 like my friend Milan does, then wear it most of the time, or

* should I buy several t-shirts in multiple colors and variations, also good looking, spending similar amount (sometime less, sometime a little more), allowing myself to change them frequently and also not be upset if one gets stained, dirty or whatever else might happen.

As far as t-shirts go, I tend to opt for second alternative as I think it is better to have variety as opposed to really expensive brand. In most cases quality difference is not that great (it at all).

Usually I could apply similar strategy in many situations, sometimes buying something more expensive is good option, I like a little more expensive notebooks (paper based) and pens.

I’ve been wondering what would be good choice when it comes to portable laptop. Here is how I see things there:

* should I buy one light and totally cool laptop like sony’s 13”, or apple or something similar, they are priced at $1300, or

* should I buy one good netbook, like Samsung NC110, or EEE 10”, HP or something similar, which is around $500. There are numerous benefits of this choice, better battery life (7+ hours), even lighter, I can buy one more by year end etc.

Mostly I am unsure because on one side you have not overly expensive 13” which have wow factor. And then you have those other machines that are really practical. Yet I think if you would like to write code, you can do this easily with first choice, while second one is more for twittering, blogging etc.

One thing is for sure, since things can only get better over time, I can take my time picking and choosing.

Rails on Windows, gems doesn’t install, can’t update

Let me first show you this:

C:\workspace>rails -v
Rails 2.3.0

(Me watching Diggnation one time too many)

So Rails or more precise gem installer sucks in Windows. Most of the time people have problem with sqlite gem but as it happens, others can make your life hard as well. Problem is that when specific Windows version of gem is not available, it tries to build one and this fails miserably. Now the real issue here is that it stops installing and updating other gems so you get stuck over some gem you barely use. Solution would be that those gems that can’t be installed get skipped and this small ruby script would do the trick (found it in ruby-forum.com after reading about it on Stack Overflow):

Create a file update-gems.rb and paste following (one line):

`gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z| `gem.bat update #{z}`}

run it with

ruby update-gems.rb

and that is it, your problems solved.

rails sqlite problem in windows : no such file to load — sqlite3

Huh, what a time waster.

Rails used to work right out of the box. Not anymore.

I recently had hd crash and today I wanted to do some rails work.  No rails, no problem.

So I install it and try to use sqlite3, which I remember was trick to make it work, then I figure, maybe they fixed it by now. No luck.

So I try to google it, like last time, but this time there is no way out. I downloaded sqlite3, put it in ruby/bin folder, then in windows/system32 folder, everything works from command line, but not in rails. It took me quite a bit of search to find this post.

In the end here is what helped:

gem install sqlite3-ruby –version 1.2.3

Hopefully this will help someone else, or me, next time I search.

Rails and Merb together in the future = R++

Rails and Merb projects decided to merge and create a powerful foundation for the future together, as of Rails 3.0 Merb will be integrated into the code and bring numerous benefits and performance improvements.

This is fantastic news for whole Ruby development ecosustem. Merging this two projects together and focusing efforts better will bring huge benefits but this is also one of those heartwarming things that people in Ruby community known for common sense approach decided that those projects have enough in common to be better off working together.

Most people read this news in total disbelief. I don’t think I read single negative reaction nor I would expect that there would be. This is awesome news and one more proof that Ruby people do things differently. I can’t wait to get my hands on Rails 3.

Merb gets merged into Rails 3!

I would like to congratulate both teams on important and fantastic decision.