Sharing With Passion

September 10, 2012

Posted by Sabar Santoso in , | September 10, 2012 No comments
JavaFX is a software technology that lets you create and deliver Rich Internet Applications (RIAs) with media and content across a wide variety of platforms and devices.

The language was originally called F3 (Form Follows Function) and was developed primarily by Chris Oliver, now at Sun Microsystems. The name was changed to JavaFX in 2007.

On Java platforms, JavaFX is a compiled, statically typed, declarative scripting language. The language offers automatic data binding, triggers, animation, and an expression syntax where code blocks yield values. Sequences, function types, and inferred types make JavaFX a concise scripting language. Developers can use objectoriented JavaFX features to simplify complexity and handle errors with Java-like exceptions. JavaFX also lets you easily access the complete Java API, which includes an enormous number of third-party Java libraries.

Figure 1.1 is the big picture for JavaFX. This block diagram shows the various pieces you can leverage when creating JavaFX applications. As the diagram shows, there are extensions for three environments: Desktop, Mobile and TV. All three environments support the common API (labeled Common Elements in Figure 1.1). As of this writing, the runtime for the JavaFX TV environment does not yet exist. There is a runtime for the JavaFX mobile environment, which supports the common API only.


On the desktop, JavaFX runs on Windows XP, Vista, and Mac OS. Linux support is forthcoming (as of this writing). JavaFX is also capable of running on Android, Windows Mobile, and other mobile operating systems.

The JavaFX platform release currently includes three major components : JavaFX SDK, NetBeans IDE and JavaFX Production Suite.

JavaFX SDK
The JavaFX SDK (Software Development Kit) includes the JavaFX compiler, runtime tools, graphics, media, and web services. It also includes libraries that let you create RIAs (Rich Internet Applications) for desktop, browser, and mobile platforms.

NetBeans IDE
NetBeans is a sophisticated IDE (Integrated Development Environment) that lets you build, preview, and debug JavaFX applications. The code editor supports JavaFX syntax checking, code completion, hyperlinked documentation, and other developerfriendly features. To decrease development time, the editor offers drag-and-drop from palettes of GUI controls, event handlers, transformations, effects, and animation. For Mobile applications, NetBeans also supports a Mobile emulator to simulate applications running on mobile devices.

Currently, JavaFX is a plug-in component for NetBeans. A community-supported plug-in for Eclipse IDE users is also available.

JavaFX Production Suite
The JavaFX Production Suite is a set of tools and plug-ins to help designers export JavaFX graphics from third-party applications (Adobe Illustrator and Photoshop).

Using the JavaFX Graphics Viewer, you can preview how graphics will render when you deploy to desktop and mobile environments. An SVG (Scalable Vector Graphics) conversion tool lets you convert SVG files to JavaFX format.

To access the JavaFX downloads, go to
http://java.sun.com/javafx/downloads. You will see downloads for the following components.
• JavaFX SDK
• NetBeans for JavaFX
• JavaFX Production Suite
Follow the instructions on the web site to download and install the component you want. You can download and install NetBeans with JavaFX together or you can install the JavaFX plug-in separately if you already have NetBeans installed.

Here are some other valuable links for JavaFX.
• http://java.sun.com/javafx—Main site for JavaFX
• http://javafx.com—Samples and demos for JavaFX
• http://java.sun.com/javafx/num/docs/api—JavaFX documentation (version num)
• http://www.netbeans.org—NetBeans site
• https://openjfx-compiler.dev.java.net—OpenJFX Compiler Project

Once you have NetBeans and JavaFX installed, you are ready to try out JavaFX.

September 08, 2012

Posted by Sabar Santoso in , , , , | September 08, 2012 No comments

As you may have realized, the PHP language revolves around the central theme of practicality. PHP is about providing the programmer with the necessary tools to get the job done in a quick and efficient fashion. Five important characteristics make PHP’s practical nature possible:
• Familiarity
• Simplicity
• Efficiency
• Security
• Flexibility
One final characteristic makes PHP particularly interesting: it’s free!

Familiarity
Programmers from many backgrounds will find themselves already accustomed to the PHP language. Many of the language’s constructs are borrowed from C and Perl, and in many cases PHP code is almost indistinguishable from that found in the typical C or Pascal program. This minimizes the learning curve considerably.

Simplicity
A PHP script can consist of 10,000 lines or one line: whatever you need to get the job done. There is no need to include libraries, special compilation directives, or anything of the sort. The PHP engine simply begins executing the code after the first escape sequence (). If the code is syntactically correct, it will be executed exactly as it is displayed.

