If Linux is your main OS for web development and using XAMPP as web server, then it would be handy if working web folder to be linked to htdocs.

Here is the command to link it

to test it just type in the browser

 

Posted in Web.

An existing project in the local can be exported easily into Git client repository, in my case is Bitbucket, by following steps

  • Assumed that a login has been created, if no, then make it one :)
  • Create Repository
  • Go to folder that wanted to be placed in the repo, then issue this command

to initialize the directory under source control

  • To add existing folders/files then fire this command

Be careful of missing the dot after the add command 😀

We need to commit it by

  • Choose the “I have an existing Project” from the overview
  • Then connect your local with the remote by

  • Push the code into remote repository by

That’s the way to push the existing code into remote repository.

Hopefully, this short “How to Add Existing Project on Git Web Based Repository”

Reference

  1. Creating a Repo for existing project
Posted in Web.

In dealing with customer, the information often required to be displayed in pdf form. Fortunately, in laravel there are many ways to achieve this. One of them is by using Laravel Snappy which supports conversion text and image into pdf. In this How to Generate PDF using Snappy in Laravel 5.1 tutorial, I am gonna show you how to do that.

  • Installation

In the composer.json file, please add

that is for the 64 architecture, while for 32 just replace -amd64 toi386. Then we need to update the composer by typing

Ok, after updating it, in the ServiceProvider

need to be added in the providers array in app/config/app.php then add this alias into facades:

To publish the config-file

In the snappy.php file, we add

  • Usage

In the view, let’s create invoce.blade.php

 

and in the controller, let’s say as PdfController@generateInvoice

 

How to Generate PDF using Snappy in Laravel 5.1

Reference

  1. Laravel Snappy
Posted in Web.

The way to install composer on Xubuntu is pretty much the same as on ubuntu in general.

  • Step 1

Install the dependencies, such as curl in order to download Composer and php5-cli for installing and running it. While git is to be used by composer for downloading project dependencies. All of them can be installed with the single command as follow:

  • Step 2

To install composer globally. The command is

Here is the originial link

 

 

 

In this post, we are going to add the screens for the game. They are splash screen, menu screen and game screen.

Now our codes is growing and it is time to refactor the code into several packages. We grouped it into screens, utils and game, as their name, it is pretty much self explained.

The structure is grouped based on what they are doing. Let’s take a look on the TicTacToe class. It was extended the ApplicationAdapter, now we changed it into Game. Both ApplicationAdapter and Game implement ApplicationListener. The reason for changing to Game is that to make easy to switch among differents screens. 

And the GameScreen now looks like

Back again, now we are going to check the winner in the game either Cross or Circle player. Since we are going to add others images, we will refactor Tile class. We will let all images are inside the Image class. The images added are player 1 wins, player 2 wins and draw in png form, so we need to pack it using TexturePacker tool.

In the Tile class, as we refactored it now, it looks like

In the InputListener class, we do check who win the game by adding checkingGameState method. Here is the final code of the InputListener.java

 

Now, in the TicTacToe.java file, we are going to add methods for checking the winner and get game state such as player 1 or player 2 or draw state of the game. First we check who the winner is, then whenever the tiles matched, we mark its tile as red

 

then we check whenever the tiles matched with Cross, we return that the player with cross move as the winner, it also applies for the Circle. And if there all tiles has been occupied, the draw state will be returned.

and for checking the state of the game, we use this method

 

For showing the player status, inside the render method we add

The final of the TicTacToe.java will be

wins