Thursday, July 12, 2012

Social Media


The last blog of this course is about social media and social networking. The first thing that comes to mind when we listen to the word social media or social networking is Facebook. At the moment, Facebook seems to be the reason for living for most of the people. People post everything they do on Facebook as if it was a diary. However, there are many more social networks around, including Twitter, Linked In, Bebo, and more…

Social Media

So, what is social media and social networking?? Social media is all about web-based (and mobile-based) technologies which are used to turn communication into interactive dialogue among organizations, communities, and individuals. These build on the ideological principles that the web is platform for information sharing, interoperability and collaboration, and allow the creation and exchange of user-generated content. This is enabled by scalable communication techniques, such as cloud computing.


Figure 1: Popular Social Networking Brands

Social Network

A social network is a social structure made up of a set of individuals or organizations and the social relation between these individuals or organizations. The social network perspective provides a clear way of analyzing the structure of whole social entities.

Figure 2: Popular Social Networking Activity

Smart Phones

Smartphones have helped a lot in this world of social media. People now have constant access to the web. Also, the operating systems of such devices enable their users to constantly receive updates from their favorite social networks. Also, it is much easier to upload pictures and stuff to your profile. Friends from your social network are also contacts in your mobile phone, which enable you to send a message instantly to your friends Facebook account.


Figure 3: Facebook on an Android Device

Social Game – Shake with Me

My colleagues at Webit Design Studios Ltd produced a social game with very tight integration with Facebook, one of the most popular social networks. While the game play is fairly simple, the server side development is done with a huge insight. The game play is all about shaking the device (IOS or Android) and with each shake the screen is filled with water. The social aspect of the game is when the game integrates with other friends from Facebook. You can invite other people to join you in a game and who fills the screen first wins. It also includes suggesting friends to play with you and other people whom you may not know but who are in your area to play with you.



Figure 4: Shake with Me

Statistics

Social networking is all about numbers. People talk about how many statuses are posted, images shared, time spent and more. These are some statistics for 2012:

Facebook Statistics 2012:

  • An average Facebook user has 130 friends and likes 80 pages
  • 56% of consumer say that they are more likely recommend a brand after becoming a fan
  • Each week on Facebook more than 3.5 billion pieces of content are shared


Twitter Statistics 2012:

  • 34% of marketers have generated leads using Twitter
  • 55% of Twitter users access the platform via their mobile


General Social Media Statistics 2012:

  • 30% of B2B marketers are spending millions of dollars each year on social media marketing
  • Nearly 30% of these users are not tracking the impact of this marketing
  • 20% of Google searches each day have never been searched for before
  • Out of the 6 billion people on the planet 4.8 billion have a mobile and only 4.2 billion own a toothbrush

Wednesday, July 4, 2012

Cloud Computing


Is this the next big thing?? Or is it already a thing of the past?? Cloud computing refers to delivering computing and storage capacity as a service. That is, no upfront cost and pay per use for the services you really require. With cloud computing we generally speak of three categories:



  • Infrastructure as a Service (IaaS)
  • Platform as a Service (PaaS)
  • Software as a Service (SaaS)




Figure 1: Major players in Cloud Computing

Infrastructure as a Service (IaaS)

Infrastructure as a Service is when users rent use of servers based on the computational power needed and storage required. Most of the time users buy virtual machines in pay per use, but other devices are available such as physical servers, GPU clusters, firewalls, load balancers and networks. Examples include the massive Amazon EC2 and the Rackspace Cloud.

Platform as a Service (PaaS)

Cloud providers offer a computing platform including an operating system, database, web server and programming language execution environment. This means that the platform will be ready to deploy very quickly. Such platforms are specific for programming languages and databases used. For example Heroku is one of these with a platform specific for Ruby, Java, Python and Node.js. Such platforms typically scale according to load and use.

Software as a Service (SaaS)

This means that an application is readily supplied with all the configuration and the all the user needs to do is to configure the last few settings and tweaks. Examples of these are Google Apps and Office 365 which is a cloud based exchange server.


Figure 2: IBM Data Center

Private Cloud, Public Cloud or both?

