quinta-feira, 25 de outubro de 2007

Passing PHP vars by parameter to Javascript functions

Usually PHP programmers need to build dynamic systems like scrools , random text , image galleries ...
First time i tryed to build some php features using javascript i faced some problems using php and javascript, concretely passing php variables to javascript fucntions by parameter.
On this article i´ll teach how i solve this problem.
First we will declare an JavaScript function . Let´s use the simple example above.

The function must be added between the tags head on the html code

Check how to add php code as parameters on javascript functions

And it´s done

Visit my php web site at www.revista-php.net , and add your questions


sexta-feira, 19 de outubro de 2007

Detecting resolution with javascript

Here is a simple javascript function to detect your screen resolution.
With this you are able to build your web sites correctly working on all available resolutions

On this function i ´ll apply some features to an css box , and formating them using style properties.

Regards ;)

quinta-feira, 18 de outubro de 2007

How to load two ore more javascript functions

Here is a simple answer to a question sended to my email box

"How do i call two or more javascript functions on HTML ? "

here is the solution

where functionx1  and functionx2  are you javascript functions defined between the tags

Great programming ;)

terça-feira, 16 de outubro de 2007

Solving the problem of getting MySQL last id

I was studing a few of mysql to a project of mine , and i realize there arlots of people that has this doubt .

How to get the last id from a MySQL table. Follows the ansewer :)

Here is how to use this function

Hope it can help you

Regards ;)

PHP ADVANCED :: The Singleton Design Pattern

Design Patterns , usually the GOF (gang of four) technics , are used to solve current problems on software modelling , generally on software engineering cases.
On this article i´ll tell you how to use Singleton Patterns on PHP, on current version PHP5.
This patterns is used when you can use just one single instance of the class you declared, and with it have an active instance without losing the link resource.
An example very useful is what happens on database connections , where , with just one instance you are able to make to rest of operations you need to.
The main properties to work on Singleton with PHP5 , are the private and static properties.
Understand his use are extremly important to build a good Singleton class code.
On the example right next , i´ll will build a simple class to use mysql and msqli according the project settings.

.... this article is beeing written, please stand by

segunda-feira, 1 de outubro de 2007

I ´m very proud to announce the edition of first PHP magazine here in Portugal.
November will be out. This release will have only e-magazine version, but we are thinking on a printable version after.
Project will have collaboration of some prestidigitate PHP programmers as Manuel Lemos (PHP CLasses), José Fonseca (Yahoo UK), Zendrael (Anubis), Pablo dall Óglio (Tulip and Agata)... and a few more

Here goes the magazine cover for the next mount

sexta-feira, 13 de julho de 2007

Hackers are each day more younger

According the Crimnology Report 2006, done by McAffe, hacher´s practices still being done by
younger people each time.
The reason pointed on the study , points the Internet as storage of needed contents and tools.
The layer is composed by university students on majority.
They see it as a good way to get easy money or at least receive some
recognition .
The main area who carries hackers much interest are botnets attacks.
It consists in zombie networks that can be controlled remotly.
The study also mentions that at least 12 millions
of PC world wide, are used in fishing or spam squemes and robbery of ID´s and passwords.

terça-feira, 3 de julho de 2007

I pay 20€ for each web site you sell

Hello there , i´m the owner of this blog and i have a cool propose to you.
I f you want to make some money , be my partner .
All you need to do is getting my templates preview by email [guto.onideskATgmail.com], or downloading it on http://guto.awardspace.com

Depending the number of web sites you sell, you can rise your commission.
Here´s your opportunity to get money.

Phone +351 96 2694432
Web http://guto.awardspace.com

This promotion is valid to software too where the commission is larger.

quarta-feira, 13 de junho de 2007

2 Life unlimited dreams are possible now

Second Life is more than a game.
It´s a 3-D virtual world builded by the residents (is the name given to the people that became member)
All you need is make a free registration.

Create an avatar your personal appearence on the virtual world.
Became owner of your territory.
Meet people and live conversations.
Advertise your bussiness or institution (in Portugal Aveiro University did it already)
Make your own carrer , by programming stuff to the virtual world.
The language of scripting on this world is knowed as Linden Script Language (LSL).
It´s similiar like C or Java and allows to control objets and avatars , by building "lindgets" the name
i gave to those creations, or build mini-games or other complex programs.
You can find Wiki resources on

2 Life LSL Portal


2 Life Forum


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