Retweet vs TweetMeme WordPress plugins
I decided earlier this week that I should add a Retweet plugin to my blog; so I googled “Retweet wordpress”, which gave me two good results the Retweet plugin and the TweetMeme plugin. I thought I would install and try both of them before I decided which one I should go for.
Retweet
I installed the Retweet plugin first, this had to be installed, I had to add a custom field to each post and I had to add some PHP code to one of the template files. Once this was done I had to style the link myself.
TweetMeme
The TweetMeme plugin however had to be installed and then it needed to be configured from a separate settings page. Once that was done it was added to all of my posts and it even showed how many retweets each post had.
Conclusion
When I need a plugin for wordpress I really do not want to do more than install it and do some configuration on a settings page. It is way to much hassle to modify template files and adding custom fields to the posts.
Guess which plugin I chose
Hello mySapient
It has been a couple of weeks since my last update and a lot has happened since then. I was very much in doubt of what I should do in my last blog post. I had the choice of starting up my own company or to join a company. I chose to go for the latter one and join a company called mySapient, I have already spent a week with them and I am really looking forward to work with these guys. mySapient is a relatively new company, which are developing 3D online games, I am however not hired to do 3D development but rather to work with their web applications. We are at the moment 4 game developers and me, doing the web stuff. It is great fun and it is really interesting to learn about online gaming and 3D games.
So, why did I choose to go for mySapient? I spoke so warmly about freelancing and setting up my own company. Well, it was no easy choice to make, I had met a some really good freelancers which I could have had the chance to work with, they had this spark and enthusiasm, and I was really tempted to join forces with them. Still there are so many uncertainties running your own company or working freelance, and having a family to support I chose to go down the safe route with a set income. It was however not just the safety of working in mySapient that lead me to them, all the employees I met had the energy and spark which I am looking for. I also find it very interesting to work with people in a very different sector of computing than myself. I learn so much, and look forward to learn about gaming and their development processes. We have already discovered several practices that are common both for the web world and the gaming world, interesting stuff.
I would like to thank all of you for your support and assistance, it has been highly appreciated.
Moving on – looking into the future
I resigned from my position at Orange Bus this week as you probably already know, and I thought I would keep you updated on what I am up to now. This has been a very hectic week, I have had several interviews and talked to a lot of interesting people. I have pretty much been running in meetings, talking, sending and answering emails and using twitter. Twitter has proven to be a brilliant tool I am surprised by all the response I got through twitter when I posted the message about my resignation.
At the moment I am looking into two possible permanent jobs, both seem interesting but I am not at all sure that this is the way I want to go. What I have discovered the past few days is that there is a lot of good ideas out there, these ideas need to be developed, they need technical assistance and a lot of them need more than just the technical assistance. They need partnerships, they need to team up with someone and work together.
I have also seen that the freelancers in Newcastle are piled down in work, they have so much to do that they don’t know how to get it all done in time. These things have caught my attention, all the freelancers I have spoken to and all the people with the great ideas have this spark, glow and enthusiasm I have talked so much about. They love what they are doing and they really believe in their ideas or products. They are the kind of people I would like to work with, and I am at the moment looking into starting up my own company. I know there is enough work out there, and I believe that I can make a difference and help and assist some of these people.
Walking a path without knowing where it ends up is very interesting and I am sure this will lead me to the right place. I look forward to the coming weeks and I am loving every minute of this.
Going our separate ways
Yesterday (21 July 2009) I chose to resign from my position in Orange Bus. It was a very difficult decision to take, because I like the company and I like the people working there. I do however believe I took the right decision, it was something I had been thinking about for quite a while.
The most frequent question I have been asked the last 24 hours is:
Why did you resign from Orange Bus?…. I thought Orange Bus was a good place to work.
First of all I would like to say that YES!! Orange Bus is a good place to work. I have nothing bad to say about Orange Bus, they are a innovative and experienced web agency, have a brilliant team, and provide their customers with smart and solid web solutions.
My reason for resigning is much more personal, I have the last 4 months been seeing my enthusiasm and “spark” disappear bit by bit. This has scared me tremendously, because without my “spark” without that enthusiasm I am no longer a good developer and my creativity are not what it should be without it the “spark”. I spent a while trying to figure out why this was happening, and it took me some time before I found the problem.
I did not do what I am best at and likes to do the most, designing the architectural layout of software and develop in a way I enjoy. Drupal which is the main development platform in Orange Bus is a very good CMS (Content Management System) and I hugely respect it and the people behind it. I do however feel that this is not a platform I am very comfortable with. This is purely a personal preference.
To resign from a job without having a new job might seem idiotic in the current economical climate, but I honestly believe this was the best to do both for myself and for Orange Bus, neither of us would benefit from me staying. I am confident that I will find a new job and I look forward to talking it on. I have already had a few interviews and talked with some interesting people. I have a few ideas I would really like to see put to life, so I might set up my own company back in Norway. If and when that happens I will make sure to let you know. For now I will stay in Newcastle and see what happens.
There is no hard feelings between myself and Orange Bus, I have had a very good time there and I have learned a lot, I wish them all the best in the future.
Javascript snippets
Lately I have been doing some javascript development and I have written a couple of functions which I find really useful. I almost find the code snippets to be used on all sites I work on so I thought I would share them with you. Both the snippets are written using the jQuery library.
Opening urls in a separate window/tab in a xhtml strict environment
The target attribute is not a valid attribute in xhtml strict and your site will fail to validate if you use it, so to get around this you can use replace your target attribute with the rel attribute. Adding the rel=”external” attribute on your anchors that points to an external source and adding some javascript solves the problem.
-
<a href="http://www.klunde.net" rel="external" title="Klunde.net">Kristian Lunde</a>
-
function externalLinks() {
-
$("a[rel='external']").each(function() {
-
$(this).attr('target', '_blank');
-
});
-
};
The code here is pretty self explaining, but to describe it briefly, the javascript function must be invoked once the DOM is loaded (see code further down on the page). The function loops through all anchors that have the rel=”external” attribute and add the attribute target=”_blank”. I guess this is a bit of a hack, but it works and it keeps the clients happy
Creating spam proof mailto: anchors
It is a well known fact that if you add your email address on a site in a plain mailto anchor you will be flooded by spam after a while. You can easily avoid this by adding a little bit of javascript on your site.
It works simply by printing out the email address as plain text replacing the @ with a ” AT ” and add the email addresses in a div or which ever element you prefer and add a set class to that tag. Then you run a small snippet of javascript that find all the elements with that class, I have chosen the class name “email”. The script replaces the content in all the elements with the email class with the proper html anchor. This can not be picked up by web crawlers and it displays the links properly for the user. All browsers without javascript support / enabled will of course only see the post AT somesite.com.
-
<div class="email">post AT somesite.com</div>
-
function createMailTo() {
-
var c_email_field = $('.email');
-
if($(c_email_field).length > 0) {
-
$(c_email_field).each(function()
-
{
-
var email = $(this).html().replace(' AT ', '@');
-
$(this).html('<a href="mailto:' + email + '" rel="nofollow" title="' + email + '">' + email + '</a>');
-
});
-
};
-
};
Running this script would transform the code into:
-
<a href="mailto:post@somesite.com" rel="nofollow" title="post@somesite.com">post@somesite.com</a>
Putting it all together
I have but together a simple example to illustrate the functions in action with all code and functionality. You should be able to copy this code save it as a .html file and run it in your browser.
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
<html>
-
<head>
-
<title>Javascript snippets</title>
-
</head>
-
<body>
-
-
<a href="http://www.klunde.net" rel="external" title="Klunde.net">Kristian Lunde</a>
-
<div class="email">post AT somesite.com</div>
-
-
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
-
<script type="text/javascript">
-
-
function externalLinks() {
-
$("a[rel='external']").each(function() {
-
$(this).attr('target', '_blank');
-
});
-
};
-
-
function createMailTo() {
-
var c_email_field = $('.email');
-
if($(c_email_field).length > 0) {
-
$(c_email_field).each(function()
-
{
-
var email = $(this).html().replace(' AT ', '@');
-
$(this).html('<a href="mailto:' + email + '" rel="nofollow" title="' + email + '">' + email + '</a>');
-
});
-
};
-
};
-
-
$(function() {
-
externalLinks();
-
createMailTo();
-
});
-
</script>
-
</body>
-
</html>
On the move
I am currently switching both domain host and web host, and in that case this site might be down for a little while. I am about to replicate the site to my new web host so hopefully it will be a minimum of down time.
I have chosen to leave servetheworld.net which has been my web host since 2003, they have done a great job, but the time has now come to move to a web host which can provide me with some more advanced features.
I have chosen webfaction.com as my new web host. I chose them because they offer a multitude of different applications, for instance svn, python, ruby on rails and of course PHP. They also offer ssh access.
I chose 123-reg.com to host my domain names, that was done out of convenience, they are well known, large and hopefully know what they are doing
Installing nutch 1.0 on OSX
Today I started to work on a little project that required a crawler, and Nutch seemed to do most of what I needed. The nutch team conveniently released Nutch 1.0 late in March 2009, so I had a brand new release to test out. Installing nutch 1.0 on a mac is not as straight forward as I thought, I ran into a lot of unexpected issues and here is my cook book description of how to successfully install nutch 1.0 on your mac.
- Download the latest source code from the Apache SVN repository http://svn.apache.org/repos/asf/lucene/nutch/. I tried running it from the tarball without success, I also tried to compile the source from the tarball, but a post on the nutch forum clearly states that this will not work.
- Set your JAVA_HOME and NUTCH_JAVA_HOME variables, again this is not straight forward, they both need to point to your real installation of Java 1.6 (earlier versions of Java will fail). I sat these variables to: /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home, I could not get the /Library/Java/Home symbolic link to work properly.
- Compile the source code using Ant (I built it in Eclipse).
- Setup your nutch configuration, by following the tutorial by Peter P. Wang
- Run your first crawl with: ./bin/nutch crawl urls -dir crawl -depth 3 -topN 50
Most of the issues I encountered was related to the Java version and the fact that using /Application/Utilities/Java/Java preferences application do not really change the JAVA_HOME directory /Library/Java/Home properly. So make sure you have set both JAVA_HOME and NUTCH_JAVA_HOME, and that your OSX does not fool you when it pretend to be symbolically linking to the 1.6 installation.
Good luck.
Getting the default option of a ubercart product attribute
In Orange Bus we are currently busy building a new web shop for a clothing company. We are building this web shop on Drupal 6 and Ubercart 2. While I was doing some tuning of the product page (built as a node template) on this site I suddenly realized that even though you can get most of the information needed in from the $node object, you are unable to get the default options of each attribute.
In my case this attribute was the sizes of the products (small, medium, large and so on), the node object contained all the attributes but not the default options. It is not at all complicated to get this information but you do need to add some custom code to get a hold of the default options. I would argue that this should be included in the default node object, which really should not be a big deal adding. I guess I should add a patch for this, instead of going around the problem which is what I do and describe here.
To get a hold of this I had to call a ubercart specific function called uc_product_get_attributes function. This function takes a node id as parameter and return all an array of all the attributes related to the node. The array contain a set of attributes objects and these object contain all the information available on each attribute.
My solution was to call the uc_product_get_attributes function and get the default_option variable from the attribute object, see code example below.
-
//get all attributes related to the node
-
$attributes = uc_product_get_attributes($node->nid);
-
-
//get the id of default size of the product
-
$default_size = $attributes[1]->default_option;
It is simple, but it took me about an 30 minutes to determine the problem and adding a solution. Hopefully this will save someone the job of solving the same problem.
My 7 things
The 7 things have been all around the PHP community for a while now, and I got tagged by Christer a while ago. So I guess I should go around and publish my seven things:
- I am an assisting nurse graduate
- I have a 3 year old daughter
- Expired dairy products are some of the most disgusting things I know
- I dream of some day having a small cabin by the lake, without any internet or television?!?
- I often think about how it would be like to be the only person alive on the earth. (Something similar to the “I am legend” movie, without the zombies).
- I took dance lessons when I was a kid, however I really suck at dancing.
- I drink way to much Pepsi
Those seven things were not really interesting at all, but it was all I could get together for now. Who knows someday I just might publish: “the top 1000 things you did not know about me”
My lucky seven bloggers which I tag are:
- Ms. Ramona Zachariassen
- Mr. Mike Parker
- Ms. Torunn Seim Skrogstad
- Mr. T. Dancer
- Mr. Jan-Petter Jensen
- Mr. Michael Odden
- Mr. Magne Thyrhaug
Here are some rules that must be followed by anyone who decide to follow up:
* Link your original tagger(s), and list these rules on your blog.
* Share seven facts about yourself in the post – some random, some wierd.
* Tag seven people at the end of your post by leaving their names and the links to their blogs.
* Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.
The revolution
I have experienced a revolution the last week. Last Wednesday I was provided with a new phone by my employer Orange Bus, it was an……. Iphone.
I never really understood the big thing with the Iphone, until now, my requirements and expectations from a phone so far has been calling, and sending and receiving text messages. So as you might imagine getting an Iphone was quite a revolution for me, and it have changed my entire understanding of a mobile device, and I am tempted to say that it actually have changed my life to some extent.
Now I am surfing with my (I)phone, I read my emails, I listen to podcasts, check the weather reports, I find directions and I watch youtube videos!?! I am also using it to the regular things like calling and text messaging of course.
I have had other phones before which had wlan, a decent browser and a couple of GB of memory but their user interface and screen size have not been appealing enough for real usage.
I have to hand it to Apple, that is one piece of craftsmanship they have created.
Thank you Apple for revolutionizing my mobile world.