Thursday, June 7, 2012

Why do you need web presence?

Whether you are a small entrepreneur, or a large business, corporate presence is increasingly required to effectively market your business through the world wide web.  Using web-design which are appealing, coupled with search engine optimization and internationalization can boost your web-presence, page ranking and help you reach your audience whilst they are browsing the web.

Our experts can provide you with web-applications including e-commerce, shopping carts, WordPress websites, and, a wide range of technical support services at a favorable and reasonable price. 

Whether the technologies used are .NET based, J2EE, PHP, or any other software platform, we will design and test it using controlled project management techniques.

You may drop me an email on camilleri.jon@gmail.com with your requirements, to schedule a chat.  Pictures and information about what products or services you need to market are useful information.  The rest is up to us!

Outline of a Strategic Management System by Jon C.

Wednesday, May 23, 2012

Java ...an unfinished poker game

Well, here is the source code...

package poker;

public class Card {

    public Card(Suit suit, Rank rank) {
        this.suit = suit;
        this.rank = rank;

    }
    public Card(short _suit, short _cardnumber)
    {
        switch (_suit) {
        case 1 :
            this.suit = Suit.CLUBS;
            break;
        case 2 :
            this.suit = Suit.DIAMONDS;
            break;
        case 3 :
            this.suit = Suit.HEARTS;
            break;
        case 4 :
            this.suit = Suit.SPADES;
            break;
        default :
            break;
        }

        switch (_cardnumber) {
        case 1 :
            this.rank = Rank.ACE;
            break;
        case 2 :
            this.rank = Rank.KING;
            break;
        case 3 :
            this.rank = Rank.QUEEN;
            break;
        case 4 :
            this.rank = Rank.JACK;
            break;
        case 5 :
            this.rank = Rank.TEN;
            break;
        case 6 :
            this.rank = Rank.NINE;
            break;
        case 7 :
            this.rank = Rank.EIGHT;
            break;
        case 8 :
            this.rank = Rank.SEVEN;
            break;
        case 9 :
            this.rank = Rank.SIX;
            break;
        case 10 :
            this.rank = Rank.FIVE;
            break;
        case 11 :
            this.rank = Rank.FOUR;
            break;
        case 12 :
            this.rank = Rank.THREE;
            break;
        case 13 :
            this.rank = Rank.TWO;
            break;
        default : break;
        }
    }

    @Override
    public String toString() {
        return rank.toString().toLowerCase() + " of " + suit.toString().toLowerCase();
    }
   
    @Override
    public int hashCode() {
       
        int _hash = 7; 
        _hash = _hash * 31 + suit.hashCode(); 
        _hash = _hash * 31 + rank.hashCode(); 
        return _hash;  
    }

    @Override
    public boolean equals (Object other) {
        if ((other == null) || (!(other instanceof Card))) return false;

        if (this == other) return true;
       
        if (getClass() != other.getClass()) return false;
       
        Card card = (Card) other;
        return  card.suit == this.suit &&
                card.rank == this.rank &&
                other.hashCode() == this.hashCode();   
    }

protected enum Suit {
        CLUBS("Clubs"), DIAMONDS("Diamonds"), HEARTS("Hearts"), SPADES("Spades");

        private String name;
        Suit(String name) { this.name = name; }
        public String getName() { return name; }
    }

    protected enum Rank {
        ACE("Ace"), KING("King"), QUEEN("Queen"), JACK("Jack"), TEN("Ten"),
        NINE("Nine"), EIGHT("Eight"), SEVEN("Seven"), SIX("Six"), FIVE("Five"),
        FOUR("Four"), THREE("Three"), TWO("Two");

        private String name;
        Rank(String name) { this.name = name; }
        public String getName() { return name; }
    }

    public Suit getSuit() {
        return this.suit;}

    public Rank getRank() {
        return this.rank;
    }   
    public static int RANKING_CARDS_PER_SUIT = 13;
    public static int SUIT_COUNT = 4;
    @SuppressWarnings("unused")
    private static boolean isJokerAvailable = false;

    private Suit suit;
    private Rank rank;

}

# The root logger is assigned priority level DEBUG and an appender named
# consoleAppender.
log4j.rootLogger=DEBUG,consoleAppender, fileAppender

# The appender's type specified as ConsoleAppender, i.e. log output to
# the Eclipse console. (Could have been FileAppender.)
#log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender

