Skip to main content

Posts

Top 20 JVM languages

Java is a popular object-oriented programming language. It was developed with an intention of WORA i.e. write once, run anywhere. Compiled Java code can run be run on any platform without recompilation. Java runs on Java Virtual Machine (JVM). JVM is a virtual machine and it is required by the computer to run any code compiled to Java bytecode.  Besides Java, the following languages can be run on JVM Scala Kotlin Clojure Apache Groovy Frege Ceylon Redline Smalltalk Xtend Haxe JRuby Kawa scheme Armed Bear Common Lisp Neo4j Nashorn Jacl Simula Jabaco JScheme Bigloo Renjin

Oracle How to reset Sequence without dropping it

In this article, we will learn how to reset Sequence to a particular value without dropping it. Let's suppose the current value of the sequence e.g seq_person_id is 10234 and we want to reset it to 100. Step 1 alter sequence  seq_person_id increment by -10134 minvalue 0 Note : MINUS sign with 10134. Step 2 select  seq_person_id.nextval from dual Step 3 alter sequence  seq_person_id  increment by 1 minvalue 0; The sequence is now reset to 100. 

SQL Reporting Services Missing in Action in Visual Studio 2017

Microsoft RDLC Report Designer for Visual Studio To install these extensions: Launch Visual Studio 2017 -> Go to Tools Menu -> Select Extensions and Updates -> In the Extensions and Updates dialog box, select the Online option -> Click in the Search Visual Studio Marketplace dialog box, top right hand corner -> Type in Report -> Press return -> Select Microsoft Rdlc Report Design for Visual Studio -> Press the Download button -> Select Microsoft Reporting Services Project -> Press the Download button -> Press the Close button -> Close Visual Studio 2017 The extensions will install Open Visual Studio 2017 SQL Server Reporting Services will be installed ___Stay Happy_____________

No 'Access-Control-Allow-Origin' header is present on the requested resource.

//No 'Access-Control-Allow-Origin' header is present on the requested resource__ Access-Control-Allow-Origin error mostly when you access web api without client like from ajax or javascrip call Issue can be resolved in following steps. 1) Goto global aspx calss of WebApi 2) After default start method add below mentioned code in step 3 3) protected void Application_BeginRequest(object sender, EventArgs e) { HttpContext.Current.Response.AddHeader("Access-Control-Allow-Origin", "*"); if (HttpContext.Current.Request.HttpMethod == "OPTIONS") { HttpContext.Current.Response.AddHeader("Access-Control-Allow-Methods", "POST, PUT, DELETE"); HttpContext.Current.Response.AddHeader("Access-Control-Allow-Headers", "Content-Type, Accept"); HttpContext.Current.Response.AddHeader("Access-Control-Max-Age", "1728000&

Gmail API - Invalid topicName does not match projects/../topics/*

I am exploring the Google Cloud PubSub these days. I am working on a project where I have to listen for the User's Gmail Inbox and then process the new emails as they arrive. I used a Gmail Client API to add the  watch  on user's Gmail. I encountered the following exception Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request {   "code" : 400,   "errors" : [ {     "domain" : "global",     "message" : "Invalid topicName does not match projects/modular-botany-234216/topics/*",     "reason" : "invalidArgument"   } ],   "message" : "Invalid topicName does not match projects/modular-botany-234216/topics/*" } at com.google.api.client.googleapis.json.GoogleJsonResponseException.from(GoogleJsonResponseException.java:146) Solution After a bit of struggle and google, I found that I have created th

Java - How to remove characters from a String at a specific index?

In this post, I will show you how to remove the characters/string from a string at a specific index. In Java, there is no such function available in String class. We have the following two alternates available StringBuilder StringBuffer Option 1 (StringBuilder)     StringBuilder builder = new StringBuilder("hello to Java");              builder.delete( 5, 8 );     System.out.println( builder );// OUTPUT  hello Java To remove a single character     StringBuilder builder = new StringBuilder("hello to Java");           builder.deleteCharAt( 0 );     System.out.println( builder );// OUTPUT ello to Java Option 2 (StringBuffer)     StringBuffer buffer = new StringBuffer ("hello to Java");     buffer .delete( 5, 8 );     System.out.println(  buffer );// OUTPUT hello Java To remove a single character     StringBuffer  buffer  = new  StringBuffer  ("hello to Java");           buffer .dele

Java - How to insert characters in a String at a specific index?

I was translating a DotNet project to Java. In code, CSharp  insert String function was used and I wrote my own Java function to insert characters/string at a specific index of string. Following is the code     public static String insert(String originalString,int offset, String injectString) {         if(offset>= originalString.length()) {             return originalString;         }         String firstPart = originalString.substring( 0, offset);         String secondPart = originalString.substring( offset);               return firstPart.concat( injectString ).concat( secondPart );     }  Later on, I found the StringBuffer's built-in  insert function for the same purpose         StringBuffer buffer = new StringBuffer();         buffer.append( "Hello Java" );         buffer.insert( 6, "to " );         System.out.println( buffer ); // OUTPUT  Hello to Java

Jersey Java Framework - How to add HTTP Basic Authentication to RESTful web services?

Overview I have shown you in the following post how to develop the RESTful web services using the Jersey Java Framework Jersey JAX-RS Framework - Step by Step Guide for Developing RESTful web services There are different security levels that we can add to web services a) Authentication b) Authorization c) Encryption The scope of this post is for Authentication. If we look at the available options then we have a) OpenID b) OAuth c) HTTP Basic Authentication  HTTP Basic level authentication is the weakest among the above three available options but it is still preferable over no Authentication :) Let's start how to implement  the Basic HTTP Authentication. Requirements for this tutorial  Eclipse  Maven Jersey Framework Tomcat STEP 1 First, we will code our filter to process the request before redirecting it to the respective resource. We will achieve it by implementing the  ContainerRequestFilter. We will add the following dependency to the

How to Create, Add, Receive MSMQ

//How to Create a MessageQueue ?_______________________ static string myQueue = ".\\private$\\EmailQueue"; if (!MessageQueue.Exists(myQueue)) { MessageQueue.Create(myQueue, false); } Console.WriteLine("Server is up and running on port 32578"); //How to Add MessageQueue :__________________________ MessageQueue messageQueue = new MessageQueue(myQueue); messageQueue.Send(emailDetail, "Email"); //How to Receive a MessageQueue :_____________________________________ private static EmailDetails ReceiveMessage(string queueName) { log.Info(DateTime.Now + " Queue checking"); MessageQueue messageQueue = new MessageQueue(queueName); EmailDetails emailDetail = null; try { messageQueue.Formatter = new XmlMessageFormatter(new Type[] { typeof(EmailDetails) }); emailDetail = (Emai

Access to Message Queuing system is denied

Access to Message Queuing system is denied Following step are involved to resolve this issue 1- Go to start and pess Windows + R key fro keyboard and write: compmgmt.msc 2- Expand services and applications 3- Next expand Message queuing 4- Click on private queue and then right click on desired queue which you have created 5- Allow permission from security every one and IIS if showing.