Skip to content

Instantly share code, notes, and snippets.

View topriddy's full-sized avatar

Temitope topriddy

View GitHub Profile
@topriddy
topriddy / CRUD Xxxx
Created January 17, 2012 11:04
Simple CRUD
@Transactional(type = TransactionType.READ_ONLY)
@Override
public <T> List<T> findAll(Class<T> clazz) throws MTrackerException{
Criteria criteria = session.get().createCriteria(clazz);
return criteria.list();
}
@Transactional(type = TransactionType.READ_ONLY)
public <T> List<T> findAll(Class<T> clazz, int start, int size) throws MTrackerException{
Criteria criteria = session.get().createCriteria(clazz);
private void addCompanyTable() {
IDataProvider dataProvider = new IDataProvider() {
public Iterator iterator(int first, int count) {
Iterator iter = null;
try {
List<TrackDeviceCompany> list = dao.findAll(TrackDeviceCompany.class, first, count);
iter = list.iterator();
} catch (Exception ex) {
logger.error("Exception occured getting iterator for company", ex);
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:wicket>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>AlertPanel</title>
</head>
<body>
<wicket:panel>
<div wicket:id="wrapper" class="alert">
@topriddy
topriddy / DivLinkExample .java
Created February 10, 2012 11:55
This Gist demonstrates how to stop internal link from propagating events higher the dom level after handling it
package com.sf.topriddy;
import org.apache.wicket.ajax.AjaxEventBehavior;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxFallbackLink;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.util.string.AppendingStringBuffer;
@topriddy
topriddy / Student.java
Created March 23, 2012 10:05
A simple Lombok Example, documented here for peace.
package com.topriddy.app;
import lombok.Data;
import lombok.NonNull;
@Data
public class Student {
public enum Sex {MALE, FEMALE};
@NonNull private String matricNumber;
@topriddy
topriddy / AdditionUI.java
Created April 13, 2012 09:23
Simple example that demonstrates concept of MVC in a java app
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
@topriddy
topriddy / MapPanel.html
Created May 11, 2012 13:07
Fairly Reusable GoogleMap Wicket Component
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns:wicket>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>TrackListMapPanel</title>
<wicket:head>
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/>
<style type="text/css">
#map_canvas{
@topriddy
topriddy / Jambito.java
Created June 27, 2012 14:17
Sample code on how to do a quick launch on click of a Blackberry Icon to browser
package com.topriddy.jambito.mobile;
import net.rim.blackberry.api.browser.Browser;
import net.rim.blackberry.api.browser.BrowserSession;
import net.rim.device.api.ui.UiApplication;
public class Jambito extends UiApplication {
private static final String START_URL ="http://www.mobilejamb.appspot.com";
public static void main(String args[]) {
BrowserSession browserSession = Browser.getDefaultSession();
@topriddy
topriddy / README.md
Created September 10, 2016 11:44
Steps for Integrating Jacoco in IntelliJ IDEA
  1. Integrate the dependency and plugin sections to relevant parts in your pom.xml from the pom.xml_fragment file below.
  2. Run "mvn clean package" to generate the results
  3. In IntelliJ, Select "Analyse -> Show Coverage Data..." and pick your Jacoco output file. This should be the path specified in the plug-in config i.e: ${basedir}/target/coverage-reports/jacoco-unit.exec

Output should be displayed in the IDE and you should also have the classes overlayed with test coverage.

@topriddy
topriddy / AbstractDaoHibernateImpl.java
Created September 16, 2017 16:20
Sample Hibernate AbstractDAOImpl utility class from an old project 2014.
package ng.myproject.backend.dao.impl;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import lombok.extern.log4j.Log4j;
import ng.myproject.backend.dao.Dao;
import ng.myproject.backend.entities.DomainObject;