Archive

For our office products, we are using Amazon Cloud. For the database, we prefer to use Amazon RDS (Aurora). Recently one of our sites was showing lots of error message in sentry.io. The error log shows it was because of MySQL denied to connect for too many open connections. This is when we checked the RDS max_connection limit and found its related to the size of your RDS instance. So we tested the max_connection limit for different size instances. And here is the result:

In projects we may need to make sure some of the urls are only accessible from ssl (https). It’s really useful for user sections. And rest of the url should browse from non-ssl (http) link. It can be done with a small htaccess rules.

In this block we are checking for ssl on and some url, if match we redirect the user to same url in non-ssl version. Here u may notice we are using a extra check ( RewriteCond %{REQUEST_URI} !^/(api) [NC] ) , it’s because in project we may need some url those accisable from both ssl and non-ssl.

Its been around 5 years i am using mac os x. I really love the most features of mac os x, except finder (the default file manager), it’s still missing lots of important functionality like cut, duel panel, folder on top etc etc.

Its been long time i last wrote any post here. Today I am going to show you some use of macports.

Macports – One of the best package manager for mac os x. Its specially helpful for advance user like us, who needs to install lots of *nix packages. And also for developers, to maintain their tools, like apache, php, python, ruby, vi, emacs etc etc. So either you are a advance user or developer, u will like this post.

Here we go:

To use macports, the very first thing you will need to install is the gcc compiler and its helping tool. Don’t get afraid, in mac its very simple to get these tools. Just install the Xcode from your 2nd install DVD, if you don’t have the DVD, you can download it from apple site. it’s free 🙂

After the Xcode is installed get the macports installer dmg from macports.org. Mount the dmg and run the installer. it’s damn simple, but you may have to wait 10-20 minutes to complete the installation (based on your mac configuration).

Congratulation!!! your install processing complete. Now how you will use it.

Install package:

$ sudo port install portname

Searching package:

$ port search packagename

Variants:

A very good feature of macports, you can choice what will be configured/installed along with this package. Like if your installing php5 , you may tell the installer to configure it for apache or fastcgi mode or no_web . That’s the best part of macports. You can pick what you need, and what not. Here is the command format:

$ sudo port variants packagename

this command will give you a possible variants list. you will have to +variants_name after the normal ports install command.

$ sudo port install packagename +variants1 +variants2

Upgrade package:

Upgrade is one of the important reason of using package manger, instate of installing everything separately. You will get all your installed packages almost without any effort.

upgrade a single package:

$ sudo port upgrade packagename

this command will upgrade the package along with the pre-selected variants (if any)

upgrade all packages:

$ sudo port upgrade outdated

This command will upgrade all the outdated application/package to the latest version (of-course you will have to sync ports repo, that i described later.)

Port maintenance:

Though most of the task here, you will do very few time in 2-3 months, but still i am showing it here. As we run one single os for years 🙂

Update repository:

To get the latest changes from port repository. The command is very simple:

$ sudo port sync

Remove inactive ports:

One of the good and bad side of macports is, when u upgrading any existing package, it keep the old versions of the package. After few months of use of macports you may feel the need to clean up the space. Here is the single line command to do it.

$ sudo port uninstall inactive

Cleanup ports:

In long run macports store lots of helping files for the compile process. You may like to run this command sometime after 1-2 months to cleanup some space.

$ sudo port clean –all installed

upgrade macports:

Its even simpler to upgrade your installed ports with single command

$ sudo port selfupdate

or you can check which ports are outdated by running :

$ sudo port outdated

I wrote this post after long time and in very hurry, so there can be some issue or i may missed something. Please let me know, i will fix those.

Last 13th February was the first day of spring. Here in bangladesh we do spring festival to welcome the spring 😀 . As I am doing photography a-lot these days, i tried to capture the festival in my frame as much as possible. Here is some of the pics.

As i was checking WassUp stats of my blog, suddenly i found that my blog got 71 visits from some external sites (referrer) in last 24 hours. First my felling was “WOW, so may referrer”.

referrer spam

*screenshot: showing external referrer excluding search engines.