Efficiency
Efficiency is an extremely important consideration for working in a multiuser environment such as the WWW. PHP 4.0 introduced resource allocation mechanisms and more pronounced support for object-oriented programming, in addition to session management features. Reference counting has also been introduced in the latest version, eliminating unnecessary memory allocation.

Security
PHP provides developers and administrators with a flexible and efficient set of security safeguards. These safeguards can be divided into two frames of reference: system level and application level.

- System-Level Security Safeguards :
PHP furnishes a number of security mechanisms that administrators can manipulate, providing for the maximum amount of freedom and security when PHP is properly configured. PHP can be run in what is known as safe mode, which can limit users’ attempts to exploit the PHP implementation in many important ways.
Limits can also be placed on maximum execution time and memory usage, which if not controlled can have adverse affects on server performance. Much as with a cgi-bin folder, administrators can also place restrictions on the locations in which users can view and execute PHP scripts and use PHP scripts to view guarded server information, such as the passwd file.

- Application-Level Security Safeguards :
Several trusted data encryption options are supported in PHP’s predefined function set. PHP is also compatible with many third-party applications, allowing for easy-integration with secure ecommerce technologies. Another advantage is that the PHP source code is not viewable through the browser because the script is completely parsed before it is sent back to the requesting user. This benefit of PHP’s server-side architecture prevents the loss of creative scripts to users at least knowledgeable enough to execute a ‘View Source’. Security is such an important issue that this book contains an entire chapter on the subject.

Flexibility
Because PHP is an embedded language, it is extremely flexible towards meeting the needs of the developer. Although PHP is generally touted as being used in conjunction solely with HTML, it can also be integrated alongside languages like JavaScript, WML, XML, and many others. Additionally, as with most other mainstream languages, isely planned PHP applications can be easily expanded as needed.
Browser dependency is not an issue because PHP scripts are compiled entirely on the server side before being sent to the user. In fact, PHP scripts can be sent to just about any kind of device containing a browser, including cell phones, personal digital assistant (PDA) devices, pagers, laptops, not to mention the traditional PC. People who want to develop shell-based applications can also execute PHP from the command line.

Since PHP contains no server-specific code, users are not limited to a specific and perhaps unfamiliar Web server. Apache, Microsoft IIs, Netscape Enterprise Server, Stronghold, and Zeus are all fair game for PHP’s server integration. Because of the various platforms that these servers operate on, PHP is largely platform independent, available for such platforms as UNIX, Solaris, FreeBSD, and Windows 95/98/NT.
Finally, PHP offers access to external components, such as Enterprise Java Beans and Win32 COM objects. These newly added features put PHP in the big league, truly enabling developers to scale PHP projects upward and outward as need be. An Introduction to PHP 7

Free
The open source development strategy has gained considerable notoriety in the software industry. The prospect of releasing source code to the masses has resulted in undeniably positive outcomes for many projects, perhaps most notably Linux, although the success of the Apache project has certainly been a major contributor in proving the validity of the open source ideal. The same holds true for the developmental history of PHP, as users worldwide have been a huge factor in the advancement of the PHP project.

PHP’s embracing of this open source strategy result in great performance gains for users, and the code is available free of charge. Additionally, an extremely receptive user community numbering in the thousands acts as “customer support,” providing answers to even the most arcane questions in popular online discussion groups.

Posted by Sabar Santoso in | September 08, 2012 No comments
















When you talk about viewing a PHP page, you are referring to a Web page. When you go to a Web page a series of events occur. These events start at the client with the request, go to a server to get the page, and end back at the client for viewing. Take a look at these events as listed below,

  1. The client computer connects to the Internet.
  2. The client opens a Web browser.
  3. The client requests a page from a Web site. When you do this, a message is sent over the Internet to a name server, and the name server then directs you to the server that hosts the Web page.
  4. The server that hosts the Web page receives your request and retrieves the requested page.
  5. If the page is a scripted page, such as a PHP page, the server compiles the page through a just-in-time compiler that generates HTML.
  6. The server then transmits the completed HTML back to the client (the browser).
  7. The Web browser receives the HTML and displays an interpretation of the page.
All of that is fairly straightforward; it’s almost like magic. There is only one catch—from browser to browser, your Web pages are not displayed identically. That is why we say the browser interprets the page. For instance, when Internet Explorer receives a page that includes nested tables, both with heights of 100%, Internet Explorer interprets the height
of the inner table relative to the height of the outer table. However, in Netscape Navigator, the browser will make both the inner and the outer table the height of the browser window. This poses a problem if you want a page to look the same in multiple browsers.

