This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Splitter { | |
public String[] split(String original, String separator) { | |
Vector nodes = new Vector(); | |
// Parse nodes into vector | |
int index = original.indexOf(separator); | |
while (index >= 0) { | |
nodes.addElement(original.substring(0, index)); | |
original = original.substring(index + separator.length()); | |
index = original.indexOf(separator); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Created on Feb 10, 2012 | |
This module will be used to answer a set of questions and to | |
give intelligent answers | |
@author: Duli-chan | |
''' | |
import time | |
import re | |
print("We will now analyze what programming component is good for you?") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package app.posmachine.machine; | |
import java.io.IOException; | |
import java.io.OutputStream; | |
import java.util.Enumeration; | |
import javax.comm.CommPortIdentifier; | |
import javax.comm.SerialPort; | |
public class PosPrinter { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dchan.orm; | |
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.JPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
@author: dulithar(Dulitha Ransanga Wijewantha) | |
Helping a Stack Overflow Question | |
a[0] = [0, 1, 2] | |
a[1] = [0, 2, 2] | |
a[2] = [100, 200, 300] | |
Should output as - [{0:2, 100:1}, {1:1, 2:1, 200:1}, {2:2, 300:1}] | |
Not sure about the efficiency of the code. But you can find better solutions at http://stackoverflow.com/q/13699169/813471 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dchan.context; | |
import java.awt.BorderLayout; | |
import java.awt.EventQueue; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.File; | |
import java.io.FileWriter; | |
import java.io.IOException; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.dchan.ui; | |
import java.awt.CardLayout; | |
import javax.swing.JPanel; | |
/** | |
* | |
* @author Dchan(Dulitha Wijewantha) | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import psycopg2 | |
import sys | |
connection = None | |
try : | |
connection = psycopg2.connect(database='postgres', user='test', host='localhost') | |
cur = connection.cursor() | |
cur.execute('SELECT version()') | |
ver = cur.fetchone() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.test.frame; | |
import java.awt.Color; | |
import java.awt.Font; | |
import java.awt.Graphics; | |
import java.awt.Graphics2D; | |
import java.awt.Image; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.awt.geom.AffineTransform; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try: | |
import gtk, pynotify | |
pygtk.require('2.0') | |
except: | |
print "Error: need python-notify, python-gtk2 and gtk" | |
class NotificationWrapper: | |
def __init__(self, title="Testing Title", message="Testing message"): | |
self.title = title | |
self.message = message | |
def showNotification(self): |
OlderNewer