Public Cloud are cloud services offered by a cloud service provider with pay per use models. Community cloud shares infrastructure between more than one organization with common concerns such as security and compliance. Private cloud is a cloud infrastructure operated solely for a single organization and can be either internally managed or externally managed and may also either be hosted internally or externally. Private cloud still has the upfront cost and the maintenance which means losing most of the advantages of cloud computing in the first place. Hybrid computing is a mix of one of the previously mentioned types of cloud. An organization might host most of the services in public cloud and may have some more sensitive applications and storage running in a private cloud environment.

Concerns

Of course people have a lot of concerns with cloud computing. There is a lack of control over what happens with the critical stuff of the company or the individual. The fact that the data is not stored within the facilities of the company or the individual is a huge concern. Privacy and security are also concerns. Compliance with standard is also something that you cannot do much about. Hidden costs are also an issue. Most providers request automatic payment at the end of the month, which can cause surprises. Outages in the data centers, although rare, can cause disruption to your services. Also, there will be a reliance on an internet connection to access the services. No internet and all your employees can go home as they can do nothing.


Figure 3: Location of Google Data Centers around the world

Major Benefits

Cloud Computing brings with it many benefits to the end user. These include access to a huge range of applications without having to download or install anything, applications can be accessed from any computer, anywhere in the world, users can avoid expenditure on hardware and software; only using what they need, companies can share resources in one place, consumption is billed as a utility with minimal upfront costs and scalability via on-demand resources.
There are several differences from traditional hosting to cloud hosting. The main differences are that cloud computing is sold on demand, the service is managed by the provider, users can determine the amount of service they take and users can log on to the network from any computer in the world

Infrastructure Required

Without doubt, large datacenters are required for all this to be offered. The video below shows a new data center being built by Soft Layer, a cloud computing provider. This shows the massive planning, space and hardware required for such a data center. Of course, this is only a small part as a large number of human resources and so on are required.





Figure 4: Video showing Soft Layer New Data Center

Cloud Training

Like always, with new technologies arise the need to become trained and certified. While cloud services are mostly identical to normal hosted or co-located servers, special certifications still exist and are very important. Some of the certifications available are mentioned in the video below.


Figure 5: Video showing Top 5 cloud certifications

Personal Experience

I have worked with Amazon AWS and Rackspace Cloud Servers. Both products are very good. Their internet speed is very fast and it is very easy to use the service and integrate with their APIs. Setting up is also very easy and it is much easier to create a new cloud server than purchasing a server, racking it up and starting from scratch every time you need to change something for testing. At the moment I would not know what to do without cloud computing!!

Monday, July 2, 2012

More Second Life


Following my last post about programming in Second Life, today I will create a Note Card Giver, a Post Box System and an Object which interacts with a web page.

Note Card Giver

I chose to build a note card giver which gives note cards to avatars who pass by the object. Another option for this is to give a note card to who touches the note card giver. First I created an object to be able to give note cards. I did not create an elaborate object as this was not the purpose of the task. Then I created a note card in the inventory which will be given by the note card giver. The note card was also added to the contents of the note card giver. I added a script to the note card giver to start handing note cards. In the first part of the script I created a number of variables


string notecard = "Note1";
integer freq = 1;

integer maxList = 100;

list given;


The string holds the name of the note card which will be given to the passing avatar. freq is the number which the sensor uses as a frequency. It is the number of seconds which the sensor waits until he checks again for an avatar. The max list is the number of avatars which can be stored in the list of already contacted avatars. Then, I modified the code of the object of the state_entry().


state_entry()
    {

        llSensorRepeat("", "",AGENT, 5, PI, freq);

        llSetText("", <1.0, 1.0, 1.0>, 1.0);
    }


The code above is to create a sensor to check for avatar movement in the area. The number 5 is the radius in metres to check around. PI is used to make the sensor work in 360 degrees.




       sensor(integer num_detected)
    {

        integer i;

        key detected;
      
        for(i=0;i<num_detected;i++)
        {
            detected = llDetectedKey(i);
          
            if( llListFindList(given, [detected]) < 0 )
            {
                given += llDetectedKey(i);
              
                llGiveInventory(detected, notecard);
                if (llGetListLength(given) >= maxList)
                {
                    given = llDeleteSubList(given,0,10);
                }                               
            }
        }               
    }


Figure 1: Note Card given to me by Object

