Nice to meet you. I'm Daniel, passionate learner and maker.

Reinstall Ruby after upgrading to OSX Yosemite

October 22, 2014 - programming - permalink

After upgrading your OS X to Yosemite and Homebrew libraries you may encouter that your Ruby installations won't work anymore.

You need to reinstall your Ruby versions. The problem? This won't work right away:

$ rbenv install 2.1.3
rbenv: /Users/pulleasy/.rbenv/versions/2.1.3 already exists
continue with installation? (y/N) y
Downloading ruby-2.1.3.tar.gz...
-> http://dqw8nmjcqpjn7.cloudfront.net/0818beb7b10ce9a058cd21d85cfe1dcd233e98b7342d32e9a5d4bebe98347f01
Installing ruby-2.1.3...

BUILD FAILED (OS X 10.10 using ruby-build 20130628-366-gc2b2e15)

Inspect or clean up the working tree at /var/folders/df/w6ymx_bn7dggtv2cz6wtnp2c0000gn/T/ruby-build.20141022104547.86661
Results logged to /var/folders/df/w6ymx_bn7dggtv2cz6wtnp2c0000gn/T/ruby-build.20141022104547.86661.log

Last 10 log lines:
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for cd using physical directory... cd -P
checking whether CFLAGS is valid... no
configure: error: something wrong with CFLAGS=" -O3 -Wno-error=shorten-64-to-32  "
make: *** No targets specified and no makefile found.  Stop.

To fix the issue, run the installer with the following flag:

CC=/usr/bin/gcc rbenv install 2.1.3

and you should be good to go.

If the above doesn't work for you, try this:

RUBY_CONFIGURE_OPTS="--without-gcc --disable-install-rdoc" rbenv install 2.1.3

What programming taught me

March 20, 2014 - programming, startup - permalink

If you're browsing the internet you've probably already heard the news.

Kids, designers and probably every other human being should learn to code.

While I don't know and can't give you the answer to the question "should everyone know how to program?" I'm quite sure about what one individual would gain from it.

But let's take a closer look into the past. My past.

In 2008, the 4th of August to be exactly, I started my apprenticeship as an computer scientist at the Canton of Basel-Landschaft in Liestal, Switzerland.

If you had ask me 1 year in advance, in summer of 2007, I would never have told you that I'm going to do something with computers. Because I had absolutely no plan what I should do. My 11th school year was just beginning and I knew after this year I was either going to be jobless or working in an industry I don't ever wanted to work in.

Everything changed with one decision. I took an optional subject class. The topic taught was HTML.

Since then my life changed completely:

  • I've won Gold at the SwissSkills championships in Trade 17, Webdesign in 2011 and 2012
  • Succeeded my 4 year long computer scientist apprenticeship with the mark 5.7 (6 is the best in Switzerland) in 2012
  • Succeeded my professional baccalaureate within the 4 years I've worked as an computer scientist apprentice in 2012
  • Started and cofounded my own business as a freelance developer/designer in 2012 and can cover 100% of my living costs from it
  • Organized a TED like event called Bridge in 2012
  • Organized Rails Girls Basel with 40 participants and 15 coaches in 2013
  • And solved many problems (my own and the ones of others) in technical and non technical fields from 2007 to present day

"Nice for you", you might think, "but why are you telling me this?"

Because those are a few of my achievements I earned during my still ongoing journey of mastering programming. And all of those things above would not have happened if I hadn't learned how to program.

Programming taught me how to solve problems. It taught me how to push myself forward again and again while thinking I'll never get the hang out of this skill. And not only in technical areas like developing, but in general. It teaches you how to analyse a problem and then find a solution for it. Instead of relying on someone else, you will be the one others rely on.

The truth is, learning to program is hard and intimidating. Especially in the early days. But what you get back from it is about a million times more worth it then what you had to or will put into it.

And of course you will also learn tons of technical skills. Which path you will follow is up to you. You can become a web developer (like me), a digital developer, a game developer, a mobile developer and much more. And don't even get me started on what you could become if you combine those programming fields with non programming fields. Your possibilities are huge. But whatsoever way you are going to choose. You will always be a magician.

Because most of the people you will have to deal with during your life will never have the knowledge and skills you have gained during your journey of learning how to program.

And to them you will be their last resort, their magician, their problem solver.

