Posts

Make image background transparent with CSS

Image
If you have a opaque image and it doesn't align with the background of your webpage, you can make the background transparent with CSS < style > .bg-blend{ background: url("https://images.hertz.com/vehicles/220x128/ZEUSECAR999.jpg"); background-color: #f0f5f9; background-blend-mode: multiply; height: 128px; width: 220px; } </ style > < body > < div class =" bg-blend "></ div > </ body >

How to encrypt plaintext passwords in JBoss

By default, database connections for the JBoss A8 are defined in *-ds.xml, and include clear text passwords. You can, however, replace it with encrypted passwords. There is no need to change your source code. The class org.jboss.resource.security.SecureIdentityLoginModule can be used to both encrypt database passwords and to provide a decrypted version of the password when the data source configuration is required by the server. Step 1: Encrypt a datasource password Open cmd.exe, change directory to the JBoss directory and execute the following command: java -cp client\jboss-logging.jar;lib\jbosssx.jar org.jboss.resource.security.SecureIdentityLoginModule MyPLaintextPASSWDRD This command will return an encrypted password like this: Encoded password: ia744dc3700000125ff73cfb98e94f3e3 Step 2: Create an application authentication policy with the encrypted password Open conf/login-config.xm1 file, add a new <app1ication-policy> element to the <policy> element, put the encode

Parse Json with dynamic key with JQuery

<script  src="http://code.jquery.com/jquery-3.1.0.min.js"  integrity="sha256-cCueBR6CsyA4/9szpPfrX3s49M9vUU5BgtiJj06wt/s="  crossorigin="anonymous"></script> <script> var json ={ "result": { "101010":["PRAVAT","SGSGSG","UKEMP5","UKENTD","WAUK01","MK87UK"], "202020":["CORA1E","PSASAS","EDCRJS","USHC01","USDR06"], "304050":["ERCDE2","DELT01","DECGKG","DEHC03","IS02","DEPI01"] }, "status":"SUCCESS" }; var obj = jQuery.parseJSON(JSON.stringify(json)); if (obj.status.toLowerCase() === "success") { for (var key in obj.result) { console.log("key >> "+key); if (obj.result.hasOwnProperty(key)) {   console.log(key

List of all countries in JSON

[ { "name" : "Afghanistan" , "code" : "AF" }, { "name" : "land Islands" , "code" : "AX" }, { "name" : "Albania" , "code" : "AL" }, { "name" : "Algeria" , "code" : "DZ" }, { "name" : "American Samoa" , "code" : "AS" }, { "name" : "AndorrA" , "code" : "AD" }, { "name" : "Angola" , "code" : "AO" }, { "name" : "Anguilla" , "code" : "AI" }, { "name" : "Antarctica" , "code" : "AQ" }, { "name" : "Antigua and Barbuda" , "code" : "AG" }, { "name" : "Argentina" , "code" : "AR" }, { "name" : &q

Singleton Design Pattern for Utility Clases

public class DateUtility {   private static DateUtility instance;         public static DateUtility getInstance() {    synchronized (DateUtility.class) {      if (instance == null) {        instance = new DateUtility();      } } return instance; }  public String convertDateToString(Date date) { ....................................... } } Usage : DateUtility.getInstance().convertDateToString();

Add PMD rules into your project

pom.xml <properties>              <pmd.failOnViolation>true</pmd.failOnViolation> </properties> <plugin>             <groupId>org.apache.maven.plugins</groupId>             <artifactId>maven-pmd-plugin</artifactId>             <version>3.1</version>             <executions>               <execution>                 <id>pmd</id>                 <phase>verify</phase>                 <goals>                   <goal>pmd</goal>                   <goal>check</goal>                   <goal>cpd</goal>                   <goal>cpd-check</goal>                 </goals>               </execution>             </executions>             <configuration>               <rulesets>                 <ruleset>target/classes/tps_standard_pmd_ruleset.xml</ruleset>               </rulesets

Convert XSD element choice with "maxOccurs=unbounded" into individual list of objects

Problem defined here: http://archive.oreilly.com/pub/a/onjava/2003/12/10/jaxb.html?page=2 Plugins used: https://github.com/highsource/jaxb2-basics/wiki/JAXB2-Simplify-Plugin XSD Sample <xs:schema xmlns:tns="http://www.omnicogroup.com/FPF/namespace" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://www.omnicogroup.com/FPF/namespace" xmlns:xs="http://www.w3.org/2001/XMLSchema">   <xs:element  name="transaction">     <xs:complexType>       <xs:sequence>         <xs:choice maxOccurs="unbounded">           <xs:element  name="TransactionDetails">             <xs:complexType>               <xs:sequence>                 <xs:choice >                   <xs:element  name="LogicalBusinessKey"  type="xs:integer" />                   <xs:element  name="RecordName" type="xs:s