Skip to content

Instantly share code, notes, and snippets.

@rrguntaka
rrguntaka / run_for_each_file
Created October 11, 2012 22:07
Run a system command for matched files
for fname in glob.glob('./*.jar'): os.system("echo " + fname)
@rrguntaka
rrguntaka / ora_segment_details.sql
Created September 12, 2012 15:45
Oracle Table segment details, to find the space usage for given table
select extent_id, bytes, blocks
from user_extents
where segment_name = '&table_name'
/
select blocks, empty_blocks, avg_space, num_freelist_blocks
from user_tables
where table_name = '&table_name'
/
@rrguntaka
rrguntaka / box_shadow.html
Created August 27, 2012 18:17
Layered Box with Shadow CSS3
<html>
<head>
<title></title>
<style>
#example1 {
box-shadow: 5px 5px 15px 3px #999;
width: 200px;
padding: 2px 10px;
background-color: #F1F1F1;
}
@rrguntaka
rrguntaka / TextFileParser.java
Created August 17, 2012 15:09
Parse a text file and process batches
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javaperfdemo;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@rrguntaka
rrguntaka / resultset_to_map.java
Created August 15, 2012 15:27
JDBC Result set to Java HashMap
try {
Class.forName(driver);
Connection con = DriverManager.getConnection(url + db, user, pass);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
ResultSetMetaData rsmd = rs.getMetaData();
List<String> columns = new ArrayList<String>(rsmd.getColumnCount());
for(int i = 1; i <= rsmd.getColumnCount(); i++){
columns.add(rsmd.getColumnName(i));
}
@rrguntaka
rrguntaka / plsql_obj_rel_concepts.sql
Created July 31, 2012 14:36
PL/SQL Object-Relational Concepts
select t.* from obj t where t.created > sysdate - 1;
create or replace type person_typ as object(
idno number,
first_name varchar2(50),
last_name varchar2(50))
not final;
create table person_obj_tab(p person_typ);
@rrguntaka
rrguntaka / page1.html
Created July 10, 2012 18:47
rounded corner box with shadow HTML template
<html>
<head>
<title>Page 1</title>
<style type="text/css">
.roundContainer {
box-shadow:0px 0px 70px #222;
-moz-box-shadow:0px 0px 70px #222;
@rrguntaka
rrguntaka / test_graph.txt
Created April 12, 2012 19:53
A sample directed graph to test some traversal algorithms
1 2 3
2 3 4
3 4 5 7
4 1 6
5 6
6 7 8 10
7 5 8 10
8 9 11
9 10
10 8 11
@rrguntaka
rrguntaka / course_score.sql
Created March 28, 2012 17:19
Online Course Progress
select t1.*, t2.score,t2.total from oc_course t1,
(SELECT class_id,sum(weight*score/max_points) score, sum(weight) total FROM `oc_score` WHERE selected = 1 group by class_id) t2 where t1.class_id = t2.class_id
CREATE TABLE InvRec(
rcpt_nr integer primary key,
purchase_date datetime not null,
qty_on_hand integer not null
check (qty_on_hand>= 0),
unit_price decimal(12,4) not null
);
insert into InvRec values(1,'2011-01-01',15,10.00);