Skip to content

Instantly share code, notes, and snippets.

@rangalo
rangalo / Scheduler.Java
Created October 26, 2015 12:57
EJB timer
package com.firstscope.asynchronous;
import javax.ejb.Schedule;
import javax.ejb.Singleton;
import javax.ejb.Startup;
/**
* @author: hardik
* @since: 26.10.15.
*/
{
"id":1,
"name":
"Company 1",
"slaTime":60,
"slaPercentage":0.9,
"currentSlaPercent":0.95
}
{
@rangalo
rangalo / HelloWorld.scala
Created June 15, 2015 18:35
scala regex code
import scala.util.matching.Regex
object HelloWorld {
def main(args: Array[String]) {
val pattern = new Regex("Id=(.*)")
val str = "http://www.xyz.com?Id=798"
val res = pattern.findAllMatchIn(str)
res.foreach { m =>
@rangalo
rangalo / registerUnregisterJmx.java
Last active August 29, 2015 14:19
Registering jmx
@PostConstruct
public void registerInJMX() {
try {
objectName = new ObjectName("Scope1:type=" + this.getClass().getName());
platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
platformMBeanServer.registerMBean(sc.getBusinessObject(HealthMonitor.class), objectName);
} catch (IllegalStateException | InstanceAlreadyExistsException | MBeanRegistrationException | MalformedObjectNameException | NotCompliantMBeanException e) {
throw new IllegalStateException("Problem during registration of Monitoring into JMX:" + e);
}
}
<h:outputLabel for="pwd1" value="Password 1: *" />
<p:password id="pwd1" value="#{passwordBean.password6}" feedback="false" match="pwd2" label="Password 1" required="true"/>
 
<h:outputLabel for="pwd2" value="Password 2: *" />
<p:password id="pwd2" value="#{passwordBean.password6}" feedback="false" label="Password 2" required="true"/>
@rangalo
rangalo / gitLogAlias
Created March 13, 2015 09:48
gitLogAlias
[alias]
ci = commit
br = branch
co = checkout
st = status
lg1 = log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all
lg2 = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
lg = !"git lg1"
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.firstscope</groupId>
<artifactId>scopeone</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>First scopeapplication</description>
<packaging>war</packaging>
@rangalo
rangalo / setEclipsePath
Last active August 29, 2015 14:16
Set eclipse path
# open ~/.bashrc in your favorite editor (gedit, sublime, vim etc)
# add following to the file
# eclipse
export PATH=${PATH}:${HOME}/apps/eclipse
@rangalo
rangalo / installEclipse
Last active August 29, 2015 14:16
Install eclipse
cd ~/apps
tar xvf ~/Downloads/eclipse-jee-luna-SR2-linux-gtk-x86_64.tar.gz
@rangalo
rangalo / setMavenPath
Last active August 29, 2015 14:16
Set maven path
# open ~/.bashrc in your favorite editor (gedit, sublime, vim etc)
# add following to the file
# maven
export M2_HOME=${HOME}/apps/maven
export PATH=${PATH}:${M2_HOME}/bin