sábado, 26 de maio de 2007

Extending classes to develop faster with PHP-GTK

Sometimes we need to have some control on the code, in way to implement some new features.
Extending classes is a nice trick to build personalized and complex applications.
Programming oriented to objects (OOP), ebables a lot of possibilities .
Extend an class is a technic that allows to get all properties of main class and add some new ones.
On PHP you do it using the reserved word extends.
On this article i will teack you how to create some objects by extending the class GtkFixed, to create a kind of Tform like those ones we work on Java.
I will just implement one or two methods , but you can create any as you need.

The technic on my script is to pass and object type by parameter, as the example above shows.
public function setObject(GtkWidget $object,$name,...

Everitime you call this method all you need to do is to pass an object instance , as GtkButton, GtkEntry ,....
The code below shows how to build class.
Follows a short example showinf how to this class works


Mapping your computer Hardware drivers

All the time we travel , or for others reasons we leave our computer´s drivers at home, it is important to have always a second option, if eventualy we need to format or make some PC´s configuration.
One of these days i found a very interesting tool that maps all hardware containing on our PC.
The software called My Drivers is an utilitary described by the author as a
"driver backup utility designed to backup driver of your system in case of system crash or reinstallation of Windows. Automatic install / restore, update device drivers and find drivers for your unknown devices"
Image below show my home computer hardware list

To get your hardware drivers click with right button mouse over the hardware item that you need to get.
If you need more detailed information click over the plus to expand all related tree.
The utilitary is available at My Drivers

sexta-feira, 25 de maio de 2007

Windows Vista First Impression

Five mouths after Windows Vista have been for sale, and while all people talks about it, i decide to try it.

I installed it under minimum requirements

> 1 GHz 32-bit (x86)
> 512 MB of system memory
> 20 GB hard drive with at least 15 GB of available space

These are Microsoft recommended system requirements .
First impression was good.Nice insterface, totally redesigned, Aero System, drives encryptation, a new search system ( personally , i prefer XP system),Direct x 10...Transparence windows management and some new features ... All seems ok, but if ever work on ,MacOS you easy check that Vista is totally based on it.Other is that when install your basic software (drivers , and some few prefered apps) you check that you have 20 Gb to run almost an OS.Vista is heavy and "eats " losts of memory , so with the 512 Mb it will be more like a drager.If Vista design impress you can install Ubuntu , and you don´t need to upgrade your system .Ubuntu is one of Linux most user friedly OS .
But if you are addicted of MS products i recommend you to stay on XP , instead of buying a new computer.
Although of all people saying , Microsoft stills giving support to XP, a all security fails still being corrected, so there are no reasong to buy a new computer yet .
Meanwhile if you are a programmer (i am a programmer), and you need to develop applications to x64 bit platforms , probably you should.
One of this days i will need to buy a new computer due this.
The image below suggests how Vista works on a low lever overview.

Table moves virtual memory segments to RAM,
when it´s necessary, in way to get more memory to running processes

Is interesting to know that major of x32 application will not work on x64 btis platforms.
It will bring to much time to adapt current software to the x64 bits , so platforms running under x32 bits are enought yet.

quinta-feira, 24 de maio de 2007

The Solar System is from Denis Hope

Here is an american that are making totally sucess with an genial idea that could be strange to rest of us.
Dennis Hope found a hole in american law that forbids any government from claiming a planet like the Moon.
This law approved in "The Outer Space Treaty" of 1967 , didn’t mention that private individuals can claim some for themselves.
Take it in account Mr. Dennis filed his claim to the Moon with the Russian and American governments… and neither superpowers have contested it since.

One acre of moon with view to eart planet is for salefor only £19.99, but is very probable that you don´t put your foots on it :)

Hollywood's biggest stars like Tom Cruise and Clint Eastwood buyed it already.
It´s a least a strange world.

The world is from Google

There are two concepts of Internet.
Before and after Google.