# Stdout
# The appender is assigned a layout SimpleLayout. SimpleLayout will
# include only priority level of the log statement and the log statement
# itself in the log output.
#log4j.appender.consoleAppender.layout=org.apache.log4j.SimpleLayout

# File
log4j.appender.fileAppenderAppender.file=poker_debug.log
log4j.appender.fileAppender.maxFileSize=1Mb

# Archive log files (one backup file here)
log4j.appender.fileAppender.MaxBackupIndex=1

log4j.appender.myAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.fileAppender.layout=org.apache.log4j.PatternLayout

log4j.appender.consoleAppender.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
log4j.appender.fileAppender.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n

package poker;
import java.util.*;
import org.apache.log4j.BasicConfigurator;
public class Player {

public Player (String _name, Double _balance) {
    this.name = _name;
    this.balance = _balance;
}

public ArrayList<Card> getCardsHeld() {return CardsHeld;}
public void getCardFromDealer (Card _card) {CardsHeld.add(_card);}

public boolean equals (Object other) {
    if ((other == null) || (!(other instanceof Player))) return false;

    if (this == other) return true;
   
    if (getClass() != other.getClass()) return false;
   
    @SuppressWarnings("unused")
    Player _player = (Player) other;
    return  this.hashCode() == other.hashCode();   
}

public String toString() {
   
    String _cardsHeld = "";
    for (int i = 0; i < CardsHeld.size(); i++)         {_cardsHeld += CardsHeld.get(i).toString() + "; ";}
   
    return (name + " holds the following cards: " + _cardsHeld) ;
}

public int hashCode() {
    int _hash = 7;
    int _cpCount = this.name.codePointCount(0, this.name.length());
    int _codePointV = 0;
   
    for (_cpCount = 0; _cpCount < this.name.codePointCount(0, this.name.length()); _cpCount++) {
        _codePointV += this.name.codePointAt(_cpCount);
    }
    _hash = _hash * 31 + _codePointV; 
    return _hash;
}
private ArrayList<Card> CardsHeld = new ArrayList<Card>();

public String getName () {return name; }
public Double getBalance () {return balance;}
public boolean betAmount(Double _amountToBet) {
    if (_amountToBet <= balance) {
        balance -= _amountToBet;
        return true;}
   
    else return false;
}
public void addWinnings (Double _amountWon){
        balance += _amountWon;
}
public void setRanking (short _winningRank){
    this.winningRank = _winningRank;
}
public short getRanking () {return this.winningRank;}

public long getCurrentGameScore() {return this.scoreOfCurrentGame;}
public void setCurrentGameScore(long _currentScore) {
    this.scoreOfCurrentGame = _currentScore;
    if (_currentScore > this.highScore) this.highScore = _currentScore;}
   
public long getHighScore() {return this.highScore;}

private String name;
private Double balance;
private short winningRank;
private long scoreOfCurrentGame;
private long highScore;
//TODO: persist stats on text file
}

@echo off
set CLASSPATH=.
javac *.java
java -Dlog4j.debug=true Poker
pause

package poker;

import java.awt.Image;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import javax.imageio.ImageIO;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Logger;
public class Poker {

    /* "Magic numbers" to be replaced by parameters loaded from text file e.g. poker.init */
    public static final short MAX_CARDS_IN_DECK = 52;
    public static final short MAX_SUITS_IN_DECK = 4;
    public static final short MAX_RANK_IN_DECK = 13;
    public static final short MAX_PLAYERS_PER_TABLE = 5;
    public static final short MAX_GAMES = 1;
    //TODO:
    //1. getWinners() review and maybe use Map instead of Enums, including:
        //1a. Poker winning hands not being returned correctly.
        //1b. Poker winning hands being repeated e.g. Player One gets full house, and, Player One to Player Five (inclusive), get full house.
    //2. review code and clean up, test etc.
    //3. implement Joker, which can act as a wild card (Card.java and Poker.java) FIX.
    //4. UI, concurrent games and tables,  and, probability statistics (future).

    public static double amountOnTable;
    public static final String CURRENCY_SYMBOL = "€";

