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
@tsegismont
tsegismont / gist:2960038
Created June 20, 2012 14:01
Default Transaction Interception for spring @service objects
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
<property name="dataSource" ref="myDS" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<aop:config>
<aop:pointcut id="defaultServiceMethodTxPointcut"
expression="execution(!@org.springframework.transaction.annotation.Transactional * *(..))
@vicentebolea
vicentebolea / gist:4375227
Created December 25, 2012 20:20
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.
@struts2spring
struts2spring / java_interview_question1.md
Last active December 29, 2015 15:59
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

@raineorshine
raineorshine / built-in.md
Created March 12, 2014 18:23
55 Must Know Built-In Javascript Methods and Operators
@michaljemala
michaljemala / tls-client.go
Last active May 31, 2024 02:51
SSL Client Authentication Golang sample
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io/ioutil"
"log"
"net/http"
)
@stephen-maina
stephen-maina / Email functionalitoes javamail
Last active November 21, 2022 19:51
Basic Email activities using javamail and saving of files on a cloud storage facility eg. AWS
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;

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
@paulirish
paulirish / how-to-view-source-of-chrome-extension.md
Last active May 30, 2024 06:59
How to view-source of a Chrome extension

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

@xSAVIKx
xSAVIKx / Demo.java
Created March 20, 2017 20:54
JAXB Custom Adapter Example
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Marshaller;
/**
* Created by User on 20.03.2017.
*/
public class Demo {
public static void main(String[] args) throws JAXBException {
JAXBContext context = JAXBContext.newInstance(Type.class, InnerType.class);
@alejandro-du
alejandro-du / gist:3b417f3c5c83bf15571c59f0158c1672
Created May 2, 2017 09:56
Vaadin 8.1 - Grid Drag and Drop example
package com.example;
import com.vaadin.shared.ui.grid.DropMode;
import com.vaadin.ui.Grid;
import com.vaadin.ui.GridDragSource;
import com.vaadin.ui.GridDropTarget;
import com.vaadin.ui.VerticalLayout;
import java.util.List;