The Google company is already a giant that faces and threats Microsoft.
Future applications will be all web-based (if not all majority), and Google
takes a long advance on this area.
Microsoft saw Google at the begining as one company more - "companies on web take a least 5 years" - someone said.
Google it´s a live prove that it isn´t true.
The success of the company was to build a friendly, but complex , funtional, and stable system of web searching.
Any kid on this world know what Google is.
Google´s secret is inovation - check Google Maps - this product has a big sucess on web based aplications, can be embbed on GPS devices (i don´t know if it's available already).
TV Networks station use it on they diary news, to jump and show general view of countries in question of seconds (portuguese tv networks do it).
Almost any web based aplication use Google maps to show companies location , and so one.
Gmail was other success - meanwhile hotmail still anti-functional (hotmail download system sucks), and with just a few resources, when compared to Gmail.

Gmail mail box has already a Powerpoint embbed system, so you don´t need to download the file to see it (amazing at least).
Google has available others innovative systems as :

Google code search - find available code of any programming language
Google Books - Consult books as you are on a real librarie (some books are incomplete)~
Goole earth - visit all countries in world, see buildings (some on 3 D view)
Google Videos - Upload your videos freely
Youtube - Upload your videos freely
Google Tools - a comple package of all essencial tools totally free
Goolge AddSense - advertise your company or earn money advertising

The main surprise is the Operating System that Google is building - it will be called GooOS and will be the most powerfull OS seeing in the world.
And rumors promess it will be free also.
Why Google have success among users and companies ?
Simple answer - all they do works, it´s funtional and practical.

quarta-feira, 23 de maio de 2007

Make your company cleaver and dynamic

CRM means Customer Relationship Management .
This concept is used to define all available tools, used to automatize
proximity functions with custumer.
Those tools include informatized systems and a coorpotative attitude change, that helps
enterprises to create and mantain and optmize relashinship between them and their custumers.
It is the key to build supra and clever relashionships of data, about their activities and
interactions to the company .

On software level, implement this kind of systems not only can, but is and clever tool to
evaluate custumers file historic, maintain the list of payements, build
activities reports,inspect required services...
This process of managment embbed on Business Intelligence, practicals that entterprises
should use to make business more cleaver and dynamic.

Magic Key - briging hope based on bits

Here´s a prove that informatic can be used to make a better world, bringing at least some hope to others, that can´t make the difference, because they simply can´t.
Luis Figueiredo a portuguese teacher on Polytechnical Institute of Guarda (I.P.G.), an institution to graduate students of different areas, is developing an advanced system that makes possible move mouse cursor on screen, using the eyes movement only, with need the user be static in front on computer screen.
Magic Key project lider Luis Figueiredo

The project called Magic Key intend to improve some powerfull tool on tetraplegic people for example, reason enought to take this project on.
The project had hard days at the beggining, but it had a good acceptance by some
entities as Foundation Augusto Gil that gave tottally support to project, almost the start of it.
On the 6ª ediction of the award Engº Jaime Filipe, the project won a deserved honor mention , on 2001, and gave to know the project to all media .
If you need to know more about this project visit the site Magic Key

AlphaWorks - push your business to innovation

AlphaWorks is a IBM´s project that main objective is to supply to community all results from reasearch and mature discovers on emerget technologies, possibly people from all over the world to get all this technology and tools to work on it, free of charges.
The project was began on 1996 , and it already produced 700 emergent technologies.
AlfaWorks emerging technologies are provided as downloads, usually with a 90-day trial license.
The alphaWorks Services are on-demand applications developed by teams of IBM from all over the world and available on web-based packages.
The alphaWorks services do not require any license.
It can be your enterprise opportunity to start being part of a new business model , because IBM AlphaWoks project will surely help you to innovate, collaborate, and reduce your development time.
If you need to know more about this project visit the offcial web site on Alpha Works

segunda-feira, 21 de maio de 2007

Add current time on your PHP-GTK app

Although time is always on tray bar, there´s a good idea to add current time to our GUI applications.
The next class will teach you how to add time on your application , updating time label on each second .
I will use PHP date function embbed on a label and use Gtk::timeout_add to update label.
Follows the code

Add a background image on a GtkWindow

There´s a current thought that i use always that i build some web based or GUI application.
Code is improtant but visual is more.
Think on it as some product at supermarket. The first impact is always the package.
On this tuturial you will lear how to load images to your PHP-GTK windows,
making your applications more atractive.

Follows the result of code


If you are one of those, that like to be informed about the most recent technologies , here is a simple list of what governments and enterprises are searching about on current year.

Airborne Networks
Quantum Wires
Silicon Photonics
Magnetic-Resonance Force Microscopy
Universal Memory
Bacterial Factories
Cell-Phone Viruses

Generate and publish HTML reports using PHP and COM (Component Object Model)

Somethimes when we are devloping PHP applications, we need for some reason,print a certain group of data.
Print it directly to printer device can´t be a viable solution.
It´s be nice to check how data will be prited out, before the print process itself.
On this article i will teach you how to work with component object model (Com), in PHP.

" COM is an acronym for Component Object Model; it is an object orientated layer (and associated services) on top of DCE RPC (an open standard) and defines a common calling convention that enables code written in any language to call and interoperate with code written in any other language (provided those languages are COM aware). Not only can the code be written in any language, but it need not even be part of the same executable; the code can be loaded from a DLL, be found in another process running on the same machine, or, with DCOM (Distributed COM), be found in another process on a remote machine, all without your code even needing to know where a component resides.

There is a subset of COM known as OLE Automation which comprises a set of COM interfaces that allow loose binding to COM objects, so that they can be introspected and called at run-time without compile-time knowledge of how the object works. The PHP COM extension utilizes the OLE Automation interfaces to allow you to create and call compatible objects from your scripts. Technically speaking, this should really be called the "OLE Automation Extension for PHP", since not all COM objects are OLE compatible.

Now, why would or should you use COM? COM is one of the main ways to glue applications and components together on the Windows platform; using COM you can launch Microsoft Word, fill in a document template and save the result as a Word document and send it to a visitor of your web site. You can also use COM to perform administrative tasks for your network and to configure your IIS; these are just the most common uses; you can do much more with COM.
Starting with PHP 5, this extension (and this documentation) was rewritten from scratch and much of the old confusing and bogus cruft has be removed. Additionally, we support the instantiation and creation of .Net assemblies using the COM interoperability layer provided by Microsoft. "

The technique is to build all data report using the HTML embbed on PHP.
After it , we will call Iternet Explorer using COM.

Follows the code to the launch web browser
And right next the code that creates the report and instanciates the class to launch browser

And here´s the report generated with this code

domingo, 20 de maio de 2007

Work with INT21 to handle strings files on Assembler

What are Interupts ?
Interrupt is an external event that takes the processor to stop current program in execution, and execute a certain code block called interrupt routine (normally they occur due I/O operations )
When the interrupt ends, control is passed to the program that has been interrupted, exactly at the point where interrupt started.
On Assembler interrupts ocurr when use the reserved expression INT21. It makes part of the vectors interrupts table like others (it starts on 00h until FFh), as you can see on table vectrores just low

To undertand what we are doing let me wite a sample programe in C (i build it on Dev-C++)

Check the code
Now lets build a similiar code using Assembler
Check if you try to test this code it won´t work, just like this. It needs somethig on top and low of this code.It is the code that is needed to run any application on assembler .
Think on it as the #include on C.
The code right next will print a message on sreen like the program in C does.
But before show the code , you will need a table more to see how

The code in assembler to display an message

Check that you have to declare the variable to store the message, rigt after this code, like this

Lets now use IN21 to create files

The same application on C

sábado, 19 de maio de 2007


PHP can easly embbed on HTML. On web based applications HTML is very useful to care text, build tables , forms and create a lot of widgets.
On this article you will learn how to manage html forms using PHP.

I will use the code snnipet that i wrote to last article "Connect a database using MySQL"
Follows the code

Connect to a database using Mysql

PHP main target is to make possible build dynamic web sites.
This possibility is available by using some database system to store information and manipulate them, when system and user needs it.
On PHP a large number of database systems come by default embbed as libraries.
On this article we will learn how to use one of the most used on data handling - MySQL.
MySQL can be installed easly, by downloading EasyPHP.
This application installs Mysql on a web based version, it means that you can manage all database processes on your browser.
It allows to create databases, and tables, edit fields , backup tables system database and a large option of new features.
To access the interface that allows you to create database click with the right button of mouse on tray icon "Administration".
Right next click


it will open the window where you must the name of your database and next it will ask for your table name.

Check how many fields you need on your table and build it.

Now the database and table are created let´s configure the conection to the mysql server using PHP.
Remember that server is configured with an default username and password.
You can make secure by changing it at your choice.

Follows the PHP code generated to build the table

Here´s a simple php-mysql snnipet to connect mysql host

FreeBSD programmers claim that Microsoft uses their code

A package that implements TCP/IP protocol , and distibuted under FreeBSD lisence is creating a great polemic , after the Wall Street Journal publish an article called "Microsoft Uses Open-Source Code Despiste Denying Use of Such Software".
Second the journal "software connected with the FreeBSD open-source operating system is used in several places deep inside several versions of Microsoft's Windows software, such as in the `TCP/IP' section that arranges all connections to the Internet."

Free BSD logo

Meanwhile some Microsoft approached staff says that all this accusations are trully false by saying :
Anyway the FreeBSD programmers who reported all this to the Wall Street Journal can't see the NT TCP/IP source either, so they can't have been referring to that"

If you are interested on read more go to url

Follows the war between the
small and great.
Healthful :)

