Skip to content

Instantly share code, notes, and snippets.

@asicfr
asicfr / TestClass.java
Created May 2, 2016
Properties and ResourceBundle from Xml file
View TestClass.java
package test;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.ResourceBundle;
public class TestClass {
View DataLayerReceiver.js
function DataLayerReceiver(callBack) {
this.dataLayerByName = [];
this.callBack = callBack;
}
DataLayerReceiver.prototype.emit = function (publisherName, publisherData) {
console.log('emit from ', publisherName);
var complete = true;
for (var i = 0; i < this.dataLayerByName.length; i++) {
View test.js
// test DOMContentLoaded
console.log('parse test.js from gits'+(+new Date));
var pubpubExt = t1.attach("pubExt");
setTimeout(function () {
pubpubExt("emit pubpubExt");
}, 1000);
View gist:12d50de4f792fe165290
db.adminCommand({"addshard":"s1/localhost:37017"});
db.adminCommand({"addshard":"s2/localhost:47017"});
db.adminCommand({"enablesharding":"test"});
db.adminCommand({"shardcollection":"test.users","key":{"_id":1}});
sh.status();
View MyLogError
[ERROR] Failed to execute goal org.owasp:dependency-check-maven:1.4.5:check (default-cli) on project backend-app: Execution default-cli of goal org.owasp:dependency-check-maven:1.4.5:check failed: A required class was missing while executing org.owasp:dependency-check-maven:1.4.5:check: org/joda/time/ReadableInstant
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.owasp:dependency-check-maven:1.4.5
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/D:/outils/m2repository/org/owasp/dependency-check-maven/1.4.5/dependency-check-maven-1.4.5.jar
[ERROR] urls[1] = file:/D:/outils/m2repository/org/owasp/dependency-check-core/1.4.5/dependency-check-core-1.4.5.jar
[ERROR] urls[2] = file:/D:/outils/m2repository/joda-time/joda-time/1.6/joda-time-1.6.jar
[ERROR] urls[3] = file:/D:/outils/m2repository/org/apache/commons/commons-compress/1.13/commons-compress-1.13.jar
[ERROR] urls[4] = file:/D:/outils/m2repository/commons-io/comm
@asicfr
asicfr / GenericJpaDao.java
Created Oct 15, 2012
struts2RestJpaBootstrap - dao generic
View GenericJpaDao.java
package org.demo.util;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
@asicfr
asicfr / Test.java
Created Jun 1, 2016
The distinction between hiding and overriding method
View Test.java
class A {
public static void display() {
System.out.println("Inside static method of superclass");
}
}
class B extends A {
public void show() {
display();
}
View gist:6464246
public class App implements FizzBuzzInterface {
private static final String result = "1\n2\nFizz\n4\nBuzz\nFizz\n7\n8\nFizz\nBuzz\n11\nFizz\n13\n14\nFizzBuzz\n16\n17\nFizz\n19\nBuzz\nFizz\n22\n23\nFizz\nBuzz\n26\nFizz\n28\n29\nFizzBuzz\n31\n32\nFizz\n34\nBuzz\nFizz\n37\n38\nFizz\nBuzz\n41\nFizz\n43\n44\nFizzBuzz\n46\n47\nFizz\n49\nBuzz\nFizz\n52\n53\nFizz\nBuzz\n56\nFizz\n58\n59\nFizzBuzz\n61\n62\nFizz\n64\nBuzz\nFizz\n67\n68\nFizz\nBuzz\n71\nFizz\n73\n74\nFizzBuzz\n76\n77\nFizz\n79\nBuzz\nFizz\n82\n83\nFizz\nBuzz\n86\nFizz\n88\n89\nFizzBuzz\n91\n92\nFizz\n94\nBuzz\nFizz\n97\n98\nFizz\nBuzz\n";
@Override
public String call() {
return result;
}
}
View gist:5524945
var montext = "test";
var data = {
get text() { return montext; },
set text(val) { montext = val; }
};
View gist:5524741
var app = angular.module('myApp', []);
app.controller('MainCtrl', ['$scope', 'myService', function ($scope, myService) {
console.log('online');
$scope.data = myService.outData;
$scope.showData = function () {
myService.showData();
};
}]);
You can’t perform that action at this time.