May 18, 2012

Accessing Private Member From Other Class In Java

Core Java
Many people wonder if a private field can be accessed from other completely strange class. The words that first come out from the mouth many, if asked whether access to such private members is possible, is: 'impossible!' or say the least: 'you can't do that!'. We are not talking about using accessors here, the usual getter/setter methods are completely excluded. The truth about that is, gaining access to private members from an alien class is not only possible, but real.

May 15, 2012

How To Shutdown PC With Java Code

Java Runtime
In this tutorial I create a program that shuts the computer down after 10 seconds, which gives you chance to abort the shutdown sequence. I used Java Runtime to execute the command line switch, and the second parameter for aborting the first command sequence. Java Runtime is key to making that possible. You can also pass other commands as parameter to start other Windows programs.

Jul 26, 2011

Dealing With Files In PHP

In php and of course othe languages files are the directories or paths to a given data. file() —> Reads entire file into an array. for example:
array file(string $filename[,int $flags = 0 [,resource $context ]] );
$domain = file('http://www.example.com/');
You can iterate through a given directory read and store an array of data into a variable.

Jun 6, 2011

A Simple Time-Left PHP Code

PHP time left
function time_left($integer)
{ 

/*Returns a string of the amount of time the integer in seconds.

 $timeleft=time_left(86400); 

 $timeleft='1 day';

Will not return anything higher than weeks. False if $integer=0 or fails.