Below is an example of how you can code an About dialog in PHP-GTK.
The mail_hook and url_hook are callback functions to open your default email client and webbrowser.
These functions have been tested under Windows XP. I don’t know if they work on Mac or Linux.
PHP-GTK: making an “About” dialog
December 8th, 2009 § 0
PHP GTK: liststore error (undefined class constant)
December 8th, 2009 § 1
Been experimenting with php-gtk over the last few days. When I was trying to use a liststore, php threw a fatal error. “Undefined class constant ‘TYPE_STRING’”. » Read the rest of this entry «
Cleaning up after an emailing
November 5th, 2009 § 0
As a web master, I often send out mass mailings. After the mailing is done, the bounced emails are returned to my Outlook. I go through them manually. The real bouncers are put in a “Bounced” folder and, Out of office messages in the “Trash”. The rest of the emails are addresses I need to update in my database or people that wish to unsubscribe. Since sorting through 2000 bouncers can take up a lot of time, I did some research on how to automate this.
PHP offers a set of functions to connect to a mail server (IMAP/POP3). The plan was to let my web server connect to the mail server and sort out the bouncers for me. Below is a little script to give you some ideas of what I came up with.
Some great tools
October 27th, 2009 § 0
Over the past few months I’ve been using a couple of new tools. Since they are free and might be helpfull to website designers and managers I decided to share my find:
Canvas: flip image
October 24th, 2009 § 0
Below is a sollution for flipping an image on the <canvas> tag without having to read it pixel by pixel:
Windows 7: no mailclient
October 23rd, 2009 § 0
I just noticed that Windows 7 does not ship with Windows Mail or Outlook Express. Users of Windows 7 can download a mail client on the Windows live site. This seems to be the only mailclient for users on the 64bit version. Mozilla Thunderbird 3 64 bit is still in beta at the moment.
Skype: bulk import
October 22nd, 2009 § 0
![skype-logo[1] Skype](http://www.westworld.be/wp-content/uploads/2009/10/skype-logo1-150x150.jpg)
Out of the box, Skype doesn’t have a bulk import feature. I only found one extra and it costs 15$.
Here’s a tip how to do it for free.
- Open Skype and go to ‘Contacts’
- Go to Advanced
- Backup contacts to file
- Open the backup with Notepad or another text editor
- The file is full of vcards, just copy a vcard, and past it at the bottom. All you have to do is alter the info. (ref is reference to importtime so you don’t have to alter this tag)
- if you need to import many contacts, write a script to add extra vcards.
- When your file is ready, go back to Skype/Advanced and import restore the backup.
An autoit script to do this might look something like the code below (untested)
Phone.xls has a column with nummers and a column with names
#include
$oExcel = _ExcelBookOpen("phone.xls")
_ExcelSheetActivate($oExcel,"sheetName")
For $i = 1 To 3 ;Loop
$phone = _ExcelReadCell($oExcel, 1, $i);cell with phone
$name = _ExcelReadCell($oExcel, 1, $i);cell with name
$file = FileOpen("backupfile.vcf", 1)
; Check if file opened for writing OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open file.")
Exit
EndIf
FileWriteLine($file, "BEGIN:VCARD")
FileWriteLine($file, "VERSION:3.0")
FileWriteLine($file, "N:"+$phone)
FileWriteLine($file, "X-SKYPE-PSTNNUMBER:"+ $phone)
FileWriteLine($file, "X-SKYPE-DISPLAYNAME:"+ $name + " " + $phone)
FileWriteLine($file, "REV:01091022T130411Z")
FileWriteLine($file, "END:VCARD")
FileClose($file)
Next
_ExcelBookClose($oExcel)
__autoload function
October 21st, 2009 § 0
Some info,snippets on PHP5 autoload function:
function __autoload($className) {
include_once __autoloadFilename($className);
}
function __autoloadFilename($className) {
return str_replace('_','/',$className).".php";
}
$class = new myclass();
When a Class is not found, php will pass the classname to the __autoload function.
You can name your class like Folder1_Folder1a_Myclass and this function will look for it in Folder1/Folder1a/Myclass.php
You can put multiple classes in one folder and still make this work by creating a link to the correct file.
On Unix, Linux machines use the command “ln -s targetfile.php nonexistingclassfile.php”
Prototype: submit multiple select with ajax call
August 11th, 2009 § 0
Beware when posting data from a multiple select through ajax. You can’t send an array with a Prototype ajax call.
expl.
function postmydata(){
new Ajax.Request(’data.php’,
{
method:’post’,
parameters: {selectdata: $F(’myselect’)},
onSuccess: function(transport){
var response = transport.responseText || alert(”couldn’t add data”);
$(’mydiv’).update(response);
},
onFailure: function(){ $(’mydiv’).update(’error’); }
});
}
This won’t work. Your php page will not get an array.
Solution
replace the parameter part with:
parameters: {selectdata: $F(’myselect’).join(”,”)}, // this will send a comma seperated string
In your php code use:
$myselect = = explode(’,',$_POST['selectdata']);
Related Blogs
- Related Blogs on
- Joyce Dallas
To much urls
April 27th, 2009 § 0
Sometimes you find great sites that you wish you’d bookmarked but didn’t.
Think I first noticed Frank Buchwald on Slashdot. Took me more than a year to find his url back (forgot his name ) http://www.frankbuchwald.de
If you like his work, also visit http://klockwerks.com/ , Art Donovan, Eric Freitas
![ml_6_a[1] frank buchwald](http://www.westworld.be/wp-content/uploads/2009/04/ml_6_a1.jpg)
frank buchwald