Tuesday, March 25, 2014

Practical Assessment - basics of CORBA

Requirements:


"You are required to develop an application that allows users to register for an online
account with the Kamarad mobile operator. The Kamarad online account will allow
users to top up their account, and to get the credit balance."

Solution:


kamarad.idl

module kamarad {
    struct KamaradAccountDetails {
     string name;
     string address;
     string phoneNumber;
     string bankAcNumber;
     double credit;
     string uniqueId;
    };


    interface OnlineKamarad {
     void register(in KamaradAccountDetails accountDetails, out any uniqueId);

     void getAccountDetails(in string uniqueId, out KamaradAccountDetails accountDetails);
     void topupAccount(in string uniqueId, in double amount)
 
    };
};


OnlineKamaradImplemantation.java

import kamarad.*;
import org.omg.CORBA.*;
import java.util.*;

import java.util.Hashtable;

public class OnlineKamaradImplementation implements OnlineKamaradOperations {
    private ORB orb;

    //create HashMap to store userData
    Hashtable<String, KamaradAccountDetails> hashTable = new Hashtable<String, KamaradAccountDetails>();

    public OnlineKamaradImplementation (ORB orb) {
        this.orb = orb;
    }


    public void register (kamarad.KamaradAccountDetails accountDetails, org.omg.CORBA.AnyHolder anyUniqueIdHolder) {
        Any anyUniqueId = orb.create_any();


        // Add logic to allocate a new unique id for this registration and store the new account
        // for subsequent retrieval
        String uniqueId = UUID.randomUUID().toString();
        uniqueId = uniqueId.substring(uniqueId.length() - 6);

        anyUniqueId.insert_string(uniqueId);
        anyUniqueIdHolder.value = anyUniqueId;
  accountDetails.uniqueId = uniqueId;
  hashTable.put(uniqueId, accountDetails);
    }


    public void getAccountDetails (String uniqueId, kamarad.KamaradAccountDetailsHolder accountDetailsHolder) {
        // Look up and retrieve the account details for this user
        KamaradAccountDetails accountdetails = new KamaradAccountDetails();
        // Put the account into a holder object for returning
        accountDetailsHolder.value = hashTable.get(uniqueId);
    }

    public void topupAccount (String uniqueId, double topup) {
        // Look up the account details for this user and update the credit by adding the
        // specified top-up to the exDsting balance

        KamaradAccountDetails accountDetails = hashTable.get(uniqueId);


        accountDetails.credit  += topup;
    }
}



OnlineKamaradRegister.java

import kamarad.*;
import org.omg.CORBA.*;
import java.io.* ;
import java.util.* ;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;


public class OnlineKamaradRegister {

    public static void main(String args[]) {

        try{
            ORB orb = ORB.init(args, null);

            //Obtaining the object reference to the Name Service            org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
            //Narrowing the object reference of the Name Service to the correct Type            NamingContext rootCtx = NamingContextHelper.narrow(objRef);
            //Creating a name of the desired object that we want to get the object reference from the name server            NameComponent[] path = new NameComponent[2];

            path[0] = new NameComponent("Kamarad", "Context");
            path[1]    = new NameComponent("OnlineKamarad", "Object");

            org.omg.CORBA.Object objRefKamarad = rootCtx.resolve(path);
            // Converting the retireved object reference from the Name Service to the correct type            OnlineKamarad kamaradRef = OnlineKamaradHelper.narrow (objRefKamarad);
            // Prompt user for account details or get them as command line arguments            String name = getName();
   String address = getAddress();
            String phone = getPhoneNumber();
            String bankAcNumber ="";
            double initialCredit = 0.0;


            // Create our account details object            KamaradAccountDetails accountDetails = new KamaradAccountDetails(name, address, phone, bankAcNumber, initialCredit, "REGISTER accountThingy");
            // Creating an any holder that will hold the unique id parameter from the register operation call            AnyHolder anyUniqueIdHolder = new AnyHolder();
            // Register the user            kamaradRef.register(accountDetails, anyUniqueIdHolder);
            // Display the newly allocated user id            String uniqueId = anyUniqueIdHolder.value.extract_string();
            System.out.println("User registered as: " + uniqueId);

        } catch (Exception e) {
                System.out.println("ERROR : " + e) ;
                e.printStackTrace(System.out);
        }
    }