The code above is the part which sends the note cards. When the sensor detects an avatar, the function sensor(integer num_detected) is called. This function contains a for loop to go through all the detections. When an avatar is detected, the list is checked to see if the avatar is in the list already. An avatar might have already passed near this note card giver. If the avatar is not in the list, his name will be added to the list and a note card will be given to him. llGiveInventory() is the function used by Second Life to give the note card to the avatar. llGetListLength() checks the length of the list and if the list reaches the maximum, the function llDeleteSubList(given,0,10) deletes the first 10 avatar names of the list.


Figure 2: The Contents of the Note card

Post Box System

This was quite not difficult to create, but to test it, I had some problems. I created a very simple object to test the post box system. I did not create an elaborate post box because it was not the scope of the task. The code for this post box system is shown below:


default
{

    state_entry() {

        llAllowInventoryDrop(TRUE);
    }
    touch_start(integer total_number) {
        llSay(0,"Create a notecard and drop it into the mailbox");
    }
  
    changed(integer mask) {
        if (mask & (CHANGED_INVENTORY | CHANGED_ALLOWED_DROP)){



            integer i;

            for (i=0; i<llGetInventoryNumber(INVENTORY_ALL); i++) {
                string name = llGetInventoryName(INVENTORY_ALL, i);
                integer type = llGetInventoryType(name);
                if (type != INVENTORY_SCRIPT) {
                    integer perms = llGetInventoryPermMask(name, MASK_OWNER);
                    if ((perms & PERM_TRANSFER) == PERM_TRANSFER &&
                        (perms & PERM_COPY) == 0) {
          
                              llSay(0, "Thanks for the "+name);
                              llGiveInventory(llGetOwner(), name);
                        llRemoveInventory(name);
                    } else {
                              llSay(0, "Sorry, "+name+" isn't nocopy, trans");
                              llRemoveInventory(name);
                    }
                }
            }
        }
    }



Figure 3: Another avatar put a test note card in my post box system

The state entry part allows people to drop items into the post box object. The touch_start part displays a message when the object is touched. It displays a message to Create a notecard and drop it into the mailbox. The first part of the changed function checks for changes in the inventory and the changed allowed drop state. Then the function loops inside the inventory items and checks if an object is not a script in the inventory mask of the owner of the object with respect to the item. If the object dragged is not a copy, it is moved from the post box to the inventory. If it is a copy, it is not copied to the inventory and it is then removed from the post box. The avatar did not want to give me full permission because he was afraid of something. But he still was kind enough to test the system for me.


Figure 4: The note card given by the post box system

Object Interacting with a Website

For this part, I wanted to show how easy it is to display the content of a website in Second Life, without knowledge of the LSL scripting language. I created a kind of screen using a large object of about 10m by 10m. Then I used a texture to load the website. I selected one face of the screen and clicked on the plus sign at the bottom of the object window. In the URL, I added a URL of a youtube video. I removed the Auto Scale and entered the size of the video, 640x360. Then, I played a bit with the texture offset to center the video across the object. Below you can see the avatar in front of the BIG Screen. However the flash player is not installed within second life and the video cannot be seen. Another screen was thus created to show the content of another website. www.google.com is shown on the other screen.


Figure 5: Both screens showing two web pages in Second Life

After all, it was not that difficult to program objects in Second Life, you just need some time and patience :D

Saturday, June 30, 2012

IPv6


IPv4

IPv4 has been around since the early 1980s. This type of internet layer protocol addressing system is made up of two parts, the network identifier and the host identifier. Using classful networking, the IPv4 addressing range was divided in 5 classes. The first 3 classes had different capacity to be used for different purposes. Class D and class E were the same size, with the former being used for multicast addressing and the latter reserved for future applications. However, at around 1985, another method was devised to divide IP networks better and variably, called Variable Length Subnet Mask. This allowed networks to be divided in a small portion for the hosts, which still allowed growth.


Figure 1: Cisco CRS-3, with100Gbps Ethernet interface and 322 Tbps of interconnect capability

IPv4 Address Depletion

The Internet Assigned Numbers Authority (IANA) is in charge of the IP address structure. Since the 1980s, it was immediately apparent that the pool of available IPv4 addresses was being depleted at a much larger rate than was initially anticipated. Classful networks, Classless Inter-Domain Routing and NAT all were created to solve the problem of IPv4 address exhaustion. However, with all these technologies, something still had to be done and in 1996, IPv6 was born.


Figure 2: Difference between the IPv4 and IPv6 header

IPv6

While IPv4 uses 32 bit addressing, IPv6 uses 128 bits. This means that there are 3.4 x 1038 address. Each living person can have 4.8x1028 addresses for himself. Each subnet in IPv6 has 264 addresses. This means that each subnet has the square size of the whole IPv4 addressing. Of course, this means that a very small number of addresses will be used in each subnet but this will help hierarchical route aggregation.

Security

IPv6 has IPSec built in its architecture. This means that IPv6 was built with security in mind. Although IPSec was engineered for IPv6, it is very common in IPv4 networks. This happened because IPSec was back-engineered to work with IPv4. IPSec was designed to be an integral part of the IPv6 protocol suite, but was later removed and made optional.

IPv6 Address Format

The IPv6 address size is 128 bits. The preferred IPv6 address representation is: xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx where each x is a hexadecimal digit representing 4 bits. IPv6 addresses range from 0000:0000:0000:0000:0000:0000:0000:0000 to ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff.

In addition to this preferred format, IPv6 addresses may be specified in two other shortened formats:
Omit leading zeros - Specify IPv6 addresses by omitting leading zeros. For example, IPv6 address 1050:0000:0000:0000:0005:0600:300c:326b may be written as1050:0:0:0:5:600:300c:326b.

Double colon  - Specify IPv6 addresses by using double colons (::) in place of a series of zeros. For example, IPv6 address ff06:0:0:0:0:0:0:c3 may be written as ff06::c3. Double colons may be used only once in an IP address.

An alternative format for IPv6 addresses combines the colon and dotted notation, so the IPv4 address may be embedded in the IPv6 address. Hexadecimal values are specified for the left-most 96 bits, and decimal values are specified for the right-most 32 bits indicating the embedded IPv4 address. This format ensures compatibility between IPv6 nodes and IPv4 nodes when you are working in a mixed network environment.
These two types of IPv6 addresses use this alternative format:

IPv4–mapped IPv6 address - This type of address is used to represent IPv4 nodes as IPv6 addresses. It allows IPv6 applications to communicate directly with IPv4 applications. For example,0:0:0:0:0:ffff:192.1.56.10 and ::ffff:192.1.56.10/96 (shortened format).

IPv4–compatible IPv6 address - This type of address is used for tunneling. It allows IPv6 nodes to communicate across an IPv4 infrastructure. For example, 0:0:0:0:0:0:192.1.56.10 and::192.1.56.10/96 (shortened format).

All of these formats are valid IPv6 address formats.

IPv6 Day - 6th June, 2012

Instead of swapping an ISP one by one to change from IPv4 to IPv6, a day was organized so that a bulk change will be done. http://www.worldipv6launch.org/measurements/ shows the statistics and changes  which happened in the area of IPv6 since 6th June, nearly a month later.


Figure 3: Banner for World IPv6 Launch

Monday, June 25, 2012

A Chair and Sending Emails


This second post of Second Life takes me to creating some objects and stuff using the scripting language and the object builder. It is a bit frustrating at first but then it can get quite ok. The first thing I attempted to do was to build a chair and make my avatar sit on it. The first problem I had was that when I did the legs of the chair, another avatar came and removed it. Asking her why, she said that I was not allowed to build there and she took me to another place.

Creating a Chair

I used cylinders to make the legs and a cube to create the seat and the back of the chair. Although it is simple, it is a cute chair :) I used co-ordinates to create the legs of the chair so that I would know exactly how large it is and it would be easy to create the seat. I made the back legs longer so that I would use them for the back of the chair. Then I created two cubes, one for the seat and one for the back of the chair. Using the arrows I could move the parts and then dial in the exact number in the coordinates to create a smooth even chair. It took me nearly 1 hour to create this chair, but I was very happy with the end result. Also, the way I created the chair the avatar sat down immediately.


