Sunday, April 20, 2014

Hello world application with Google Dart


Google Dart

Dart is a new programming language developed by Google, which has a similar syntax with Java and Javascript. Dart is targeted directly for the web, however, console based applications can also be written as well as it is compilable into Javascript. Google's web browser Chromium is able to run Dart codes directly but there is not an available add-on for other browsers such as Firefox and Internet Explorer. Dart SDK supports compiling Dart to Javascript, that is, any browser will run Dart code without knowing that the original code is written Dart. The community will determine whether the language will be a standard for web based application, instead using Javascript.

In this blog entry, we will show writing a basic Dart Web Application which can be considered as a "Hello World" but it is a little bit complicated. This application will create a textbox and a button. When user writes her name and after clicks the button, the program pop ups a message box.

When a new application is created in Dart Editor, you will see something like this:



Lets change the html file. Put a textbox and command button:



Clear the Dart Code:



Fill main method. Here we handle the input element using variable name. name.onclick.listen method defines
the event handler.



Complete the code


In the screen capture above, name and say are global variables and they are defined at the top of the code. They are accessable in both main() and button_click(). The body of the method button_click() is such like its counterparts written in both Java or Javascript. Lets run the code:




Have a nice read!


Thursday, April 17, 2014

Beautiful Graphics of Flightgear 3

Here is the some screen captures of my last flight on Flightgear 3.0.
Flightgear is an open source flight simulator game which is mainly compiled for Windows, Linux and Macintosh. It is free and avaliable for downloading at site Flightgear Official Web Site




























Saturday, April 12, 2014

RCaller 2.2.0 has just been released

We have just uploaded the new compiled jar file of latest Rcaller, the simple library for calling R from within Java.

We plan to clean recently reported bugs, but the most important one was having some errors about the R package Runiversal, which is required by the library for generating XML files. The basic issue underlying this problem was the package storing policy of R which depends on the user that installed the package.

In the most recent version 2.2, users do not need to pre-install the R package Runiversal. Simply add RCaller-2.2.0-SNAPSHOT.jar to your classpath and go!

The download link of the compiled library is here [Google Driver Link]

The library is tested in a pc with Ubuntu OS installed and the usual test scenarios are success in all cases. The library has not been tested on Windows machines. 

Please use the link of Google code page at http://code.google.com/p/rcaller/issues/list and enter your problems in issues part and do not hesitate to contribute our library. 

Saturday, March 8, 2014

Sending Data to MySQL Database Using PHP With Unity3D Game Engine

Hello everyone, In this article, I will share an Unity3D game engine example with you guys. We will imagine that we have got a game has been played and opened score scene. This step will be sharing platform for scores between users. At this stage score information will be taken and posted to PHP page for sending to MySQL database. For these steps, we'll need these digital materials and tools given below:
  • An empty scene in the Unity3D game engine and Main Camera
  • An JavaScript scripting file for posting data to PHP page
  • An table named highscore in the MySQL database
  • An Server that can work PHP programming language

First, we will add javascript file to Main Camera Inspector in the empty scene.

function send(data, username) {
    var form = new WWWForm();
    form.AddField("action", "send");
    form.AddField("score", data);
        form.AddField("username", username);
    var url = "http://localhost/unity/send.php";
    var w = WWW(url, form);
    yield w;
}

send(999, "phpservisi");

Codes given above send score information to send.php PHP file for saving MySQL database. WWWForm object has been created for outside connection. This object has got action attribute and send value. This value will be used in PHP file as a condition to send MySQL database. score attribute's value is going to share with other players. For that reason we need all attribute, variable and values. Url variable shows us what will we use for target POST URL information.

Just remember that you have to add this JavaScript file to Main Camera's Inspector part using Add Component.

Now, we can finally create our PHP file for saving datas to MySQL DATABASE. But first create highscore table in the MySQL: 


Let's get PHP file:

mysql_connect("localhost","username","password");
mysql_select_db("database_name");
 
if($_REQUEST['action']=="send") {
$score = $_REQUEST['score'];
$username = $_REQUEST['username'];
$query = "INSERT INTO `highscore` (username, score) VALUES ('$username', '$score')";
mysql_query($query);

From on now, we can send our score data to PHP file for saving database, when the game run. send function helps us to POST datas. username and score datas are used via JavaScript file in the Unity3D game engine. $score and $username variables came from JavaScript file as you have known. After this we just use
SQL query.



As result, we have just done sent datas to MySQL database using PHP programming language with Unity3D game engine JavaScript codes. This article will be helpful. Because if you want to create a game for muliplatform, you have to develop multiplatform.

See you guys next articles!

Saturday, January 4, 2014

How to Generate Search Engine Friendly URL - SEF LINK

Hi! I will talk about making web site optimized for search engines. SEF link stands for Search Engine Friendly words in English language. This concept makes structure of web sites better and user friendly. For example imagine that a database on your server. You want to show products from the table in the database. In general, we developers get data with field of the table and use it like id=1 URL structure. Because that is so simple. But this showing is not understandable and useful for search engines, Google, Yahoo, Yandex etc. That's the point we should get SEF links!

programming_language.php?id=1


The URL given above us POST global id variable and returns 1 value. Yes, this is functional. Because after this step, we'll just make that query given below for getting datas:

SELECT * FROM table_name WHERE id=1


But we all know that the uses of the above is suck for nowadays. For that reason, we need to get URL given below:

programming-language-php.html
php-programming-language


We have to create a .htaccess file on the server side for generating an URL for above, that goes:

Options +FollowSymLinks
RewriteEngine On
ReWriteRule (.*) programming_language.php?id=$1 [L, QSA]


.htaccess file runs programming_language.php page and gets id value as SEF structure in the (.*) statement. According to these conditions lets make a PHP file for using SEF!

$var = $_POST["id"]; //getting URL data with using POST global variable
echo $var;


When we run the PHP page as www.whateverstdioe.com/php, we can see php on the screen. Because of there is a similarity between www.whateverstdioe.com/php and www.whateverstdioe.com/id=php. See you next article!