Month Sorting in Java using HashMap

Program: package agn; import java.util.Date; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; import java.util.TreeMap; public class Sorting { public static void main(String[] args) throws ParseException { Map<Date, Integer> m = new HashMap<Date, Integer>(); DateFormat dateFormat = new SimpleDateFormat("MMM"); m.put(new java.sql.Date(dateFormat.parse("Apr").getTime()),67); m.put(new java.sql.Date(dateFormat.parse("Dec").getTime()),89); m.put(new java.sql.Date(dateFormat.parse("Jan").getTime()),56); m.put(new java.sql.Date(dateFormat.parse("Sep").getTime()),34); Map<Date, Integer> m1 = new TreeMap(m); DateFormat df = new SimpleDateFormat("MMM"); […]

937 total views, no views today

» Read more

Eclipse plugin for go language

Step 1: Open the eclipse. Step 2: Help -> Install New Software. Step 3: Add the repository. http://goclipse.googlecode.com/svn/trunk/goclipse-update-site click next and finish. Step 4: Now you can able to see File -> New -> others -> Go project in the eclipse. Then start working on “go language”.   Thanks for reading this post……..!!! 537 total views, 2 views today

537 total views, 2 views today

» Read more

[Solved] eclipse invalid go language settings

Configuring GO settings: Step 1: Open the eclipse. Step 2: File -> New -> Go Project (Give project name as your wish) Step 3: Set the GOROOT value like this,   give ok and create the project. Step 4: Inside src folder create hello.go file and paste the below code, package agn import “fmt” func main() { fmt.Println(“Hello World”) }  Step 5: Run and see […]

581 total views, 1 views today

» Read more

Configure GO Settings in eclipse

Configuring GO settings: Step 1: Open the eclipse. Step 2: File -> New -> Go Project (Give project name as your wish) Step 3: Set the GOROOT value like this,   give ok and create the project. Step 4: Inside src folder create hello.go file and paste the below code, package agn import “fmt” func main() { fmt.Println(“Hello World”) } […]

418 total views, 1 views today

» Read more

Go language path setting in windows 7

Step 1: Before go path setting you can see the cmd like below, Step 2: Now Right click on “My computers” -> Properties -> Advanced System settings -> Advanced (tab) -> Environment variables ->  User variables -> New and set the value like this,   Variable name: go_path Variable value : c:\go\bin  Note: variable value varied based on the location […]

513 total views, no views today

» Read more

Hello World Go Programming Language

Step 1: Download the go programming language from the below link, http://code.google.com/p/go/downloads/list and Install it. Step 2: Create a file named hello.go and paste the below code, package main import “fmt” func main() { fmt.Println(“Hello World”) }  Step 3: Save the hello.go in bin folder as like in java. Step 4: Compile and run the program as like below,   […]

714 total views, no views today

» Read more

Sample multithreading program using Callable Interface

Step 1: Create “MainThread.java” and paste the below code, package runnableandcallable; import java.util.ArrayList; import java.util.Collection; import java.util.List; import runnableandcallable.CallingThread; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; public class MainThread{ private static ExecutorService service = Executors.newFixedThreadPool(10); //connection pool @SuppressWarnings("unchecked") public static void main(String[] args) throws InterruptedException { List<CallingThread> threads = new ArrayList<CallingThread>(); //ArrayList to store the threads with CallingThread Type CallingThread ct […]

550 total views, 1 views today

» Read more

Auto Refresh in All Browsers

If you use, <% response.addHeader(“Refresh”,”4;account.jsp”); %> in jsp page, the page will be redirected to account.jsp from the current page after 4 seconds. Note: The above operation would happen in all browsers except internet explorer and eclipse internal browser. To Perform Auto Refresh in all browsers: <%String autoRefresh=”accounts.jsp” %> <meta http-equiv=”refresh” content=”5;URL=<%=(autoRefresh)%>” /> Now After 5 seconds page will be […]

414 total views, no views today

» Read more

Passing Console output from java to jsp

Step 1: Create Hello.java and paste the below code,   package com.agn; public class Hello { /** * @param args */ public String returning(){ String go = "hello Naveen"; return go; } public static void main(String[] args) { Hello h = new Hello(); System.out.println(h.returning()); } }   Step 2: Create fethingfromjava.jsp and paste the below code,   <%@ page language="java" […]

2,662 total views, 2 views today

» Read more
1 56 57 58 59 60 66