Author Archives: westworld - Page 2

Skype: bulk import

Skype
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.

  1. Open Skype and go to ‘Contacts’
  2. Go to Advanced
  3. Backup contacts to file
  4. Open the backup with Notepad or another text editor
  5. 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)
  6. if you need to import many contacts, write a script to add extra vcards.
  7. 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

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

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

To much urls

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

frank buchwald

frank buchwald

Google analytics api – no PHP

Google finally released an api for Analytics this month. The example code includes code for java and javascript but no PHP. Fortunatly The electric toolbox hosts some example data of how it can be used with Curl.

usersniffing: visitors from a dogs point of view

Companys put a lot of time and effort in creating compelling websites. Tons of resources are spend to ensure sites add to sales. But is all this money well spend? Thats what analytics software should clarify. Tools like Google Analytics, AWstats,… give a wide overview of visitors, time on site, conversions and other usefull information. But what if this is not enough? What if you want to target your visitors in a more personal way. What follows are some of the options that I found and that could help you change your content on a page per page level.

GeoIP:
This tool allows you to check the visitors ip adres and make an estimated guess as to where he/she is from. Maxmind offers a free and a licensed version for GeoIP Country and GeoIP City.
I tried out the free version and it gave me:

  • country code
  • city
  • Postal code
  • latitude – longitude

Device

Handsetdetection.com has a big list of hardware it can detect. Even Kindle 2 is included.

PHP

With php you have a few tools to analyse your visitors. Just like GeoIP, you cannot be 100% sure. Some of the data that gets send to the server can be manipulated. Here are some of the things that I use.

$_SERVER referer. What is the page that the visitor was on before he came to the current.
get_browser A php function that uses an ini file to detect browserinfo.

CSS, HTML and Javascript

performance checklist AS3

  • cach bitmaps when possible
  • use correct object types: int and unit instead of Number if possible
  • set mouseEnabled and mouseChildren to fals for items that don’t use mouseevents
  • keep only the objects that you use and when you use them. Assign null when nolonger needed
  • Bitwise math

searching mysql for a columnname

SELECT table_name,column_name
FROMĀ  information_schema.COLUMNS
WHERE table_schema = ‘your database here’
and column_name = ‘your columname here’

Noir Nouar

Juxtapoz posted an interview with Nouar this week about the upcoming exhibition.
Her twisted imagery looks booth childish and commercial. Maybe that’s because she used to work for Nickelodeon.^_^ Check out her gallery for more of this nice imagery.

unchecked checkbox not in $_POST

Iamcam posted a good hack on his blog. It makes your unchecked checkboxes show up in the $_POST on the server.
It’s very simple and doesn’t need javascript.

<input type="hidden" name="box1" value="0" />
<input type="checkbox" name="box1" value="1" />

If the checkbox is not checked then the value of the hidden input is submited, else the value of the checkbox.