Skip to main content

Posts

Heartfelt Wishes & Quotes for Special Occasions | Make Every Moment Memorable

  Introduction Special occasions are milestones in our lives that deserve to be celebrated with joy, love, and heartfelt messages. Whether it’s a birthday, wedding, or holiday, sharing wishes and quotes can add a personal touch, making these moments even more memorable. This article delves into the significance of wishes and quotes, offering a curated collection for various special occasions to help you convey your sentiments perfectly. Why Wishes and Quotes Matter Wishes and quotes are more than just words; they hold the power to uplift spirits, convey deep emotions, and strengthen relationships. Sending a thoughtful message on a special day shows that you care, helping to build stronger connections with those who matter most. Whether you’re looking to inspire, amuse, or simply spread joy, the right words can leave a lasting impact. Types of Special Occasions Special occasions vary widely, from personal milestones like birthdays and anniversaries to cultural and religious celebrat...

What is Minecraft? How do you play it?

Minecraft is a gaming application which is developed by  the  Swedish  video game developer  company Mojang. The company is also known as the creator of the Lego and Scrolls series and was founded in 2009 by Markus Persson, Carl Manneh and Jakob Porser. Minecraft games download, as of 2018, has sold about 106 million copes worldwide. It's a game that has been on the market for over 10 years now. It's played all around the world by people of all ages.  Minecraft  has since been ported to several other platforms and is the  best-selling video game of all time , with over 200 million copies sold and over 140 million  monthly active users  as of 2021. Minecraft games download are available on many different platforms including PC, MacOS , Xbox One, Nintendo Switch, iOS/Android to name a few. One can also use Minecraft games offline on their computer without internet connections with the help of Minecraft PE . The game is about an explorer who wen...
Good Post on Java Development topics. JWT: The Complete Guide to JSON Web Tokens   (Very Nice and deep explanation) HTTP Session handling using Servlet Filters Session Listener tutorial
Common Eclipse Shortcuts for Java Developer Open Resource : ctrl+shift+r Quick Outline : ctrl+o Assign to local variable : ctrl+2, L Rename : alt+shift+r  Extract Local Variable : alt+shift+l  Extract Method : alt+shift+m
How to check a string starts with numeric number? String str = "123abcd"; boolean isStartWithDigit = Character.isDigit(s.charAt(0)); System.out.println("isStartWithDigit: "+isStartWithDigit); How to get first numeric value from a string in java?  Matcher matcher = Pattern.compile("\\d+").matcher(titleStr); if(matcher.find()) { System.out.println(matcher.group()); }; How to check if a String contains another String in a case insensitive manner in Java? Solution 1: String str = "I am Java Developer"; String test = "java"; Boolean bool = str.toLowerCase().contains(test.toLowerCase()); System.out.println(bool); Solution 2: org.apache.commons.lang3.StringUtils.containsIgnoreCase("AbBaCca", "bac"); Solution 3: Pattern.compile(Pattern.quote(s2), Pattern.CASE_INSENSITIVE).matcher(s1).find();

What is the significance of load factor in HashMap?

An instance of HashMap has two parameters that affect its performance: initial capacity and load factor . The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets. As a general rule, the default load factor (.75) offers a good tradeoff between time and space costs. Higher values decrease the space overhead but increase the lookup cost (reflected in most of the operations of the HashMap class, including get and put ). The expected number of entries in the map and its load factor should be taken into a...
Good Stub from other sites : Spring+Hibernate Application with zero XML Spring framework came up with Annotation support since 2.5 version which eases the  development. Whether Annotation based approach better or XML approach is better is  depends on the project  and their personal preference. This is very good example for zero xml. - See more at: http://www.sivalabs.in/2011/02/springhibernate-application-with-zero.html#sthash.G1pYeuBl.dpuf

Copy Content of One file to another file using Java

