Posts

Showing posts from April, 2018

RSQL / FIQL parser

//https://github.com/jirutka/rsql-parser RSQL is a query language for parametrized filtering of entries in RESTful APIs. It’s based on FIQL (Feed Item Query Language) – an URI-friendly syntax for expressing filters across the entries in an Atom Feed. FIQL is great for use in URI; there are no unsafe characters, so URL encoding is not required. On the other side, FIQL’s syntax is not very intuitive and URL encoding isn’t always that big deal, so RSQL also provides a friendlier syntax for logical operators and some of the comparison operators. For example, you can query your resource like this: /movies?query=name=="Kill Bill";year=gt=2003 or /movies?query=director.lastName==Nolan and year)=2000. See examples below. This is a complete and thoroughly tested parser for RSQL written in JavaCC and Java. Since RSQL is a superset of the FIQL, it can be used for parsing FIQL as well. Related libraries RSQL-parser can be used with: rsql-jpa to convert RSQL into JPA2 CriteriaQuery, rsql-...

JSON Schena Validation FGE

(dependency)     (groupId)com.github.java-json-tools(/groupId)     (artifactId)json-schema-validator(/artifactId)     (version)2.2.8(/version) (/dependency)  ObjectMapper objectMapper = new ObjectMapper();     // this line will generate JSON schema from your class     JsonNode schemaNode = objectMapper.generateJsonSchema(StageDetail.class).getSchemaNode();     // make your JSON to JsonNode     JsonNode jsonToValidate = JsonLoader.fromString(JSON_TO_VALIDATE);     // validate it against the schema     ProcessingReport validate = JsonSchemaFactory.byDefault().getJsonSchema(schemaNode).validate(jsonToValidate);     // validate.messages contains error massages     System.out.println("Valid? " + validate.isSuccess()); https://github.com/java-json-tools/json-schema-validator

Mongo Import and Export

records = []; var cursor = db . getCollection ( 'foo' ). find ({}, {}); while ( cursor . hasNext ()) { records . push ( cursor . next ()) } print ( tojson ( records )); mongoimport --db bala --collection book1 --type json --file C:\Users\balaji\Desktop\test1.json --jsonArray mongo  is the command-line shell that connects to a specific instance of  mongod mongo import query will not work inside the shell When I try to import my json data file into my local instance of mongodb, I get an error. The code that I am using is shown below. > mongoimport -- db cities -- collection zips -- type json -- file C : /MongoDB/ data / zips . json This is the error that I get. 2014-11-29T20:27:33.803-0800 SyntaxError: Unexpected identifier what seems to be to problem here? I just found out that  mongoimport  is used from terminal/command line(cmd), and NOT within the mongo shell.

STS Gradle , Buildship Plugin

How to set decompiler in eclipse

In General -> Editors -> File Association Select "*.class" and mark "Class File Editor" as default Select "*.class without source" -> Add -> "Class File Editor" -> Make it as default Restart eclipse

Eclipse - Enhanced Class Decompiler

Enhanced Class Decompiler integrates JD, Jad, FernFlower, CFR, Procyon seamlessly with Eclipse and allows Java developers to debug class files without source code directly. It also integrates with the eclipse class editor, m2e plugin, supports Javadoc, reference search, library source attaching, byte code view and the syntax of JDK8 lambda expression. It is based on the popular (delisted) "Eclipse Class Decompiler" Plugin, but members of the open-source community enhanced it by removing all code which might compromise your privacy or security (i.e. everything discussed in https://0x10f8.wordpress.com/2017/08/07/reverse-engineering-an-eclipse-p... and everything else which seemed suspicious) to bring back the great core plugin functionality to all Eclipse users. Github Project Page: https://ecd-plugin.github.io (Code-)Reviews and pull requests welcome! All (!) source is in this Git repository: https://github.com/ecd-plugin/ecd

Sonar Eclipse Plugin

  (plugin)                  (groupId)org.sonarsource.scanner.maven(/groupId)                  (artifactId)sonar-maven-plugin(/artifactId)                  (version)3.3.0.603(/version)              (/plugin) mvn sonar:sonar

Cobertura Eclipse Plugin

 (plugin)                 (groupId)org.codehaus.mojo(/groupId)                 (artifactId)cobertura-maven-plugin(/artifactId)                 (version)2.7(/version)             (/plugin)       mvn cobertura:cobertura To launch Cobertura from Maven use this command: mvn cobertura:cobertura -Dcobertura.report.format=xml mvn -Dsonar.cobertura.reportPath="E:\balaji\PS_Power\CoberturaDemo-master\project\target\site\cobertura\coverage.xml" sonar:sonar

Cobertura

Cobertura POC About Cobertura Cobertura is a free Java tool that calculates the percentage of code accessed by tests. It can be used to identify which parts of your Java program are lacking test coverage. It is based on jcoverage. For more information: Cobertura official web page Use Maven There are several ways to execute Cobertura, I have used the maven plugin. You can find the info here: Cobertura maven plugin by Mojo You can execute Coberta as/is typing: mvn cobertura:cobertura I prefer this way: mvn clean install cobertura:cobertura Collect your results If everything has gone well, you will see this log line: [INFO] Cobertura Report generation was successful. Then you can find your Cobertura Report at: ${PROJECT_PATH}/target/site/cobertura/index.html

SQL JOIN

SQL JOINS Before we continue with examples, we will list the types the different SQL JOINs you can use: INNER JOIN : Returns all rows when there is at least one match in BOTH tables LEFT JOIN : Return all rows from the left table, and the matched rows from the right table RIGHT JOIN : Return all rows from the right table, and the matched rows from the left table FULL JOIN : Return all rows when there is a match in ONE of the tables An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them. The most common type of join is:  SQL INNER JOIN (simple join) . An SQL INNER JOIN return all rows from multiple tables where the join condition is met. Let's look at a selection from the "Orders" table: OrderID CustomerID OrderDate 10308 2 1996-09-18 10309 37 1996-09-19 10310 77 1996-09-20 Then, have a look at a selection from the "Customers" table: CustomerID CustomerName ContactName Country 1 Alfreds Futterkiste Maria Anders Ge...