View RSS Feed

Recent Blogs Posts

  1. Homework help - Dice Roll

    by , 04-28-2013 at 01:03 AM
    Quote Originally Posted by Slick Java View Post
    Hi, I am having trouble with this program. The point of this program is to roll a dice, store dice values in an array and print out how much time the value has been occurred. The output should be like this:

    1 3

    4 1

    5 1

    2 1

    But I am getting this:

    1 3

    4 1

    5 1

    1 3

    2 1

    1 3


    I am trying to find a way to get
    ...
    Categories
    Uncategorized
  2. Future Cheat Sheets

    by , 10-30-2012 at 08:38 PM
    Just trying to think of the topics that I want to create cheat sheets about. In the next few weeks I plan on making many more of these, here are a few topics that I think I will start with:
    • Linked Lists
    • Abstract Data Types
    • Abstract Algorithmic Analysis
    • AWT Event Handling
    • Swing Components
    • Swing Event Handling?
    • Inheritance
    • Polymorphism
    • Interfaces
    • Exception Handling



    This is in no particular order, and I will probably be hopping around this list ...
    Categories
    Uncategorized
  3. File Input Output Cheat Sheet

    by , 10-30-2012 at 04:18 AM
    File Input Output Cheat Sheet

    Importing Libraries
    The primary library that deals with files:
    Java Code:
    import java.io.File;
    The library that deals with writing to files:
    Java Code:
    import java.io.PrintWriter;

    FYI
    If there is more then one type of information that is being transferred to or from a file, it is usually best to use a record; IMO.


    Writing to a File

    Declare ...
  4. AWT Component Cheat Sheet

    by , 10-30-2012 at 02:15 AM
    AWT Components Cheat Sheet

    Importing Libraries
    There are two main libraries that involve the AWT tools. This package contains the core AWT graphics classes. Contains component classes for buttons, text fields, labels, frames, panels, dialogs, and scroll panes. It also contains the layout managers such as flow layout, border layout, and grid layout. Also included are the cusrom graphics classes such as graphics, color and font.
    Java Code:
    import java.awt.*;
    ...

    Updated 10-30-2012 at 06:02 AM by penguinCoder

    Categories
    Cheat Sheet
  5. ArrayList Cheat Sheet

    by , 10-29-2012 at 11:17 AM
    Importing the Library
    Before you can use an ArrayList, you must first import the necessary library.
    Java Code:
    import java.util.ArrayList
    Creating a Generic ArrayList
    Generic ArrayList is an ArrayList with a type; no other type is allowed to be inserted into the ArrayList.
    Java Code:
    ArrayList<type> listName = new ArrayList<type>();
    Example of this would be:
    Java Code:
    ArrayList<String> myArrayList = new ArrayList<String>();
    ...
  6. Virtual Memory Cheat Sheet

    by , 10-27-2012 at 04:39 AM
    Brief Description:
    'Virtual' Memory is the mental model, or abstraction, that the programming language provides to the programmer to explain how computer memory is managed while you program is running. It is NOT the same as physical memory.

    Run Time:
    At run time, the operating system handles the translation from 'virtual' memory addresses to physical memory addresses, and the programmer does no need to be aware of this process.

    Static Region:
    This ...

    Updated 10-30-2012 at 04:19 AM by penguinCoder

    Categories
    Cheat Sheet
  7. Records Cheat Sheet

    by , 10-27-2012 at 04:25 AM
    Brief Description:
    A record is pretty much just a programmer defined data type. It combines one or more pieces of information, or potentially different data types, into one unit. Structure wise, it is just a template that defines how to interpret the contents of a sequence of memory locations.

    First outside of any class, define the new data type:
    Java Code:
    class recordName{
      public [dataType] fieldName;
      ..repeat for any number of types..
    }
    ...
  8. Random Number Cheat Sheet

    by , 10-27-2012 at 04:00 AM
    Just for FYI, computers cannot generate actual random numbers. They are machines, and they do what they are told; and therefore cannot just choose a number at random. Mathematicians would call the process this process 'psuedo-random' number generation, but I didn't feel that made a good title so, whatever.. Just covering all the bases.

    First you will have to import the library:
    Java Code:
    import java.util.Random;
    Next, you create a random number generator; ...
  9. Scanner Class Cheat Sheet

    by , 10-18-2012 at 12:26 AM
    The Scanner class can be used for many things other then just getting input from the user; however this cheat sheet/tutorial is just going to be about getting input from the user.

    Defining the Scanner Class
    Java Code:
    import java.util.Scanner;
    
    public class ClassName{
      ...code...
    }
    It will tell the translator to look in that directory for the code defining the Scanner class.


    Declaring the Scanner
    If you ...

    Updated 10-18-2012 at 12:29 AM by penguinCoder

    Categories
    Cheat Sheet
  10. String Cheat Sheet

    by , 10-18-2012 at 12:05 AM
    A string is a piece of text, that is zero or more characters in length. In Java, strings are considered to be pre-built objects. The variable for a string does not store the value of the string, rather it is a reference point, or pointer, to the storage location of where the string is kept.


    Declaring a String:
    Java Code:
    String s1;
    Assigning a Value On Declaration:
    Java Code:
    String s1 = "Hello World!";
    Assigning ...

    Updated 10-18-2012 at 12:29 AM by penguinCoder

    Categories
    Cheat Sheet
  11. Class and Method Terminology Cheat Sheet

    by , 10-17-2012 at 10:45 PM
    Class Body - the area between the braces, that contains all the code.

    Constructors - used for initializing new objects

    Declarations - fields that provide the state of the class and its objects

    Methods - implement the behaviour of the class and its objects

    Fields - member variables in a class

    Local Variables - variables in a method or a block of code

    Parameters - is the list of variables in a method declaration ...

    Updated 10-18-2012 at 12:30 AM by penguinCoder

    Categories
    Cheat Sheet
  12. Class and Method Cheat Sheet

    by , 10-17-2012 at 10:42 PM
    Declaring a Class
    Java Code:
    class ClassName{
      ...code...
    }

    Declaring a Class with Parent
    Java Code:
    class ClassName extends parentClassName{
      ...code...
    }

    Declaring a class with Interface
    Java Code:
    class ClassName implements interface1, interface2, interface3{
       ...code...
    }

    Declaring a Class with Fields
    Java Code:
    class ClassName{
      public
    ...

    Updated 10-18-2012 at 12:30 AM by penguinCoder

    Categories
    Cheat Sheet
  13. Some Basic Technical Terminolgy Cheat Sheet

    by , 10-10-2012 at 04:08 AM
    Well I just got out of class, and I thought I would do a brain dump of some of the terminology that is utilized in Programming and Computer Science. This is going to be in more human readable format then most places I have found on the Internet.

    Abstract Algorithm Analysis
    What is O(N)?
    Big O of N, and it is commonly pronounced, is when the run-time of an algorithm is approximately proportional to the size of the data (N), when there are large amounts of data; in the ...

    Updated 10-18-2012 at 12:30 AM by penguinCoder

    Categories
    Cheat Sheet
  14. problem with shopping cart

    by , 08-29-2012 at 02:15 PM
    how do i increase the quatity of an item when it is added again and again into my shopping cart table.there is only a button add to cart.there is no textfeild for quantitiy.
    the code as of now i have retreives the items from database and add it into the shipping cart table. if i clik on it again and again the same item wil be shown again and again.
    Java Code:
     DefaultTableModel model = (DefaultTableModel) 
    tbl1.getModel();
                DefaultTableModel tm = (DefaultTableModel)
    ...
    Categories
    Uncategorized
  15. java (7) equivalent of .Net timespan

    by , 07-28-2012 at 07:03 AM
    Quote Originally Posted by .paul. View Post
    i used Dates in this particular case, as they were better suited to the application.

    but i also created a java TimeSpan class, similar to the .Net Framework TimeSpan class:

    Java Code:
    package javaTimeSpans;
    
    /**
     *
     * @author Paul
     */
    public class TimeSpan {
        
        private int _days;
        private int _hours;
        private int _minutes;
        private int _seconds;
        
        public int Days(){
    ...
    Categories
    Uncategorized
  16. xml encoding problem.

    by , 07-11-2012 at 10:52 AM
    Hi All,
    I am trying to embedd an xml response string as CData inside an XML tree. The main XML tree is not in my control to create or change. I just have a class object where i am just setting the content as String, where the string is my xml.

    The problem is when the mail xml tree appears, the content of my xml ( RawProfile ) are not properly encoded.

    Java Code:
    <ns5:PotsdamCache xmlns:ns2="http://schemas.xmlsoap.org/ws/2002/12/secext"
    ...
    Categories
    Uncategorized
  17. Architecture of Web Service

    by , 07-07-2012 at 07:43 PM
    Following diagram explains the architecture of the web servers.

    Name:  1.jpg
Views: 5623
Size:  29.1 KB

    Web Service Architecture


    • Web Service Discovery: All the web services are discovered with the help of this part by meeting certain requirements and passing filters. The UDDI which stands for Universal Description, Discovery and Integration handles this part of web services.

    • Web Service Description: All the web services are self describing which ...
    Categories
    Tutorial
  18. SOAP - Envelope Element

    by , 07-07-2012 at 07:40 PM
    The end and the start of the message are indicated by SOAP envelope. The receiver will be informed of the complete message arrival. When a message is received and processed, it will be informed by the SOAP envelope. So it solved the major problem of informing message processing. So in other words we can say that is a packaging method.

    Following points will explain it in more detail:

    • A root element is the base of SOAP envelop message and it is contained by all the
    ...
  19. SOAP Introduction

    by , 07-07-2012 at 07:39 PM
    To exchange messages and information between multiple computers, XML based protocol is used which is called SOAP. SOAP is XML based protocol so you can say that it is the XML specification application.

    Following rules or statements are considered as true for the SOAP.

    • It is a protocol for communication.
    • SOAP stands for Simple Object Access Protocol.
    • It is designed to use internet for all its communication.
    • It has the facility to use HTTP ...
    Categories
    Tutorial , SOAP
  20. Log4J Support Objects

    by , 07-07-2012 at 07:37 PM
    Following are the log4j framework important support objects which are critical in this framework.

    • Level Object: This object is used to define priority of log information. Following log levels are defined in the log4j API:
    o INFO
    o DEBUG
    o ERROR
    o OFF
    o FATAL
    o WARN
    o ALL

    • Filet Object: This object is used to filter and analyze the logging information. Based on the analysis and filter criteria, logging information is ...
    Categories
    Tutorial
  21. log4j - Core Objects

    by , 07-07-2012 at 07:36 PM
    Following are the log4j framework important core objects which are important and play a critical role in this framework.

    • Logger Object: The Logger object is provided by the top Logger layer. All the information captured by this Logger Object is stored in a hierarchy and this is the main object responsible for collecting all information.

    • Layout Object: The Layout Object is responsible for formatting all the information in multiple styles. The Layout Objects helps ...
    Categories
    Tutorial
  22. log4j – Introduction

    by , 07-07-2012 at 07:34 PM
    Log4J is a Java based API that provides a logging framework which is:

    • Fast
    • Reliable
    • Flexible

    The Apache software License provides the Log4J distribution. It has been also ported to following different languages:

    • C++
    • C
    • C#
    • Python
    • Eiffel
    • Ruby

    Following are the core features and functionalities of Log4J Framework:

    • It is configurable at runtime using files. ...
    Categories
    Tutorial
  23. What are the Major Servlets Tasks

    by
    JSP
    , 07-07-2012 at 07:31 PM
    Following are the major servlets tasks:

    • The Servlet major task is to read client data that is explicitly sent. It may include:
    o Data sent by a web page in form of HTML form
    o Data sent by an applet
    o Data sent by some HTTP client

    • The Servlet major task is to read client data that is implicitly sent. It may include:
    o Media types
    o Cookies
    o Different compression

    • The servlet is responsible for data processing ...
    Categories
    Tutorial
  24. Exception Handling in JSP

    by
    JSP
    , 07-07-2012 at 07:30 PM
    There is always a probability of programming errors in the code while a programmer is coding a JSP page. Following are the major types of errors which may arise in a JSP code:

    • Checked Exceptions: The checked exception is an unforeseen error by the programmer of JSP code or it is a user error in the code. For example, you are opening a file which may not exisit or may have some issue will raise an exception. At the compile time, these checked exceptions cannot be ignored.
    ...
  25. Hits Counter in a JSP Page

    by
    JSP
    , 07-07-2012 at 07:29 PM
    You have a website developed in JSP with different pages. The hit counter will help you the total number of users visit your any JSP page. In most cases, the hit counter is attached with “index.jsp” page. It is the main login page and most users will first visit this page before navigating to any other page on your application or website.

    The following methods are used to implement hit counter. These methods are attached with you “Application” object.

    • setAttribute() ...
    Tags: hits counter Add / Edit Tags
    Categories
    Tutorial
  26. Session Tracking in a JSP Page

    by
    JSP
    , 07-07-2012 at 07:12 PM
    JSP communicates with the clients using stateless HTTP protocol. For each new request, following operations are performed:

    • A new connection is opened with web server.
    • Server does not record client information.

    In this topic, we will focus on the different ways of handling and maintaining session information. Following are the 3 main ways for session maintaining.

    • Cookies: A cookies also known as session ID is assigned to a web client by the ...
    Categories
    Tutorial
  27. Form Processing in JSP

    by
    JSP
    , 07-07-2012 at 07:10 PM
    In a JSP progam, a programmer may have handled situations in which he sends information from browser to server and finally this information is communicated to backend business logic. Following two methods are used by the web browsers to send form data and information to web server.

    • GET Method: The encoded information is sent from browser to the server using this GET method. The information and page URL is separated using the “?” character. Following is an example of GET method information ...
    Categories
    Tutorial
  28. Expressions in JSP

    by
    JSP
    , 07-07-2012 at 07:09 PM
    The expression elements are supported by the JSP Page which:

    • Are based on scripting language
    • These expressions are evaluated.
    • These expressions are coverted to a String format
    • These are replaced with the expression elements in the JSP Page.

    The expression elements in a JSP page are finally converted to a string so you can use it anywhere in your JSP Page. These expression elements must be valid and follow the Java Language. There is only ...
    Categories
    Tutorial
  29. How a JSP Page is processed?

    by
    JSP
    , 07-07-2012 at 07:07 PM
    In this topic, we will dicuss how a JSP Pages is created and processed by a web server. Following steps will explain it in more detail.

    • An HTTP request is sent to the web server by your JSP Page.
    • The web server is responsible for receiving this JSP Page request and it will determine that it’s a JSP request so it will call the JSP engine. This process is done for the pages that have a .jsp extension.
    • The requested JSP page will be loaded from the disk and the JSP ...
    Categories
    Tutorial
  30. What are the Advantages of JSP

    by
    JSP
    , 07-07-2012 at 07:05 PM
    JSP offers the following advantages as compared to using other technologies in the market.

    • JSP vs Active Server Pages: The major benefit offered by the JSP as compared to Active Server Pages is that it uses Java for expression writing which is more helpful, powerful and easy to use. Where as in Active Server Pages, you will need to use Visual Basic or any other Microsoft language. The second benefit offered by the JSP is that you can port it to any other operating system.
    ...
    Categories
    Tutorial
Page 1 of 48 12311 ... LastLast