    public static void main(String[] args) {

    BasicConfigurator.configure();

    readIcons();

    boolean shuffled = true;
    getCards(shuffled);

    Player playerOne = new Player("Player One", 10000.00);
    playerOne.getCardFromDealer(getTopCard());
    playerOne.getCardFromDealer(getTopCard());
    if (playerOne.betAmount(100.00) == false) {System.out.println("WARNING: Player tried to bet " + CURRENCY_SYMBOL + "100.00, whilst the balance available is " + CURRENCY_SYMBOL + playerOne.getBalance());}


    Player playerTwo = new Player("Player Two", 10000.0);
    playerTwo.getCardFromDealer(getTopCard());
    playerTwo.getCardFromDealer(getTopCard());
    Double _amountforPlayerTwo = 10000.0;
    if (playerTwo.betAmount(_amountforPlayerTwo) == false) {System.out.println("WARNING: Player tried to bet " + CURRENCY_SYMBOL + _amountforPlayerTwo + ", whilst the balance available is " + CURRENCY_SYMBOL + playerTwo.getBalance());}

    Player playerThree = new Player("Player Three", 10000.0);
    playerThree.getCardFromDealer(getTopCard());
    playerThree.getCardFromDealer(getTopCard());
    if (playerThree.betAmount(100.00) == false) {System.out.println("WARNING: Player tried to bet " + CURRENCY_SYMBOL + "100.00, whilst the balance available is " + CURRENCY_SYMBOL + playerThree.getBalance());}

    Player playerFour = new Player("Player Four", 10000.0);
    playerFour.getCardFromDealer(getTopCard());
    playerFour.getCardFromDealer(getTopCard());
    if (playerFour.betAmount(100.00) == false) {System.out.println("WARNING: Player tried to bet " + CURRENCY_SYMBOL + "100.00, whilst the balance available is " + CURRENCY_SYMBOL + playerFour.getBalance());}

    Player playerFive = new Player("Player Five", 10000.0);
    playerFive.getCardFromDealer(getTopCard());
    playerFive.getCardFromDealer(getTopCard());
    if (playerFive.betAmount(100.00) == false) {System.out.println("WARNING: Player tried to bet " + CURRENCY_SYMBOL + "100.00, whilst the balance available is " + CURRENCY_SYMBOL + playerFive.getBalance());}

    for (int iBettingRounds = 0; iBettingRounds < 3; iBettingRounds++) {
        playerOne.getCardFromDealer(getTopCard());
        playerOne.betAmount(100.00);

        playerTwo.getCardFromDealer(getTopCard());
        playerTwo.betAmount(100.00);

        playerThree.getCardFromDealer(getTopCard());
        playerThree.betAmount(100.00);

        playerFour.getCardFromDealer(getTopCard());
        playerFour.betAmount(100.00);

        playerFive.getCardFromDealer(getTopCard());
        playerFive.betAmount(100.00);
    }

    System.out.println(playerOne);
    System.out.println(playerTwo);
    System.out.println(playerThree);
    System.out.println(playerFour);
    System.out.println(playerFive);

    System.out.println("Cards held by dealer:");
    for (int i = 0; i < deckOfCards.size(); i++) { System.out.println((i + 1) +"." + deckOfCards.get(i));}

    deckOfCards.trimToSize();

    ArrayList<Player> _players = new ArrayList<Player>();
    _players.add(playerOne);
    _players.add(playerTwo);
    _players.add(playerThree);
    _players.add(playerFour);
    _players.add(playerFive);
    System.out.println("And the winners are...");
    for (Player _p: getWinner(_players)) {
        System.out.println (_p + "Score: " + _p.getCurrentGameScore() + " High Score: " + _p.getHighScore());
    }

    }
    private static void getCards (boolean _shuffled) {
        short iCount = 0;
        for (short suit = 1; suit <= MAX_SUITS_IN_DECK; suit++){
            for (short rank = 1; rank <= MAX_RANK_IN_DECK; rank++) {
                deckOfCards.add(iCount, new Card(suit, rank));
                iCount++;
            }}

        if (_shuffled == true){Collections.shuffle(deckOfCards, new Random());}

    }

    private static Card getTopCard() {
        Card _cardRemoved = deckOfCards.get(1);
        deckOfCards.remove(1);
        return _cardRemoved;
    }

