Skip to content

Instantly share code, notes, and snippets.

View apremalal's full-sized avatar

Anuruddha apremalal

View GitHub Profile
@apremalal
apremalal / OptimizedBubbleSort.java
Created February 18, 2013 06:19
Bubble sort optimization implementation for integers in java
public class OptimizedBubbleSort {
public static void main(String args[]) {
int a[] = { 2, 3, 6, 1, 9, 2, 10, 5 };
int sorted[] = buble(a);
for (int x : sorted) {
System.out.print(x + " ");
}
}
public static int[] buble(int a[]) {
@apremalal
apremalal / root-context.xml
Created April 12, 2013 07:35
Spring bean configuration for gate web application
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:gate="http://gate.ac.uk/ns/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://gate.ac.uk/ns/spring
@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
/**
* Atomic counter that we use to obtain a unique ID for each handler
* instance.
*/
private static AtomicInteger nextId = new AtomicInteger(1);
Public Class Form1
'Global variables
Public value1 As Double
Public value2 As Double
Public previousOperator As Char
Public currentOperator As Char
Public operated As Boolean
Public answerPresented As Boolean
Public buttonClicked As String 'keep trak of the currently clicked button
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.0/css/jquery.dataTables_themeroller.css">
<title>DataTables example</title>
<script type="text/javascript" language="javascript" src="../../media/js/jquery.js"></script>
.MPartStack {
font-size: 9;
swt-simple: false;
swt-mru-visible: false;
swt-shadow-visible: true;
}
import unicodecsv,json
import sys
def convert2csv(data):
fieldnames = ['user_id','name','average_stars','review_count','type'] #Filed names to filter and record, json stream
with open('test.csv', 'wb+') as f:
dict_writer = unicodecsv.DictWriter(f, fieldnames=fieldnames)
dict_writer.writerow(dict(zip(fieldnames, fieldnames)))
for line in data:
@apremalal
apremalal / main.cpp
Created October 4, 2013 10:12
Simple opencv application
#include <QCoreApplication>
#include <cv.h>
#include<cxcore.h>
#include <highgui.h>
#include<iostream>
using namespace std;
using namespace cv;
@apremalal
apremalal / detector.cpp
Created October 19, 2013 03:21
Microfilari detection based on Canny edge detection.
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
using namespace cv;
using namespace std;
Mat src; Mat src_gray;
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
79.852452,
6.909472
]
},
"properties": {