Figure 1: The Chair


Figure 2: The Avatar Sitting Down

Creating an object to send emails

Anyone doing programming knows that you need to setup a proper SMTP server with all the necessary details and settings to be able to send an email from a website or from an application. However, it was very easy to send emails in Second Life. using only a function with 2 lines of code, I was immediately sending emails when the object was touched. This was done by using the code below:

touch_start(integer total_number)
{
     llEmail("danielborgmt@gmail.com","Hey, You touched me","I have been touched on Second Life");
     llSay(0, "You Touched Me! - I sent an email to my owner!");
}

This shows how easy it is to send emails from Second Life. After touching the box I created with the script above, using the technique shown below, I got an email from the Second Life Object. The email indicates the name of the object, the Region name and also the local position.


Figure 3: Touching the Object


Figure 4: Email received from the Object 

Thursday, June 21, 2012

What on earth is Second Life????



Figure 1: Second Life Logo

Second Life is a 3D world where everyone you see is  a real person and every place you visit is built by people just like you and me.

Second Life is an online virtual world. It was developed by Linden Lab and was launched in 2003. Residents can use a number of client applications, or Viewers, to connect with each other through avatars in this virtual world. The world, known as grid, can be explored by thee residents to meet other residents, participate in events and more. It can also be used as a trading place. After reaching top popularity in the late 2000s, it has declined in popularity.