    private static void readIcons(){

        String _filename;

        //read icons
        Image _image = null;
        File _file = null;
        InputStream _is = null;
        for (int i = 1; i < MAX_CARDS_IN_DECK + 1; i++) {
        try {

            /* Security information: filenames should not be altered manually by an Administrator, and,
             should be available within the same directory where the source code runs. */

                if (i < 10) {_filename = "0" + Integer.toString(i);}
                else {_filename = Integer.toString(i);}

                String _temp = _filename;
                _filename = _temp + ".GIF";

                //TODO: Relative path might change when implementing?
                _filename = System.getProperty("user.dir") + "\\img\\" + _filename;

            _file = new File(_filename);

            //read from an input stream
            _is = new BufferedInputStream (new FileInputStream(_filename));

            _image = ImageIO.read(_is);
            if (_file.exists()) {
            CardIcons.add(_image);
            //_log.debug(_filename + " loaded.");
            }
        }
        catch (IOException e) { _log.debug(e.getMessage()); }
        }
    }

    private static byte[] countCardsByRank (ArrayList<Card> _cardsAtHand) {
        byte _cardsByRank[] = new byte[MAX_RANK_IN_DECK];
        for (Card _card : _cardsAtHand) {
       
            _cardsByRank[_card.getRank().ordinal()] += (byte) _card.getRank().ordinal();
        }
        return _cardsByRank;
    }
   
