Archive

Archive for the ‘Theory’ Category

Link Penting Dalam Implementasi C#

Categories: C#, Theory

System.getProperties()


System.getProperties():

  • Determines the current system properties.
  • First, if there is a security manager, its checkPropertiesAccess method is called with no arguments. This may result in a security exception.
  • The current set of system properties for use by the System.getProperty(String) method is returned as a Properties object. If there is no current set of system properties, a set of system properties is first created and initialized. This set of system properties always includes values for the following keys:
  • Multiple paths in a system property value are separated by the path separator character of the platform.
  • Note that even if the security manager does not permit the getProperties operation, it may choose to permit the System.getProperty(String) operation.

Returns:

  • the system properties

Throws:

  • SecurityException – if a security manager exists and its checkPropertiesAccess method doesn’t allow access to the system properties.

Read more…

Hosts File


The hosts file is a computer file used in an operating system to map hostnames to IP addresses. This method is one of several system facilities to address network nodes on a computer network. On some operating systems, the host file content is used preferentially over other methods, such as the Domain Name System (DNS), but many systems implement name service switches to provide customization. Unlike DNS, the hosts file is under the control of the local computer’s administrator.[1]

The hosts file is a plain-text file and is traditionally named hosts.

History

The ARPANET, the predecessor of the Internet, had no distributed host name database, such as the modern Domain Name System for retrieving a host’s network node address. Each network node maintained its own map of the network nodes as needed and assigned them names that were memorable to the system’s users. There was no method for ensuring that all references to a given node on a network were using the same name, nor was there a way to read some other system’s hosts file to automatically obtain a copy.

The small size of the ARPANET made the use of hosts files practical. Network nodes typically had one address and could have many names. As individual TCP/IP computer networks gained popularity, however, the maintenance of the hosts file became a larger burden on system administrators as networks and network nodes were being added to the system with increasing frequency.

Standardization efforts, such as the format specification of the file HOSTS.TXT in RFC 952, and distribution protocols, e.g., the hostname server described in RFC 953, helped with these problems, but the centralized and monolithic nature of host files eventually necessitated the creation of the distributed Domain Name System.

Read more…

Categories: Theory

Java Primitive Data Types


The Java programming language is statically-typed, which means that all variables must first be declared before they can be used. This involves stating the variable’s type and name, as you’ve already seen:

    int gear = 1;

Doing so tells your program that a field named “gear” exists, holds numerical data, and has an initial value of “1”. A variable’s data type determines the values it may contain, plus the operations that may be performed on it. In addition to int, the Java programming language supports seven other primitive data types. A primitive type is predefined by the language and is named by a reserved keyword. Primitive values do not share state with other primitive values. The eight primitive data types supported by the Java programming language are:

  1. byte: The byte data type is an 8-bit signed two’s complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive). The byte data type can be useful for saving memory in large arrays, where the memory savings actually matters. They can also be used in place of int where their limits help to clarify your code; the fact that a variable’s range is limited can serve as a form of documentation.
  2. short: The short data type is a 16-bit signed two’s complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive). As with byte, the same guidelines apply: you can use a short to save memory in large arrays, in situations where the memory savings actually matters.
  3. int: The int data type is a 32-bit signed two’s complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive). For integral values, this data type is generally the default choice unless there is a reason (like the above) to choose something else. This data type will most likely be large enough for the numbers your program will use, but if you need a wider range of values, use long instead. Read more…
Categories: Java, Theory Tags: ,

Java Native Access


Java Native Access provides Java programs easy access to native shared libraries without using the Java Native Interface. JNA’s design aims to provide native access in a natural way with a minimum of effort. No boilerplate or generated glue code is required.

Architecture

The JNA library uses a small native library called foreign function interface library (libffi) to dynamically invoke native code. The JNA library uses native functions that allow code to load a library by name and retrieve a pointer to a function within that library, and uses libffi library to invoke it, all without static bindings, header files, or any compile phase. The developer uses a Java interface to describe functions and structures in the target native library. This makes it quite easy to take advantage of native platform features without incurring the high overhead of configuring and building JNI code.

JNA is built and tested on Mac OS X, Microsoft Windows, FreeBSD / OpenBSD, Solaris, and Linux. It is also possible to tweak and recompile the native build configurations to make it work on other platforms. For example, it is known to work on Windows Mobile, even if it is not tested for this platform by the development team.

Read more…

Categories: Java, Theory Tags:

Java Communications (Tested)


javax.comm adalah lib untuk mengirim data ke port tertentu, library ini dapat digunakan untuk keperluan:

  1. print data
  2. open cash drawer
  3. view pole display

cara memakainya:

  1. download javax.comm Setup.rar di sini
  2. extract dan jalankan batch nya
  3. import comm.jar dkk ke project anda
  4. untuk sample project download di sini
  5. untuk post yang berhubungan klik ini

beberapa informasi tambahan:

  1. untuk membuka cash drawer, kirim ascii 7 (bell)
  2. untuk membersihkan layar pole display, kirim ascii 31 (unit separator)

UPDATE 20100901 » javax.comm Setup v2.rar « UPDATE 20100901

Categories: Java, Theory Tags:
%d bloggers like this: