Php type casting

So I have been writing a php library for automating a laboratory management of equipment, experiments, results and grading… its pretty simple starting point version 0.1 based on an earlier php-mysql thingy I did. I had implemented data handling using arrays, but I am using PDO this time around and I have a chance to return data from select queries as standard objects. So I wanted to patch up things and convert arrays to standard objects and the other way around instead of rewriting everything in the existing part of the library. As it turns out, you can convert a standard object to an array by type-casting, but not the other way around.
Here is a test:

class myClass{
    public $var1;
    public $var2;
    public $var3;
    public $var4;
    function __construct(){
$var = array("0"=>"hello","1"=>"planet","2"=>"test","3"=>4);
print_r($var);//an array
$var2 = (object)$var;
print_r($var2);//an object type-cast from array
$var3 = new myClass;
print_r($var3);//a standard object
$var3 = array($var3);
print_r($var3);//an array type-cast from a standard object

Continue reading “Php type casting”

Disabling the touch-pad in Linux when using an external USB mouse on a laptop

Sometimes I use an external USB [wireless] mouse when doing things that are cumbersome to do with a touch-pad, like 3D modeling in CAD software [Sketchup]. At such times, I have to find a setting in the system and disable the touch-pad. It works well but, when I later login after the laptop goes to sleep or I unplug and replug the external mouse for whatever reason, those settings are forgotten. Its pretty easy to disable the touch-pad on the linux terminal:

synclient TouchpadOff=1

and re-enable:

synclient TouchpadOff=0

You can even create an alias to make the command shorter and easier to remember and type-in

sudo nano ~/.bash_aliases

and add the following line

alias touchpaddoff='synclient TouchpadOff=1'
alias touchpadon='synclient TouchpadOff=0'

or a toggle function
Continue reading “Disabling the touch-pad in Linux when using an external USB mouse on a laptop”

Ultimaker2 new firmware update and new Cura Version

Cura, a 3D printer slicing software by Ultimaker has seen some nice changes. The Ultimaker2 3D printer has seen some improvements as well as the new Cura 15.01 comes with a new firmware version 15.01. Among the details added in Cura is the visual of the metal clippings that hold the glass bed in place :P. Thats important. Anyway, here is a list of important changes in the firmware:

  1. The pause at height functionality is now well implemented with a chance to change printing material while at it.
  2. The temperature display jitter is gone!

Cura is cool now because:

  1. There is a single layer view
  2. Quick print profile
  3. Fixed problems with ‘PauseAtHeight’ plugin
  4. New TweakAtZ 4.0 plugin
  5. Added top/bottom speed setting
  6. Improved handling of large 3D models, supports Ultimaker 2Go and Ultimaker 2Extended models (I dont care, I dont have those)
  7. Among other listed thigs

Continue reading “Ultimaker2 new firmware update and new Cura Version”

/* */