    //TODO: write ranking rules
    private static ArrayList<Player> getWinner(ArrayList<Player> _players) {

        ArrayList<Player> _winners = new ArrayList<Player>();
        /*TODO: FIX: getWinner() being filled with multiple instances of Players, not just "winners".

        /*TODO:    1. Player.setRanking(_ranking) for each of the players:
        Ranking
        for hand # - highest ranking wins

        _highCardPoints = High-card ranking scores                                                                Score
        Card.Rank.Suit.ACE                                                                                        +14
        Card.Rank.Suit.KING                                                                                        +13
        Card.Rank.Suit.QUEEN                                                                                    +12
        Card.Rank.Suit.JACK                                                                                        +11
        Card.Rank.Suit.TEN                                                                                        +10
        Card.Rank.Suit.NINE                                                                                        +9
        Card.Rank.Suit.EIGHT                                                                                    +8
        Card.Rank.Suit.SEVEN                                                                                    +7
        Card.Rank.Suit.SIX                                                                                        +6
        Card.Rank.Suit.FIVE                                                                                        +5
        Card.Rank.Suit.FOUR                                                                                        +4
        Card.Rank.Suit.THREE                                                                                    +3
        Card.Rank.Suit.TWO                                                                                        +2

        _handRanking = Scores by hand ranking
        ----------------------
        1.         Straight flush.  Five cards in sequence all of the same suit.                                    *1000000000
        2.         Four of a kind.  Four cards of the same rank i.e. two pairs.                                    *100000000
        3.        Full house.         Three cards of the same rank, and, a pair of cards with the same rank.            *10000000
        4.        Flush.             Five cards of the same suit.                                                    *1000000
        5.        Straight.         Five cards in sequence, not necessarily of the same suit.                        *100000
        6.         Three of a kind. Three cards of the same rank.                                                    *10000
        7.        Two pair.        Two pairs of cards, each having the same rank.  Higher ranks win.                *1000
        8.        One pair.        One pair of cards with the same rank.                                            *100
        9.      High card.        Cards in order of their rank.                                                     *10


        Higher cards get higher points.
        Further information at http://en.wikipedia.org/wiki/Poker_hands.
        */

        /*TODO: If two or more players have equal high ranking, then players get to split the pot, hence, add both players to the winning
                ArrayList and return the ArrayList.
        */

        int _suitCount = 0;
        int _rankCount = 0;
        ArrayList<Card> _cardsAtHand = new ArrayList<Card>();
        long _highScore = 0;

        //scores will be in the same order as _players
        long _handRanking[] = new long[_players.size()];
        int _highCardPoints[] = new int[_players.size()];
        long _totalScore[] = new long[_players.size()];

        for (Player _p : _players) {
            boolean _rankingFound = false;

            for (int iPlayer = 0; iPlayer < _players.size(); iPlayer++) {
            _cardsAtHand = _players.get(iPlayer).getCardsHeld();

            /* Straight flush */
            for (Card _card: _cardsAtHand) {

                _suitCount += _card.getSuit().ordinal();

                switch (_card.getRank()) {
                    case ACE     :    {_rankCount += Card.Rank.ACE.ordinal();
                                     _highCardPoints[iPlayer] += 14;
                                     break; }
                    case KING     :    {_rankCount += Card.Rank.KING.ordinal();
                                    _highCardPoints[iPlayer] += 13;
                                    break;}
                    case QUEEN    :    {_rankCount += Card.Rank.QUEEN.ordinal();
                                    _highCardPoints[iPlayer] +=12;
                                    break;}
                    case JACK    :    {_rankCount += Card.Rank.JACK.ordinal();
                                    _highCardPoints[iPlayer] += 11;
                                    break;}
                    case TEN    :    {_rankCount += Card.Rank.TEN.ordinal();
                                    _highCardPoints[iPlayer] += 10;
                                    break;}
                    case NINE    :    {_rankCount += Card.Rank.NINE.ordinal();
                                    _highCardPoints[iPlayer] += 9;
                                    break;}
                    case EIGHT    :    {_rankCount += Card.Rank.EIGHT.ordinal();
                                    _highCardPoints[iPlayer] += 8;
                                    break;}
                    case SEVEN  :     {_rankCount += Card.Rank.SEVEN.ordinal();
                                    _highCardPoints[iPlayer] += 7;
                                    break;}
                    case SIX     :    {_rankCount += Card.Rank.SIX.ordinal();
                                    _highCardPoints[iPlayer] += 6;
                                    break;}
                    case FIVE    :    {_rankCount += Card.Rank.FIVE.ordinal();
                                    _highCardPoints[iPlayer] += 5;
                                    break;}
                    case FOUR    :    {_rankCount += Card.Rank.FOUR.ordinal();
                                    _highCardPoints[iPlayer] += 4;
                                    break;}
                    case THREE    :    {_rankCount += Card.Rank.THREE.ordinal();
                                    _highCardPoints[iPlayer] += 3;
                                    break;}
                    case TWO    :    {_rankCount += Card.Rank.TWO.ordinal();
                                    _highCardPoints[iPlayer] += 2;
                                    break;}
                    default        :    break;
                }
            }
            /* all hands must be from the same suit, hence, the total points must be the squares of the Card.Suit.<RANK>.ordinal() values */
            //TODO: FIX - not working as expected.
            if (!(_suitCount == 0 || _suitCount == 5 || _suitCount == 10 || _suitCount == 15)) {
                _handRanking[iPlayer] = 0;
                _highCardPoints [iPlayer]= 0; }

                else if ( (_rankCount >= 10) && (_rankCount <=50) && ((_rankCount % 5) == 0) )    {
                    _rankingFound = true;
                    _handRanking[iPlayer] = 1000000000;
                    _winners.add(_p);

                    if (_highCardPoints[iPlayer] == 60)  _log.debug("Royal flush" + _p);
                    else _log.debug("Straight flush " + _p);}

            if (!_rankingFound) {
                /* 2. Four of a kind*/

                for (Card _card : _cardsAtHand) {
                    _rankCount += _card.getRank().ordinal();
                }

                if ((_rankCount > 0) && (_rankCount < 48) && (_rankCount % 4 == 0))  {
                    _rankingFound = true;
                    _handRanking[iPlayer] = 100000000;
                    _log.debug("Four of a kind " + _p);
                }}

            if (!_rankingFound) {
                /* 3. Full house */
                byte[] _cardsByRank = countCardsByRank(_cardsAtHand);
               
                boolean _foundThreeOfARank = false;
                boolean _foundPairOfARank = false;
                //TODO: FIX ArrayIndexOutOfBoundsException
                for (byte i : _cardsByRank) {
                    if (_cardsByRank[i]==3) _foundThreeOfARank = true;
                }
                for (byte i : _cardsByRank) {
                    if (_cardsByRank[i]==2) _foundPairOfARank = true;
                }
               
                if (_foundThreeOfARank && _foundPairOfARank) _rankingFound = true;
                _handRanking[iPlayer] = 10000000;
                _log.debug("Full house " + _p);
            }

            if (!_rankingFound) {
                /* 4. Flush */
            }

            if (!_rankingFound) {
                /* 5. Straight */
            }

            if (!_rankingFound) {
                /* 6. Three of a kind */
            }

            if (!_rankingFound) {
                /* 7. Two pair */
            }

            if (!_rankingFound) {
                /* 8. One pair */
            }

            if (!_rankingFound) {
                /* 9. High cards */
            }

            if (!_rankingFound) {
                /* dummy - TODO: delete*/
                _highScore = 0;

            }
        _totalScore[iPlayer] = _highCardPoints[iPlayer] * _handRanking[iPlayer];
        _p.setCurrentGameScore(_totalScore[iPlayer]);

        //read high scores
        for (Player _playersWhoScored: _players) {
            if (_highScore < _playersWhoScored.getCurrentGameScore()) {_highScore = _totalScore[iPlayer];}
            iPlayer++;
        }

        }}

        //set winners are...
        short _iPlayer = 0;
        for (Player _playersWhoScored: _players ) {
            if (_playersWhoScored.getCurrentGameScore() == _highScore) {_winners.add(_playersWhoScored);}
            _iPlayer++;
        }
        _winners.trimToSize();
        return _winners;
    }

   

