Categories

My FIRST Facebook application

I have just finished, more or less, the development of my first official facebook application.

As you all know, I’m italian, also if I am not living in Italy any more… Anyway the application is in italian, so many of you will not be able to understand it.

What it does? You can use it to calculate your monthly net salary, starting from your total yearly income. It is quite useful… I have already another website offering this calculation and it is quite succesfull… about 1.000 users per day.

I am very curious to check the power of the social web! I ‘ll keep note of the number of users daily, in order to verify the virality of what I propose:) … 4ll let you know in some days.

I also put some links to the original website, in order to have a return in terms of users,  and increase the value of the website itself.

Does any of you could appreciate the value of social networks in the promotions of his website?

OHh.. I almost forgot to add the addresse of the application:

Stipendio netto

Develop in PHP without spending money

I find PHP to be a great solution for creating websites.

I have been working for years on the microsoft side of the world, but in the last years I have worked more and more with PHP/MySql projects. The last versions of these platform are quite powerful and it turns out that it is now very easy to build/use webservices in PHP5. OOP is fully supported and, above all, there are plenty of free Editors and IDE.

If you want to start working in PHP, I would strongly recommend you the WAMP server, which offer, for free, APACHE,  PHP5 and MySQL server to install on your home PC!

It is very easy to install and in some minutes you are free to write your applications and see them running on your PC. In the same package you will receive a phpmyadmin to administer your databases.

To write PHP code, you have then an incredible number of options… I am using PSPAD, a light editor that let you develop in many languages.

If you are used to work in Eclipse, do not forget to download the PHP environment for Eclipse, I am not using it personally, but a colleague of mine is, and he’s enthusiast :-)

History of the blog

I have been running this blog for seven years. I started it in 2002 as a window on my business.

At the beginning it was only a static website to publish the mission, a contact form and my portfolio: note that it is in italian as I was working for the italian market… If I look now at the list of the websites I was working on, I realise that some of them are not online any more !!

Two years later I developed a flash menu that I liked a lot, where the menu items where contained in some bubbles that could be dragged and dropped around the screen. Here is the bubbles flash version of cyberactiva.

In 2005,  I developed a CMS for a client, so I decided to use it to manage the first dynamic version of the blog. So, for the curious ones, here you will find the dynamic self developed content management system of Cyberactiva.

I also implemented a forum and a registration module, not mentioning the newsletter engine.

End of 2007, I decided to move on blogger.com, mainly to test this blog engine… as you know, you can also keep your blog url,  giving blogger an ftp access to your site. Find here the blogger powered version of cyberactiva.

Finally, let’s talk about today. I decided to leave blogger, not because of the power of the engine… I have to confess that I liked it. Anyway I find it a good solution if you do not have your own domain and if you use a url like myname.blogspot.com… Having my own domain I have preferres to be less linked to an external provider… so whet better solution than Wordpress?

Develop facebook applications in PHP, part 1

I will spend some posts to talk about applications on facebook, and what to do to create one.

For sure you know this great social network, but I’m not so sure you know that it is very easy to create and publish applications on it.

You can even use your favourite language to create the application, as the whole application will work through internet.

I have chosen PHP, but you can work in DotNet or one of the many other languages  that can produce webpages.

Why did I choose PHP?

Mainly because it is free and because I like the fact that I can develop in the same platform used by Facebook itself.

Now, everybody can download for free the Facebook PHP API.

You will find also a sample application, in order to get started easily.

Before starting developing, you will need to register on the developer application, within Facebook. You will be given a KEY, to use in your code.

Using a mix of API and FBML, the facebook markup language, you will then be able to add easily friends lists and other FB features to your pages.

SQL lovers will soon discover that they can use FQL, the facebook query language, to create queries qnd obtain data.

PHP error on webservices: extra content at the end of the document

I was trying to test some webservices using PHP 5.3.0 as client.
Most of them were working properly, but One gave me the following error:

Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn’t load from ‘http://thisistheUrlOfTheWsdl?wsdl’ : Extra content at the end of the document

After some investigations, I realised that this is probably a bug of PHP: I’ve found out that the webservice is working if I access it using PHP 5.2.10.

The solution I found is to create a local copy of the WSDL file (it’ll be something mywsdl.xml) and reference the local copy instead of the original wsdl url.

Select tag clickable under the above transparent div layer

It bothers me a lot, when I can’t find a solution for a problem that do not depend on me… Anywway here is the problem and the work-around solution I found.

Let’s say you have a form on the page, with some <select> tags.

Now, you want that on the onclick event of the submit,  a semi transparent DIV appears above the form, in order to block the user to change the data on the form.

The .html (or whatever you are using) should be like:

<script language=”JavaScript”>
function show(layer_ref) {

  if (document.all) { //for IE 4 or 5 (or 6 beta)
    eval( “document.all.” + layer_ref + “.style.display = ‘block’”);
  }
  if (document.layers) { //for NETSCAPE 4 or below
    document.layers[layer_ref].display = ‘block’;
  }
  if (document.getElementById &&!document.all) {
    myel = document.getElementById(layer_ref);
    myel.style.display = ‘block’;
  }
}
</script>
<div id=”form1″>
 <form>
  <select name=”test”>
   <option>test</option>
  </select>
  <input type=”submit” onclick=”javascript:show(’waiting’);”>
 </form>