    private static String getName(){
      String name = null;
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      System.out.print("Enter Your Name:");
      try{
       name = br.readLine();
      }
      catch (IOException ioe){
       System.out.println("Error trying to read your name!");
             System.exit(1);
      }
      return name;
     }


     private static String getAddress(){
      String address = null;

      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Enter Your Address:");
      try{
       address = br.readLine();
      }
      catch (IOException ioe){
       System.out.println("Error trying to read your adress!");
             System.exit(1);
      }
      return address;
     }


     private static String getPhoneNumber(){
      String phoneNumber = null;

      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      System.out.print("Enter Your Phone Number:");
      try{
       phoneNumber = br.readLine();
      }
      catch (IOException ioe){
       System.out.println("Error trying to read your phoneNumber!");
             System.exit(1);
      }
      return phoneNumber;
    }
}

Wednesday, March 19, 2014

Gay Dublin Guide

Hi everyone, here's a nice app for those traveling to Dublin.

 
 
You can see more details in this video shot.
 



You can downloaded at http://appshopper.com/travel/gay-dublin-guide.

Wednesday, February 26, 2014

Phonograph - New technology meets the old

Shot with Nikon D7000


Rolling links - CSS3 + JS example

"Rolling link" is a great example of CSS and JS combination. I found it the other day at this great site http://www.webdesignerdepot.com/2013/09/the-ultimate-guide-to-flat-design/ full of flat-ui design inspirations.

This tutorial shows you how to create catchy "rolling links".

 