    private static ArrayList<Image> CardIcons = new ArrayList<Image>();
    private static ArrayList<Card> deckOfCards = new ArrayList<Card>();
    private static final Logger _log = Logger.getLogger(Poker.class);


    /* References
     * ----------
     * Texas Hold'em rules are used throughout the game.
     * Information about poker at http://en.wikipedia.org/wiki/Poker.
     * List of poker hands at http://en.wikipedia.org/wiki/Poker_hands.
     * Rules for Texas Hold'Em at http://en.wikipedia.org/wiki/Texas_hold_'em.  This will be implemented at a later stage.
     * Steve Badger, How to Play Poker at http://www.playwinningpoker.com/articles/how-to-play-poker.
     * Graphics to be implemented at a later stage.
     */
}

ETC Business Planning - Importing Accessories From Indonesia (Draft) by Jon C.

You can help a brother pay University Fees...

You may credit IBAN MT64APSB77046002349520000853602 or send cash/cheque by post to Jonathan Camilleri, 33, L. Casolani street, Birkirkara BKR4535, Malta, Europa

ASP.NET...writing my first blog

Having read Scott Mitchell's readings, I wrote a blog, which is based on a simplistic style.  Here's the .aspx page for About.aspx.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="About.aspx.cs" Inherits="About" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
    <title>@Jon's</title>
</head>
<body>
 <h1>@Jon's <img src="images/sofa.jpg" alt="logo"/> </h1>
 <div style="float:left;width:122px">
        <p style="width: 122px; height: 663px; margin-top: 0px; margin-right: 0px;">
        <a href="About.aspx">About me</a> <br />
        <a href="Diary.aspx">My diary</a> <br />
        <a href="Articles.aspx">Articles</a> <br />
        <a href="Bookmarks.aspx">My bookmarks</a> <br />
        <a href="Promotions.aspx">Promotions</a> <br />
        <a href="Resume.aspx">My resume</a> <br />
        <a href="Warez.aspx">Filesharing</a> <br />
        </p>
 </div>