Contact serial port with assembler

Serial port , also knowed as RS-32, is a comunication port used to stablish connection between modems, mouses, and a large kind of printers a other hardward equipments.
Although it´s beeing replaced by USB ports, it still is beeing used in all fields of robotic and electrocnic.
... in development


PHP flexibility to work with images on a large number of formats is a fantastic funcionality.
GD library offers that capacity on Linux and Windows.
Right next follows a small example showing how function are mounted to create an image.

This code generates the next image above
Just in case, if you need some professional class to generate statistics graphics i have one available only for a just 25€ , please contact me at gutoferreira69[@]hotmail.com

Follows an graphic example builded with that class


Somethimes when we need to build a great number of php -gtk object can be a hard work if we are programming all the code by hand.
Work with coordinates and object positions can simplify the work and save time on development process.
On ther next code snnipet i will tech you how to generate dynamic button using coordinates process.
Follows the code

The result of code

Hope it´s useful

sexta-feira, 11 de maio de 2007

Splash screens with PHP-GTK

Splash screen is a term used to describe an image that appears while a computer program is loading. Splash screens often don't cover the entire screen, but only a rectangle near the center. The splash screens of operating systems and some applications that expect to be run full-screen usually cover the entire screen [WIKI]
On this article we will learn how to build splash screens using PHP5.2-GTK2

