As of today my blog is now hosted on webfaction. I did this because I recently bought an apartment and now I don’t have enough finances for a 38$ 512MB VPS :(. But I hope this is just temporary.
Still webfaction is an excellent shared hosting. You get a shell account and the control panel is awesome. Django, Rails, WordPress, Trac, Subversion, Zope, Plone, TurboGears setups are just a few clicks away for just 9.5$ a month.
Enjoy!
Posted in Other, 0 Comments
At work I’ve been looking at Windsor container and I must say it is a excellent peace of software. I don’t know how was I able to do my work properly without it thus far. I’m now preparing a series of 2 or 3 posts on my company blog site explaining how to use it and what are the benefits of using it.
I absolutely suggest to every .NET programmers out there to look at Windsor. It will save you time & money. Windsor helps you solve your object dependencies. If for example object A depends on object B (B is passed to A through the constructor) Windsor if properly configured can resolve that dependency when asking him to give you and instance of object A.
You can also configure him to give you a specific implementation of an interface. Then you can develop a different implementation of that interface (if your client asks) and replace the old implementation with the new one without ever recompiling the application. You just change the configuration to point to the new implementation.
There is a lot more to Windsor than this and because of that I invite you to read about it on the Windsor site.
Enjoy!
Posted in .NET, 0 Comments
I’ve finally got some time to work on my blog application. I always wanted to remove duplicate code for comment management from the post controller and photo controller. So today I sat down and extracted common code form both controllers and “CommentController” was born.
Here is the code if you are curious.
class CommentController < ApplicationController
include Akismet
def add_comment
if request.post?
params[:comment][:ip_address] = request.remote_ip
comment = Comment.new(params[:comment])
commentable_type = find_commentable_type(
comment.commentable_type,
comment.commentable_id)
if comment.valid?
params[:comment][:is_spam] =
comment_is_spam?(comment)
commentable_type.comments.create(params[:comment])
end
end
count = comment.errors.count
unless count == 0
flash[:errors] = comment.errors.full_messages.join('|')
end
redirect_to_commentable_type(commentable_type)
end
def delete_comment
if request.post?
comment = Comment.find(params[:id])
comment.destroy
end
redirect_to_commentable_type(
find_commentable_type(comment.commentable_type,
params[:commentable_id].to_i))
end
def comment_report_spam
comment = Comment.find(params[:id])
comment.is_spam = true
comment.save
submit_spam(:comment_author => comment.author_name,
:comment_content => comment.comment,
:user_ip => comment.ip_address,
:user_agent => request.user_agent,
:referer => request.env['HTTP_REFERER'])
redirect_to_commentable_type(
find_commentable_type(comment.commentable_type,
comment.commentable_id))
end
protected
def comment_is_spam?(comment)
is_spam?(:comment_author => comment.author_name,
:comment_content => comment.comment,
:user_ip => comment.ip_address,
:user_agent => request.user_agent,
:referrer => request.env['HTTP_REFERER'])
end
private
def find_commentable_type(commentable_type, commentable_id)
case commentable_type
when Post.class_name
result = Post.find(commentable_id)
when Photo.class_name
result = Photo.find(commentable_id)
else
throw "Wrong commentable type"
end
result
end
def redirect_to_commentable_type(commentable_type)
case commentable_type.class.class_name
when Post.class_name
redirect_to article_comments_url(commentable_type)
when Photo.class_name
redirect_to :action => "show_comments",
:controller => "photo",
:id => commentable_type
else
throw "Wrong commentable type"
end
end
def article_comments_url(post)
"#{article_url(:year => post.created_on.year,
:month => post.created_on.month,
:day => post.created_on.day,
:permalink => post.permalink)
}#comment_form"
end
end
Posted in Rails,
0 Comments
This past month or two I was preoccupied with collecting necessary documents to raise a loan at the bank to buy a flat. I’m planning to go live with my girlfriend/future wife in a small town called Solin near Split (Croatia). So all my free time was spent collecting those documents . I only need to get one more document and then I’m going to the bank for that loan.
I haven’t had much time to program anything in my free time. I am reading “Programming Erlang” very slowly though, half a chapter every 3 to 5 days. I must say I’m enjoying it, and I already have some ideas about projects. One idea would be to develop a ejabberd module which integrates with trac. The integration would mean a developer could add, edit, list tickets, attach files to tickets and comment on tickets using his or hers IM client.
To enable this integration the IM client would need to know how to use it so I’m planning to write a pidgin plugin also. For now ejabberd and trac will need to live on the same machine because I intend to write a simple port program in python using trac API.
If you have any useful comments please do comment :)
Enjoy!
Posted in Other,Erlang, 0 Comments
I’ve started reading the Programming Erlang book by Joe Armstrong. I’ve learned about the existence of Erlang about a year or two ago when I was looking into learning a functional language.
I tried Haskell, Ocaml and Erlang (I didn’t tried Lisp purely on aesthetics issues – i don’t like too many parenthesis :) ). After a while with those languages i choose Erlang as my functional language to learn. Haskell learning curve was too steep, and in Ocaml i didn’t like the syntax.
So when the beta of the Erlang book was announced I bought it. And now after I have some spare time I started reading it. The book is really easy to read. Joe did a fantastic job of explaining Erlang in simple words. I recommend to all of you who have a desire to learn a functional language to give Erlang a try.
P.S. The reasons for choosing Erlang are totally subjective and by no mean am I saying that either Haskell or Ocaml are bad languages. I’m just saying that I liked Erlang more. The same goes for Lisp.
Enjoy!
Posted in Erlang, 2 Comments

Full name: Ivica Munitic
Age: 30
Profession: Developer
Email: ivica@munitic.com.hr