<p><img src="images/jon.jpg" alt="Jon" align="left"/> Name's Jon, I was born on 15th January 1980.  I was raised in a <a target="_top" href="http://www.myheritageimages.com/V/storage/site51171941/files/00/00/06/000006_984608e039dab4ytlrt205.pdf">family of 4</a> and still live with my parents and a younger sister. in <a target="_top" href="http://www.google.co.uk/maps?f=q&source=s_q&hl=en&q=&vps=1&jsv=265c&sll=35.896667,14.4625&sspn=0.037615,0.077162&ie=UTF8&geocode=FVu9IwIdJK7cAA&split=0">Birkirkara </a>, <a target="_top" href="http://en.wikipedia.org/wiki/Malta">Malta</a>.
I've always enjoyed freedom and fun throughout most of my youth, with the exception of a 2 year relationship, and I still consider myself young at heart... </body></p>
<p>Since I was focused on a career, I did not really bother about relationships as much, because business is a jungle, and, I was trained to think that you're either gonna live on the edge or you will get surpassed by competition.  Unfortunately this happened following a <a target="_top" href="http://www.guardian.co.uk/business/recession">global recession</a>. </p>
<p>When it comes to fun, I daresay that I'm pretty cool and spontaneous, my friends would say I'm like Dean Martin, or Steve Mc Queen I guess :)  I'm simplistic, an extrovert (speak my mind), easy going, and, take life with a pinch of salt.</p>
<p>When it comes to working I'm detail oriented, procedural and, a hell of a perfectionist, although tend to delegate, prioritize and sometimes delay what I perceive as "low priority items".  Who doesn't anyway..be honest? :) </p>
<p>I enjoy listening to a variety of music including Goa Trance, Psychadelic Trance, Rock, Metal (80s/90s...); currently I listen to stuff on <a target="_top" href="http://www.mtv.co.uk/">MTV</a> and <a target="_top" href="http://www.bay.com.mt/page.asp?p=17005&l=1">my favorite radio station</a>.  In addition to my interest in music, I am a bit of a bookworm, although I seldom read fiction.  I'm more fascinated by technical, scientific, and, academic topics, business news and current affairs. I go to gym to keep fit as well, although I tend to procrastinate because physical activities are not my favourite hobbies. I enjoy watching scientific <a target="_top" href="http://dsc.discovery.com">documentaries</a> and music videos on TV.</p>
<p>More about my professional life <a target="_top" href="http://www.linkedin.com/in/jonathancamilleri"> here</a>.  Up to a few years ago I was more focused on building a career, however since my career seemed to have taken a wrong turn, I've seen my salary go down by 1.6 times (2008), and, that was a bad shot to my personal lifestyle. </p>
<p>How can you contact me?
   You can peep my profile at <a target="_top" href="http://www.facebook.com/camilleri.jon">facebook</a>...like? :)  We can also chat with <a target="_top" href="msnim:chat?contact=slyth@hotmail.com ">MSN</a>.  Scammers and spammers will be, of course reported to <a target="_top" href="http://www.interpol.int">the authorities</a>.</p>
</body>
</html>

public class Invoice { public int InvoiceNumber { get { return 2; } set { } } } Other code behind form that sits behind desktop applications, this time for keeping membership details, although I have a slight technical problem figuring out how to bind an image to an SQL Server native type this far: using System; using System.IO; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Reflection; using System.Data.SqlClient; using System.Diagnostics; namespace TestUI { public partial class frmUserDetails : Form { public frmUserDetails() { InitializeComponent(); } private void label1_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { } private void btnSave_Click(object sender, EventArgs e) { try { string connectionString = TestUI.Properties.Settings.Default.UserStoreConnectionString; using (SqlConnection con = new SqlConnection(connectionString)) { bool userExists = false; con.Open(); if (userExists) { string commandText = "UPDATE [UserStore].[dbo].[user] SET Name = @Name, Surname = @Surname, @Userimage WHERE UserID = @UserID;"; SqlCommand command = new SqlCommand(commandText, con); command.Parameters.AddWithValue("@UserId", 0); MemoryStream _stream = new MemoryStream(); pcbMember.Image.Save(_stream, System.Drawing.Imaging.ImageFormat.Jpeg); byte[] _pic = _stream.ToArray(); command.Parameters.AddWithValue("@UserImage", _pic); if (txtName.Text != null) { command.Parameters.AddWithValue("@Name", txtName.Text); } if (txtSurname.Text != null) { command.Parameters.AddWithValue("@Surname", txtSurname.Text); } command.ExecuteNonQuery(); Debug.WriteLine("Existing user saved."); } else if (!userExists) { int _count = 0; string commandText = "INSERT INTO [UserStore].[dbo].[user] VALUES (Name = @Name, Surname = @Surname, UserPicture = @UserPicture, UserID = @UserID);"; SqlCommand command = new SqlCommand(commandText, con); command.Parameters.AddWithValue("@UserID", _count++); command.Parameters.AddWithValue("@Name", txtName.Text); command.Parameters.AddWithValue("@Surname", txtSurname.Text); command.Parameters.AddWithValue("@UserPicture", pcbMember.Image); command.ExecuteNonQuery(); Debug.WriteLine("New user saved."); con.Close(); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.Source); Debug.WriteLine(ex.StackTrace); } finally { } } private void createFields() { } public object DataSource; private void pcbMember_MouseDoubleClick(object sender, MouseEventArgs e) { OpenFileDialog op = new OpenFileDialog(); DialogResult result = op.ShowDialog(); } private void pcbMember_Click(object sender, EventArgs e) { } } }