Skip to content

Instantly share code, notes, and snippets.

View radityopw's full-sized avatar

radityo radityopw

View GitHub Profile
<?php
$con = mssql_pconnect("server","user","pass");
if (!$con || !mssql_select_db('database', $con)) {
die('Unable to connect or select database!');
}
$sql = "SELECT type, data FROM FILES WHERE name = '".$namefile."'";
$res = mssql_query($sql,$con);
@radityopw
radityopw / free_up_memory_php_excel.php
Last active January 4, 2022 05:11
free up memory on phpExcel
$objPHPExcel->disconnectWorksheets();
unset($objPHPExcel);
@radityopw
radityopw / wsrp_hoho.java
Created February 8, 2013 15:43
wsrp url extract.....
String url = p2.encodeURL(p1.getContextPath()+"/AppContext/img/display.jsp");
String[] urltemp = url.split("&");
for(int i=0;i<urltemp.length;i++){
String uTemp = urltemp[i];
if(uTemp.trim().substring(0, 8).equals("wsrp-url")){
url = uTemp.replaceAll("wsrp-url=", "");
url = url.replaceAll("%3A", ":");
url = url.replaceAll("%2F", "/");
break;
}
@radityopw
radityopw / levenshtein
Last active December 12, 2020 02:01
levenshtein distance in sqlserver
CREATE FUNCTION [dbo].[LEVENSHTEIN]( @s NVARCHAR(MAX), @t NVARCHAR(MAX) )
/*
Levenshtein Distance Algorithm: TSQL Implementation
by Joseph Gama
http://www.merriampark.com/ldtsql.htm
Returns the Levenshtein Distance between strings s1 and s2.
Original developer: Michael Gilleland http://www.merriampark.com/ld.htm
Translated to TSQL by Joseph Gama
<!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 {
@radityopw
radityopw / Dicoba.java
Created January 10, 2016 01:41
simple class dicoba
package dicoba;
/**
*
* @author radity
*/
public class Dicoba {
public String masukin(){
return "hello";
CREATE TABLE [dbo].[person_cluster](
[id] [int] IDENTITY(1,1) NOT NULL,
[nama] [varchar](50) NOT NULL,
[umur] [int] NOT NULL,
CONSTRAINT [PK_person_cluster] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
use clustered_vs_non_clustered
set statistics IO on
SET STATISTICS TIME ON
select top 10000 * from person_non_cluster
where id > 21
order by id
use clustered_vs_non_clustered
set statistics IO on
SET STATISTICS TIME ON
select top 10000 * from person_cluster
where id > 21
order by id
use clustered_vs_non_clustered
set statistics IO on
SET STATISTICS TIME ON
select top 10000 * from person_cluster
where umur > 25
order by umur