Second Life has a 3D modeling tool which is based on simple geometric shapes which allow residents to build virtual objects. It also has a procedural scripting language, Linden Scripting Language or LSL. This language can be used to add interactivity to objects, such as sending emails, dancing, and more.

Never in my life I have resisted something as much as I resisted Second Life. Using Second Life is an essential part for this module and it is compulsory, meaning it cannot be avoided. Personally, I do not see any point of learning this language as I cannot see myself making any use of this knowledge. After all, this product is decreasing its popularity. Personally I do not think that this will help me find a better job and I find it an utter waste of time.

However, my opinion does not count and I still have to work on it. Next week I will continue by explaining the interface of Second Life and how to navigate around.


Figure 2: Residents as Avatars hanging out

My question about this is how useful such a virtual world is. Talking to some of my colleagues, while working with some of the largest casinos in the world, I noticed that some of the casinos actually have a similar environment for their players. Players in such casinos choose an avatar to play 3 Dimensional poker for example. It might not be that boring after all......


Figure 3: An Avatar in a Live Casino environment

Monday, June 18, 2012

Mobile Application Development


The world of smart phones totally changed the way we live, as we constantly have a mini computer in our pockets. Several sizes, form factors and platforms are available and choosing your smart phone is certainly not easy, unless you are either a brainwashed Apple fan. The most common OSs for mobile phones are Android (36.9%), iOS (28.5%), RIM (18.1%) and Symbian (13.1%). Bada, WinMobile and Windows Phone 7 occupy the rest (3.4%).


Figure 1: Top Mobile Operating Systems


Figure 2: Operating Systems in Comparison (January 2012)


Figure 3: Smart Phone Manufacturer Comparison

One Application, 5 Operating Systems

Deciding on which platform to start developing can be tricky. There are an unlimited number of devices out there to cater for all but sticking to just one platform many times is not good enough. Thank god for PhoneGap, Appcelerator Titanium and Rhodes.

Android developers use Java to build applications for Android devices. iOS developers use Objective-C to develop applications for iPhones and iPADs. Immediately we can see that the code is not interchangeable since a different language is used. Also, learning Java and Objective-C has a steep learning curve. How about using JavaScript, CSS3 and HTML5 instead. These three applications allow you to create an application using JavaScript (or JQuery), CSS3 and HTML5. These technologies are very fast and also quite easy to use.


Figure 4: Appcelerator Titanium, PhoneGap and Rhodes

How is it done?

PhoneGap allows the developer to build applications once using web standards. Then, using PhoneGap, a mobile developer can get access to native APIs and then allows the developer to deploy to as many devices as he wants. Appcelerator uses nearly the same cycle. However, Rhodes makes use of Ruby to create the applications, rather than the other web technologies. This makes Rhodes less popular as there are a smaller number of developers using Ruby than the other languages.

Android Market vs AppStore

These two are the location people use to download applications for Android and IOS respectively. It turns out that although Android owns more than 50% of total smartphone market share, developers have, thus far, been reluctant to flock to the Android platform with their apps. In fact, there are more than 4 times as many iOS developers as there are Android developers. Why, you may ask? Quite simply, developers have long known that Apple device owners are closely locked into the Apple ecosystem, with credit cards on file. Many a study has been done, and the results are unanimous – Apple device owners are more willing to pay for apps. That being said, there are many apps in the Google Play Store that are also on Apple’s App Store – but are free, or ad supported.

Downloads and Fragmentation

