Fixing SASS –watch on OS X Lion

I have had problem with my SASS-styles not being compiled automatically when I change a partial file, so first I got help from @chriseppstein, Sass Core Developer via Twitter suggesting I should watch the directory instead of the file. Then I ran into this:

sass --watch public_html/css
>>> Sass is watching for changes. Press Ctrl-C to stop.
  overwrite public_html/css/style.css
/Library/[...]/fsevents.rb:27: [BUG] Segmentation fault
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]

@chriseppstein suggested I try to reinstall fsevents, I did not get that to work so I searched some more, and found this resource suggesting running this command:


gem install fssm
 

When that has finished and you start watching a folder you get promted to:


FSSM -> An optimized backend is available for this platform!
FSSM ->     gem install rb-fsevent

So, just do what you are told


gem install rb-fsevent

Now it works. Thanks for helping. Just putting this down for people experience the same issues (and myself when I have forgot the solution)

Mumrik 2 – Work has started

For a long time (2 years+) I have had the intention to start working on Mumrik 2, a web framework and WordPress theme aiming at getting a good looking web up quickly. Today I started working on it. It will be a web framework mainly and the wordpress theme will be based on the framework. If you are interested, make sure you follow the project on Github:

https://github.com/hising/m2

Mumrik 2 is a follow-up to my old WordPress theme named Mumrik

If Developers Were To Try a Real Job – Carpenter

“How many hours do you need to build this interior wall, it is 2.40 x 5 meters. Just a standard wall with 2-by-4 studs and covered with plasterboard?”
“I don’t like plasterboards, I try to solve the wall problems with plain particleboard.”
“OK, good for you, but back to reality, I want a 2.40 x 5 meter interior wall with plasterboard. Can you do it?”
“Of course I can, but I wont, only idiots use plasterboard.”
“OK, why is that?”
“Plasterboard was invented 1938 as a solution to another problem, and it has come to my attention that it is not perfect in all conditions. You must use another solution in order to create a better quality. That is why I use glue and particleboard on steel studs. It is the smartest and best solution.”
“But that was not what I wanted.”
“You want wrong”
“No, I WANT A 2.40 x 5 meter interior wall with tree 2-by-4 studs and plasticboard, because that is the freaking standard!”
“Standards are compromizes, I DO NOT COMPROMIZE.”
“So, you cant do it?”
“I wont do it.”
“You cant”
“I can, but I suggest you go to India, hrrm, sorry Poland because they just build what you want with high skills and quality at a good price. If you want something expensive and not what you expected, please call me.”

Action is the Killer App

Everybody is looking for the killer app. Everyone wants the billion dollar idea, sell it to Google and sit back and just watch the money roll in. I got a question a couple a weeks ago on how much value I would be able to generate as a developer if I got to work 100% on developing new stuff together with one of the best guys in the industry. I have not worked for more than 4 hours focused the last couple of years due to enterprise architecture, meetings and family. My answer was:

If I get to work on something 100% for three months with skilled people I am sure I will be able to create a new religion.

It felt so absurd. Once when time was an infinite factor action was just something that came along. Now when time is finite and is competed for, a timespan such as three months is just absurd.

Whether you have 4 hours a week to focus or three months, there is only one hidden secret for creating great value and moving towards the billion dollar idea. Action. There are probably 1000 reasons for not being able to deliver the idea you have.  Below I have listed a few, just to show that it is all about mindset. Dont take the items to serious, they are just examples of the 1000 reasons people use in order to not get things done.

  • I need a designer! – Solution: Call one and give him/her percentage on the product if you dont have any money
  • The pricing model is not set yet – Solution: Pricing and income should not be the key elements for building a product from the beginning, user expectations and experience should. Go with the first pricing model you have in mind, if you dont have one in mind, start without.
  • There may be legal problems with the product – Solution: Yep, there may be, do your best to find out, start, this will only be a problem if usage picks up, then you can hire people for this, of course you should avoid things that are illegal to start with, like selling drugs, offer online poker to americans or similiar.
  • There may be scaling issues if we get 100,000 users – Solution: If you have 100,000 users that is a good thing, fix it when you have 100,000 users, IF it is a problem (choose your tech solution wisely)
  • I will only be able to support payments in USD, I would like to offer a solution that works for all – Solution: Offer only payments in USD, prioritize other currencies in your product backlog after launch
  • I need to get me a computer with Windows XP and Internet Explorer and test that everything works – Solution: Do it or use your users. There are a lot of users using Internet Explorer, they will contact you if stuff doesn’t work, or be a pioneer and dont give a f**k about user of IE8 and below. You should build the product according to some development principle such as accessible, mobile first, graceful degradation or progressive enhancement, so this shouldnt be a big problem.
  • I have written inline styles, inline scripts and run business code in the view – Solution: Hell yeah! The thing with products is that the user buys the product not the components it was built of. Forget it, or fix it when you have the time and money to fix it. Sometimes problem solving forces ugly solutions, hard fact, so forget it.
  • There are someone who does the same thing online already – Yeah, as there is only one brand of cereals or toothpaste. Do your thing, find your niche and execute it better than the competition.