What we need

  1. Notepad++ (or any other html editor of your choice)
  2. jQuery  (you can download jQuery file from  http://jquery.com/download/ or you can add this markup into head section of your html file <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"> </script>

 

Create Html file


We'll start with the simple html file. Let's save it as index.html

<!DOCTYPE html>
<html>
   <head>
       <title>Fancy Rolling Link</title>

   </head>
   <body>
   </body>
</html>

Add div box into body section. We will apply CSS3 and JavaScript to everything inside the <a> tags, in our case it'll be "Flat design".

<div>
    <article>
       We love <a href="#" >Flat design </a>.
    </article>
</div>


Styling rolling links


You can create a CSS file or else you can include CSS into head section of he HTML file. We'll add this CSS markup to our html file in this tutorial.  

 <style>
  
a {
   color: #9b59b6;
   font-weight: bold;
   text-decoration: none;
   }
  .roll-link {
   display: inline-block;
   overflow: hidden;
   vertical-align: top;
   -webkit-perspective: 600px;
      -moz-perspective: 600px;
       -ms-perspective: 600px;
           perspective: 600px;
   -webkit-perspective-origin: 50% 50%;
      -moz-perspective-origin: 50% 50%;
       -ms-perspective-origin: 50% 50%;
           perspective-origin: 50% 50%;
   }
   .roll-link:hover span {
    background: #9b59b6;
    -webkit-transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
       -moz-transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
        -ms-transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
            transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
    }
   .roll-link span {
    display: block;
    padding: 0 2px;
    position: relative;
    -webkit-transition: all 400ms ease;
       -moz-transition: all 400ms ease;
        -ms-transition: all 400ms ease;
            transition: all 400ms ease;
    -webkit-transform-origin: 50% 0%;
       -moz-transform-origin: 50% 0%;
     -ms-transform-origin: 50% 0%;
      transform-origin: 50% 0%;
    -webkit-transform-style: preserve-3d;
       -moz-transform-style: preserve-3d;
        -ms-transform-style: preserve-3d;
            transform-style: preserve-3d;
    }
    .roll-link span:after {
     background: #9b59b6;
     color: #fff;
     content: attr(data-title);
     display: block; 
     left: 0;
     padding: 0 2px;
     position: absolute;
     top: 0; 
     -webkit-transform-origin: 50% 0%;
        -moz-transform-origin: 50% 0%;
         -ms-transform-origin: 50% 0%;
             transform-origin: 50% 0%;
     -webkit-transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
        -moz-transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
         -ms-transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
             transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
     } 
 </style>


JavaScript


This simple JS function is executed immediately after the DOM has been fully loaded. It finds all <a> tags, adds class="roll-link" to it and encloses text inside <a> tag with <span> tags. 


<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"> </script>
<script>
  jQuery(document).ready(function(){
   initFancyRollingLinks();
  });

  function initFancyRollingLinks(){
   jQuery('a').each(function(i,e){
    var link = jQuery(e);
    link.addClass('roll-link');
    link.html('<span data-title="'+ link.text() +'">' + link.html() + '</span>');
   });
  };
 </script>


Demo


Demo to this tutorial is not available at the moment. But you can see working version on this site http://www.webdesignerdepot.com/2013/09/the-ultimate-guide-to-flat-design/


Friday, November 2, 2012

Mobile Website vs Hybrid App comparison

Mobile Website  App

 Strengths
  •  cheapest / easiest / fastest to develop
  •  works across all platforms
  •  updates are immediately available to end users
  •  can work offline
 Weaknesses
  •  cannot use device's native hardware features
  •  slower that native apps 
What can we access?
  •  geolocation api (GPS)
  •  device orientation (accelerometer)
  •  battery
  •  web audio/video (NOT supported by majority of older browsers ) 

Hybrid App

Strengths
  •  code once and deploy the app to multiple platforms
  •  can work offline
  •  content can be updated easily
 Weaknesses
  •   partial access to the device's native hardware features
  •   major changes to the app will require the user to update the app
 What can we access? (using PhoneGap for example)
  •  accelerometer
  •  camera
  •  capture (media files using device's media capture apps)
  •  compass
  •  connection
  •  contacts (devices contact database)
  •  device (device specific info)
  •  events
  •  geolocation
  •  globalization
  •  media (record and play back audio files)
  •  notification
  •  splashscreen
  •  storage  



Saturday, October 13, 2012

How to easily detect and redirect android and iPhone

Simple script for Android detection.

<script type="text/javascript">

         if ( (navigator.userAgent.indexOf('Android') != -1) ) {
document.location = "http://www.your_url.com";
}

</script>


Lets specify Android and iPhone version.

<script type="text/javascript">
       var ua = navigator.userAgent;
       if (ua.indexOf("Android") >= 0) {
           var androidversion = parseFloat(ua.slice(ua.indexOf("Android") + 8));
           if (androidversion <= 2.3) {
               window.location = 'http:/www.your_url.com';
           }
       } if (/(iPhone)/i.test(navigator.userAgent)) {
           if (/OS [1-4]_\d(_\d)? like Mac OS X/i.test(navigator.userAgent)) {
               // iOS 1-4 so Do Something            
               window.location = 'http://www.your_url.com';
           }
       }
</script>

Monday, July 16, 2012

MadeByALexandra


Modern and functional Design. 
Minimalist, Responsive, Trendy, Professional Websites



Saturday, April 28, 2012

Team Dynamics

Group dynamics is the study of groups, and also a general term for group processes.
Group is a number of people that work together, share certain beliefs and common
identity, or are connected to each other by social relationship. Criteria for a group
include also a face-to-face interaction, two or more people in the group, common goals,
interdependence, self-definition as group members and recognition by others. Every
group has to pass 4 phases of Team Development (forming, storming, norming and
performing) which form, reinforce and build up a strong team.
Team or Group Dynamics are the unseen forces concerning the fluid and on-going
interaction between and among team members, their actions and reactions. Team
dynamics can strongly influence how team or group behave, react or perform. Team
members and team dynamics have to depend on and support each other to accomplish a
shared goal. Effective Team Climate can be created by fostering social support (mutual
respect and support enhance team climates), encouraging proximity (closer contacts
promote team interaction), creating distinctiveness (the more distinct the group feels, the
better climate will be).


Marketing


The purpose of this report is to outline a marketing strategy for part time IT courses
in National College of Ireland. Working with a fixed budget of €15,000, which may be
increased or decreased in a negotiation, we wanted to maximize the impact of our
campaign without the need for a substantially increased budget . In order to complete this
task we researched many areas, who is our target market, what is the competition, what
can NCI offer and how can we attract customers to our brand.

We shall first look at what part time courses are available at NCI, then look at what
the competition has to offer. We will also look at who our target market is. Why should
they choose NCI over any other institution? Finally, we shall outline our strategy for
negotiating the budget, aiming for an increase in spending but also a strategy for
maintaining our budget and a contingency plan if it to be reduced.



Mobile Gaming

“Family, religion, friends.. these are the three demons you must slay if you wish to
succeed in business.”

     Monty Burns

The purpose of this report is to outline our idea for a new business and why it would
be profitable. We will outline the direction we have taken for our business idea, the
reasons why we believe it would be successful and discuss our strategy for promoting our
product.
With the worlds economy currently enduring a downturn, coming up with a
economically viable business idea is no small order. With the exception of writing that
one Christmas hit or Country and Western song that would provide for you for life, we
decided to look at what industries have maintained good returns.
During our research we found that during these times of recession the smart phone
and gaming market have remained strong.

Tuesday, April 24, 2012

Project Management




Project Management

Implementation of Learning Content Management System. Moodle vs Blackboard.
(college project) 





Wednesday, March 21, 2012

How to connect to JavaDB and create database -- Tutorial

1. Open your Netbeans, go to Window and select Services. Alternatively press CTRL+5.

2. Right Click on JavaDB and select Start Server

3. Right Click again and this time select Create Databese
  1. name it -- login
  2. username -- nut
  3. password -- nut
  4. confirm password
  5. click OK

4. Right click on jdbc:derby://localhost:1527/login[nut on APP] and select Connect

5. Open jdbc:derby://localhost:1527/login[nut on APP] tree and select APP

6. Right click on Tables, select Create Table


7. Name your table -- users


8. Create columns, one by one
  1. firstName
  2. lastName
  3. userName
  4. password
  5. address1
  6. address2
  7. address3
  8. address4
  9. telephone
  10. mobile
  11. email
  12. ageGroup
  13. employmentStatus

9. Alternatively you can create and populate your table using mysql query. Right click on Tables and select Execute Command and insert following mySql query.

CREATE TABLE users (firstName VARCHAR(20), lastName VARCHAR(20), userName VARCHAR(15), password VARCHAR(15), address1 VARCHAR(30), address2 VARCHAR(30), address3 VARCHAR(20), address4 VARCHAR(20), telephone VARCHAR(15), mobile VARCHAR(15), email VARCHAR(35), ageGroup VARCHAR(5), employmentStatus VARCHAR(17));
and  Run SQL.

10. Add some users...
INSERT INTO users 
VALUES      ('Jake', 'Roberts', 'snake@ifpwafcad.com', 'password' , '123 Castle Lawns' , 'Tallagh' , 'Dublin 24' , 'Ireland' , '412 565-5656', '555 565-5656','snake@ifpwafcad.com', '18-24' , 'Student' ),
('Andre','','snake@ifpwafcad.com', 'password' , '123 Castle Lawns' , 'Tallagh' , 'Dublin 24' , 'Ireland' , '412 565-5656', '555 565-5656','snake@ifpwafcad.com', '18-24' , 'Student' );
and  Run SQL.