</div>
<div id=”waiting” style=”display:none;”>
</div>

In the css, you should put

#waiting {
 position:absolute;
 width: 100%;
 height: 100%;
 top:0;
 left:0;
 background: #cccccc;
 z-index:2;
 -moz-opacity:0.5;
 opacity:0.5;
 filter: Alpha(opacity:80);

}

The problem will immediately appear when you launch the page and click on the submit…

Actually, the select tag will remain active, even if it is under the “waiting” layer.

The only solution I found, is to hide the DIV form1… so, from the above code you should change only:

onclick=”javascript:show(’waiting’);hide(’form1′);”

and of course add the new hide javascript function (just change ‘block’ with ‘none’):

function hide(layer_ref) {

  if (document.all) { //for IE 4 or 5 (or 6 beta)
    eval( “document.all.” + layer_ref + “.style.display = ‘none’”);
  }
  if (document.layers) { //for NETSCAPE 4 or below
    document.layers[layer_ref].display = ‘none’;
  }
  if (document.getElementById &&!document.all) {
    myel = document.getElementById(layer_ref);
    myel.style.display = ‘none’;
  }
}

I am very curious to know if somebody could solve this issue differently, LET ME KNOW!!!

PHP session variables

Managing session variables in PHP is really easy.
First thing to do is to initialise the variable. For instance

$_SESSION["myvariable"] = myvalue;

To use it, in another page, you can then just use $_SESSION["myvariable"].
Just remember to put at the top of the code this instruction:

session_start();

Actually, this will not re-initialise the session, but will create the session object with the current session variables.

AJAX example

There are tons of places on the net where you can find some ajax tutorial on how to make hidden calls to the server.
Anyway, I put here a basic javascript function (may be more for my reference). For instance I have to send three parameters v1,v2,v3 to the checkdate.php server page and receive back a code. If the code is equal to 1, then I show the errors’ layer and hide the buttons’ layer.

function ajaxsend (v1,v2,v3)
{
var xajax = null;

if(window.XMLHttpRequest) xajax = new XMLHttpRequest();
else if(window.ActiveXObject) xajax = new ActiveXObject “Microsoft.XMLHTTP”);
else return(false);

var str = “chky=”+v1+”&chkm=”+v2+”&chkd=”+v3;
xajax.open(”POST”,”./checkdate.php”,false);
xajax.setRequestHeader(”Content-Type”,”application/x-www-form-urlencoded”);
xajax.send(str);

if(xajax.readyState == 4) {
if (xajax.responseText==”1″) { //<15years
hide(’buttons’);
show(’errors’);
}
}
}

Just to be complete, here are the two functions hide and show, written in a “browser independent” way:

function show(layer_ref) {

  if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( “document.all.” + layer_ref + “.style.display = ‘block’”);
  }
  if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].display = ‘block’;
  }
  if (document.getElementById &&!document.all) {
    mylayer = document.getElementById(layer_ref);
    mylayer.style.display = ‘block’;
  }
}

function hide(layer_ref) {

  if (document.all) { //IS IE 4 or 5 (or 6 beta)
    eval( “document.all.” + layer_ref + “.style.display = ‘none’”);
  }
  if (document.layers) { //IS NETSCAPE 4 or below
    document.layers[layer_ref].display = ‘none’;
  }
  if (document.getElementById &&!document.all) {
    mylayer = document.getElementById(layer_ref);
    mylayer.style.display = ‘none’;
  }
}

I hope you will find this example useful!

2 ideas to make your website more social on facebook and linkedin

Of course, you are already aware of the importance of social networks in promoting your website, or in fine tuning your target.

First action is to create a group in Facebook and invite your “in target” friends… do not invite everybody… you don’t want to loose credibility in spamming your friends!

Second action is to create a group in Linkedin. OK, this is not suitable for all kind of websites, but if your audience is at least partially composed by professionals, you will find tons of potential new users.

For instance, I am going to launch a new website concerning parents and parenting.

What I did, was to create a new group in Linkedin called Parents’ Network. Of course Parenting is not the main issue in Linkedin, but you can be sure that there are thousands and thousands parents among their members!

This way, you can provide a meeting point there, and offer “side” services on your own website.

Have you already done something similar?

SHAREPOINT:The list that is referenced here no longer exists

Are you get this error while using the updatelistitems method in SHAREPOINT web service (list.asmx)?
Are you aiming to data stored in a subsite?
If so, the solution is to point the webservice of the subsite directly.
If your main site is http://cia, and your subsite is http://cia/coa, you should point to the webservice:

http://cia/coa/_vti_bin/list.asmx

Pay attention that, sometimes, when you update the webreference, in the app.config it remains the same. So change it there as well.

Good luck!

Cyberactiva web development - Blogged