Setup acts_as_taggable_on with globalize3

September 25, 2013 - programming, rails - permalink

Recently I had to setup a Rails app with localization support for static and dynamic content.

Static content was localized with Rails locale files and the seiten gem. For the dynamic content I used Sven Fuchs globalize3 gem which lets you localize all or just a few attributes of your database objects.

Because the app is using acts-as-taggable-on for tagging different models and globalize3 I think it was worth sharing how to get these two gems setup to work together. The setup is really easy and shouldn't take longer than a few minutes. So let's dive in.

First, create an initializer file called config/initializers/acts_as_taggable_on.rb and add the following content:

ActsAsTaggableOn::Tag.class_eval do
  translates :name
end

Now create a migration file with the following content:

class TranslateTags < ActiveRecord::Migration
  def self.up
    ActsAsTaggableOn::Tag.create_translation_table!({
      :name => :string
    }, {
      :migrate_data => true
    })
  end

  def self.down
    ActsAsTaggableOn::Tag.drop_translation_table! :migrate_data => true
  end
end

Run rake db:migrate and you're all setup. Because it wasn't necessary for me to translate all tags I added a fallback, you find more about this in the globalize3 Readme.

Now you should be able to translate your acts_as_taggable_on tags:

I18n.locale = :de
tag = ActsAsTaggableOn::Tag.find_by_name("Allgemein")
I18n.locale = :en
tag.name = "General"
tag.save

# The tag name should now be different when you switch between the locales
I18n.locale = :en
tag.name
# => "General"
I18n.locale = :de
tag.name
# => "Allgemein"

Do the right thing, Wait to get fired

September 20, 2013 - permalink

Chade-Meng Tan:

New Google employees (we call “Nooglers”) often ask me what makes me effective at what I do. I tell them only half-jokingly that it’s very simple: I do the Right Thing for Google and the world, and then I sit back and wait to get fired. If I don’t get fired, I’ve done the Right Thing for everyone. If I do get fired, this is the wrong employer to work for in the first place. So, either way, I win. That is my career strategy.

Love it.

My 10 most used Gems in Rails Applications

September 16, 2013 - programming, rails - permalink

Today I want to show you my 10 most used gems which I use for my rails development process and production applications on a daily basis. I hope you find something which you didn't know before. And if so, have fun!

Note: The list order doesn't have any meaning.

1. acts_as_taggable_on

acts_as_taggable_on lets you add (which surprise!) tags to every model in your rails app. Its also possible to add different tag contexts which makes the whole thing pretty awesome. I use it for blog features like tags or categories. Check it out!

2. ransack

The successor of MetaSearch. Easy to setup search functionality for single models. A little bit trickier if you want to search multiple models. But I wouldn't say that if I hadn't a production ready solution for you. Check out this stackoverflow answer if you're looking for something like this.

3. seiten

This is my own little baby. You need some static pages and a navigation to connect them with each other? Don't look any further. seiten has you covered. It's still under heavy development but feel free to fork and send me some pull requests!

4. friendly_id

Probably one you already know but used in almost every single one of my rails projects. friendly_id lets you create pretty URLs based on an object attribute (or a custom method). Use this if you want to improve your SEO within several minutes.

5. truncate_html

Do you had to truncate HTML code before? truncate_html is the drop in solution you need for that task. Let's you for example create easily excerpts for your blog posts or similar things without loosing the markup of your content.

6. redcarpet

