Monday, April 21, 2014

Fuzuli for Java Online Interpreter

JFuzuli, Java version of Fuzuli interpreter, is now the main implementation of Fuzuli Programming Language. There is always a gossip on the efficiency of C and C++ over Java and people who starts to writing computer programs are encouraged to make a decision between them but not the Java. However, when you don't do things correctly, C and C++ are the worst programming languages in means of efficiency. Allocating memory and garbage collection are important issues and should be handled by user or other third party libraries but not by the language itself. As not being a computer scientist, my both C++ and Java codes include algorithmic errors and my Java codes run faster than the code written in C++. I can confess that is my fault! But it is not false to say that a big portion of programmers does not either write the correct code and their C++ code does not reach its maximum efficiency. Finally, our Java implementation is faster than the C++ version.

Lets try our online interpreter! Fuzuli is a little bit Lisp, Scheme, C and Java! Try it, learn it and join the development team. The link for the online interpreter is http://fuzuliproject.org/index.php?node=tryonline

The screenshot of the online algorithm is given below.


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!

Friday, August 23, 2013

Source Code Management Using Git

Hello everyone!
In this article, I want to talk about version control systems. Actually management source code using Git. We use Git on the projects in which multiple participants. Git is not the only way to use version control. There are others which are so popular; SVN, Mercurial and CVS.

In this article, we will continue using code.google.com server. You can also get started to create an account from there. In code.google.com server, there are SVN, Mercurial and Git options. So, before the processing clone your project to local machine, we define username and password to log in. Sure, you have to set Git software up first.

echo machine code.google.com >> ~/.netrc
echo login email@example.com >> ~/.netrc
echo password yourpassword >> ~/.netrc
chmod go= ~/.netrc

The code given above shows us what we code on your Git console screen. Password value is a unique key word given by code.google. Login value is also your google e-mail address. From on now, the time is adding our code.

touch test.inc
git add test.inc
git commit -m "test file has been added"
git remote add myproject https://code.google.com/p/yourprojectname
git push myproject master:master

After doing this, test.inc file has been added successfuly. Following the first push, inserting, deleting and updating will be made.

touch text.txt
git status
git rm test.inc
git status -s
git add test.txt
git commit -m "some files has been changed"
git push

The commands given above, we can see touching and text file easily. test.inc file has been removed and created text.txt file, and logged "some files has been changed" message. After all, we push all change

git pull

Take care!

Tuesday, August 20, 2013

Redirect Mobile Devices Using PHP

Hi everyone!

Today, I want to share this useful article with you. This article is going to be about redirecting mobile devices with PHP programming language. I am sure that you will need it.
If you have your own web site or something else, It means that you have members, users or followers on your site. Sure, we should remember that most of people uses mobile devices. Internet, social media, game or some applications etc, and we know that they visit your web site from their mobile devices. For that reason if we put this special feature on, we get more quality site of course.
As I said the title, I am doing this using PHP. So, let me show you:
//just define user's agents (iphone or android)
$iphoneDevice  =  strpos($_SERVER['HTTP_USER_AGENT'], "iPhone");
$androidDevice =  strpos($_SERVER['HTTP_USER_AGENT'], "Android");

if($iphoneDevice) {
    print "Your device is iphone!";
}

