Showing posts with label Software. Show all posts
Showing posts with label Software. Show all posts

Friday, February 14, 2020

Are PHP Objects passed as a value?


Yes they are, but as a copy of a value of a reference. Same as in Java.

Example below is showing how the Person type arguments are passed. In the point of entry of the methods changeName() and changeNameToNull(), $person reference copy is made.

From that point, a new reference can change the $person object in changeName(), as it has a reference to it. On the other hand, changeNameToNull() shows it is a copy of a reference, as setting to NULL value just destroys the copied reference, but not the $person object, thus original reference also.

<?php

class Person
{
    public $name = 'Mike';
}


class Change
{
    public function changeName(Person $person): void
    {
        $person->name = 'Jack';

    }

    public function setPersonToNull(Person $person): void
    {
        $person = null;

    }
}


//set person to NULL

$person1 = new Person();
(new Change())->setPersonToNull($person1);
var_dump($person1);

//change name to Jack

$person2 = new Person();
(new Change())->changeName($person2);
var_dump($person2);


Result:

object(Person)#1 (1) {
  ["name"]=>
  string(4) "Mike"
}
object(Person)#2 (1) {
  ["name"]=>
  string(4) "Jack"
}


Wednesday, February 28, 2018

Image Meta Data&EXIF Removal


Image meta data can contain some information which image uploader wouldn't like to share with broad audience. Luckily, there is a great tool which strips all meta data and EXIF data. It works with JPG and PNG image formats.

There are a lot of tools claiming to clean meta data from image, but this one called 
JPEG & PNG Stripper works just awesome! It provides super easy and efficient meta removal.

Need bulk image cleaning? It's a piece of cake with this software. Just select your images and drag&drop in the application window. Plus, you'll get old school software feeling, back in a days when software did it's purpose, nothing more or less.




JPEG & PNG Stripper link


Tuesday, September 13, 2011

Heroes 3 on Windows 7 / 64 bit

Legendary game Heroes of Might and Magic 3, originally dated from 1999 is still very popular and is being played even today. Playing this game on Windows 7 / 64 bit was unable due to problem which was.........................Windows registry!
According to many previous "solutions", the problem was on backward compatibility built in Win7, so advises were to check Winows XP compatybility for .exe files in game and to add administrator right to game files. Those weren't worked in my case.
It turned out that the only and ultimate solution is to change the paths in the Win registry. Smart guy who have found the problem and the solution says:
Today, through research and test, got the final solution (absolute playable) as below:
The main reason is the registry file (11.reg, maybe other on your PC, but should be *.reg file) wrote HEROES III’s data to an improper registry location.
Open and compare 11.reg data and x64 Windows Registry, the modification method is obvious:
It can be seen clearly from the registry: all data of 32-bit programs are located at HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node, not located at HKEY_LOCAL_MACHINE\SOFTWARE directly.
link: Heroes 3 on Win 7 64 bit

This guy also has made registry file which changes this paths! link:Registry patch for Heroes 3

It means, you can make Heroes 3 playable in a few clicks. Just download a file, double click and play.