The important thing with the list is not the actual problems or the solutions, but the thing that there is always a way to move forward when you run into trouble. Think action and get things done. It is better to release a product that fails than not to release a product at all. You are not that smart that you can think it all out. Get it out there, let people feel it. If they dont like it, build something new. If you still believe in your product, keep building, but release often in order to be able to fail early. Sooner or later your product will be good, and if it is good you will gain users. The big problem is that a lot of people has to move away from the idea that the idea is the killer app, when it is action. Any idea is the killer application with action bundled into its implementation. Now go and build what you love and users will show their love.

You Can’t Fight Youth

I am not old. If you ask my sons, they probably say I am though. A couple of days ago my oldest son said that when he is a grown up, me and my wife will be an old man and an old woman. True in it is simplicity of course and not so much to argue about. You can’t fight aging, it will happen whether you like it or not. You can’t fight death either, sooner or later it will occur and you have to leave it to your kids and their kids to make sure the wheels are still spinning. Why not start right away.

When I started my walk towards where I am now I was young and thought that I was a pretty smart guy. I was 22, had just started studying at the University and thought that changing stuff was easy, it was all about heart, knowledge and wanting it. I set up some goals, goals that may sound stupid as hell for a 22 year old, those were:

  1. I am going to get married and have a family with kids
  2. I am going to build my own house
  3. I am going to have my own business

I probably scared of a number of good-looking-20-somethings-potential-wifes communicating these goals after one or two beer too many. 2001 I fooled a woman who now is the mother of my two kids, married to me and live in the house I have built. Right now she is the one who pushes me when I want to quit on running my own business. It took me 15 years to accomplish these goals. Now I am setting three new goals, the big difference is youth. I am not as young anymore and I need that inspiring feeling that everything is possible. I think I am blessed with a lot of heart and focus, but to be honestly true, I am having tougher times now getting things done than I had 10 years ago. How to cure that? With the kids and age I have a different view of myself, I am not that smart as I thought I was 15 years ago, but I try to use my bits and pieces to do good, focus on the things I like and are somewhat talented in. I have realized a couple of things (sometimes the hard way):

  • I cant fix everything by myself
  • I try to be around people I like
  • I try to work with smarter people than myself
  • I try to do things I am good at differently from time-to-time
  • I focus on stuff I can do something about
  • I avoid things that burn me
  • I do not lick frozen lamp posts

I have hundreds of different business ideas. I know that ideas alone just sucks. You need to get them out there. You need to stop thinking and start building, otherwise it will all just be ideas. But what if there are 22-year-olds with the same ideas, better stamina, more risk taking tendency and new skills acquired by the life they have lived, which I have not. There are two options:

  • Try to do a better job than the young, skilled and risk taking youth
  • Join them or make them join you

Stop thinking that your brilliant idea together with your long experience is superior to the idea of the younger and less experienced. It is not. But it may be one hell of an idea to go for together with younger minds.

It is a rule so simple it is easy to forget. The young ones today will be the older ones tomorrow with a lot of experience. Why not join forces with these people giving them your excellent ideas and experience and get heart, inspiration and getting-things-done mentality in return. Lets face it, they are producing young people in numbers you simply can’t fight, it is impossible. Instead of fighting them, join them or make them join you and get fuel enough for you to finish the idea you have come to love.

The moral of this story is that it is often a good idea to ally oneself with other people and how experienced you may be you will have a lot to learn from people with less experience. Nothing beats the heart and getting things done mentality from a 20-something. We dont see a lot of 40-years old starting riots. Sometimes it is very helpful to have someone starting the riot and enjoy the ride.

Web Performance, Django CMS and Smileys

Below is some links I got today in my inbox after different discussions on Twitter (follow me on Twitter). Putting them here for two reasons, first for myself, I may forget to read them otherwise, second, if any of you are interested in reading.

Hope to deliver more links tomorrow.

Redirect www to non-www on nginx

Logging this as a note for myself (and eventually someone else) so I dont forget it. Solves the problem of coexisting contexts www and non-www. With this all requests to www.* are redirected to * on the nginx webserver