if($androidDevice) {
    print "Your device is android, you can download Fast Boy Game 
Application from Play Google
"; print " FAST BOY"; }

That's it. If the user use iphone, will see "Your device is iphone!" message on the screen, if use android device,
Your device is android, you can download Fast Boy Game 
Application from Play Google
FAST BOY (clickable)

If you want to put more features on your web site, for example blackberry, webos or ipod, you can use already.
$webOSDevice      = strpos($_SERVER['HTTP_USER_AGENT'], "webOS");
$BlackBerryDevice = strpos($_SERVER['HTTP_USER_AGENT'], "BlackBerry");
$ipodDevice       = strpos($_SERVER['HTTP_USER_AGENT'], "iPod");
The code given above shows us other devices and brands.
We will see you next article!

A gWidgets Example - Using windows, groups, labels, text and password boxes, buttons and events in R

A gWidget Example - Using windows, groups, labels, text and password boxes, buttons and events in R

jbytecode

August 20, 2013

In this entry, a short example for using gWidgets is given. gWidgets is a package for creating GUI’s in R.

Our example shows a GUI window with width = 400 and height = 400. Window is created by gwindow function. Components are located by rows. Rows are handled by ggroup function. ggroup must take a container as a parameter. In this logic, lbl_username and txt_username are childs of row1 which is child of gwindow.

Any text field can act as a password field by using visible¡- function.

visible(txt_password) <- FALSE

So, the object txt_password is now hiding characters by * characters. Finally, the method addHandlerClicked links an object to a function for click event. In our example, btn_login is linked to do_login function. When btn_login clicked, a message is written. The source code of the complete example is given below.

 
1# Loading required packages 
2require("gWidgets") 
3require("gWidgetstcltk") 
4 
5# main window 
6main <- gwindow(title="LoginWindow", 
7                width=400, 
8                height=400) 
9 
10# a row and components 
11row1 <- ggroup(container=main) 
12lbl_username <- glabel(container=row1, text="Username:") 
13txt_username <- gedit(container=row1) 
14 
15 
16# a row and components 
17row2 <- ggroup(container=main) 
18lbl_password <- glabel(container=row2, text="Password:") 
19txt_password <- gedit(container=row2) 
20 
21# any text in txt_password will be show with * character 
22visible(txt_password) <- FALSE 
23 
24# a row for button 
25row3 <- ggroup(container=main) 
26btn_login <- gbutton(container=row3, 
27                        text="Login") 
28btn_register <- gbutton(container=row3, 
29                        text="Register") 
30 
31 
32# Event handler for login button 
33do_login <- function(obj){ 
34        cat("Loginwith",svalue(txt_username),"\n") 
35} 
36 
37# Event handler for register button 
38do_register <- function(obj){ 
39        cat("Registerwith", svalue(txt_username),"\n") 
40} 
41 
42 
43# Registering Events 
44addHandlerClicked ( btn_login, do_login) 
45addHandlerClicked ( btn_register, do_register)



Monday, August 19, 2013

Greek Laters in LaTeX

Greek letters are essential in writing mathematical equations. Many text editors
provide equation editors but we can say the most comprehensive one is the LaTeX. The list below represents letters and corresponding LaTeX commands.
The image of this list is imported from the site http://web.ift.uib.no/Teori/KURS/WRK/TeX/sym1.html
http://web.ift.uib.no/Teori/KURS/WRK/TeX/t1.gif

A list of other special characters can be found in site http://www.noao.edu/noaoprop/help/symbols/

Getting MySQL Backup and Archiving

Hi everyone!

In this article, I am going to show you how to get MySQL backup and archive on Linux. If you use MySQL or any data base, you need backup your database and archive after. So, If you work for huge datas, you get what I mean actually.


I am sure that you heard phpmyadmin before. This is alternative with a user friendly interface for developers. You can import and export datas or all databases. If your size of data is small or medium, phpmyadmin will be perfect for this. But if the size of data increases, phpmyadmin should be doomed. That's why we need console, namely mysqldump! In short if you dont want to get 504 gateway error message, just use it :)

In this regard, let me show you some codes:
$. mysqldump --add-drop-table -h localhost -u username
-p dbname > dbname.sql
$. ls
dbname.sql

The commands given above show us getting dbname database backup and touching dbname.sql file. Using ls command, just listing files in the folder.
$. tar cvzf archive.tar.gz dbname.sql
dbname.sql
$. ls
archive.tar.gz dbname.sql

The commands given above also show us archiving dbname.sql file to archive.tar.gz archive file. After that listing files on there.
Like you have seen up here, we created a archive file. But if want to open it, just do like:
$. tar xvzf archive.tar.gz
dbname.sql

Then we need remove .sql extension file, because it's size may be huge.
$. rm *.sql
$. ls

That's it! What did we do above? We just get the database backup and archive it. After that remove the .sql file. What we've got is my backup archive.
We'll see you next article!

How To Create Scheduled Jobs With Crontab in Linux

Hi everyone!


In this article, I want to talk about cronjob. Some of us heard about this subject before. Cronjob scheduled task used in the sense of is very important for us. Because you can use it everytime you have to set some scripts will run next date. So, imagine that you have got a web site there are so many users on it. If you want to send e-mail to all your members at 02:00 am, here is the time you need cronjob!

Some hosting companies offer to manage cronjob service, but not all. Because of it is every hosting have not CPanel. Maybe you can use SSH or something else. Me, show you how to manage cronjob using SSH. In this regard, open your Unix Server using SSH, and;

vi /etc/crontab

* * * * * ( [minute] [hour] [day] [month] [day of the week] )
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── day of the week (0 – 7) (total 7 days)
│ │ │ └────────── month (1 – 12)
│ │ └─────────────── day (1 – 31)
│ └──────────────────── hour (0 – 23)
└───────────────────────── minute (0 – 59)

//test.php file
$db->query("INSERT INTO db_name.table_name(field_name) values('test')");
 
#cronjob file
* * * * * username php test.php

The code given above shows us the script that adds data to the database every minutes.
*/15 * * * * username php test.php

The code given above also shows us the script that adds data to the database every 15 minutes.
#02:00am at night
00 02 * * * username php test.php
 
#every 3 hours during the day
0 */3 * * * username php test.php
 
#each hour
0 * * * * username php test.php
 
#4 pm o'clock on the 15th day of each month
00 16 15 * * username php test.php
 
#weeks every night at 2 am
00 02 * * 1-5 username php test.php
 
#every hour every Sunday
0 * * * sun
 
#every 3 hours
0 2,5,8,11,14,17,20,23 * * * username php test.php

The codes given above shows us different cronjob examples. You can try and work for creative and usefull cronjob examples.
We'll see you guys next article!

Linear Regression Revisited



If she loves you more each and every day, by linear regression she hated you before you met.






- Your theory is wrong!
- Out, liar! 


Sunday, August 18, 2013