Home about IT Motivation Course Sales Project About Me

Sunday, January 24, 2010

include_path in php.ini

the purpose for changes location folder path to certain path. default is dissable. Please set open the remark as below at php ini:
;;;;;;;;;;;;;;;;;;;;;;;;;; Paths and Directories ;;;;;;;;;;;;;;;;;;;;;;;;;;
; UNIX: "/path1:/path2";include_path = ".:/php/includes";; Windows: "\path1;\path2"
include_path = ".;c:\AppServ\php5\pear"

then please copy folder jpgraph, fpdf, adodb , etc to that path
then restart the apache services

Fatal error: Call to undefined function mssql_connect()

Got error messsage Fatal error: Call to undefined function mssql_connect() in C:\AppServ\www .. when perform PHP use MsSQL server 2005, and Appsrv. Whereas below code at php.in already unremark
extension=php_mssql.dll
;extension=php_msql.dll
extension=php_mysql.dll
extension=php_mysqli.dll
;extension=php_oci8.dll
and Apache services already restart, PC also.
and below dll files also keep at C:\AppServ\php5\ext:
- php_msql.dll and
- php_mssql.dll

please download ntwdblib.dll at http://webzila.com/?wz=dll#results then restore to folder:
C:\AppServ\Apache2.2\bin then restart the apache services

Friday, January 15, 2010

CUPS di LINUX

(Common UNIX Printing System)
The printing system for Unix computers. Designed by Michael Sweet in
the late 1990s, CUPS is the de facto standard for Linux and Unix
machines as well as the built-in printing system in the Macintosh as of
Mac OS X Version 10.2. Prior to CUPS, LPR/LPD, LP print spooler and
LPRng were used in conjunction with the appropriate printer drivers.
Apple used Tioga and the Apple Print Manager.

Starting and Stopping Apache


In order to restart Apache service from command prompt...
need to execute below mentioned command:
/scripts/restartsrv_apache/

di redhat: http://www.redhat.com/docs/manuals/
linux/RHL-9-Manual/ref-guide/s1-apache-startstop.html

10.4. Starting and Stopping httpd

The httpd RPM installs the /etc/rc.d/init.d/httpd script, which can be accessed using the /sbin/service command.

To start the server, as root type:

/sbin/service httpd start

To stop the server, as root type:

/sbin/service httpd stop

The restart option is a shorthand way of stopping and then starting the Apache HTTP Server.

To restart the server, as root type:

/sbin/service httpd restart
File konfigurasi Apache
disimpan di C:\Program Files\Apache Group\Apache2\conf\httpd.conf (kita
asumsikan Anda menginstall Apache di C:\Program Files\Apache Group ).
File ini berbentuk plain text sehingga Anda bisa menggunakan Notepad
atau Text Editor yang lain untuk mengedi



SWAP di LINUX

SWAP itu adalah pastisi harddisk yang dijadikan memori,
semacam virtual memori kalo di windows.

Extended itu adalah format partisi utama linux
yang dipakai buat install linux, biasanya pake ext3,
klo di windows perbandingannya kaya format FAT32 atau NTFS

Sunday, January 10, 2010

Component di VB6

karena sering lupa, dan suka pindah pindah PC, maka berikut resume componen control di VB:
- DTPicker: ada di Microsoft Windows Common Controls-2 6.0
- ADODC di : di Microsoft ADO Data control 6.0 (OLEDB)
- DataCombo (bukan Combobox) dan DataList di Microsoft DataList control 6.0 (OLEDB)
- Crystal Report di Crystal report control
- DATA dan DBGRID , ada pada VB5
bila ingin masih pake di VB6. maka harus register dbgrid32.ocx (tgl: 26/06/1998, size: 514 KB) di c:\windows\system32.exe memakai "regsvr32.exe"

Saturday, January 09, 2010

script dan storeprocedure di SQL Server

Berikut script dan storeprosedure beserta kegunaannya:
didokumentasikan karena sering lupa/ jarang pakai.
dijalaninn pake SQL Analyser atau lainnya.

koneksi ke sesama SQL Server
EXEC sp_addlinkedserver ‘[Nama Server Tujuan]‘,N’SQL Server’

Versi dari SQL Server;
select @@version
pernah kejadian salah install personal edition untuk Live database production. gara-gara tidak cek dulu. Diomelin semua di orang 4 negara (Japan, Hongkong, Malaysia dan Indonesia sendiri). Tapi jalan lo untuk 50 user, cuma lambat aje.

Apabila server tujuan tidak menggunakan user ’sa’, maka perlu di set user n passwordnya.dengan menjalankan query berikut.
EXEC sp_addlinkedsrvlogin ‘[Server Name]‘, ‘false’, NULL, ‘[SQLUser]‘, ‘[Password]‘

attach database
EXEC sp_attach_db @dbname = 'KARYA_KITA',
@filename1 = 'D:\mssql\karya_kita.mdf',
@filename2 = 'D:\mssql\karya_kitalog.ldf'
cara ini lebih mudah ketika kita ingin nama database nya kita rubah namanya.
lebih mudah daripada memakai cara di SQL server management studio.


drop database KARYA_KITA
USE MASTER
GO
DROP DATABASE KARYA_KITA
-->hati hati karena file database akan terhapus juga.
kalo ingin database nya tetap keep di folder,
pakai detach dari SQL server management studio

:::liat semua nama tabel di satu database
:::.
USE
YourDBName
GO
SELECT
*
FROM
sys.Tables
GO

:::liat semua nama database di satu server:::.
use master
select * from sysdatabases


:::liat semua nama tabel di satu server:::.

sp_msforeachdb @command1='USE ?;SELECT * FROM sys.Tables'


:::liat semua tabel di satu database:::.
select * from sysobjects where type='u'