server {

	listen 80;

	server_name www.domain.com domain.com;

	root /var/www/domain.com/public_html;

	index /index.html;

	if ($host = 'www.domain.com' ) {
		rewrite  ^/(.*)$  http://domain.com/$1  permanent;
	}

	location / {
		#whatever
	}

	location ~ /\.ht {
		deny  all;
	}
}

Update. According to Nginx the above code is a common pitfall, and should instead read:

server {
        server_name www.domain.com;
        rewrite ^ $scheme://domain.com$request_uri redirect;
}

server {

	listen 80;

	server_name domain.com;

	root /var/www/domain.com/public_html;

	index /index.html;

	location / {
		#whatever
	}

}

There are actually three problems here. The first being the if. That’s what we care about now. Why is this bad? Did you read If is Evil? When nginx receives a request no matter what is the subdomain being requested, be it www.domain.com or just the plain domain.com this if directive is always evaluated. Since you’re requesting nginx to check for the Host header for every request. It’s extremely inefficient. You should avoid it. Instead use two server directives like the example below.

Thanks to Johan as well who pointed me in this direction in his comments. However, if you use the first setup, I dont think you have to hurry to change it, it is almost certain of academic value on 90%+ of all nginx-setups.

My Upcoming Posts

Below you can find the upcoming blog posts on Frontendbook.com with a short excerpt for them. Please come with input if you find some of them more interesting than others.

jQuery Plugin Template

In this article I will show how easily you can write your own plugin template for jquery plugins. Having a template for this eases development and lets you get up to speed quickly. I will also share this template for Textmate so that you easily can use the best editor out there for writing your jQuery plugins.

Extend Google Analytics

In this post I will go into details on how you can extend Google Analytics to better suit your needs. We will look into custom reports, user types, tracking external links, tracking downloads and more. After reading this article you will be able to better track and analyze the behavior of your visitors.

Writing a SEO-friendly Widget

In this article we will go through the steps needed in order to setup a SEO-friendly widget. If someone is willing to put your content on their website, you should thank them, but you should also take the advantage to send some link-juice back to your site with the preferred keywords you are targeting. I show you how.

Piggybacking API-loading

Sometimes you will have to write some generic JavaScript code that can be used in a wide variety of environments, maybe on platforms not hosted by you (read our Writing a SEO-friendly Widget article) or maybe as script used in a plugin on some CMS or blogging platform. Of course you should make use of any of the nice libraries that exists (jQuery, Prototype, YUI, MooTools or Dojo) but at the same time, you should not distribute these libraries as a lot of websites already have them included, and if not better alternatives exists. I show you how.

The Zen of Internal Linking

Why is internal linking important? I see internal linking as way describing your content in a more dynamic and interactional type of pattern, adding usability to the user. Internal linking done right is very close to the first idea of hypertext or hyperlinking. Look at Wikipedia, they have taken internal linking to perfection. This article will discuss the philosophy and zen behind internal linking and discuss why and who users and search engines likes it.

How to get started on HTML5

You all have read and heard about HTML5 and how all this new beauty will change the world. Now is the time for web based applications. Some people even think HTML5 will make native desktop and mobile apps redundant as we will be able to build all our interfaces as web based applications with rich interfaces built on the features and new standards HTML5 offers. The trend is pretty straightforward, Google builds an OS on web technology, Facebook chooses HTML5 as its common future platform, pushes it as a game platform, PhoneGap lets you build web based applications in JavaScript and build and deploy them on a wide variety of mobile platforms, such as iOS, Android, WebOS, Blackberry, Symbian. In this post I try to collect some links and articles for you that makes it easier for you to get started on developing HTML5 based web apps. In the next post I will focus more on how to get started with CSS3 and the post after that will focus on the JavaScript parts of all these new standards available.

Introduction to HTML5 by Robert Nyman

Robert Nyman has an thorough article on his blog about HTML5 with examples, pros and cons with the approach and code examples. Head over there and read An introduction to HTML5

HTML5 Demos and Examples

On html5demos.com by Remy Sharp you find some code examples, table with supported features of HTML5 in different browsers and some experiments with HTML5. The code is Creative Commons and can be forked on GitHub.

Dive into HTML5

Dive Into HTML5 seeks to elaborate on a hand-picked Selection of features from the HTML5 specification and other fine Standards”

Dive into HTML5 is an online book by Mark Pilgrim where he goes into different bits and pieces of HTML5. He writes about stuff such as Detecting HTML5 features, Canvas Support and Offline Support. Recommended reading.

HTML5 Showcase by Apple

