January 21 2014

SQL Server Date Formats

Tagged Under : ,

mssql
How to format datetime value or column into a specific date format. Is the most frequently asked question by the newbie. Below table is summary of the different date formats that come from SQL Server with the CONVERT function.

Please note that the output of these date formats are VARCHAR data type, not DATETIME data type. With this in mind, any date comparisons performed after the DATETIME value has been formatted are using the VARCHAR value of the date and time and not its original DATETIME value.

January 15 2014

Jquery plugin tablesorter filter match how to

Tagged Under :

jquery
Jquery tablesorter is a powerful plugin for table sort and filter. It help me completed a lot of stuff.

But I found a problem, when I want filter by exact match results, the default filter function cannot do this. And I try add “filter-match” classes to the “th” header cells. Unfortunately the results return still same.

The Solution:
To filter by exact match, you may need modify or add “filter_functions” at the “widgetOptions“. The example:

January 11 2014

IE custom cursor

Tagged Under :

css3
I found that quite a lot of people omit Internet Explorer browser, when they are doing the CSS.

For example like the custom cursor. In Firefox, Safari and Chrome, it can display property when you use PNG image format, but it not for IE. that’s the reason why custom cursor not working on IE browser.

January 09 2014

example of Yii autocomplete

Tagged Under : ,

Yii
Because I didn’t found any example of Yii autocomplete function. particularly showing how to fetched data via a server request.

For the widget function in view:
$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
  'name' => 'username',
  'value' => $model->username,
  'sourceUrl' => array('user/getusername'),//path of the controller
  'options' => array(
    'minLength' => '1', // min chars to start search
    'select' => '' // when the value selected
  ),
));

Now, we start create the getusername action in the UserController file.

January 01 2014

Tidesdk connect to MySQL Database

Tagged Under :

TideSDK
In here, I am showing you how to use TideSDK to connect MySQL Database with PHP in your applicaion.

Example Data
The example data in this post uses as below.
CREATE TABLE fruits (`id` int, `name` varchar(50));
	
INSERT INTO fruits (`id`, `name`)
VALUES (1, 'Apple'),
       (2, 'Durian'),
       (3, 'Banana'),
       (4, 'Lemon'),
       (5, 'Pear'),
       (6, 'Star fruit'),
       (7, 'Strawberry'),
       (8, 'Orange');

After that we need create a connection string with the Database. Save the code below as conn.php and put it inside the Resources folder.
$conn = mysql_connect('localhost', 'username', 'password');
mysql_select_db('foo', $conn);