Linux / Windows – what’s the difference…

Office365 e-mail oma .EE domeeninimega läbi GoDaddy

K: Kui sul on olemas oma domeeninimi ja Office365 Home tellimus – kas saab kasutada oma ostetud domeeninime? V: Rahvusvahelisi jah, kui need on registreeritud läbi GoDaddy domeeniregistri. K: Aga mul on .ee domeeniregistris olev domeeninimi, kas ka seda saab siduda Office365 tellimusega? V: Ei ja Jah. Ehk vaikimisi mitte, kuid väikese automaagilise peidetud vigurdamisega […]

, ,

Good snippet for when You have to revalidate page on every load (sportnews etc.)

Add to Your .htaccess: FileETag None Header unset ETag Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" Header set Pragma "no-cache" Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"  

How to add publickey to Unix SSH when VNC like console lacks of copy/paste functionality

1. Copy Your publickey to a file and add it to some webpage (for ex. pubkey.txt and added to tomain 2. Log on to console as user needed 3. Get remote file to under Your account: curl '' > tempfile 4. Add it to authorized_keys file: cat tempfile >> .ssh/authorized_keys  

Snippet for replacing certain code within PHP code

Replaces/searches by row on unix commandline: find folder/* -type f -name \*.php -exec sed -i.bak.php "s/function_name('blahblah');/\$variable['blahblah'];/" {} \; – searches in certain folder – searches in .php files – makes backup of modified files NB! Some things must be escaped with \ mark

Fix for old code when GLOBALS are needed on newer PHP versions

Quickfix is: if (! isset($PXM_REG_GLOB)) { $PXM_REG_GLOB = 1; if (! ini_get('register_globals')) { foreach (array_merge($_GET, $_POST) as $key => $val) { global $$key; $$key = (get_magic_quotes_gpc()) ? $val : addslashes($val); } } if (! get_magic_quotes_gpc()) { foreach ($_POST as $key => $val) $_POST[$key] = addslashes($val); foreach ($_GET as $key => $val) $_GET[$key] = addslashes($val); } […]

How to install Symfony3 under shared webhosting in Developement mode

1. Log in to SSH 2. Install Composer (We assume that composer is not yet installed): export COMPOSERDIR=~/bin;mkdir bin curl -sS | php — –install-dir=$COMPOSERDIR –filename=composer (Composer will be installed under: /home/username/bin/composer ) 3. To test that installation was successful – You can run: ~/bin/composer 4. Make environment global INSTALLDIR: export INSTALLDIR=~/public_html/symfony mkdir $INSTALLDIR […]

, , ,

All local mail sent out via external smarthost (Exim4 on Ubuntu 16.04)

Steps to do: 1. First run (start basic exim conf): sudo dpkg-reconfigure exim4-config And use these config options: General type of mail configuration: mail sent by smarthost; received via SMTP or fetchmail System mail name: IP-address to listen on for incoming SMTP connections:, ::1 Other destinations for which mail is accepted: Machines to relay […]

unserialize() : Error at offset XX:XXX

Food for thought: 1. Probably Your charset is wrong (after PHP 5.5) – Set charset after open tag: header('Content-Type: text/html; charset=utf-8'); – And set charset utf8 in your database : mysql_query("SET NAMES 'utf8'"); 2. Your serialized array is faulty Could be fixed by: $fixed_data = preg_replace_callback ( '!s:(\d+):"(.*?)";!', function($match) { return ($match[1] == strlen($match[2])) ? […]

NetBeans on Ubuntu

Earlier I had version NB 8.0.* on my laptop – worked like a charm. On Ubuntu 16.04 I installed NB 8.1.* via official repo – and that’s where the problems started… I had no luck enabling auto-completion from included file – Interwebs was full of probable “solutions” to remove cache and/or to check settings and/or […]

Bash script to run via command-line to lowercase all file- and folder names in current folder recursively

#!/bin/bash # first, rename all folders for f in `find . -depth ! -name CVS -type d`; do g=`dirname "$f"`/`basename "$f" | tr '[A-Z]' '[a-z]'` if [ "xxx$f" != "xxx$g" ]; then echo "Renaming folder $f" mv -f "$f" "$g" fi done # now, rename all files for f in `find . ! -type d`; […]

Previous Posts