View RSS Feed

Recent Blogs Posts

  1. My Goal

    by , 05-20-2012 at 08:30 AM
    Some people on this site may not like how I am posting on this site and for that I am sorry. I am not very good at forums, but my goal not with just this site but with my career in computer science using networking is the follow that I have typed out...

    I want to go all the way down the Networking programming rabbit hole, I want to learn everything I can about computer science, programming, and the world inside of the internet. I have choose Java to do this because I like the syntax ...
  2. Get the info of a socket

    by , 05-16-2012 at 01:50 AM
    This program reads a list of hostnames from the command-line, attempts to open a socket to each host, and then prints to the remote host, the remote port, and the local address, and the local port.

    ** Happy Coding**

    * Get the info of a socket
    public class SocketInfo{
    public static void main(String[] args){
    for(int index=0; index<args.length; index++){ ...
  3. Using threads in Java applications

    by , 04-03-2012 at 12:57 PM
    Are you going to code a Java application that processes multiple tasks at the same time? Or is your program doing some heavy operations in the background, while the user is viewing a chart report? Such applications are referred as multi-threaded or concurrency programs. The Java platform has built-in support for threading from its very early versions, so developing multi-threaded applications in Java is not tough at all, thanks to the comprehensive and powerful threading and concurrency API. ...
    Tags: java, thread, tutorial Add / Edit Tags
  4. Simple Frame Transitions without Complex Code

    by , 03-22-2012 at 08:18 PM
    I've spent the past few days looking up Java window transitions that work with Swing components & containers (JFrame, JPanel, etc.).

    Yes, there are packages such as JavaFX which includes a Timeline & Transition framework. I also came across these:

    Project Kenai &mdash; We're More Than Just a Forge

    Filthy Rich Clients (find the Animation jar (org.jdesktop.animation))

    However, I've been impatient lately ...
  5. Multiple variables

    by , 03-10-2012 at 12:44 AM
    I'm just getting started with programming and i want it so that if the variable = 0 it doesn't show up in the equation. I made an alternate boolean variable but i need help with the rest or any other ideas

    public class App {

    public App() {
    public static void main(String[] args) {

    float speed = 2;
    boolean speed2;
    if (speed >= 0){speed2 = true;
    }else ...
  6. How to get e-mail with Java

    by , 02-29-2012 at 04:39 PM
    In the article “How to send e-mail with Java”, you are familiar with the JavaMail API on sending e-mail messages from a SMTP server. What about receiving e-mail messages? Well, that is the topic of this article. We will study how the JavaMail API exposes classes and interfaces for retrieving e-mail messages from a server, to write a utility class that checks for new messages in inbox of an e-mail account from Gmail server.

    Protocols for receiving e-mail

    There are two ...
    Mail API
  7. How to send e-mail with Java

    by , 02-29-2012 at 04:05 PM
    Sending an e-mail is a trivial task in the information world today. Billions of e-mails are sent everyday on the earth. For those who are Java developers, the ability to send e-mail from within a Java program is trivial also. However the standard Java platform does not include any e-mail functionality by default. Instead, developers have to use a separate library for the e-mail things, it is the JavaMail API. This article will guide you on how to write an email utility to send an e-mail out with ...
    Tags: java, javamail, mail, send Add / Edit Tags
    Mail API
  8. How to work zip files in Java

    by , 02-29-2012 at 09:59 AM
    he Java platform provides powerful API to work with the most popular compressed file format – zip format. This article will show you how to write code to compress and decompress zip files using Java. And beyond the basics, the code that works with multiple files in a directory recursively is also provided.

    The Zip API

    The package provides classes for working with zip file format. Although the documentation states that the package also provides classes ...
    Tags: file, java, zip Add / Edit Tags
  9. How to use JTree in Java

    by , 02-29-2012 at 07:14 AM
    JTree is a Swing component that displays hierarchical data in a tree structure. The screen-shot below depicts a tree component:

    Name:  sample tree.png
Views: 7669
Size:  12.3 KB
    Figure: A tree component in Java

    This article will focus on how to implement such a tree component in Java, by walking through basic concepts to develop an interesting sample application.

    Fundamental concepts about Tree component

    • Node: A tree displays data vertically in rows,
    Tags: java, jtree, swing Add / Edit Tags
  10. Using Random class to generate two numbers

    by , 02-27-2012 at 11:42 PM
    Guys can you please help me out here, I'm using JOptionPane to receive two values from the user I then use these values as a range for my random generator. I then ask the user what's the answer based on a question randomly generated, but since I'm asking a division question how can I make sure that the first value is always bigger than the second?

    Random rand = new Random();
    it val1 = 0;
    it val2 = 0;
    it start = Integer.parseInt(JOptionPane.showInputDialog("enter ...
    Tags: java Add / Edit Tags
  11. Java memory management

    by , 02-18-2012 at 04:22 PM
    There are 2 categories of Java memory management problems which are as following:

    1. In-complete deallocation
    2. Pre-mature deallocation

    Incomplete deallocation has been divided into 2 subclasses which are:

    1. Desing bugs
    2. Coding bugs

    Coding bugs are considered to be dependent upon language whereas design bugs are not language dependent. They are programming mistakes. Usually programmer is involved in handling the memory ...
  12. Performance improvement of a Java application

    by , 01-08-2012 at 01:45 PM
    Follow these steps to improve performance of your Java application.

    • Always Pool valuable system resources like threads, database connections, socket connections.
    • Optimize your I/O operations by using buffering when writing to and reading from files and/or streams.
    • Minimize network overheads by retrieving several related items simultaneously in one remote invocation if possible.
    • Apply the following performance tips in your code

    • Use ArrayLists,
  13. Difference between java and C++

    by , 01-08-2012 at 11:44 AM
    Java and C++ are almost similar in syntax. Following are the major differences between these:

    • Java has no support to C++ pointers.
    • Java has no support for multiple inheritances. Java has replaced multiple inheritances with multiple interface inheritance. Interface inheritance allows methods to be inherited from different interfaces. It is also referred to as polymorphism.
    • Java has replaced destructors with finalize methods. These methods are called by the garbage collector
    Java and C++
  14. Difference between java and other platforms

    by , 01-08-2012 at 11:41 AM
    Java is only software based platform. It runs on some specific hardware based operating systems like UNIX, Windows etc. Below diagram explains this process.

    Name:  44.JPG
Views: 1758
Size:  17.1 KB

    Java Compile and JVM

    The Java platform contains the following 2 components.

    • Java Virtual Machine (JVM): It can be deployed on any hardware specific platform. It generates byte codes for the java program.
    • Java Application Programming Interface
  15. How to send HTTP request to a URL

    by , 12-09-2011 at 08:28 AM
    Sometimes an application needs to communicate to a web server to send/receive data through HTTP. For example, connecting to a financial service to get stock price, posting user data to server to save in database, or checking for a new version of an application if available.

    This article will guide you to write a generic utility method that can connect to a specified URL with either HTTP’s GET/POST method, and attaching parameters to the request. The method will return server’s response ...
    Tags: http, java, post, request, url Add / Edit Tags
    HTTP , URL
  16. How to sign a Java applet

    by , 12-09-2011 at 07:16 AM
    Why signing an applet?

    By default, a Java applet is running inside a restricted environment called “sandbox”. The sandbox isolates the applet outside the browser environment and user’s computer, preventing maliciously coded applets from running without user’s granted permission.
    Applets are considered to be untrusted if they are not signed with a security certificate. Untrusted applets are also referred to as unsigned applets. Being inside the security sandbox, unsigned applets ...

    Updated 12-09-2011 at 04:41 PM by Java Applet

    Java Applet , Tutorial
  17. How to use HTML to display an Applet in browsers

    by , 12-08-2011 at 12:19 PM
    Applet is a Java based application which is embedded into a web page. Its advantage is to provide rich user interface experience and interaction just like other desktop applications, while still keeping the powerful features of Java like cross-platform, security, multi-threading…
    This article will guide you through some basic steps to build a simple applet, use HTML code to display the applet in browsers. In addition, you will learn how to passing parameters and loading external libraries ...
  18. Using Inheritance - Substitution vs. Extension

    by , 11-30-2011 at 03:51 AM
    We are going to look at inheritance hierarchy. If we take a classic approach, as shown below we would see the methods that have been defined in the base class overridden in the derived classes. Inheritance guarantees that any derived class will have the interface of the base class. If you follow this diagram below, derived classes will also have no more than the base-class interface.

    Name:  Inheritance-Example.jpg
Views: 1037
Size:  16.7 KB

    This can be thought of as pure substitution, because ...
  19. Using Name Hiding for Overriding

    by , 11-30-2011 at 03:45 AM
    Sometimes you will have a java base class that has a method that’s been overloaded several times. It is important for the programmer to remember that redefining the method name in the derived class does not hide any of the base-class versions. Therefore you should keep in mind that overloading works irrespective of whether the method has been defined at this level or in a base class:

    Java Code:
    import static com.acme.examples.Print.*;
    public class Mother {
    	char foo(char
  20. Using Imports to Change Behaviour

    by , 11-30-2011 at 03:36 AM
    One thing that would be great to have is a feature that I know well from my previous experience coding in C. That is the possibility to conditional compile in order to modify the behavior of the application. A feature that is missing from Java is C’s conditional compilation, which allows you to change a switch and get different behavior without changing any other code. I think is was left out of Java is that I remember using this feature often to address issues related to compiling a program on ...
    Tutorial , Import
  21. Unnecessary Object Creation with Immutable Objects

    by , 11-30-2011 at 12:05 AM
    Programmers are often not aware of how to create objects that can be reused. The key to understanding how to create reusable objects is that they must be immutable. So for example if you a running a loop in which each loop a string instance is required, rather than create a new instance every time it executes, you simply reuse the existing instance.

    Rather than create a new String instance.

    Java Code:
    public void BuildingLoop{
    	int total = 10;
    	for(int i=0;
  22. Unnecessary Object Creation with Mutable Objects

    by , 11-29-2011 at 11:59 PM
    Continuing with our last tip on immutable objects, we now look at re-using mutable objects. Although you cannot modify a mutable object, you can avoid unnecessarily waste memory by reusing the existing instance. So consider for example mutable Date objects. Once the values are computed, they are never modified. So for example if you a running a loop in which each loop a string instance is required, rather than create a new instance every time it executes, you simply reuse the existing instance. ...
  23. How to do Overloading with Generics

    by , 11-29-2011 at 05:12 PM
    Overloading is a technique often used in object orientated programming languages such as java. In the context of generics unfortunately, classic type of overloading will produce a compile time error because of erasure.

    Java Code:
    import java.util.List;
    public class OverloadingExample<W, T> {
    	void f(List<T> v) {
    	void f(List<W> v) {

    What you must do to overcome this problem is to provide ...
  24. Eclipse Templates

    by , 11-10-2011 at 06:30 PM (My Java Tips)
    Eclipse Templates are used to make programming easier and simpler. Eclipse IDE provides many templates by default which can be used to save time. Also one can add more templates as required. In this post, I will briefly write about creating and using templates in Eclipse.

    Open the preferences window in Eclipse. Under Java > Editor you will find Templates. Click it and you will see the available templates in the right had side window.Name:  templates.PNG
Views: 339
Size:  21.6 KB
    Making own ...
    Java SE
  25. "Hello world with Java"

    by , 10-21-2011 at 05:53 AM
    This is my first blog on the internet EVER lol

    I have just started to read the book Thinking in Java 3rd edition, its starting out to be very helpful talking about object in memory and where this all fits in with object oriented programming. I still have not yet done any work with the Stack data structure but I am hopeful by the end of the month that is shall!

    If anyone out there reads this and wanted to talk more about object oriented programming or Java ...
    Tags: java Add / Edit Tags