Skip to content

Instantly share code, notes, and snippets.

@hidayat365
hidayat365 / Yii-Hightchart.php
Created December 11, 2012 03:30
Yii-Hightchart
<?php
$this->Widget('ext.highcharts.HighchartsWidget',
array(
'options'=>array(
'title' => array('text' => 'Accounts Receivable by Department'),
'chart' => array('height'=>320),
'series' => array(
array(
'type'=>'pie',
'name'=>'Receivable',
@hidayat365
hidayat365 / gist:4706105
Last active May 8, 2020 08:21
PostgreSQL cross-tab sample
-- -------------------------------
-- MySQL Only
-- -------------------------------
with grade_calculation as (
select '00001' student_code, 'N001' course_code, 90 grade union all
select '00001' student_code, 'N002' course_code, 95 grade union all
select '00001' student_code, 'N003' course_code, 80 grade union all
select '00001' student_code, 'N004' course_code, 75 grade union all
select '00002' student_code, 'N001' course_code, 70 grade union all
select '00002' student_code, 'N002' course_code, 80 grade union all
@hidayat365
hidayat365 / CContacts.vb
Last active December 12, 2015 09:39
Contoh Class untuk Data Access Helper dengan bantuan CommandBuilder untuk generate INSERT/UPDATE/DELETE secara otomatis
Imports System.Data
Imports System.Data.SqlServerCe
''' <summary>
''' Interface IDataAccess
''' </summary>
''' <remarks>Untuk keseragaman metode akses data</remarks>
Public Interface IDataAccess
Function GetData() As DataTable
@hidayat365
hidayat365 / DateFilter.vb
Created May 21, 2013 07:34
Query filter tanggal di VB.net dan database MS Access
' definisikan sql string
Dim sql As String = "SELECT * FROM [Order Summary] WHERE [Order Date] BETWEEN ? AND ?"
' definisikan variable untuk retrieve data
Dim dt As New DataTable
Dim cn As New OleDb.OleDbConnection(My.Settings.northwindConnectionString)
Dim da As New OleDb.OleDbDataAdapter(sql, cn)
' masukkan parameter query
da.SelectCommand.Parameters.AddWithValue("?_1", DateTimePicker1.Value.ToString("yyyy-MM-dd"))
@hidayat365
hidayat365 / referrals.css
Created May 22, 2013 05:02
Contoh Penggunaan CSS fontface
/* custom fonts from www.m2i-internasional.com */
@font-face {
font-family: 'BebasNeueRegular';
src: url('../fonts/BebasNeue-webfont.eot');
src: url('../fonts/BebasNeue-webfont.eot?#iefix') format('embedded-opentype'),
url('../fonts/BebasNeue-webfont.woff') format('woff'),
url('../fonts/BebasNeue-webfont.ttf') format('truetype'),
url('../fonts/BebasNeue-webfont.svg#BebasNeueRegular') format('svg');
font-weight: normal;
@hidayat365
hidayat365 / crosstab2.txt
Created May 23, 2013 23:17
Another MySQL crosstab query
D:\xampp\mysql\bin>mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
@hidayat365
hidayat365 / dbInsert.php
Created June 5, 2013 05:07
dbInsert Helper. Contoh penggunaan array untuk men-generate INSERT statement sehingga kita tidak perlu membuat INSERT statement secara manual
<?php
// database connection parameters
$db_host = 'localhost';
$db_port = 5432;
$db_name = 'db_name';
$db_user = 'postgres';
$db_pass = '*****';
// try connecting to database
@hidayat365
hidayat365 / trigger-demo.sql
Created June 14, 2013 23:52
Demonstrasi Trigger AFTER INSERT untuk mengubah field amount di table header berdasarkan insert ke table detail
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Nur Hidayat>d:
D:\>cd xampp\mysql\bin
D:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
@hidayat365
hidayat365 / union-all.sql
Last active May 13, 2022 02:56
Contoh Penggunaan UNION ALL
D:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
@hidayat365
hidayat365 / datediff.sql
Created July 1, 2013 09:50
MySQL: Menghitung selisih tanggal menggunakan fungsi DATEDIFF
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
D:\xampp\mysql\bin>mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.5.16 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.