Week 12: Second Life

Introduction
Second Life is a place where people meet & interact virtually through a virtual world. It's not specifically a game & there are no objectives one can tick off. Just imagine our world but transformed into a virtual world where you can control your avatar commanding it to do whatever you like, sort of like in the movie Avatar. Developers can create new objects and even sell them for a hefty price should they want to. These objects can be used by all avatars and consist of all imaginable things such as clothes, tables & much.... much more.

My Experience
Although I used to play some computer games in my early years, I grew out of them & it's now to me just a waste of time. That said, this is school work so it must be done, so I embarked into the journey of exploring this virtual world with my ugly looking avatar. The first thing I noticed is that the virtual world objects are painfully slow to load & this is because all the objects are downloaded from their server in real time. As a "Player" you only have a client/viewer which connects to Second Life's server and displays all the objects giving you the ability to control your avatar. In my opinion it's still not developed to the extent were people will actually enjoy their time on Second Life. I imagine a future where websites like ebay & facebook will be integrated with this sort of virtual 3D world were real people could interact with other people or buy real world items through a virtual world interface. People would probably enjoy something like that since they will be actually managing  their own real life through a 3D virtual world. Lately many movies have revolved around this idea such as the blockbuster Avatar & Surrogates starring Bruce Willis & It's probably an inevitable future and we will one day end up with something similar.


Features
When you first open your viewer you'll notice that before you login you can choose between a "basic" user type or an "advanced" user type. As a basic user, you are only allowed to participate in the virtual world by moving around, interacting with objects & socializing. On the other hand, advanced users can go into the world and create objects which in the future can be used by several other users who wish to make use of created objects. You can definitely see a difference in the interface when logging in the advanced mode since tools to create objects are added.

Conclusion
Quite different than any subject I've learned in my previous courses & in my honest opinion it's not an important one since I rarely ever seen a company making use of this type of world in it's operations. Maybe you are thinking to yourself that in the future it may come useful, well who knows maybe it will & maybe it won't but I'm almost 100% sure that if in the future anyone is interested in something like this a new platform will be developed.


Week11: Coursework 2

Introduction
After following some PHP lessons, the coursework's time was up. The task consisted of a simple web based file manager coded with PHP,MySql, HTML,CSS & javascript which concludes the subjects we've been learning for the past 10 weeks. The program allows users with an account to login, upload/delete files, Create & delete new directories & move through these directories while they comply to a space limit. This is the quota every user has on the hard disk.

