Skip to content

Instantly share code, notes, and snippets.

View jpukg's full-sized avatar
🧭
Full Stack Developer (Java, Angular)

Jayaprakash / JP jpukg

🧭
Full Stack Developer (Java, Angular)
  • Brussels, Belgium
View GitHub Profile

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@jpukg
jpukg / gist:08525d90ecbdf26e3428
Created October 15, 2015 11:30 — forked from vicentebolea/gist:4375227
Aggregation vs composition OOP
simple rule:
we have object A and object Z.
if we have a pointer from object A to object Z then its aggregation.(no pointing from Z to A ,since it maks a simple relation).
if object Z cannot exists in the system without object A, then its composition.
its not that hard, even more ITS NOT THAT USEFUL. why? beacuse no body uses this stuff to the fine lines, its a loose model that lets you grasp what you want from the system.
@jpukg
jpukg / oo-ideas.md
Created October 15, 2015 11:33 — forked from stujo/oo-ideas.md

Object Oriented Ideas

Why

  • Represent our ideas
  • Manage Complexity

Generic OO Terms

  • Abstraction - Figuring out what abstractions express our requirements
  • Polymorphism - Using multiple abstractions in the same way
  • Inheritance - Sharing Implementation
@jpukg
jpukg / java_interview_question1.md
Created October 20, 2015 09:58 — forked from struts2spring/java_interview_question1.md
java interview question One

1. What is immutable object in Java? Can you change values of a immutable object?

A Java object is considered immutable when its state cannot change after it is created. Use of immutable objects is widely accepted as a sound strategy for creating simple, reliable code. Immutable objects are particularly useful in concurrent applications. Since they cannot change state, they cannot be corrupted by thread interference or observed in an inconsistent state. java.lang.String and java.lang.Integer classes are the Examples of immutable objects from the Java Development Kit. Immutable objects simplify your program due to following characteristics :

Immutable objects are simple to use test and construct. Immutable objects are automatically thread-safe. Immutable objects do not require a copy constructor. Immutable objects do not require an implementation of clone. Immutable objects allow hashCode to use lazy initialization, and to cache its return value. Immutable objects do not need to be copied defensively when

@jpukg
jpukg / CustomXpathTest
Created October 1, 2016 15:44 — forked from KalpaD/CustomXpathTest
CustomXpath Junit Test
package custom.xpath;
import java.io.File;
import java.io.FileNotFoundException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
@jpukg
jpukg / XsltServiceSaxonImpl.java
Created October 1, 2016 20:50 — forked from BDF/XsltServiceSaxonImpl.java
Figuring out why saxon does not find license file in a Spring MVC application.
import net.sf.saxon.lib.FeatureKeys;
import net.sf.saxon.s9api.Processor;
import net.sf.saxon.s9api.SaxonApiException;
import net.sf.saxon.s9api.XsltCompiler;
import net.sf.saxon.s9api.XsltExecutable;
import org.springframework.stereotype.Service;
import javax.xml.transform.stream.StreamSource;
import java.io.IOException;
@jpukg
jpukg / XSLTSaxonFunctionExtension.java
Created October 1, 2016 20:51 — forked from BDF/XSLTSaxonFunctionExtension.java
A very small example of using saxon:evaluate and saxon:linenumber(). I was having trouble getting the saxon:evaluate function to work correctly. The solution was very simple. When creating the processor pass in 'true' instead of 'false' (which is what most of the saxon examples use).
import net.sf.saxon.s9api.*;
import javax.xml.transform.stream.StreamSource;
import java.io.StringReader;
public class Main {
public static void main(String[] args) throws SaxonApiException {
String bookXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<books>\n" +
" <book category=\"reference\">\n" +
" <author>Nigel Rees</author>\n" +
@jpukg
jpukg / BasicToNTLMHttpComponentsMessageSender.java
Created October 1, 2016 21:03 — forked from yamanyar/BasicToNTLMHttpComponentsMessageSender.java
A simple HttpComponentsMessageSender to use in spring integration with out bound ws gateway to authenticate with NTLM
package com.secretcompany.esb.util.exchange;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.NTCredentials;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.xml.security.utils.Base64;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.ws.transport.WebServiceConnection;
@jpukg
jpukg / DataDomBuilder.java
Created October 1, 2016 21:09 — forked from rschumm/DataDomBuilder.java
JDBC, DOM und XSLT Utilities aus alten Zeiten...
/*
* Created on 26.05.2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
* $Id: DataDomBuilder.java,v 1.21 2004/02/05 09:27:55 rschumm Exp $
*/
package ch.zhwin.jdbc2xml;
@jpukg
jpukg / Data.java
Created October 1, 2016 21:11 — forked from dazfuller/Data.java
Method for transforming XML to XML using XSLT for Java/Android
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.StringReader;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;