Postări

Se afișează postări din 2012

Display image in gmail

Display image in gmail // content index.html <img src="script.php?f=img.png"> //content of script.php <?php header('content-type: image/jpg'); readfile($_GET['f']); ?>

Magento home display products

in admin - cms - pages home page in content insert this lines {{block type="catalog/product_new" template="catalog/product/new.phtml"}} {{block type="catalog/product_new" name="home.catalog.product.new" alias="product_homepage" template="catalog/product/new.phtml"}} {{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="3" template="catalog/product/list.phtml" column_count="4"}}

Zend

get config in controller $config = $this->getServiceLocator()->get('Config'); $config = $this->getServiceLocator()->get('ApplicationConfig'); get get params $this->params()->fromQuery('getVar',null);

Typo3 snippets

Clear cache from fe extension $GLOBALS [ 'TSFE' ] -> clearPageCacheContent_pidList ( $pidList ) Language menu graph with flags temp.langMenu = COA temp.langMenu.10 = IMAGE temp.langMenu.10{ file=fileadmin/img/ro.gif stdWrap.typolink.parameter={TSFE:id} stdWrap.typolink.additionalParams=&L=0 stdWrap.typolink.parameter.insertData=1 titleText=Romana params=class="img-polaroid" } temp.langMenu.11 = TEXT temp.langMenu.11 { typolink.parameter.data = TSFE: id typolink.additionalParams = &L=0 value = Română } temp.langMenu.20 = IMAGE temp.langMenu.20{ file=fileadmin/img/gb.gif stdWrap.typolink.parameter={TSFE:id} stdWrap.typolink.additionalParams=&L=3 stdWrap.typolink.parameter.insertData=1 titleText=Romana params=class="img-polaroid" } temp.langMenu.21 = TEXT temp.langMenu.21 { typolink.parameter.data = TSFE: id typolink.additionalParams = &L=3 value = English }

Select Range Datepicker

1. display selector for change month / year 2. on month/year change preserve day and modify input 3. restriction selection prev or future date $(function(){     var d = new Date();     d.setMonth(d.getMonth(),1);     $('#from_date').datepicker({         dateFormat: 'yy-mm-dd',         changeMonth: true,         changeYear: true,         showButtonPanel: true,         beforeShow: function(input, instance) {             window.from_day = $('#from_date').val().split('-')[2];             if($('#from_date').val()==''){                 $(input).datepicker('setDate', d);             }         },         onSelect: function( selectedDate ) {     ...

Block email from postfix to yahoo

Block email from postfix to yahoo in etc/postfix/main.cf  insert transport_maps = hash:/etc/postfix/yahoo create file yahoo in folder /etc/postfix with this content: yahoo.com error:Emails to yahoo are banned 

File structure Mio

FBL - map files - \Content\MAP FSP - speed profile for a given road for smart routes HSP - histspeed (maximum car per given road ratio) - \content\histspeed FTR - Truck Info - \Content\MAP FPA - Proximity Alerts - \Content\MAP FDA - Driver Alerts - \Content\MAP HNR - Defined Routes - \ Content\ MAP TMC - Traffic Message Channel - Content\TMC

Tar over ssh

Archive using tar command over ssh - store to other ssh server tar zcvf - /var/www/html | ssh root@myserver.com "cat > /home/myhome/html.tar.gz"

jquery iframe resizer

jQuery(function() {     sizeIFrame();     jQuery("#iframe_id").load(sizeIFrame); }); function sizeIFrame() {     var helpFrame = jQuery("#iframe_g");     var innerDoc = (helpFrame.get(0).contentDocument) ? helpFrame.get(0).contentDocument : helpFrame.get(0).contentWindow.document;     try {         helpFrame.height(innerDoc.body.scrollHeight + 35);     }     catch (e) {         //do nothing     }        if(document.all) {         try {             helpFrame.style.height(innerDoc.body.scrollHeight + 35); ...

postfix configuration

smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination ....

Show password in backend typo3

Display fe_users password in backend - typo3 add this line to typo3conf/extTables.php   $TCA['fe_users']['columns']['password']['config']['eval'] = 'nospace,required';

Config realurl for my extension

<?php $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['realurl']=array (   '_DEFAULT' =>   array (     'init' =>     array (       'enableCHashCache' => true,       'appendMissingSlash' => 'ifNotFile,redirect',       'adminJumpToBackend' => true,       'enableUrlDecodeCache' => true,       'enableUrlEncodeCache' => true,       'emptyUrlReturnValue' => '/',     ),     'pagePath' =>     array (       'type' => 'user',       'userFunc' => 'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',       'spaceCharacter' => '-',       'languageGetVar' => 'L',     ),     'fileName' =>     array (       'defaultToHTMLsuffixOnPrev' => 0,       'acc...

Links html5

http://html5boilerplate.com/ http://html5please.com/ http://caniuse.com/

Start-up script in ubuntu

Start-up script in ubuntu create a file mystart.sh in /etc/init.d !#/bin/sh hostname ns.example.com save file make executable chmod +x /etc/init.d/mystart.sh and after that adding to default runlevels update-rc.d mystart.sh defaults

iptables security script - a must do init...

#!/bin/sh #------------------------------------------------------------------------------ # # File: SIG-antiDDoS.sh # # Compiler: Ruslan Abuzant <ruslan@abuzant.com> #           PS> Collected From Lots Of Sources #           PS> Credits: Real Authors (no idea) # # URL: http://www.liteforex.org/ # # License: GNU GPL (version 2, or any later version). # # Configuration. #------------------------------------------------------------------------------ # For debugging use iptables -v. IPTABLES="/sbin/iptables" IP6TABLES="/sbin/ip6tables" MODPROBE="/sbin/modprobe" RMMOD="/sbin/rmmod" ARP="/usr/sbin/arp" # Logging options. #------------------------------------------------------------------------------ LOG="LOG --log-level debug --log-tcp-sequence --log-tcp-options" LOG="$LOG --log-ip-options" # Defaults for rate limiting #------------------------------------------------------------...