When I am working on projects, I encounter some situations that I need to read all content of a file insert the content to current buffer. Fortunately, vim read command can do it.

:read /etc/issue

Content of /etc/issue, will be added to current buffer starting by current position.

Read command, can be used by its shortcut r. It means the following snippet has the same result as the previous one.

:r /etc/issue

Read command if proceeds with exclamation mark !, it will consider next parameter as bash command. The bash command will be executed and the result will be inserted to current buffer.

Example use cases:

  • write date time to current line
:r! date
  • write number of users on system to current line
:r! cat /etc/passwd | wc -l
  • write current directory path
:r! pwd

Remember this command. It will save your life.

Amazing effect of using human readable title in naming page’s path to improve SEO, is not deniable for web developers and SEO specialists. URL encoding only accepts a specified characters and the other characters must be transformed.

Take space character as an example, it must be translated to %20. To be human readable these characters should be removed.

There is some gems to make slug from strings. But all of them supports only ASCII characters and other UTF-8 characters like Persian character set will be removed. Slugifa is developed to support Persian character set in generating slug. A brief guide of this gem is provided in following.

gem install slugifa

usage examples

require 'slugifa'

'Mohsen Alizadeh presents'.slugifa
# => "mohsen-alizadeh-presents"

'برگزاری‌ آنلاین مسابقات'.slugifa
 # => "برگزاری-آنلاین-مسابقات"

While developing an application in a programming language, most of application functionalities have close relation to Date and Time. All programming languages have enough facilities to work with it, The problem will be appear in areas that they do not use Gregorian Calendar.

I used to develop my application in PHP language. There is a plenty of libraries to support Persian Calendar in PHP. The first time i migrated to Ruby and Ruby on Rails, lack of Persian Calendar support was one of my serious concerns. I decided to develop a simple gem which i can use in my Rails applications to show dates in Persian Calendar format. Therefore, rails-pdate project created.

Until now, every functionality that i needed in my applications have been developed. It is mainly used to develop Persian Calendar plugin for Redmine. (I will publish this project as open source if project owner grants me the permission)

I will elaborate more on rails-pdate in future.

As everyone knows, Computer is created based on English language. Other Languages are involved later. There are some issues when working on an application which is used in Non English languages like Persian language which is my Native language.

One of the small issues is about numbers. When a system user enters numbers by keyboard, saving characters will be different based on keyboard layout configuration. Therefore, texts displayed on your application will in good format if all of numbers are displayed in English or Persian format.

Read more

Hello world! This site is my first English blog. I will use this blog to share my experiences with you.