:::liat semua store procedure di satu database:::.
select * from sysobjects where type='p'

:::insert data ke suatu tabel:::.
INSERT INTO nama_tabel (kolom1, kolom2..)
VALUES (nilai1, nilai2...)
contoh:
insert into pegawai (nopeg,nama,jabatan,gaji)
values ('011','rina','akuntan','5000000');


:::updated/ ubah data:::.
UPDATE nama_tabel
SET kolom1=nilai1
[,kolom2=nilai2]..
WHERE kondisi
contoh:
update pegawai set jabatan='direktur'
where nama='putri'

:::delete / hapus data:::.
DELETE FROM nama_tabel
WHERE kondisi
contoh:
delete from pegawai where nama = 'rina';

:::create / bikin tabel baru dan bikin primary key :::.
contoh: di Oracle spt ini
create table tb_dummy
(
Sr varchar2(3),
PayMonth varchar2(6),
Badge_No varchar2(6),
Nama varchar2(50),
Dept varchar2(10
constraint dummy_pk primary key (paymonth , badge_no )) ;





Thursday, January 07, 2010

Crosstab query di SQL 2005

dulu untuk bikin crosstab Pivot tabel pakai cara berikut:

SELECT Bulan,
SUM(CASE Sales WHEN 'Agus' THEN Jumlah ELSE 0 END) AS Agus,
SUM(CASE Sales WHEN 'Dani' THEN Jumlah ELSE 0 END) AS Dani,
SUM(CASE Sales WHEN 'Fahmi' THEN Jumlah ELSE 0 END) AS Fahmi,
SUM(CASE Sales WHEN 'Firstman' THEN Jumlah ELSE 0 END) AS Firstman,
SUM(CASE Sales WHEN 'Rully' THEN Jumlah ELSE 0 END) AS Rully,
SUM(Jumlah) as [Y Total]
FROM tblSamplePivot
GROUP BY Bulan
UNION
SELECT 'X Total' AS Bulan,
SUM(CASE Sales WHEN 'Agus' THEN Jumlah ELSE 0 END) AS Agus,
SUM(CASE Sales WHEN 'Dani' THEN Jumlah ELSE 0 END) AS Dani,
SUM(CASE Sales WHEN 'Fahmi' THEN Jumlah ELSE 0 END) AS Fahmi,
SUM(CASE Sales WHEN 'Firstman' THEN Jumlah ELSE 0 END) AS Firstman,
SUM(CASE Sales WHEN 'Rully' THEN Jumlah ELSE 0 END) AS Rully,
SUM(Jumlah) as [Y Total]
FROM tblSamplePivot


sekarang di SQL 2005 pake cara berikut bisa:
SELECT Bulan,
ISNULL([Agus],0) AS Agus,
ISNULL([Dani], 0) AS Dani,
ISNULL([Fahmi], 0) AS Fahmi,
ISNULL([Firstman], 0) AS Firstman,
ISNULL([Rully], 0) AS Rully,
[X Total]
FROM(
SELECT Bulan, Sales, ISNULL(Jumlah, 0) AS Jumlah FROM tblSamplePivot
UNION
--Retrieve Data untuk Total dari tiap bulan
SELECT Bulan, 'X Total' as Sales, SUM(Jumlah) AS Jumlah FROM tblSamplePivot GROUP BY Bulan
UNION
--Retrieve Data untuk Total dari tiap Sales
SELECT 'Y Total' AS Bulan, Sales, SUM(Jumlah) AS Jumlah FROM tblSamplePivot GROUP BY Sales
UNION
--Retrieve Data untuk Total Keseluruhan
SELECT 'Y Total' AS Bulan, 'X Total' AS Sales, SUM(Jumlah) AS Jumlah FROM tblSamplePivot
) AS PS
PIVOT
(
SUM(Jumlah) FOR Sales IN(Agus, Dani, Fahmi, Firstman, Rully, [X Total])
) P

diambil dari : http://waroengvb.net/crosstab-query-menggunakan-pivot-pada-sql-server/

Sunday, January 03, 2010

Buat report di PHP

ada banyak macamnya :
(1) pakai class fpdf (http://www.fpdf.org)

(2) pakai class tcpdf (http://www.tcpdf.org)

(3) pakai crystalreport

(4) pakai html2pdf (http://html2fpdf.sourceforge.net)
Sepertinya pake html2pdf tidak bisa untuk report repot yang model invoice, yang memerlukan header dan footer dan summary total amount di halaman terakhir.

Friday, January 01, 2010

auto generate Code

Berikut contoh salah satu untuk membuat Kode Otomatis (auto generate Code) dari system

$sql_isi ="SELECT * FROM permohonan_cuti";
$qr_isi =mysql_query($sql_isi, $koneksi) or die ("Gagal query".mysql_error());
if (mysql_num_rows($qr_isi) <=0) {
$kd_pcuti="PC001";
}
else {
$sql_kdpcuti="SELECT MAX(RIGHT(kd_pcuti,3)) + 1 AS kd_pcuti_baru FROM permohonan_cuti";
$qr_kdpcuti=@mysql_query($sql_kdpcuti) or die ("Gagal query".mysql_error());
$hs_kdpcuti=mysql_fetch_array($qr_kdpcuti) or die ("Hasil pemakai tidak ada");
$kd_pcuti_baru=$hs_kdpcuti[kd_pcuti_baru];

if ($kd_pcuti_baru < 10 ) {
$kd_pcuti="PC00".$kd_pcuti_baru;
}
elseif ($kd_pcuti_baru < 100) {
$kd_pcuti="PC0".$kd_pcuti_baru;
}
elseif ($kd_pcuti_baru < 1000) {
$kd_pcuti="PC".$kd_pcuti_baru;
}
}