Author's posts
Aug 02
MySQL: Get total number of rows when using LIMIT
A SELECT statement may include a LIMIT clause to restrict the number of rows return by the MySQL server. In some cases, it is desirable to know how many rows the SELECT statement would have returned without the LIMIT. To obtain the row count by include SQL_CALC_FOUND_ROWS option in the SELECT statement, and then execute …
Permanent link to this article: https://blog.openshell.in/2012/08/mysql-get-total-number-of-rows-when-using-limit/
Jul 26
Pass command line argument to PHP
The command line arguments are stored in an array in the $_SERVER variables called ‘argv’. Running the command “php index.php test1 test2” and then doing print_r($_SERVER[‘argv’]) would output this: [php] Array ( [0] => index.php [1] => test1 [2] => test2 ) [/php] You can also use $argv, It has return the same value. $argc …
Permanent link to this article: https://blog.openshell.in/2012/07/pass-command-line-argument-to-php/
Jul 20
Segmentation fault with rake db:create in ruby on rails
Whenever we invoke rake db:migrate, getting segmentation fault error. Segmentation fault ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32] Code Aborted probably a bug in our database connectivity DLL file Place this linmysql.dll file within your ruby/bin folder. If the file exists already, replace that file by this file. Download libmySQL.dll
Permanent link to this article: https://blog.openshell.in/2012/07/segmentation-fault-with-rake-dbcreate-in-ruby-on-rails/
Apr 15
YII Primary Key error
Error: Table “user” does not have a primary key. Solution: The crud command requires primary key to be defined in your tables. If you are working with legacy tables and can’t specify primary key, you can declare it in primaryKey() method of your model class. override method primaryKey in protected/models/User.php [php] public function primaryKey() { …
Permanent link to this article: https://blog.openshell.in/2012/04/yii-primary-key-error/
Apr 15
APC extension Enable in apache
To enable APC extension on Ubuntu, Use the following command sudo apt-get install php-apc To enalbe APC extension on Windows, 1) Go to http://downloads.php.net/pierre/ 2) Download php_apc-.zip 3) Copy php_apc.dll to /ext folder 4) In your php.ini, make sure you have: extension=php_apc.dll 5) Restart your server.
Permanent link to this article: https://blog.openshell.in/2012/04/apc-extension-enable-in-apache/
Apr 03
How To Install memcached with memcache PHP Extension on Ubuntu
memcached and the PHP5 memcache module are available as packages, so we can install them as follows: sudo apt-get install memcached php5-memcache
Permanent link to this article: https://blog.openshell.in/2012/04/how-to-install-memcached-with-memcache-php-extension-on-ubuntu/
Apr 03
Enable Sqlite in PHP on Apache
To enable SQLite on Windows/Apache/PHP setup, Uncomment the following lines in the php.ini file and restart Apache: [code] extension=php_pdo.dll extension=php_pdo_sqlite.dll [/code] To enable SQLite on Ubuntu, Use the following command [code] sudo apt-get install sqlite php5-sqlite sudo apt-get install php-pear php-apc php5-curl [/code]
Permanent link to this article: https://blog.openshell.in/2012/04/enable-sqlite-in-php-on-apache/
Mar 04
Java Essential Tips: How to set null value in Java JDBC PreparedStatement
This Java blog explains how to pass ‘null’ values to PreparedStatement. Passing ‘null’ to primitive data types is little tricky.
Permanent link to this article: https://blog.openshell.in/2012/03/java-essential-tips-how-to-set-null-value-in-java-jdbc-preparedstatement/
Jan 29
Java Essential Tips: Static Import
Static Import Static import is a mechanism to include constants into your code without referring its class in which the constants defined. For example, if you are using Integer.MAX_VALUE or some other constants field of class java.lang.Integer then you could simply use the following static import statement: [java]import static java.lang.Integer.*; class Demo{ public static void …
Permanent link to this article: https://blog.openshell.in/2012/01/java-essential-tips-static-import/
Oct 24
Custom Date Validation in ASP.Net
The validators shipped with .NET are great tools to check and validate what the user enters on a web form, before processing it. With the DateValidator control this gap has been filled. User can insert date in a common text box and that’s all: you won’t have to bother about validating their input, the only …
Permanent link to this article: https://blog.openshell.in/2011/10/custom-date-validation-in-asp-net/