May 31, 2011

May 24, 2011

Search and replace in multiple files.

  • find app/code/local/Flux/Catalog/ -name "*.php" -print | xargs sed -i 's/Mage_Catalog/Flux_Catalog/g'

  • perl -w -i -p -e "s/search_text/replace_text/g" filename

  • perl -w -i -p -e "s/search_text/replace_text/g" *.php

  • find /www_root -name "*.php"|xargs perl -w -i -p -e "s/Perl is good/perl is great/g"

Linux User Expiration

Check password expiration date

[winsftp@FRNAPROD ~]$ chage -l username
Sample Output:
[winsftp@FRNAPROD ~]$ chage -l fluxsftp
Last password change : Jul 07, 2012
Password expires : Aug 06, 2012 Password inactive : never
Account expires : never
Minimum number of days between password change : 30
Maximum number of days between password change : 30
Number of days of warning before password expires : 7

May 19, 2011

HTACCESS: Rewrite all HTTP request to HTTPS

RewriteCond %{HTTPS} !=on
RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


May 18, 2011

JS Prototype - How to access value in FORM input text?

For example, if you have an input named "company" in a form with an ID "contact":

var form = $('contact');
var input = form['company'];


// but, the preferred call is:
$(input).getValue(); // we used the $() method so the node gets extended

// you can also use the shortcut