Skip to content

Instantly share code, notes, and snippets.

View radityopw's full-sized avatar

radityo radityopw

View GitHub Profile
<!DOCTYPE HTML>
<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<title>Graph2d | Basic Example</title>
<style type="text/css">
body, html {
class Node
attr_writer :data, :index, :next, :prev
attr_reader :data, :index, :next, :prev
end
class My_list
attr_reader :node,:total
def add(data)
require "find"
require "fileutils"
targets = ARGV
for target in targets
Find.find(target) do |path|
if FileTest.directory?(path)
next
else
print path,"\n"
end
@radityopw
radityopw / server.rb
Created April 3, 2011 09:40
server.rb
require 'webrick'
include WEBrick
port = 8090
if ARGV.length > 0 then
port = ARGV[0]
end
# Create an HTTP server
@radityopw
radityopw / multiple_kategori.php
Created May 28, 2011 04:16
multiple kategori view as <ul><li>
<?php
$con = mysql_pconnect("server location","server user","server pass");
mysql_select_db("yourdb",$con);
function list_all_kategori($parent_id,$level=0){
global $con;
$sql = "SELECT * FROM kategori WHERE parent_id='".$parent_id."'";
$res = mysql_query($sql,$con);
$data = array();
@radityopw
radityopw / kategori.sql
Created May 28, 2011 04:18
multiple kategori table structure
CREATE TABLE IF NOT EXISTS `kategori` (
`id` bigint(255) NOT NULL AUTO_INCREMENT,
`nama` varchar(255) NOT NULL,
`parent_id` bigint(255) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
@radityopw
radityopw / mail_in.sql
Created June 2, 2011 21:58
save the mail to db
CREATE TABLE IF NOT EXISTS `mail_in` (
`id` bigint(255) NOT NULL auto_increment,
`tanggal` varchar(255) NOT NULL,
`uid` varchar(255) NOT NULL,
`from` varchar(255) NOT NULL,
`to` varchar(255) NOT NULL,
`subject` varchar(255) NOT NULL,
`body` longtext NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uid` (`uid`)
@radityopw
radityopw / index.zk
Created October 30, 2011 12:35
checkbox in listbox with zk framework...
<?xml version="1.0" encoding="UTF-8"?>
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="win"?>
<!--
index.zul
{{IS_NOTE
Purpose:
Description:
@radityopw
radityopw / MyListBox.java
Created October 30, 2011 12:36
checkbox in listbox with zk framework...
/**
* @author radityo.p.w (radityo.p.w@gmail.com)
* @version 1.0
*/
package controller;
import entity.DaftarMahasiswa;
import entity.Mahasiswa;
import java.util.ArrayList;
import java.util.Iterator;
@radityopw
radityopw / my_correlation.php
Created January 8, 2012 12:27
Correlation over 2 arrays
<?php
function my_correlation($a_x,$a_y){
$len = count($a_x);
$jml_x = 0;
$jml_y = 0;
$jml_xy = 0;