Skip to content

Instantly share code, notes, and snippets.

View sourabh86's full-sized avatar

Sourabh Soni sourabh86

View GitHub Profile
@sourabh86
sourabh86 / Employee.java
Last active December 24, 2015 16:19
Employee class for hibernate 4 example
package com.cc.example.hibernate;
public class Employee {
private String firstName;
private String lastName;
private String email;
private long id;
public String getFirstName() {
return firstName;
}
@sourabh86
sourabh86 / hibernate.cfg.xml
Created October 4, 2013 14:35
hibernate configuration xml for hibernate 4 example
<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost:3306/hibernatedb</property>
<property name="connection.username">root</property>
@sourabh86
sourabh86 / regexExample.cpp
Created October 4, 2013 14:30
main cpp file for Boost regex example
#include <boost/regex.hpp>
#include <iostream>
#include <string>
int main()
{
std::string line;
boost::regex pat( "^Subject: (Re: |Fw: )*(.*)" );
while (std::cin)
@sourabh86
sourabh86 / MainActivity.java
Created October 4, 2013 14:22
Main Activity for Action time tick example
package com.cc.demo.digiClock;
import java.util.Calendar;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
@sourabh86
sourabh86 / activity_main.xml
Created October 4, 2013 14:17
Activity_main for action time tick example
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:orientation="vertical">
<!-- Text View to show hour-->
<TextView
android:id="@+id/hourText"
android:layout_width="wrap_content"
@sourabh86
sourabh86 / TagDetailsActivity.java
Created October 3, 2013 19:16
Activity to show all the messages which has the selected hashtag (for HashTags example)
package com.sourabhsoni.hashtags;
import java.util.ArrayList;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.ArrayAdapter;
import android.widget.ListView;
@sourabh86
sourabh86 / AndroidManifest.xml
Created October 3, 2013 19:08
Android Manifest for HashTags example
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sourabhsoni.hashtags"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
@sourabh86
sourabh86 / activity_tag_details.xml
Created October 3, 2013 19:05
Activity which is called when a user clicks on a HashTag, for HashTags example
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/messagesWithTag"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
@sourabh86
sourabh86 / TagProvider.java
Created October 3, 2013 19:02
Custom content provider for HashTag example.
package com.sourabhsoni.hashtags;
import android.content.ContentProvider;
import android.content.ContentValues;
import android.database.Cursor;
import android.net.Uri;
public class TagProvider extends ContentProvider {
@Override
@sourabh86
sourabh86 / activity_main.xml
Last active December 24, 2015 14:39
UI part of main activity for HashTags example
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >