Forcing ssl to particular page and non-ssl to other pages

March 14th, 2013 2 comments

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.

Here is htaccess hack to do:

#SSL for some pages
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_FILENAME} !index\.php$ [NC]
RewriteCond %{REQUEST_URI} ^/(signin|signup|account) [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

In this block we are checking for ssl off and some url, if match we redirect the user to same url in ssl version.


#SSL off for some pages
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_FILENAME} !index\.php$ [NC]
RewriteCond %{REQUEST_URI} !^/(signin|signup|account) [NC]
RewriteCond %{REQUEST_URI} !^/(api) [NC] #allow this url from both ssl and non-ssl
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

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.

Views :1886

TotalFinder – the missing file manager for mac os x

August 28th, 2012 No comments

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.

So to fix these missing features problem i was looking for a good solution and few months ago found a very good solution for it, called “TotalFinder – brings tabs to your native Finder and more!“. I really loved it.

The features i liked most:

1. Cut & paste : You will able to use Cut and paste feature, even with keyboard shortcut.

2. Dual mode: If you are a old “total commander” fan, then you know what it means. You will able to use finders parallel. It really helps when you are moving files from one folder to another.

3. Tabbed Browsing: You browse all your folders in a single window.

4. Folders on Top: Your finder stay on top of the other window.

There are more features, but i really love these features.

Check their site for more details TotalFinder

Views :2540
Categories: General Tags:

Macports – Your ultimate friend for developers

March 13th, 2012 No comments

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.

Views :2278

Spring festival 2012

February 21st, 2012 No comments

Last 13th February was the first day of spring. Here in bangladesh we do spring festival to welcome the spring :D . 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.

* I am adding more pictures almost every day. so don’t forget to come back again or add me in flickr.
* all picture have individual flickr link, click on the link to see large version.

Views :3231

Stop referrer spam on your site

February 14th, 2011 12 comments

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

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 .

That’s all . If you know any better option please share with us.

Views :8818

Make/converting eot from ttf in mac os x & linux

February 7th, 2011 3 comments

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”

Views :6167

Set/change default application on mac os x

October 5th, 2010 1 comment

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.

This shows RCDefaultApp as it appears in System Preferences.app.

Views :6726

Got iPad

September 11th, 2010 2 comments

After waiting for so long, we got my iPad. You can’t believe how much happy We are.

Thanks goes to my friend shanaz kanon apu and here husband for bring this iPad from japan.

It’s an gift to my wife Tania sabnam.

Right now writing this post from iPad. Will upload real photo soon.

Views :5257
Categories: My Computer Tags: ,

playing too much games

May 16th, 2010 4 comments

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”

2. AOE3 – ( http://www.ageofempires3.com/) it’s my second fav :) i like the deck :)

also playing some other game, will add more on next post, again going to play aoe3 :)

Views :8184
Categories: games Tags: , , ,

Download iPhone SDK using wget

August 28th, 2009 9 comments

If you are using slow connection like me and trying to download the apples iPhone SDK , then you already know how much tough it is , because of apple only allow to download this file after login. And non of the download manager can give you the resume facility. so after trying 2 days with different downloaders i tried wget and got sucess :D

Here i am discribing how to do it. First login to http://developer.apple.com/iphone (if you don’t have any account, just create one, it’s free). then use firefox extension to export (firebug+firecookie) cookie to cookie.txt . Then rest of the task simple. just copy download link from http://developer.apple.com/iphone and give the following command in the console.

$cd /path/to/cookie.txt

$ wget -ct 0 –load-cookies cookie.txt your_file_url

that’s all, now you can resume download without any problem. Here is the command i used to download to download it.

$ wget -ct 0 –server-response –load-cookies cookies.txt http://developer.apple.com/iphone/download.action?path=/iphone/iphone_sdk_3.0__final/iphone_sdk_3.0__leopard__9m2736__final.dmg

If this post help you, don’t forget to share it with others.

Views :10619
Categories: iphone, mac, Tricks Tags: , , ,
77 queries in 5.486 seconds