Skip to content

Instantly share code, notes, and snippets.

Avatar

Pham Cong Dinh pcdinh

View GitHub Profile
View pcdinh_pdf_archive_normalization_report
SELECT
MAX(CASE
WHEN checked_status = 0 THEN doc_count
ELSE 0
END) file_not_existed,
MAX(CASE
WHEN checked_status = 1 THEN doc_count
ELSE 0
END) file_existed,
MAX(CASE
View Tiny library for unit testing
<?php
/**
* A test case defines the fixture to run multiple tests. To define a test case
* 1. implement a subclass of TinyTestCase
* 2. define instance variables that store the state of the fixture
* 3. initialize the fixture state by overriding setUp()
* 4. clean-up after a test by overriding tearDown().
*
* @author pcdinh
View IndexerController.php
<?php
/**
* Class to control the indexing operation.
*
* @author pcdinh
* @since July 25, 2009
* @version $Id$
*/
class IndexerController
View FileNameParser.php
<?php
include_once './FileNameComponent.php';
/**
* Provides methods to parse file name into meaningful parts.
*
* @author pcdinh
* @since July 25, 2009
* @version $Id$
View (Action Controller) IndexController.php
<?php
/**
* This class provides page controller service for handling requests to the index page.
*
* @author pcdinh
* @since June 18, 2009
* @version $Id: IndexController.php 250 2009-07-02 10:40:22Z pcdinh $
*/
class IndexController
View SearchController.php
<?php
/**
* A set of methods to manipulate files.
*
* @author pcdinh
* @since June 18, 2009
* @version $Id: SearchController.php 407 2009-07-22 04:51:07Z hanhnt83 $
*/
class SearchController
View oracle_regex_replace
UPDATE documents
SET doc_code = REGEXP_REPLACE(doc_code, '.Q[[:digit:]]{1}.',
(CASE
WHEN REGEXP_LIKE(doc_code, '.(E|L).(10|11|12){1}.') THEN '.4.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(7|8|9){1}.') THEN '.3.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(4|5|6){1}.') THEN '.2.'
WHEN REGEXP_LIKE(doc_code, '.(E|L).0(1|2|3){1}.') THEN '.1.'
END ))
WHERE REGEXP_LIKE(doc_code, '.Q[[:digit:]]{1}.')
View vBulletin-CommunityServer-Posts-Migration.sql
WITH PostList AS (
SELECT row_number() OVER (ORDER BY p.PostID DESC) Row,
p.PostID, p.ThreadID, p.ParentID, p.SortOrder,
p.PostDate, p.Subject, p.SectionID ForumID, p.PostAuthor UserName,
p.UserID UserID, p.IPAddress, t.ThreadDate, cast(p.[Body] as text) Body
FROM cs_Posts p
INNER JOIN cs_Threads t ON t.ThreadID = p.ThreadID
INNER JOIN cs_Sections s ON s.SectionID = p.SectionID
WHERE s.ApplicationType = 0
)
View StandardAnalyzerTest.java
package lucene1;
import java.io.StringReader;
import org.apache.lucene.analysis.Token;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
/**
* @see Lucene 2.4.1
View mysql_export.sql
SELECT * INTO OUTFILE "users.txt"
FIELDS TERMINATED BY '\t' LINES TERMINATED BY '\n'
FROM cms.webusers
WHERE MONTH(created_time) = '01' AND YEAR(created_time) = '2009';
You can’t perform that action at this time.