It gets worse when you switch between OS platforms. Let’s say you have a page of text, and for some reason the text determines the layout of the page, and you get it looking perfect on a Windows platform. When you then view the page on a Macintosh, the font is rendered very differently. The kerning (the space between characters) and the leading (the space between lines) is totally different. In fact, the font itself might be changed to a different font altogether. Style sheets can mitigate some of these problems, but you’ll still run into layout issues. The point is that what the browser displays is not a photograph, so if you want your games to work on several different browsers you have to be careful about the types of elements (text and graphics) you use.


The Web Server

Now that you have a general understanding of how a client/server relationship works you can take a closer look at the heart of the beast: the Web server itself. A Web server runs what is called an HTTP daemon. This daemon handles all of the requests received on a particular port. The HTTP daemon will listen to two ports—port 80 and port 443. Port 80 is the general Web port (http://). Port 443 is the standard for secure socket (https://). A Web server is also said to be stateless. That is to say, no permanent connection is maintained between the client and the server. This is extremely important to understand. It will make debugging or solving certain problems much easier, and, more important, this concept will completely change the way you design your games. It won’t be as easy as making a library of functions or a simple engine and calling functions. You will need to develop a way to keep state.

Think about that for a minute. What does that really mean? Well, it means that every time a particular event happens in your PHP game—e.g., the user enters coordinates and clicks the fire button—the Web browser will reopen the connection to the server, resend the request to the server, and the server will then process the page and send it back. Now you need to reload all of your variables/states and update the page appropriately. Otherwise the whole game would start over, and that would be no fun. Don’t get me wrong—there are some client-side scripting languages, such as JavaScript, that you can use for clientside event processing. However, that is beyond the scope of this book, which focuses on how to make games with PHP. So how exactly do you do this?
Posted by Sabar Santoso in | September 08, 2012 No comments

The iPhone is one of the most distinctive game platforms currently available. The touch screen, integration with iTunes, programming in Objective-C, low development cost, and ease of publishing all make for a very strange but promising new development opportunity. As the newest kid on the block, the iPhone instantly captured a noticeable portion of the mobile phone market and inspired a wave of copycat devices by makers such as Motorola, Samsung, and LG.
As a programmer, you might not be impressed with sales figures and market shares, but you should be interested in the viability of the iPhone as a whole. If no one owns an iPhone, no one will buy the games you make for it. The good news is that even in the face of the 2009 economic downturn, iPhones continued to sell. To get started with the iPhone, you’ll need to get a free Apple developer account. Next you’ll download the iPhone SDK on your Mac, which also contains the Xcode IDE and Interface Builder tool for laying out screens. (Apple doesn’t provide a toolkit for Windows or any other non-Mac platform.) And because the iPhone API requires you to write in Objective-C, you will need to read a primer on the language if you do not already understand it. This chapter takes you step by step through all of these tasks.

Apple Developer Account and Downloading the SDK

The first step in setting up your iPhone development environment is to register an Apple developer account. Signing up for an account is free and gives you access to Apple’s online documentation, tutorial videos, and the SDK download:
1. Go to http://developer.apple.com/iphone/.
2. Click the Register link, and then click Start Now. Choose the option to create a new Apple ID, or to log in using an Apple ID from an iTunes or App Store account.
3. Once you have registered, you can log in to the iPhone Dev Center.
4. Apple may already have emailed you a link to download the free SDK, or you may choose to download the SDK using the link from the website. Note that you should not download Xcode separately because it is included within the SDK download package (and the version of Xcode that comes with the SDK may be newer than what is otherwise available).
5. Once downloaded, install the SDK, which will make Xcode and Interface Builder accessible to you in the /Developer/Applications folder on your hard drive (you can also activate Spotlight and search for Xcode and Interface Builder to launch either application quickly).

The free developer account will allow you to build applications and run them in a simulator on your Mac. However, to load your application onto a phone, you will also need to sign up for the paid developer program. This requires a small annual fee, so even if you are a private developer, it won’t hurt your wallet too much:
1. Go to http://developer.apple.com/iphone/program/apply.html.
2. You will have two options: Standard Program and Enterprise Program. If you are writing games for the general public, you probably do not want the Enterprise Program. If you read closely, you will notice the Enterprise Program is actually for creating applications that only you and your company will use internally. If you plan to create games that will be sold via the App Store, rest assured that the Standard Program is the correct choice for you.
3. Select Enroll Now and log in if necessary.
4. You now have another choice: enroll as an individual or as a company. If you choose Individual, you will not be able to add other programmers or quality assurance members to your account, which is necessary to distribute your application to others during the development and testing process. However, if you select Company, you will be required to provide detailed information about your company.
5. Continue through the website, selecting the appropriate information, until you arrive at a screen that says “Thank you for submitting your enrollment.” Now you must wait for an email from Apple (which may take on the order of a month to arrive).
It is good to get your paid developer account enrollment going as soon as possible so that it will be available when you actually need it.

Search

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter