Come installara Varnish 3 su debian squeeze


curl http://repo.varnish-cache.org/debian/GPG-key.txt | apt-key add -
echo "deb http://repo.varnish-cache.org/debian/ $(lsb_release -s -c) varnish-3.0" >> /etc/apt/sources.list
apt-get update
apt-get install varnish

How to add new administrator user in Magento.

It can be a bit tricky task if you are not familiar with magento system, but it’s pretty easy once you know where to go.

Open magento administration page, then go in system->permissions->users.
Click on “Add new user“, fill necessary data.
Be sure to click on the Roles tab (on the left) and associate Administrator Role to user.
Click on Save.

Of course you can also create new role and assign to user some non devastating permission (i.e only ability to change descriptions and photos of your products).

How to reset file/directory permissions with chmod on web server.

The solution is quiet simple: just exec following commands inside site’s root:

find . -type f -print0 | xargs -0 chmod 644
find . -type d -print0 | xargs -0 chmod 755

Magento: convert all wrong product links in their canonical equivalent.

Sometimes in magento product links are listed in the following mode:
catalog/product/view/id/3/s/product-name/category/3/
which can be very inconvenient from the SEO point of view. To solve this issue you can force a canonical form of product url in following mode:

In theme/template/catalog/product/list replace all instances of

$_product->getProductUrl()

with

Mage::getUrl($_product->getUrlKey())

Edit attribute(show,x) template in EzPublish

You know when you are using attribute(show,2) on some variable and you can’t understand levels of variable’s contents? I do, so i decided to tweak a bit this function.

All you need to do is open
lib\eztemplate\classes\eztemplateattributeoperator.php
and replace all instances of $spacing = str_repeat( “>”, $cur_level ); with $spacing = str_repeat( “==”, $cur_level );

Now it’s a bit more understandable.

Colonna sonora di “Real Steel”

Se avete visto questo film, forse vi è piaciuta la colonna sonora utilizzata (anche se a mio avviso hanno messo un po troppo hip pop). Nel caso volete riascoltarla su youtube o comprarla su itunes eccovi l’elenco dei brani:

1. Fastlane – Bad Meets Evil (Edited)
2. Here’s A Little Something For Ya – Beastie Boys (Edited)
3. Miss The Misery – Foo Fighters
4. The Enforcer – 50 Cent (Unreleased)
5. Make Some Noise – The Crystal Method Featuring Yelawolf
6. Till I Collapse – Eminem (Edited)
7. One Man Army – Prodigy & Tom Morello
8. Give It A Go – Timbaland Featuring Veronica
9. The Midas Touch – Tom Morello
10. Why Try – Limp Bizkit (Edited)
11. Torture – Rival Sons
12. All My Days – Alexi Murdoch
13. Kenton – Danny Elfman

E invece per quanto riguarda il contributo di grande Danny Elfman:
Continua…

Le novità sui ricorsi dal giudice di pace per le multe.

Ci sono diverse novità in arrivo… Dopo l’introduzione del contributo unificato (37 euro anche per ricorsi contro le multe per divieto di parcheggio di 39 euro <.<), dal 6 ottobre il termine per opporsi ad una multa si sono dimezzati passando da 60 ai 30 giorni a partire dalla data di accertamento (nel caso di notifica immediata) o notifica del verbale.

Altra novità è che se il ricorso è stato respinto, il magistrato potrebbe aumentare l’importo della sanzione fino al massimo previsto. Per esempio, se superate il limite di velocità di oltre 10 km/h (ma sotto i 40), la multa che vi arriva a casa è di 159 euro. Se presentate un ricorso e lo perdete, il magistrato potrebbe decidere di portare l’importo dela sanzione fino a 639 euro

 

Bloccare i bot con Nginx in base al loro User Agent

Ecco un piccolo snippet utile per bloccare i bot che non desideriate che si aggirano sul vs. server.

if ($http_user_agent ~ "(Purebot|MaMa CaSpEr|libwww-perl|Mail.Ru|gold crawler)" ) {
    return 403;
}

Le virgolette servono a causa dello spazio in “gold crawler”, altrimenti riceverete l’errore [emerg] invalid condition “$http_user_agent”

Problemi con mib di snmpd su debian

Cercando di estendere le funzionalità di snmpd mi è uscito seguente errore


MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (SNMP-FRAMEWORK-MIB): At line 9 in /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Cannot find module (SNMPv2-SMI): At line 8 in /usr/share/mibs/netsnmp/NET-SNMP-MIB
Did not find 'enterprises' in module #-1 (/usr/share/mibs/netsnmp/NET-SNMP-MIB)
Unlinked OID in NET-SNMP-MIB: netSnmp ::= { enterprises 8072 }
Undefined identifier: enterprises near line 10 of /usr/share/mibs/netsnmp/NET-SNMP-MIB
Cannot find module (SNMPv2-TC): At line 21 in /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Did not find 'SnmpAdminString' in module #-1 (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'netSnmpObjects' in module NET-SNMP-MIB (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'netSnmpModuleIDs' in module NET-SNMP-MIB (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'netSnmpNotifications' in module NET-SNMP-MIB (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'netSnmpGroups' in module NET-SNMP-MIB (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'DisplayString' in module #-1 (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'RowStatus' in module #-1 (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Did not find 'TruthValue' in module #-1 (/usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB)
Unlinked OID in NET-SNMP-AGENT-MIB: nsAgentNotifyGroup ::= { netSnmpGroups 9 }
Undefined identifier: netSnmpGroups near line 545 of /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Unlinked OID in NET-SNMP-AGENT-MIB: nsTransactionGroup ::= { netSnmpGroups 8 }
Undefined identifier: netSnmpGroups near line 536 of /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Unlinked OID in NET-SNMP-AGENT-MIB: nsConfigGroups ::= { netSnmpGroups 7 }
Undefined identifier: netSnmpGroups near line 515 of /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Unlinked OID in NET-SNMP-AGENT-MIB: nsCacheGroup ::= { netSnmpGroups 4 }
Undefined identifier: netSnmpGroups near line 505 of /usr/share/mibs/netsnmp/NET-SNMP-AGENT-MIB
Unlinked OID in NET-SNMP-AGENT-MIB: nsModuleGroup ::= { netSnmpGroups 2 }

Cercando un po in giro ho trovato che questo errore è causato dal fatto che per motivi della licenza, i mib extra non sono più inclusi dentro il pacchetto standard di snmpd. Per risolvere questo problema basta lanciare seguente commando:

apt-get install  snmp-mibs-downloader

Come configurare mc (midnight commander) per usare vim durante la modifica dei file

Se volete che premendo F4 in midnight commander vi esca il vostro caro vecchio vim invece dell’editor allora dovete andare in Opzioni->Configurazione e togliere la spunta sulla voce “Usa editor interno

Se dopo questa operazione ancora non vedete il vim ma per esempio nano, allora eseguite

sudo update-alternatives –config-editor

e selezionate dalla lista vim-basic