redcarpet and pygments.rb are the perfect match if you want to give your rails app markdown functionality with syntax highlighting (just leave pygments.rb alone if you don't need syntax highlighting). WYSIWYG was yesterday, give your users some markdown awesomeness!

7. rack-canonical-host

Do you have multiple domains which point to a single rails application but are downrated by Google because your content is downrated because of "multiple content"? rack-canonical-host gives you the functionality to redirect every additional domain to the "main" domain. I use it for http://kreatify.com. Try it out: http://creatify.ch, http://kreatify.ch.

8. ranked-model

Simple and fast drop in solution if you need sortable lists. Want to order that page list? No problem! Want to order that child pages with that parent page? No problem! ranked-model lets you define several order methods with just a few line of code.

9. font-awesome-sass-rails

The fastest and simplest way to provide your UI with some nice icons during development and in my opinion even beautiful enough for production mode. Otherwise just use them to find out what kind of icons do you need and then purchase a customized pictos font pack.

10. faker

Perfect for creating fake sample data for multiple objects during development. Don't waste your time on short-term data. Plus: sometimes faker can light up your development process with some funny generated names you wouldn't even think of.

Want more?

You can find more awesome gems that I use in my personal link collection. Just input gem into the search box and you will get them all.

Found one or more useful gems? Give me a hand and share this article with your friends and followers!

Embrace code generation

August 22, 2013 - programming - permalink

Last week I came across Devin Halladay's article about Laziness & The Web Designer. In the article he claims that, a web designer should not use tools like the not yet released Macaw because they encourage

  • laziness in the web design industry,
  • produce badly written code and
  • rushed designs.

He points out that he prefers doing things the "old-fashioned" way and that he's much faster when he does everything by hand.

A few weeks back I would have agreed with him to 100%. Today I think he's wrong. Not because I know the answer to all of our problems but because I watched Bret Victors great talk The Future of Programming and I have to agree with Bret. Since the time I started to learn programming (and probably also the time you started to learn programming) the way we produce code hasn't really changed. We're still dumping around lines of code in a text editor, test our program, debug and repeat. We obviously do things computers could do for us: creating code.

And this concept isn't even new. I mean take look at Rails for example. Rails does a lot of code generation for you and it does that pretty well. So why are code generation tools on the command line accepted while UI code generation tools are not? Is it because of our bad experience in the past with Dreamweaver and Co. that we don't trust such tools anymore? Do we need that assurance that we've done everything on our own so that we can be 100% sure the product we create is good and fully functional? I don't think so.

I think it has to do how we interpret words like programming and a little bit with our own ego. As Wikipedia says:

Computer programming [...] involves activities such as [...] implementation (or coding) of the algorithm in a target programming language, testing, debugging, and maintaining the source code [...].

What do you imagine when you think of someone coding an algorithm in a programming language or creating a website? You probably think of someone who sits in front of a computer typing in words and characters into a text editor or into the command line.

But the Wikipedia definition doesn't include the words text or typing. The algorithm could also be clicked together right? So using a tool like Macaw would still be programming.

And only because a tool like Macaw does something differently than you're used to doesn't mean it is bad or wrong. To get back to Devin's opinion, he said tools like Macaw encourage three essential down points: Laziness, bad code and rushed designs. I think they encourage quite the opposite:

  • better designs and collaborations through a visible creation process,
  • better maintainable code through specific validations and guidelines and
  • less used time and money because the work is done by a computer.

Of course this presupposes that the code, code generation tools produce is good and maintainable but I think we live in a time where this can be a reality.

Ignoring the possibilities of such things would be wrong and I think we would miss out on huge potential if we would just disregard new things because of our own ego.

So embrace code generation.

Embrace changes.

Nested layouts in Rails 3.2

August 06, 2013 - programming, rails - permalink

I'm currently developing a new site where I need different column styles for the content, for example some pages need a one-column style and some need a two-column style with a sidebar.

Pratik Naik has written a great post about nested layouts and it is a very good solution for my problem.

I found out that the technique he used was working with Rails 3.0 but not with Rails 3.1 and Rails 3.2 so here is an updated version for the helper method he created:

# app/helpers/application_helper.rb

def parent_layout(layout)
  @view_flow.set(:layout,output_buffer)
  self.output_buffer = render(file: "layouts/#{layout}")
end  

Now you can just create your sub layouts and add the helper method at the bottom of them:

<!-- app/layouts/one_column.html.erb -->

<div class="one-whole">
  <%= yield %>
</div>

<%= parent_layout('application') %>
<!-- app/layouts/two_column.html.erb -->

<div class="one-half">
  <%= yield %>
</div>
<div class="one-half">
  <%= render "layouts/sidebar" %>
</div>

<%= parent_layout('application') %>

And those will be rendered like every normal view inside the application layout.

<!-- app/layouts/application.html.erb -->

<html>
  <head><title>My Awesome Application</title></head>
  <body>
    <%= yield %>
  </body>
</html>

Why Your IQ Matters Less Than You Think

July 24, 2013 - permalink

Focus on the fact that you can learn new things every day which boosts your prior knowledge, a huge part of your overall intelligence. Focus on building confidence through small goals. Remember that you can learn anything anyone else can, and ignore the people who say it’s impossible for you.

I had a lot discussions recently about intelligence and the ability to make something out of your life. The main argument was always that intelligence is something that was given to you when you were born and that you can't do anything about it. That some people just can't break out of their miserable life and strive for something greater. Because, well, they are just not "intelligent" enough.

I always said that I think this kind of thinking is wrong.

First, I don't think intelligence is something that you are born with. Intelligence is something you earn over time. It grows (For more on this, read the linked article above).

But what exactly is intelligence?

Intelligence isn't a number or something you can measure. Intelligence is something very vague, especially when viewed from a overall perspective. To me, intelligence is more defined by the knowledge and interest you have in a certain topic or area.

And knowledge and skills can be acquired over time. If you want to learn something, learn it. Repetition is everything. Some learn slower and some learn faster and that's okay. Darwin, Mozart or Einstein haven't build up their knowledge over night. They built it over years of training and repetition.

Saying this, I think anyone on this planet can learn and achieve anything they want if they have the will to do so.

Ignore your school grades, they aren't that important. Only because you sucked in math at school, doesn't mean you are dumb and can't be a good programmer.

If you aren't happy with your current situation do something about it. Start to gain knowledge. Learn something new. Today! Everyday!

Kreatify: An evaluation

July 17, 2013 - kreatify - permalink

The project Kreatify lives since about 10 months.

This post is a little diary about what I've done so far, what changed during the process and whats in for the future.

10th September 2012

I just finished a four year apprenticeship as a computer scientist and I was working 60% part time as a web/database designer back then. The other 40% I tried myself as a web design freelancer. After a few small web projects I did for friends and family members, the incoming projects started to drown and soon after, I hadn't any work left to do as a freelancer.

Friends tried to convince me that I should create business cards and advertise myself a little bit to gain new contracts. I printed the business cards. Until today I think I gave about 20 pieces away. Business cards and advertising myself for doing client work didn't work out for me. Something was holding me back as diving all in as a pure web design freelancer. The reason was, and still is, that I want more than just doing client work as a freelancer. I want to build a product and maybe live from it at some point in my life.

I knew that this product isn't just going pop out of nowhere and I still need to make some cash on the side. Traditional print advertising didn't work out for me because I didn't believe in it. I wanted something that smelled more like web design and so I decided I want to build something that not only helps me, but also others in the same industry. This was the day when I created a new Rails directory called creativepool, which was the working name for Kreatify, in my terminal.

13th December 2012

CreativePool was renamed to Kreatify. Domains were buyed. Heroku was setup. Kreatify was finally ready. 13th December was launch day. After developing line after line of code in the last three months I was ready to ship. Kreatify at that point was basically a more or less pure Sortfolio clone. The only difference was, that the platform language was German and it was exclusive for Swiss web designer. I started to reach out to potential customers, wrote about 200 emails and managed to achieve a customer base of about 50 agencies. The problem was, nobody was paying. I had build a freemium model were everyone could sign up and for 99$/month would get more value out of the service.

What went wrong you might ask?

Well I didn't create value for those customers. All web designers on Kreatify gave me positive feedback about the user experience and how it looked, they liked it. But they didn't want to pay and I knew why, but hadn't the influence to change it back then. The problem was that I didn't generate real value for them, they didn't gain any new contracts from Kreatify. On a bad day Kreatify had about 5-10 visitors per day back then, on a good day about 15-20. I thought I just needed to build something and people would come and use it. Well, I was wrong. I gained my customers no value and myself no value. Because, remember? I wanted to build something which also helps myself.

1st March 2013

I gave up my 60% part time job to work as a full time freelancer. In the last few weeks I hadn't the time to bring Kreatify to the next level. I started to write to online magazines and blogs, influential twitter accounts and so on. I soon realized that there weren't that much resources I could promote my content to because there simply aren't that much in Switzerland. Creating a Swiss only product for a niche with about 100 people didn't work out for me. In the mean time I builded new connections as a freelancer and started to take in new web design projects. In my free time I cleaned up the Kreatify code and made some small additions to the code. The Kreatify user base grew from 50 free to 90 free users. Traffic was still at the same level.

16th April 2013

Kreatify was going nowhere. Now I was left with two choices, do I open up Kreatify for other countries and more industries than just Switzerland and Web Design? Or do I try to make something else out of it? I decided myself for a combination of both options. I opened up the fake country borders and changed the industries to Design, Programming and Photography. The fact that I couldn't bring any traffic to the site made me think that I should change how users on Kreatify interact with each other. Because, they didn't. Kreatify at that point was just a web directory for web designers. But I wanted it to be more, I wanted that users can showcase their work and get feedback based on it. I wanted that users can showcase their projects to the world and with which creative person/agencies they worked on it. So I started to build.

18th June 2013

Two months are gone and the new Kreatify version is online. Users can now add more works, projects and add collaborators. All data was migrated from the old version to the new version. A major change was also that I removed the payed plan from Kreatify. The reason for this is that I didn't want to focus on cash until I could provide real value to my users. The time of build, measure, learn has begun. My first realization was, that something essential was still missing. Users would come back after I notified them about the launch but soon after didn't returned. They didn't interact with the new site. Which was the whole point of the rework of Kreatify. I started to inform myself about community building.

17th July 2013

One month later, users aren't more active than before. I've gained 8 more users but Kreatify learned some new features which could help potential user activity growth.

I added the following functionality to Kreatify to engage user activity:

  • A user can comment other users work
  • A user see incoming activities (when someone commented on their work or added them as a collaborator to a project)
  • A user receives emails (when someone commented on their work or added them as a collaborator to a project)

I also localized Kreatify into English. This hopefully is going to help me to reach more users. And this is were I am today. What have I learned from the process?

Evaluation

Here is a list with things I would repeat, not repeat or would do in an other way:

  • I would not start to build a platform without knowing if there is any user needs it would fulfil. The old Kreatify was targeted to bring work to web designers in Switzerland. Most of them are agencies which already have plenty of work and liked the work I did, but I didn't generate enough traffic to create real value to them.
  • Build the audience first and then build the product. Start to write about your idea and see if anyone would be interested in using or paying for it.
  • More ground work action, less coding. I'm a developer/designer by heart. I love coding, but I have definitely focused to much on coding than building my customer base. This needs some change. I need to focus more on generating values to my users than adding new features nobody ever uses.
  • Building a marketplace is hard. It is like answering the question: "What was there in the beginning, the chicken or the egg?". What I mean with this is, I had to provide value to two different user bases. The old Kreatify had two because I had the designers who wanted to get hired and the people who would hire designers through Kreatify. In the future I'm focusing on one user group, the creative people who are already on my platform. This means I need to provide other value than contracts to them, like relationships.
  • Evaluate what I've done. When I started to rework Kreatify to what it is today, I felt that this is the way it has to be. Maybe it is, but I'm not that sure anymore. During writing this post I saw a whole lot more other possibilities which could have been done with the old Kreatify. So writing evaluations like this down are helping me. I'm surely going to do this more often in the future.

So my next steps will be to focus more on building an audience and providing real value to them. But how can I provide value to them from the beginning? As I said in the above list, I need to do more ground work which happens outside of Kreatify. I think Kreatify is mostly about relationships. If you're a programmer and are looking for a designer, Kreatify can help you to find someone which matches your type and vice versa. So the next few days/weeks I'm going to concentrate on connecting people offline and online.

If you have any feedback for me, do not hesitate to write me an email. I would love to hear your opinion.

Thanks for reading and until next time.

Day in the Life at Dropbox: Rasmus Andersson

July 14, 2013 - permalink

Rasmus Andersson:

I wish I knew that being a designer is not really a ‘thing.’ In the late 1990s when I had my first job as a designer and knew that this was something I enjoyed doing, I had this sense that there was a designer profile. You know, that a “designer” has a certain kind of computer and likes certain kinds of typefaces. It turns out that typefaces and computers have nothing to do with design, as they are just tools and subject to trends and fashion. I thought that I needed to go to expensive graphic design schools to “become” a designer. If I only knew that I already was a designer and that I had been since I was a little kid, my life would probably look a little bit different. I should just have focused on building the things I enjoyed building.

Everyone of us is in some way already a designer. Making things look nice isn't everything which defines a designer. Designer are creators. Creator of that useful app on your smartphone, creator of that everyday item on your desk, creator of that new haircut on the top of your head, creator of that three little words to say someone how you feel, creator of that wake/sleep cycle called life. You are a creator. You are a designer.