Copy Content of One file to another file using Java. package com.pukhraj.blog; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; public class FileCopy { public static void main(String[] args) throws IOException {   File inFile = new File("FullPath/inputFileName.extension"); File outFile = new File("FullPath/outputFileName.extension");    FileReader in = new FileReader(inFile);    FileWriter out = new FileWriter(outFile);    int i;    while ((i = in.read()) != -1)      out.write(i);    in.close();    out.close();   } }
Read a file using Java package com.pukhraj.blog; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class ReadSimpleFile { public static void main(String[] args) { String inputFileName =  "FullPath/filename.extension"; try{ FileInputStream fstream = new FileInputStream(inputFileName); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; //Read File Line By Line while ((strLine = br.readLine()) != null)   { } }catch(IOException e){ e.printStackTrace(); } } }
Read Properties file using java   package com.pukhraj.blog; import java.io.FileInputStream; import java.util.Properties; public class ReadPropertiesFile {         public static void main(String[] args) {                 Properties prop = new Properties();                 try {                 FileInputStream in = new FileInputStream("PropertiesFilePath");                          prop.load(in);                         String name = prop.getProperty("name");                         String address = prop.getProperty("address");                         String city = prop...
Generate One Pixel image using Servlet package com.pukhraj.blog; //Generate One Pixel image using Servlet import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; import javax.imageio.ImageIO; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class PixelImage extends HttpServlet  { private BufferedImage pixel;  public void init(ServletConfig config) throws ServletException {    super.init(config);    pixel = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB);    pixel.setRGB(0, 0, (0xFF));  } public void process(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType("image/png"); OutputStre...
Uncompress GZip file package com.pukhraj.blog; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.OutputStream; import java.util.zip.GZIPInputStream; public class UncompressGZip {   public static void main(String[] argv) throws Exception {     String source = "path/FileName.gzip";     GZIPInputStream in = new GZIPInputStream(new FileInputStream(source));     String target = "path/outfilename";     OutputStream out = new FileOutputStream(target);     byte[] buf = new byte[1024];     int len;     while ((len = in.read(buf)) > 0) {       out.write(buf, 0, len);     }     in.close();     out.close();   } }
Compress File in GZip Format using java package com.pukhraj.blog; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; import java.io.OutputStream; import java.util.zip.GZIPOutputStream; public class CompressFile {   public static void main(String[] args) throws Exception {     InputStream in = new FileInputStream("InputFilePath/fileName.txt");     OutputStream out = new FileOutputStream("OutputFilePath/fileName.txt.gz");     GZIPOutputStream gzout = new GZIPOutputStream(out);     for (int c = in.read(); c != -1; c = in.read()) {       gzout.write(c);     }     gzout.close();   } }
Calculating IPs with the help of IP Subnet Mask (CIDR Notation ) //Library Required : commons-net-3.0.1.jar package com.pukhraj.blog; import org.apache.commons.net.util.SubnetUtils; public class IPSubnetMask { public static void main(String[] args) { String subnet = "IP/SubnetMask"; SubnetUtils utils = new SubnetUtils(subnet); String lowip = utils.getInfo().getLowAddress(); System.out.println("Low IP "+lowip); String highip = utils.getInfo().getHighAddress(); System.out.println("High IP "+highip); String[] addresses = utils.getInfo().getAllAddresses(); System.out.println("Total IPs : "+addresses.length); System.out.println("isInRange : "+utils.getInfo().isInRange("IP")); } }
Read Compressed gz file. package com.pukhraj.blog; import java.io.BufferedReader; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.zip.GZIPInputStream; public class ReadZipFile { public static void main(String[] args) { String FILENAME ="Path";  try{  FileInputStream fin = new FileInputStream(FILENAME);  GZIPInputStream gzis = new GZIPInputStream(fin);  InputStreamReader xover = new InputStreamReader(gzis);  BufferedReader is = new BufferedReader(xover);  String strLine;  while ((strLine = is.readLine()) != null){  System.out.println(strLine);  }  }catch(FileNotFoundException e){  e.printStackTrace();  } catch (IOException e) { e.printStackTrace(); } } }