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]


Reference:
1 http://www.askapache.com/htaccess/ssl-example-usage-in-htaccess.html
2 http://joseph.randomnetworks.com/2004/07/22/redirect-to-ssl-using-apaches-htaccess/

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'];

Form.Element.getValue(input);

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

// you can also use the shortcut
$F(input);


http://particletree.com/features/quick-guide-to-prototype/

http://xavisys.com/using-prototype-javascript-to-get-the-value-of-a-radio-group/