Skip to content

Instantly share code, notes, and snippets.

@tedheich
tedheich / cupsd.conf
Created October 5, 2011 13:37
Default configuration of CUPS
# Administrator user group...
SystemGroup lpadmin
# Only listen for connections from the local machine.
Listen localhost:631 #change this to Listen youripaddress:631
Listen /var/run/cups/cups.sock
# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
#import <Foundation/Foundation.h>
@interface Hello: NSObject {
}
- (void) sayhello ;
@end
@tedheich
tedheich / Hi.m
Created March 7, 2011 11:31
Simplistic Hello World program in objective C
#include <Foundation/Foundation.h>
@interface Hi:NSObject {}
- (void) hi;
@end
@implementation Hi
@tedheich
tedheich / Repl.java
Created November 26, 2009 14:09
Accept Input from keyboard - a bit more modularized
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
class Repl {
InputStreamReader isr = null;
BufferedReader br = null;
@tedheich
tedheich / AcceptInputFromKB.java
Created November 26, 2009 13:50
Code to accept keyboard input in Java
import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.IOException;
class AcceptInputFromKB {
public static void main(String []args) throws IOException {
InputStreamReader isr = new InputStreamReader (System.in);
BufferedReader br = new BufferedReader (isr);
@tedheich
tedheich / ByteOps.java
Created November 26, 2009 07:13
Exercise on java bytes
class ByteOps {
public static void main(String []args) {
byte a = 127;
byte b = 1;
for (int i = 1;i<128;i++){
a = (byte) (a + b);
System.out.println("byte a = " + a);
}
@tedheich
tedheich / MultiplicationTable.java
Created November 26, 2009 01:39
Code to generat Multiplication table - this seems to be a famous assignments for students
class MultiplicationTable {
public static void main(String []args) {
int rows=10;
int columns=10;
for(int i=1;i<=rows;i++) {
for(int j=1;j<=columns;j++){
System.out.print(i*j + "\t");
@tedheich
tedheich / DBSample.java
Created November 25, 2009 13:19
Boiler plate code in java database programming - using sqlite
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.Statement;
import java.sql.ResultSet;
import java.sql.SQLException;
class DBSample {
public static void main(String []args){
@tedheich
tedheich / server.xml
Created November 23, 2009 00:56
Snippet of /tomcat/conf/server.xml -- shows the part where to edit the non ssl http 1.1
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
/home (rw,sync,no_subtree_check,insecure)
/mnt/badass (rw,sync,no_subtree_check,insecure)