Generally we start build the spalsh thinking on a image, that you must to choose before.
The image used on my class is on the format *.png .

The splash class uses the gtk class - GTKImage to load the image file, and the widget is added to an vbox container, but you can add it to gtkwidow instead.
... follows the class splash

Right nest we will build a new class test to check the result of class splash builded above
Follows the code

The image next was used as splash screen on the code chunk

quinta-feira, 10 de maio de 2007


PHP Classes is a world wide repository to all PHP programmers may publish their scripts freely.

On this web site you have free classes related to all programming domains, since database hadling, xml parsing , dom, soap and lots of resources more.
This communitary web site was created by Manuel Lemos , a portuguese programmer and the currently site administrator.
I decide to annouce this site, because i also have my classes published there.
Last year one of those classes was rewarded by the award "PHP CLASSES INOVATION AWARD".
All the classes are free to use since you respect the lisence writed by the author on each package.
This is great to study others programmers code , and check how some programming steps are done, when you didn´t get idea how it works.
You can just use it, and save some of your precious time .

Distribuite PHP-GTK applications on Windows or Linux

Software distibution can raise some important questions.
Did your software has something to offer that can be used by a great group of users?
Did you tested it and allowed others to test them?
What is user´s opinion about your software possibilities ?
Did your code is your own creation, and it has nothing that could raise doubts?
This questions and a few more,can be the answer to decide if we can or can´t distribute our application
at this time.
A good practical is to create discussions on forum or discussion lists, by adding some screenshots of the sofware
and ask for users opinion.
You should face all opinions on a constructive way.Experimented users generally have reason when they manifest their opinions about it.
The main subject of this article is to help PHP-GTK developers or programmers to
teach and illuminate them when comes the hour to distribute the applications written with PHP-GTK.
To simplify this task, we will need to compile all php source code to it stand alone, by generating native binaries whitch do not require an interpreter.
All this process is done by using others softwstes knowed as compilers.
Linux users have lucky on this area. The best PHP compilers are available to Linux and Unix platforms.