The most frustration for developers on the Android platform has come from one evil word, which is fragmentation. As noted in the image above, thanks to The Next Web, iOS versions are adopted much faster and in far higher numbers than any recent version of Android. Ice Cream Sandwich, however,  still has not passed the 3% mark of all Android devices. Furthermore, according to GigaOm, 45% of iPhone and iPod Touch users purchased at least one paid app every month. Only 19% of Android users bought a paid app every month. In addition, iOS users almost double Android users in the total number of apps downloaded per month.


Figure 5: Fragmentation

Conclusion

In the end, this war between Android and IOS will never be over and it will never be a seamless job to produce apps for both Android and IOS. It is still a matter of personal taste and what the developer wants to achieve with the application he or she is going to develop

Saturday, May 19, 2012

Coursework 2 - Part 3


Today I am going to talk about the last part of my course work. After nearly finishing my coursework, I got an idea to make the game more interesting. I added a feature that checks if a player beats the current high score, and the current high score was achieved by another player, the game sends an email to the other player to tell him or her that her score was beaten.

Modifying the database

Even though this was not very difficult to do, it took me a whole week to manage to sort it out. First, I added a field in the database of the users to add the email address of the player. This requires the email to be added manually to the database as a new user cannot add an email address in the login form. This was done without because the scope of the login page was not to create a fully featured login form with a registration form.  So, I added an email address to each record in the database. For testing purposes, I inserted my email address in all the fields so that I would not bug other people with my emails.

Checking if the highest score was beaten by another player

Then, I started to modify the function which compares the high scores. After opening the connection with the database, I made a query to obtain the username, the high score and the email of the person who is at the top of the hall of fame.  The query which I used is shown below:

select username, highscore, email
from cannon_game.login    
order by highscore desc limit 1;

The record obtained is inserted into the variable $row and from it I obtained a value for the $topuser, $topscore and $topemail, which are the details of the player with the highest score in the hall of fame. Then an if statement checks if the current score is larger than the $topscore value from the database. If the score is higher than the topscore, the difference is calculated. Then, another if statement checks if the current player is the topuser. If it is not the same user, then it means that the person who was first, now moves to second place. Then, a function called email is called and it is passed the values for topuser, topemail and the score difference. Then the function continues to update the scores accordingly like it used to do before.

Testing this function

Knowing that emailing would not work immediately, I tested this function a bit primitively, using echo. I tested by using different users to play the game and trying to achieve a better score every time. I was not playing the game to obtain the highest possible score. I tried to keep scores low so I would not have to reset the scores from the database because I would not be able to beat them. By echoing the variables values I knew that the function to check if the high score was beaten by another player was working great.

Email function

I created the email function and I passed to it the variables $topuser, $topemail and $scoredifference. To send emails you need a to address to send emails to, a from address, a subject and a body. The to email was obtained from the database and passed to the function. I used my personal email as the from email address. Then I crafted a subject and a body message using the user name and the score difference. The code below shows the first part of the email function:

     $to = $topemail;
     $from = "danielborgmt@gmail.com";
     $subject = ucwords($topuser).", be careful!!";
     $body = ucwords($topuser).", your score was beaten by "                   .$scoredifference." points!! Make sure to beat his score to          stay in the first place!!!";

The function ucwords() is used to capitalize the first letter of the string passed to it. Then you need an SMTP server to be able to send emails. This gave me a lot of problems and took me nearly a week to solve. I talked about this in my previous blog. After trying a lot of solutions, I managed to find a working script which worked nearly immediately. The script was a PEAR extension and I used the following code to be able to use it:

     $er = error_reporting(0);
     require_once "Mail.php";

SMTP Server Settings

The error_reporting(0) is used to hide errors for using methods which were not called using a STRICT method. This was done at the top of the php file. After enabling SSL on my web server, I added the details of my Gmail account to use Gmail's SMTP server. Then I called the function to send the email to the details of the player who was first using my Gmail SMTP server. The code is shown below:

     $host = "ssl://smtp.gmail.com";
     $port = "465";
     $username = "danielborgmt";
     $password = "mypassword";
     $headers = array ('From' => $from, 'To' => $to, 'Subject' =>                         $subject);
     $smtp = Mail::factory('smtp', array ('host' => $host,'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password));
     $mail = $smtp->send($to, $headers, $body);
          
     if (PEAR::isError($mail)) {
          echo("<p>" . $mail->getMessage() . "</p>");
     }

This code allowed me to send emails properly to the player who lost the first place.


Figure 1: Sample Email from PHP Script


Figure 2: Email details

This concludes my second coursework.