Page 13 of 31

Publishing article with SEO rules

As I want to keep this post secret as possible I will not follow those rules here :)

  1. which keywords I need to have into the title of the article
  2. which additional keywords I need to have into the subtitle
  3. which text I want to promote to Heading or make it strong
  4. check the most important text in the article that has nice keyword density around my important information.
  5. if there are abbreviations – add the acronym tag to describe them.
  6. all images should have nice alt/title/file name text, When possible add link to the image to relevant information.
  7. links:
    1. which are my important links (containing keywords)
    2. which links should be interesting to be linked on psspy/dagens archive for more news
    3. does all links have title / alt tags, what keywords can I add there?
  8. do I want to provide a box with related news on this article

Auch – PHP

WTF?!

PHP use one standard but those Symfony guys use another?!

You may wonder why the helpers are named according to the underscore syntax rather than the camelCase convention, used everywhere else in symfony. This is because helpers are functions, and all the core PHP functions use the underscore syntax convention.
ref: http://www.symfony-project.org/book/1_0/07-Inside-the-View-Layer#chapter_07_sub_helpers

Argh…this rmagick gem – aways difficult to install/maintain.

I have recently upgraded to Ubuntu 10.04 and I got this nasty rmagick gem error:

RMagick2.so: This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)

google for This installation of RMagick was configured with ImageMagick 6.5.5 but ImageMagick 6.5.7-8 is in use. (RuntimeError)

then found this page in mixed English/Chinees

and finally got a page in German :)

Then I decide to write this post in English and slightly modify the solution

instead of putting

RMAGICK_BYPASS_VERSION_TEST = true in the deploy.rb

I have put this in the development.rb

and all it works – this way on the production I will be forced to use real compatible library or at least check again for another solution or gem.

AUCH! This solution doesn’t work even in development I got weird core dumps :( …so here it is another try

Here is the real working  solution:

su -
git clone http://github.com/rmagick/rmagick.git
cd rmagick/
ruby setup.rb
ruby setup.rb  install

How to turn your free client to a payed one

Very good examples of phrases like

  • ‘If you’d like me to do that for you, I charge $XXX/hour.’
  • ‘I can spend ten minutes with you, and if you require more assistance I will be glad to schedule a consultation at my regular rates.’
  • ‘You do know that we just crossed into paid time?’ he asked. ‘Oh, yes,’ the prospect said

read the full article here >

http://freelanceswitch.com/freelancing-essentials/turn-free-advice-into-clients/

Nice code

I have just finished one method and I was not happy with the code. Then I put a comment on top of the method “Far from perfect….”.

Then I read the class – it was ugly.

here is the before

def validate
 return if is_email == false
 found = InternetComunicatorType.find(:first, :conditions => {
 :is_email => true,
 })

 return unless found

 if found.id != id
 errors.add(:is_email, "We have already email type")
 return
 end
end

here is the after

def validate
  if is_email
    found = InternetComunicatorType.find(:first, :conditions => {
      :is_email => true,
    })

    if found and found.id != id
      errors.add(:is_email, "We have already email type")
    end
  end
end

The result is much far readable

Mongoid presentations

When starting with mongoid I have missed a lot some demo source code.

How it works with controllers, does it plays nice with nested attributes, such things.

Here is presentation of mongo  and here are some slides

Mongoid

I writing this post for those who start using Mongo in their rails applications. I want to share my experience. First I discovered mongoid but then i saw mongo_mapper  – so I decide to go with the crowd. But! I was wrong. I there is no documentation for mongo_mapper but some blog posts arround, the examples are not aways working and you have to fight with all the code – I don’t maybe I have found some old documentation. When you dive in the code – again no documentation and not clear behaviour. Maybe it is a good solution but for me it doesn’t work. I lost 1.5 days experimenting and hoping that the things will go.

Then I give a try with mongoid. It has wonderfull documentation for starters also it seems at first glance that the code in mongoid is more readably and human friendly. It took me 2hours to port all my models to mongoid.

The guy developing mongoid seems pretty active.

last words – it is pleasure to work with mongoid – I recommend it to all.

A lot of Javascript this days

I am migrating to jQuery and found this wonderfull tutorial on their webpage.
A must read for anyone which pretend to know js.

http://docs.jquery.com/Types

Малко хумор за твоя сметка

Relaying Postfix SMTP via smtp.gmail.com

This article is from ubuntu-tutorials.com

I’ve got a few servers in different places around the country and try to monitor them using the logwatch utility.  One problem that I’ve run into however is that a few of these servers are not able to send their logwatch emails to me, based on email restrictions by the ISPs.  I spent some time this afternoon researching what was required to have my servers authenticate to my gmail account and send me the mail that way.  This setup assumes Ubuntu 8.04 (or later) and Postfix.

Install the required packages

sudo aptitude install postfix libsasl2 ca-certificate libsasl2-modules

Configure Postfix

This tutorial will not outline how to configure your postfix server, but we’ll jump directly to the relayhost section.  You’ll want to add the following lines to your /etc/postfix/main.cf file:

relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes

The above lines are telling Postfix that you want to relay mail through gmail on a specific port, telling it to authenticate, and where to find the username and password.  The last three lines specify the authentication types supported, where the certificate authority file is and that it should use tls.

Define Username and Password

Next we’ll need to populate the sasl_passwd file.  Create the file /etc/postfix/sasl_passwd with the following contents:

[smtp.gmail.com]:587    user.name@gmail.com:password

This file should have restrictive permissions and then needs to be translated into a .db that Postfix will read.

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd

At this point you can restart Postfix and it should work, however it will complain about not being able to authenticate the certificate.  To take care of this issue we’ll use the ca-certificate package we installed and tell it where it can validate the certificate.

cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem

Go ahead and reload postfix (sudo /etc/init.d/postfix reload) and you should be set.

© 2026 Ivo Bardarov

Theme by Anders NorénUp ↑