Development
Firstly I created a simple database with one table, which will store any user that registers in order to use the web based application. Once that was ready, the actual application started to be developed. Now there's 3 simple pages that this system needed,
  1. Login - User logs in the system
  2. Application Page(index) - User uses the system
  3. Register Page - user registers to use the system
  4.  
    For easier database access a database class was created which helps with the connection/disconnection of the database itself & other necessary queries. For other important functions there was not enough time to develop a well structured class that does all the dirty work. So if you happen to open the index.php(Main Application page) page you'll notice that everything is mashed up together and the code is not so readable. At a later stage this could be fixed by putting all the necessary functions in a separate class and use the index.php only to combine everything with each other.

    The main features that have been developed are:
    1. Login/Register/Logout
    2. Upload/Download Files
    3. Quota / Disk limit of 50mb
    4. Creation of new folders
    5. Deletion of folders & files
    6. Design using css
    These tasks where rather simple to impliment & were completed without any problems(sort of). There was only one of these features which resulted problematic.
    I’m talking about the deletion of folders & files. I used the unlink() function to remove files & the rmdir() function to remove the directories. I thought I got everything working but after some testing I noticed that the deletion of folders which included other files wouldn’t work because recursive deletion is not a function of rmdir(). So I set myself to research some examples of functions which could be used to recursively delete a folder. Here’s the function I came up with:

    //Actual Function
    function remove_directory($dirname) {
    if (is_dir($dirname))
    $dir_handle = opendir($dirname);
    if (!$dir_handle)
    return false;
    while($file = readdir($dir_handle)) {
    if ($file != "." && $file != "..") {
    if (!is_dir($dirname."/".$file))
    unlink($dirname."/".$file);
    else
    remove_directory($dirname.'/'.$file);
    }
    }
    closedir($dir_handle);
    rmdir($dirname);
    return true;
    }


    //Example Usage
    remove_directory($path);

    Special Features
    After implementing the main tasks I researched some of the popular file managers for cool features that I could implement as special features. One that got my eye was the dragging & dropping of files & folders into other directories in order to move these elements. I already knew that the popular javascript framework Jquery had some UI elements (mainly the draggable & droppable) which could make this possible.

    So after downloading the Jquery Libraries I implemented this using javascript which can be found in the index.php file.
    Basically the Jquery libraries allow you to set a source which can be dragged and a container which can hold a dropped element. After that, you can also retrieve the properties of these elements which is where there ID comes into place. In the html markup an ID on each row was setup & the directory of the file or folder was set. So when a row is dragged onto a folder I know which file wants to be moved in which directory right?

    Now here’s where the magic happens, Ajax is a powerful way to transfer data between the client & the server without refreshing the page. So what I did was to pass the source file & the destination folder as a variable to move.php through AJAX which will in turn simply move the source file in the destination folder using php’s rename() function.



    Another Feature which I tried to implement was a multiple file uploader. The native html file chooser does not support this kind of function so I researched some Jquery libraries that could make this possible. After about a half an hour of research I stumbled upon one of the best plugins which comes with a cool name as well - Uploadify. It’s rather easy to implement but as soon as the testing started one particular problem came up. I could not find any way to check the file sizes that were being uploaded (In order to restrict to the user’s file disk quota) through javascript & didn’t have the time to research much into it either so I decided to abandon it altogether. Other than that one problem , it did work flawlessly and it also comes with quite a nice user interface by default.

    Future Improvement
    This application is just a core basic to its potential. It can be furthur developed into a much more sophisticated & secure file manager where more features can be included. Here are some features on the top of my mind that could be developed:

    1. Rename Files & Folders
    2. Check for files/folders with same name before moving/creating/uploading.
    3. Better User Interface & prompts
    4. Account section where users can modify there account information
    5. Undelete files
    6. Share folders
    7. Download Whole Folders
    8. Mobile support

    Conclusion
    That’s all I have to say for this post, here are a few screenshots of the application & the source files. See you next time!

        1. Login Page

       
     
        2. The main page after logging in. On the left under the logo we can see the quota & a logout   link. On the right hand side all the folders & files are listed together with the upload & create directory sections.


        3.  Navigating in  a Sub Folder, We can see the Up - Directory button on top.


        4.  Dragging a file into a folder in order to move it into that directory.



    Finally heres a link to download the source files.


    Week10: Mobile Techbologies


    Introduction
    In the world of today, technology gets old pretty quickly & this is also the fact with mobiles & mobile technology. When you buy a new mobile phone it seems like it gets old within 2 months because the improvements are so frequent.


    Technology Improvement
    Mobiles have come a long way especially in these last couple of years. Screens got bigger, Battery life got longer, CPU speed has gone faster & many more. Here's a list of new mobile technologies:
    •      Longer Battery life
    •      Better Communication
    •      Better & Bigger Screens
    •      Faster CPU speed
    •      Better antennas
    •      GPS
    •      Compass
    •      Touch screens
    •      Higher RAM Storage
    •      Better Operating Systems
    •      Apps
    •      Higher Storage
    •      Easier user input through touch screens

    Service Improvement
    In order to keep up with technology, even mobile service providers had to improve their services. We can recall to about 9 years ago where the internet didn't exists on your mobile, 7 years it did exist but it was excruciatingly slow which brings us to today where the internet connection on your mobile compares to that on your pc. With the improvements that will come during the next years, we will probably see a huge improvement on internet connectivity on the mobile phone.

    Here's a couple of service technologies which evolved during the years:
    • GPRS - Packet oriented mobile data technology
    • EGPRS - Extended on above
    • Edge - same as EGPRS
    • 2g - Transformed the connected from analog to digital
    • 3g - Data transfer can accommodate TV, internet & video calls.
    • 4g - Mesh Network, can reach upto 100mb/s data transfer speed.



    Security
    With new technology always coming up, there is an issue with security. We have recently heard on the news that Apple has been tracking the locations of every iphone user and sending those locations back to Apple.

    Lab Work
    This week, we were assigned to acces this blog through a phone browser. Since I do not currently have a web-enabled phone, I decided to use an emulator which can be accessed at: http://www.opera.com/mobile/demo/


    Here's a screenshot of the result:


    Given this image, this blog shows that it is not optimized for mobile web browsers. Still it was pretty easy to navigate through the webpage because the elements are not compressed altogether. A simple solution would be that of Only showing the posts in a narrower width when a mobile browser is detected and eliminate all the other widgets & extra elements.