Later after i check some of those referring sites, i found these are just some sites, that using my site to get better position in site ranking. It’s call “referrer spam”. From wikipedia:

Referrer spam (also known as log spam or referrer bombing[1]) is a kind of spamdexing (spamming aimed at search engines). The technique involves making repeated web site requests using a fake referrer url that points to the site the spammer wishes to advertise.[2] Sites that publicize their access logs, including referrer statistics, will then end up linking to the spammer’s site, which will in turn be indexed by the search engines as they crawl the access logs.

This benefits the spammer because of the free link, and also gives the spammer’s site improved search engine ranking due to link-counting algorithms that search engines use.

Though these visits will not loss you any thing, but it will just waste your server resource. And also if you show some stats on your site like referrer, then your visitors will get some wrong links.

Ok lets see how we can stop them. I searched on net, but didn’t got any good solution. So here is my solution.

Just add these lines to your .htaccess file and smile.

Order Allow,Deny
Deny from 195.54.42.56
Deny from 89.149.244.217
Deny from 78.137.7.99
Deny from 94.142.134.155
Allow from all

Here i use ip to block/stop this abuse, because after some research i fount this is happening from just particular ips, means those ips running some scripts to do this. Its semi manual way (still looking for better way). Just get these ips from your access log or any 3rd party plugins or apps. then add “Deny from newip” before Allow from all .

As i work with some bangla sites, it’s very common problem for me to create eot of bangla true type font. Today i got a really simple solution. Now (As just learned the system) you can create or convert eot from any ttf font from mac or linux with simple one line command.

$ ttf2eot < fontname.ttf > fontname.eot

That’s all!!!! .

Wait, little work left, you have to install ttf2eot :
in mac os x: sudo port install ttf2eot
linux : download the latest source from http://code.google.com/p/ttf2eot/downloads/list , extract it, then run make in the extracted folder. then you good to go. “./ttf2eot < input.ttf > output.eot”

Are you bored with clicking the right click every time to select your fav application to open a file ? At least i am , i like VLC very much and using it for last few years as my media player.

After searching on google i got a very good application to that and plus is it’s free 🙂 , and the site – RCDefaultApp

more data from their site

RCDefaultApp is a Mac OS X 10.2 or higher preference pane that allows a user to set the default application used for various URL schemes, file extensions, file types, MIME types, and Uniform Type Identifiers (or UTIs; MacOS 10.4 only). MacOS X uses the extension and file type settings to choose the application when opening a file in Finder, while Safari and other applications use the URL and MIME type settings at other times for content not related to a file (such as an unknown URL protocol, or a media stream).

RCDefaultApp also allows setting the application when digital cameras or FireWire webcams such as iSight are connected to the computer. For completeness’ sake, there are also settings that mimic the existing “CDs and DVDs” preference pane, which allows setting the action to take when various types of CDs and DVDs are inserted into the computer.

This screenshot shows the section where the default application for various Internet services can be set, similar to the preference in Safari.app and Mail.app.

This shows how to set the application for an extension; just pick the desired application from the list.

This shows the section to set the action for when various types of media are inserted or turned on, similar to the preference in Image Capture.app and iChat.app. The CD and DVD preferences are also duplicated here with easier access to the “Perform action at login” setting.

This shows the section where each application’s possible settings can be seen and assigned at once. The small button in the bottom right is for RCDefaultApp “About” information.

I am also feeling myself that i am playing too much computer game. i should stop now. lot’s of my pet projects are pending, even the avro team waiting for me to submit the avro linux version code to debian/ubuntu repository 🙁 . i should should stop now.

Anyway let me share you which game i am playing now a days.

1. AOE2 – (http://www.microsoft.com/games/age2/) though its a very old game, but still i love it. it prove that “old is gold”

About me

I am S. M. Ibrahim lavlu aka lavluda working as web application developer, server security and optimization, apps scaling consultant from dhaka, bangladesh. On my free time i like to pass my time for opensource projects.

If you are interested to work with me or hire me, send a mail to smibrahim [at] gmail.com My Linkedin profile