Apple has made some clear statements the last couple of years supporting HTML5 over proprietary software such as Flash from Adobe. Their top sellers iPhone and iPad does not support Flash and will rely on HTML5 for richer interfaces on web apps. They have set up a landing page where you can find HTML5 demos that shows what Safari can do.

HTML5Rocks

Google has a website named HTML5Rocks where they push the new standards as well. You can find a studio with examples of what can be done with these standards, a code playground where you can easily start playing with the code behind all this fancy magic. They also offer tutorials and and interactive presentation on HTML5. Feel free to contribute code to the project to show off how HTML5 rocks.

HTML5 Boilerplate

When you just want to start building stuff that works in all major browsers there are some stuff that needs to be set up, a lot of boilerplate code, lucky enough Paul Irish and Divya Manian already did that for you. From time to time I use the HTML5 Boilerplate template for getting HTML5-frontends up quick. It is also available directly from GitHub.

Introduction to HTML5 by Mozilla

On MDN there is a list of links to different HTML5 articles covering different parts of the new standards and features that build up HTML5.

Chrome Experiments

Another Google product, focusing on what can be done with JavaScript and tools such as WebGL is Chrome Experiments – Not your mother’s JavaScript. It is user-driven and they describe the project in this way:

Chrome Experiments is a showcase for creative web experiments, the vast majority of which are built with the latest open technologies, including HTML5, Canvas, SVG, and WebGL. All of them were made and submitted by talented artists and programmers from around the world.

Internet Explorer Test Drive

With Internet Explorer 9 Microsoft finally delivers a browser that more or less supports the standards web developers and designers would like to use in order to utilize the web as it was intended. Microsoft has released a Internet Explorer 9 Developer Guide and a page for HTML5 Demos that show off the new browsers capabilities.

Acid3 Browser Test

Test how well the different browsers support a subset of the standards available for web developers and designers. Primarily Acid3 is for web browser vendors to ensure that their browsers match a set of features that enable a richer and better web.

My Thoughts on Apple Subscriptions

I have just read the official statement about subscription plans in app store from Apple. On top of that I have had an interesting discussion today on Twitter with @nollbit, @sinex, @baskillen and @jbripley (all smart guys you should follow)  about whether or not this is a good or a bad thing. From what I have read and heard almost everyone thinks it is a bad idea, I on the other hand think that it is a natural step for mazimizing revenue from its application publishing platform. It is quite easy to figure out the arguments against giving Apple 30% on all in-app subscriptions. This has nothing to do with doing good, doing bad or doing no evil. This is pure business and as such Apple is of course tuning all the different revenue streams. After all, why wouldn’t Apple take a fee on all transactions made in their ecosystem, transactions that would not have been made if the Apple app store had not exist.

It is not hard to figure out how this change came about. With more and more subscription based apps, free of charge for download in the App store but with premium content available in-app, Apple saw that they offered a market place more or less free of charge if the publisher used their own in-app payment solutions. That is of course a good thing for the publisher, and I am pretty sure that the ones crying out loudest about this change is the ones with their own payment solution.

If someone offers a market with millions of daily transactions, the same someone will wanna get payed for handing publishers that system. You might argue that the publisher payed for the iOS Development Program and the user for the iPhone but compared to the revenue streams that Wired, Amazon, Netflix and Sony could generate, the fees are nothing compared to what a revenue share will generate for Apple. Of course, one could argue about the right share for Apple, 30% is pretty high, especially for products that totally rely on incomes from iPhone and subscriptions. One could also argue that having that relationship with one big platform is unhealthy for business, it is not a good thing to rely on revenue streams from one source.

My prediction is that all publishers will adapt since there are no marketplace today that offer the same liquidity of paying customers. In two or three weeks we will see apps that climbs high in the top lists that use Apples subscription payments in a smart way. I am pretty sure that this is nothing that Steve Jobs pulled without a second thought, it has nothing to do with monopolizing, since the publishers has the right to leave the marketplace, it is all about monetizing on the user base Apple has managed to put together via hardware, software and revenue sharing. There will always be people who shouts that it should be up to the publisher to decide how he/she handles payments. The thing is that it still is! If you do not like what is on TV, please change the channel or shut down the TV. If you think VISA stores too much information about your payments, stop paying with VISA, if you think that CIA stores too much information about your behaviors online, stop using online services. Everything comes with a price, and there are no such things as companies that do no evil, they are all in it for the money. And I would recommend you all to think what the price is to have a free marketplace with open payment solutions on an application market handled by the worlds largest ad network. The greatest trick the Devil pulled was that he did not exist.