Skip to content

Instantly share code, notes, and snippets.

View hermanwhyd's full-sized avatar

HermanW hermanwhyd

  • Jakarta, Indonesia
View GitHub Profile
@brettwold
brettwold / CustomAdapter.java
Last active December 14, 2022 17:52
Android adding a popup context menu to a RecyclerView
public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.ViewHolder> {
private List<CustomObject> objects;
private OnItemSelectedListener listener;
private final boolean withContextMenu;
class ViewHolder extends RecyclerView.ViewHolder
implements View.OnClickListener, View.OnCreateContextMenuListener, PopupMenu.OnMenuItemClickListener {
@BindView(R.id.custom_name)
@woemler
woemler / ComplexTableDescription.java
Created May 12, 2015 14:37
SQL building for more dynamic JDBC operations in Spring JdbcTemplates.
package me.woemler.sqlbuilder;
import org.springframework.util.Assert;
import java.util.Arrays;
import java.util.List;
/**
* Based on com.nurkiewicz.jdbcrepository.TableDescription, with a number of modifications.
*
@danferth
danferth / PDO classes.md
Last active May 15, 2023 01:17
PHP classes for PDO

PDO Classes for db connect and manipulation

Below is a description on how to use the classes in the below script

Include script and set up db variables

include 'zdb.php';
@blackcj
blackcj / ActivityEventListener.md
Created August 15, 2013 19:53
Demonstrates how to call a function in the parent Activity from within a Fragment.

Step 1: Add any functions you want to call into the interface (EventListener).

Step 2: Implement those functions in your MainActivity.

Step 3: Create the listener in your Fragment and attach it to the Activity.

Step 4: Call any functions on the listener.

@cworks
cworks / ResultSet to List
Created November 30, 2012 14:07
Java - Convert a ResultSet to a List of Maps, where each Map is a row of data
/**
* Convert the ResultSet to a List of Maps, where each Map represents a row with columnNames and columValues
* @param rs
* @return
* @throws SQLException
*/
private List<Map<String, Object>> resultSetToList(ResultSet rs) throws SQLException {
ResultSetMetaData md = rs.getMetaData();
int columns = md.getColumnCount();
List<Map<String, Object>> rows = new ArrayList<Map<String, Object>>();
@madan712
madan712 / ReadWriteExcelFile.java
Created October 18, 2012 14:35
Read / Write Excel file (.xls or .xlsx) using Apache POI
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;