Page redirection javascript – keep session values

header(“Location:./comehere.php?”.session_name().”=”.session_id());

Use along with session_write_close();

Posted in Uncategorized | Leave a comment

Joomla – Content Encoding Error

After updating php, I got: “Content Encoding Error” for some Joomla site.

configuration.php:
public $gzip = ‘0’;

 

Posted in Uncategorized | Leave a comment

removing files starting with hyphen “-” , from console

rm -- ----myfile

The “–” after rm prevents processing of more options, so everything after it will not be taken as option.

Posted in Uncategorized | Leave a comment

Javascript – refresh on resize

You need to refresh the browser window automatically when it is resized.

You can find plenty of complex solutions for this issue, with javascript, and preferably using jquery, the bigger the library the better.

Or you can also put this in the body tag:

<body onResize=”window.location.href = window.location.href;”>

Posted in Uncategorized | Leave a comment

Timezone – Debian

Another old one to remember for the road… simple question:

How to reconfigure / set the timezone in Debian, without rebooting?

dpkg-reconfigure tzdata

Soooo annoying to find plenty of solutions on the net that just tell about setting up the config and have to reboot. No, you dont have to reboot under a proper Linux to change the time. That would be just plain shame.

Posted in Uncategorized | Leave a comment

PHP 5.4 on Squeeze DTC GPLHost hosting server

Old stuff, update PHP for squeeze

Before going into distribution upgrade for my hosting server:

DTC GPLHost running on Squeeze (yeah, I know.)

I will update php, using dotdeb repositories

https://www.dotdeb.org/instructions/

deb     http://packages.dotdeb.org squeeze all
deb-src http://packages.dotdeb.org squeeze all
deb     http://packages.dotdeb.org squeeze-php54 all
deb-src http://packages.dotdeb.org squeeze-php54 all
apt-get update
!? I do not remove the dtc-toaster, just a bad feeling doing that, I should test this sometimes on some vm.
To do so, first I update mysql -> 5.1 -> 5.5
No fear,
Except mysql will not work, you need to update the user table, not the “use” command, to select the db “mysql”:
killall mysqld
mysqld –skip-grant-tables
-> in other terminal:
mysql –execute=’use mysql; ALTER table `user` MODIFY COLUMN `dtcowner` varchar(255) AFTER `authentication_string`’
killall mysqld
/etc/init.d/mysql restart
Then the PHP stuff, I had to remove roundcube-sqlite but that does not matter as it can use mysql.
And it works, great 🙂
I did not keep old config, make sure to keep copy of your old php config, and check what you should modify.
Posted in Uncategorized | Leave a comment

Java SDK install on Debian, the one from Oracle

And Debian flavored distros.. tested on Mint.

This may be a good idea, for example for Android Studio.

Found from:
http://www.webupd8.org/2014/03/how-to-install-oracle-java-8-in-debian.html

First uninstall all Java related previous stuff you may have:

apt-get update
apt-get upgrade
apt-get autoremove
apt-get purge ca-certificates-java default-jre default-jre-headless icedtea-\* icedtea-netx icedtea-netx-common openjdk-\* tzdata-java gcj-\* gcj-jre gcj-jre-headless
apt-get autoremove
apt-get update

Then:

su –
echo “deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main” | tee /etc/apt/sources.list.d/webupd8team-java.list
echo “deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main” | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys EEA14886
apt-get update
apt-get install oracle-java8-installer
exit

Checking:

root@ary-l750:/home/alain# java -version
java version “1.8.0_60”
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

Yep that’s it, tested and approved.

The guys at webupd8 also have a nice package to set the environment vars and make it default:
apt-get install oracle-java8-set-default

Posted in Uncategorized | Leave a comment

Linux auto orient photos with exif data

Easy when you know it:
for file in *.JPG; do convert $file -auto-orient oriented-$file; done

If you want to apply this to only one image:
convert imageinfile -auto-orient imageoutfile

Posted in Uncategorized | Leave a comment

IPTABLES, block IP quick

Very basic IPTables reference

How to block an IP address in Linux from ssh:

DROP anything coming from the IP address 1.2.3.4:

append will put this new rule at the end of your ruleset:
iptables -A INPUT -s 1.2.3.4 -j DROP

with insert you can tell which position you want your rule to be:
iptables -I INPUT 3 -s 1.2.3.4 -j DROP

When you insert the rule will not replace the existing one.

list rules:
iptables -L

list specific INPUT rules:
iptables -L INPUT

find where the rule is in the list, #1 at the top, and delete it:
iptables -D INPUT 3
(removes rule #3 from “INPUT”)

Posted in Uncategorized | Leave a comment

Windows wireless connection issue – cannot see my router / ssid

I’ve got my wireless setup at home working just fine with my Linux machines (Debian) and for some laptop running Windows 7 could not connect.

The SSID is not hidden (better not to), and still could not find it. I could actually at start see the name of my SSID flashing and disappearing in the list of available network.

Till I discover that this windows could not handle channel number 13… when I changed the channel number of the router, the SSID came in the list.

Great.

Posted in Uncategorized | Leave a comment