Create Post Excerpt Intelligently in Jekyll

meta-descriptions or OpenGraph Descriptions are the short descriptions that Search Engines/Facebook display on result pages. They provide a brief introduction to the content and grab user attention. So when possible, try to use keywords in meta description that describes in short what that page is about. Ensure to limit meta description length to 160 characters which seems to be a norm for SEO now-a-days.

Jekyll by default supports post.excerpt which would automatically take the value of excerpt from Front Matter (if present). Otherwise it will fall-back to post content from beginning till excerpt_separator or end of post. Whatever separator you choose, have it defined as excerpt_separator in _config.yaml. With this done you can use {% raw %}{{ post.excerpt | strip_html }}{% endraw %} wherever you need to show it (e.g. meta-description/og-description). I use strip_html to remove any html which will cause issues with description tags.

I personally like to show a bigger teaser on my main page to entice user attention. And on other pages (like search results, Category/Tag index) show a brief description. Here is how I do it.

  1. Define meta-description tag in Front Matter of the post and describe in few words what the post is about. Then use {% raw %}{{ post.meta-description }}{% endraw %} during publishing HTTP headers for the post and on Category/Tag index pages. And on main page OR index.html use {% raw %}{{ post.excerpt }}{% endraw %} which is auto-generated by Jekyll based on Front Matter or excerpt_separator. I personally stopped defining excerpt in Front Matter to avoid namespace collision with Jekyll.
    Continue reading

xming : Client 4 rejected from IP

If you are getting following error in xming log:

Xming.exe: client 4 rejected from IP XXX.XXX.XXX.XXX

Here are two solutions.

  1. Secure method: Edit: X0.hosts (in the installation directory) and add the ip you want allow. e.g.

    Restart Xming.

  2. Insecure method: Add the “-ac” option to the Xming desktop shortcut. Modify the Desktop Xming shortcut to include the arguments: “:0 -clipboard -multiwindow -ac”. The ac option accepts client requests and quells the error above. Start Xming using the shortcut you just created. Warning: This is same as “xhost +” which will grant anyone access. So only use Xming option -ac or “xhost +” on trusted networks, never on public ones. OR use the solution 1 of additing IP address of known systems on which you will be running X applications..

snmp : find network information of a system centrally

Anyone can login to a system and run ifconfig or netstat or other similar commands to find the network information of a system. But what will be even better? Do it remotely without logging in to each and every system. How? Using snmpwalk one can retrieve all this information provided that subject has both snmpd running, snmpd supporting network information and the querying host is allowed to make SNMP queries. Lets see how.

Interface table is covered by basic SNMP (just like system information, udp, tcp  socket information, address translation and snmp stats etc). Here is how to query the interface table to get the IP address and Subnet mask information.

unixite@sanbox:~/ > snmpwalk -v1 -c public sandboxS:161
iso. = IpAddress:
iso. = IpAddress:
iso. = IpAddress:
iso. = IpAddress:
unixite@sanbox:~/ > snmpwalk -v1 -c public sandboxS:161
iso. = IpAddress:
iso. = IpAddress:
iso. = IpAddress:
iso. = IpAddress:

First one here retrieves the IP addresses on the system while second one get the subnet masks. -c public has to be changed to right community string and also the version if your supports a different one. My system name here is sandboxS and snmpd is listening on default port 161. If not then you can change the port to match yours.

Configure Apache to run PHP on Windows

Just rebuilt my Windows laptop and had to reload Apache, MySQL and PHP. Some may suggest WAMP or XAMPP projects to simplify things, but those are my last resorts. I like to have full control of the situation. So I downloaded the latest versions of each from respective site and installed them. And then the problem happened.

PHP installed successfully but had an error that it could not access httpd.conf so PHP files could not be executed. To get the short answer, I turned to Google. It took me about 10 minutes and sorting of 20 webpages to get to the right configuration. Only if I had gone directly to Apache it would be better. But here is what configuration in Apache has to be done to get PHP files recognized and run by Apache.

Modify httpd.conf file to have following.

# Tell Apache where to pick PHP Module from
LoadModule php5_module "C:/Program Files/PHP/php5apache2_2.dll"

# Tell Apache that it should treat index.php just like index.html
DirectoryIndex index.html index.php

# Add type for PHP file handler
AddType application/x-httpd-php .php
# This is optional but allows user to access php source file (php files with extension  renamed) with full syntax highlighting
AddType application/x-httpd-php-source .phps