Posts

MSSQL - show data per page

- This statement will return record 1 to 20. SELECT * FROM ( SELECT row_number() OVER (ORDER BY id) AS rownum, * FROM example_table_a ) AS A WHERE A.rownum BETWEEN (1) AND (20) - If you want the next 20, your where criteria should be: WHERE A.rownum BETWEEN (21) AND (40) - Finally, SQL statement in your C# code will be: public String CreateSQL(Int32 pageNo, Int32 pageSize) {      StringBuilder _sbSQL = new StringBuilder();      Int32 _offset = 1+ ((pageNo-1) * pageSize);      _sbSQL.Append(" SELECT * FROM ");      _sbSQL.Append(" ( ");      _sbSQL.Append(" SELECT row_number() OVER (ORDER BY id) AS rownum, * ");      _sbSQL.Append(" FROM example_table_a ");      _sbSQL.Append(" ) AS A ");      _sbSQL.Append(" WHERE A.rownum BETWEEN (" + _offset +") AND (" + (_offse...

MSSQL - Integer Type

- bigint Integer (whole number) data from -2^63 (-9,223,372,036,854,775,808) through 2^63-1 (9,223,372,036,854,775,807). Storage size is 8 bytes. - int Integer (whole number) data from -2^31 (-2,147,483,648) through 2^31 - 1 (2,147,483,647). Storage size is 4 bytes. The SQL-92 synonym for int is integer. - smallint Integer data from -2^15 (-32,768) through 2^15 - 1 (32,767). Storage size is 2 bytes. - tinyint Integer data from 0 through 255. Storage size is 1 byte. Remarks The bigint data type is supported where integer values are supported. However, bigint is intended for special cases where the integer values may exceed the range supported by the int data type. The int data type remains the primary integer data type in SQL Server. bigint fits between smallmoney and int in the data type precedence chart. Functions will return bigint only if the parameter expression is a bigint data type. SQL Server will not automatically promote other integer data types (tinyint, smal...

PHP - Fatal error: Call to undefined function curl_init()

Fatal error : Call to undefined function curl_init() Solution of this problem is we need open "curl function" first. We can open this function in "php.ini" in "C:\windows\php.ini" step 1: open "c:\windows\php.ini" step 2: find ";extension=php_curl.dll" and change to "extension=php_curl.dll" step 3: go to "dir: \AppServ\php5" step 4: find     -libeay32.dll     -ssleay32.dll step 5: copy those files to "C:\windows\system32"; step 6 (last step): restart apache or restart appserv server. Website reference:  moshikub.com

PHP - MD5

string md5 ( string $str [, bool $raw_output = false ] ) output of md5 function will returns the hash as a 32-character hexadecimal number. But if you set $raw_output = true , output will return in binary format with a length of 16. Example #1: $str = 'tmvh:partner01:12345'; $output_md5 = md5($str); echo $output_md5; //output is "3d5e420dc4eaaef230409fad5662e825" Example #2 : $str = 'tmvh:partner01:12345'; $output_md5 = md5($str,true); //$output_md5 contain binary format //Convert $md5_output binary format to BASE64 $output_base64 = base64_encode($output_md5); echo $output_base64; //output is "PV5CDcTqrvIwQJ+tVmLoJQ=="

HTML - ToolTip

Step1. Add "htmltooltip.js" into <head> tag in your HTML See "htmltooltip.js" source code here Step2. Insert this stylesheet script in <head> tag in your HTML <style type="text/css">      div.htmltooltip {      position: absolute; /*leave this and next 3 values alone*/      z-index: 1000;      left: -1000px;      top: -1000px;      background: #EEEEEE;      border: 2px solid black;      color: black;      padding: 3px;      width: 250px; /*width of tooltip*/      } </style> In <body> tag. Add your tooltips text to <div class="htmltooltip"></div>. Example. <a href="#" rel="htmltooltip"> Displaying My tooltip text </a> <div class="htmlt...

PHP - cURL (post by XML)

<?php //this url return result in xml format $url = " http://www.exmple.com/fakeResponse.aspx "; $xml_request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>  <note>  <to>Tove</to>  <from>Jani</from>  <heading>Reminder</heading>  <body>Don't forget me this weekend!</body>  </note>"; $response = curl_xml($url, $xml_request); /* ------- Response  -------*/ //header for response result in xml format header('Content-type: text/xml'); echo $response; /* ------- CURL_XML -------*/ function curl_xml($_url, $_xmlRequest) {     $header = array("content-type: text/xml");     // initialize curl handle     $c = curl_init();     // set url to post to     curl_setopt($c, CURLOPT_URL, $_url);     //include header as needed     curl_setopt($c, CURLOPT_HTTPHEADER, $header)...

PHP - cURL (post by parameter)

<?php //this url return result in xml format $url = http://www.example.com/receiveRequest.php ; $parameter = "name=henry"; $response = curl_xml($url, $parameter); /* ------- Response -------*/ //header for response result in xml format header('Content-type: text/xml'); echo $response; /* ------- CURL_XML -------*/ function curl_xml($_url, $_xmlRequest) {     $header = array("content-type: application/x-www-form-urlencoded");     // initialize curl handle     $c = curl_init();     // set url to post to     curl_setopt($c, CURLOPT_URL, $_url);     //include header as needed     curl_setopt($c, CURLOPT_HTTPHEADER, $header);     //not include the header in th output     curl_setopt($c, CURLOPT_HEADER, 0);     // set post method in request otherwise curl will do a GET request     curl_setopt($c, CURLO...