hanY

hanY

(1 comments, 37 posts)

Software developer at Huawei
Interested in Developing Games, Mobile applications

Home page: http://www.namozag.com

Yahoo Messenger: hanycq

Jabber/GTalk: hanylink@gmail.com

Posts by hanY

Singleton Design pattern

0

Singleton is a design pattern used to limit the number of a class instances to one (or may be more)
and restricting any user wants a new object to use the already constructed object eliminating multiple copies of the same object
(more…)

Hello Servlet

0

what’s Servelet ?
Servlet is the type of class used to make a dynamic web page using java code

how we can make a servlet
a simple servlet class can be done by implementing the Servlet interface
but usually we use the servlet in an HTTP conection to make an HTTP response to the user in a form of HTML page, in this case it’s better to use HttpServlet abstract class
(more…)

Hello Struts

0

Struts is a java framework for web implements the MVC design pattern.
Struts facilitates the work of page redirection, form submitting, data validation and much more.

a common scenario is a login page
login.jsp that contains two inputs user name and password
a simple java class/bean that maps this information ( has two properties username and password)
an action servlet that receives the login page data and put them into the bean
then make a specific action (Logining) after that redirecting to another page (success page or return to the login page if error happened)
(more…)

Observer design pattern

0

Suppose we’ve a system like thermometer that measures the room temperature

public class Thermometer {
    
    private int temp = 0;
    
    public void setTemp(int temp) {
        this.temp = temp;
	System.out.println("Subject | temp = " + temp);
    }

    public int getTemp() {
        return temp;
    }
    
}

We want to get notified when every change in temperature happens.
Suppose that many other systems wants to be notified and these systems may varies and we want to make a good solution to handle this without the need to modify our code multiple times to handle new added systems
(more…)

Multithreading

0

The concept of multithreading is similar to the concept of multitasking

Operating systems allows multiple processes to run on the same time like word and paint and calc

We want the same behavior in the scope of a single process/java application, we want to be able to launch multiple functions at the same time, this concept is called multithreading, and every bunch of code that runs in parallel with another is called to be run on a thread.

We can make a simple thread in only 3 steps

  1. Extending Thread class
  2. Overriding run method
  3. Call start method to start the thread

(more…)

Building simple Data Access Layer

0

The aim of this tutorial is to manage the access of a table in database from separate layer written in java, this layer usually called Data Access Layer (DAL)
this layer consists of A simple class/POJO/Bean called Data Transfer Object(DTO) this object is just a simple mapping to the table, every column in the table would be a member variable in the class.

our aim is to order this layer to create, modify, delete or search for an entity Using simple java objects rather than dialing with SQL statements and Database issues.

Database Creation

We want to create a simple table for users, we may create it using these fields

  • id
  • name
  • password
  • age

(more…)

Javascript form validation

0

Client side validation is so important
by preventing the user from submitting wrong data into the server, it would be better for the server not receiving invalid data and it’s better for the user not to wait until the page reloads tells him that the data is incorrect.

some examples we may check for

  • Required
  • Length
  • Minimum/Maximum (numerical input)
  • Pattern (E-mail)

(more…)

Menus

0
Action bar

Action bar

There are two types of Android menus

  • Options menu
    the menu that appears when you press the menu button
    this type of menus is binded to the activity (Every activity can have one options menu)
  • Context menu
    the menu when you do a long press on a view (like Text view or list item)
    this type of menus is binded to the view (Every view can have one context menu)

(more…)

Android Location APIs

0

Obtaining location becomes an important feature of today’s applications.
We can get location via two providers

  • GPS Location Provider

    • Obtain user location from satellite
    • More accurate
    • Only works outdoors
    • Consumes battery power
    • Takes much time to get the location
  • Network Location Provider

    • Obtain user location from Cell tower and wifi signals
    • Works indoors, outdoors
    • Responds faster than GPS
    • Consumed less power

(more…)

One to One Chat using sockets

0

Moving from the article Hello TCP sockets

We want to make a continuous one-to-one chat between two nodes
the two nodes at the beginning would be client and server
after connection establishment they should act similar as two nodes
(more…)

hanY's RSS Feed
Go to Top