PHP: container for values and objects

Using the class  \Airaghi\Tools\Container it’s  possibile to share between your scripts (inside a single execution flow) values and objects reference without having to use global variables.

The class has methods for:
– saving and getting values
– saving and getting objects references
– deleting of values stored
– deleting of stored references

The code is available here.

PhalconPHP: alternative way to use Oracle11g

Develpoing a new website based on PhalconPHP i tried to use Oracle11g as database, but in the process i had some problem.

Searching the web for solutions i read about some problem with the native Oracle PDO driver, so i tried “pdo-via-oci8” by Arjay Angeles .

As done for MSSQL i tried to create an new Adapter and a new Dialect to let me use pdo-via-oci8 inside my PhalconPHP-based application.

What i realized is the Oracle11 project you can download here.

Force using gtk3 when building software in systems with both gtk2 and gtk3

Do you have both gtk2 che gtk3 installed on your Slackware box and sometimes gtk3 based programs compilation fails because the building script can’t find the right version of the library?

If the answer to the question is “Yes” maybe you can find a solution to your problem using the following trick.

Continue reading “Force using gtk3 when building software in systems with both gtk2 and gtk3”

Linux: read files created on OsX using Pages

Do you need to open and read on your Linux box  files generated on Mac OsX using Pages? Below how i’m doing it.

  1. create file /usr/local/bin/pages
  2. edit /usr/local/bin/pages and inserte the following code

    at line 2 insert the full path of your favorite pdf viewer
  3. make executable the newly created file ( chmod +x /usr/local/bin/pages )

Now you can read .pages file from your shell executing pages /path/to/file.pages

Slackware: CentOS linux container

If you need to create a CentOS based linux container on your Slackware here you can find how i’ve made it.

Before you start

  • (re)compile your kernel including every config option needed to have lxc-checkconfig output “enable” in each line.
  • (re)compile your kernel to add support for “networking bridge”
  • update rpm package using the one found  here
  • install yum package, you can find it here
  • make sure to have  lxc package installed (it’s in the main Slackware repository)
  • make sure tu have installed bridge-utils package (it’s in the main Slackware repository)
  • make sure to have enough free disk space (my setup used at least 400MB)
  • add at the end of /etc/rc.d/rc.local the following lines
    /usr/sbin/brctl addbr br0
    /usr/sbin/brctl br0 10.0.0.1/24
    /usr/sbin/iptables -t nat -A POSTROUTING -s 10.0.0.100 -o eth0 -j MASQUERADE
    /sbin/sysctl net.ipv4.ip_forward=1

Continue reading “Slackware: CentOS linux container”

Dukto – Multiplatform AirDrop

If you are looking for a AirDrop multiplatform replacement you can give a chance to Dukto !

It offers:
– multiplatform support (Windows, Linux, Mac OSX)
– simple text quick exchange
– simple clipboard contentquick exchange
– simple filequick exchange (select you file or use drag&drop)
– simple directoryquick exchange (select your directory or use drag&drop)

The application can be used to send/receive data over a local network.

If you need a Slackware64 package i have prepared it for “-current”, download it here.

Polkit extra actions: run useful graphical applications as root on Slackware

During my daily programming activities i have to run, as root, some applications, even if i am logged in as a normal user, which make use of a gui (most of the times based on gtk) and this can be a problem using pkexec program-name due to the default policy of Polkit that disable support for graphical environment.

To let me use applications as i need i have created a simple package (tested on slackware64-current) that adds to the system:

  • a specific polkit rule to allow Thunar to be run as root
  • a menu voice allow a normal user to execute Thunar as root using pkexec
  • a specific polkit rule to allow Mozilla Firefox to be run as root
  • a menu voice allow a normal user to execute Mozilla Firefox as root using pkexec
  • a specific polkit rule to allow Geany to be run as root
  • a menu voice allow a normal user to execute Geany as root using pkexec
  • a specific polkit rule to allow Xfce4 Terminal to be run as root
  • a menu voice allow a normal user to execute Xfce4 Terminal as root using pkexec

Download the package from here.