" Roadsend Compiler is an open source, native compiler for the PHP language. It compiles PHP source code to stand alone, native binaries which do not require an interpreter. Roadsend Compiler can build online web applications with Fast/CGI, offline web applications with an embedded web server (MicroServer), desktop GUI applications with PHP-GTK, and console applications. It is known to build on Linux, Windows (using mingw), and FreeBSD "
[roadsend compiler]

To download this software you will need to register first

PriadoBlender is another compiler avaliable to windows and linux
PriadoBlender is a tool to let you distribute your PHP scripts as an executable EXEs. It is similar to the PHPCompiler that was available for a couple of months a year or 2 ago. PriadoBlender isn't a true compiler in the computer science sense of the term. True compilers take the high-level code and turn it into machine/assembly code. Instead, PriadoBlender takes your PHP code and the PHP interpretor itself and blends them into standalone, PHP executable goodness."

Download PriadoBlender

Automatizing HTML widgets on PHP [Using PHP_SELF]

Build all HTML stuff by hand is a pretty hard work.
Coding all this stuff , like buttons, forms, divs and allover html widgets, can be a pleasant work if you find ways to optimize and reduce time of coding.
A simple way to do that is to develop some PHP api that allows to generate all forms and all HTML widgets that you need.
After it is just call the class target and pass to it some parameters like bg colors, alignment, size...
On this article i will not do all the job to you but i will show how html can be embbed , developing a plain code snnipet, where u can study how process is done.
Here´s the result of this code snnipet

sexta-feira, 4 de maio de 2007

Woking with GtkTreeModel and GtkTreeStore

On this article you will learn how to create a PHP-GTK model to place your informations stored on database ,files, or in another data repository systems .

The technique is to use some specific widgts, allowing the system to work right.

I will make all this stuff using OOP on PHP5-GTK2 dev. based, so if you don´t know nothing about classes or object oriented programming, i recomend you to read a few thing about it (there´s enought documentation about it on Internet, use google and search 4 "php oop" , it will show a large list of related web sites).
I personally recommed you this :

On first snippet i will dev. an basic example by using the widgets ,GtkListStore ,GtkTreeView and GtkRenderText.

Here´s the inheritance diagram used for this aplication

To make work go faster i will build a generic class to create the windows, using the inheritance GtkWindow and GtkVBox used as container

Save this file above as "class_window.inc"

and write the next class and check how the process to build the list was made.

Result of this code:

Example as shown on my book "PHP5-GTK2 - Criação de aplicações com interfáce gráfica"