User Login

Please enter user name and password into following boxes!

If you are not registered yet, please click

Forget Password

If you forget your password, please click


  • Enable Sql Log in Laravel

    Event::listen('Illuminate\Database\Events\QueryExecuted', function ($query) { if (App::environment() == 'local') { Log::info($query->sql . ' Parameters: ' . serialize($query->bindings)); } });...Continue Reading

    MSSQL Server UTF-8 Connection in PHP

    We can connect msql server as follows: $serverName = ""; $uid = "sa"; $pwd = "123456!"; $databaseName = "TEST"; $connectionInfo = array("UID" => $uid, "PWD" => $pwd, "Database" => $databaseName, "CharacterSet" => "UTF-8"); //Connect using SQL Server Authentication. $conn = sqlsrv_connect($serverName, $connectionInfo); $tsql = "SELECT * FROM fatura"; // Execute the query. $stmt = sqlsrv_query($conn, $tsql); $row = sqlsrv_fetch_array($stmt); if (stmt) { echo "Statement executed"; } else { echo "Error in statement execut...Continue Reading

    MappedBy in bi-directional @ManyToMany : what is the reason

    Question: 1. What is the reason for setting MappedBy in bidirectional many-to-many relationships? 2. When one table has significant amount of records, while other has a few, which side is better to put mappedBy Answer: It's actually a good question, and it helps to understand the concept of an "owning" entity. If you want to prevent both sides (in a bidirectional relationship) from having join tables, a good idea, then you need to have a mappedBy= element on one side. Whether or not there is a join table is controlled by the mappedBy="name" el...Continue Reading

    How To Enable Mysql Server Remote Access In Amazon EC2 Service?

    1. First of all, create a new mysql user: mysql -u root -p create user 'olyanren'@'%' identified by '123456'; grant all priviliges on *.* to 'olyanren'@'%' with grant option; Note: Change olyanren username and password 123456. Also note that don't delete single quotas. The key point is wildcard (%). By using wildcard, we give olyanren user an access right to connect from any host. After these steps, confirm if the new user olyanren has been created select user, host from mysql.user; 2) Restart mysql service mysqld restart ...

    Hibernate Unidirectional OneToMany and ManyToOne Concepts

    OneToMany Unidirectional Mapping Question: In this document (scroll down to the Unidirectional section): It says that a unidirectional one-to-many association with a join table is much preferred to just using a foreign key column in the owned entity. My question is, why is it much preferred? Answer 1: Consider the situation where the owned entity type can also be owned by another parent entity type. Do you put foreign key refere...Continue Reading

    Spring Generic DAO And Generic Service Implementation

    For most developers, writing almost the same code for every DAO in an application has become indespensible. To solve this problem and to rescue developers from copying and pasting same codes into every dao classes, we will use DAO pattern. In this tutorial, I will show you how to create dao pattern in a spring application. The foundation of using a Generic DAO is the CRUD operations that you can perform on each entity. Generic Dao Implementation Model Class Hibernate ORM framework uses model classes for database tables. Therefore we need to creat...Continue Reading

    Change MySQL default character set to UTF-8

    To set the default to UTF-8, you want to add the following to my.cnf or my.ini for Windows [mysqld] collation-server = utf8_unicode_ci character-set-server = utf8 If you want to change the character set for an existing DB, you can use following code: ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci; ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;...Continue Reading

    How to convert YYYYMMDDHHMMSS to Datetime in Microsoft Sql Server

    To convert yyyymmddhhmmss string format to datetime in Microsoft Sql Server, you can use below sql script: update PageContent set NewDatetimeColumn = convert(datetime, stuff(stuff(stuff(OldDateAsStringColumn, 9, 0, ' '), 12, 0, ':'), 15, 0, ':')) NewDatetimeColumn column is defined in the PageContent table and will be used to store OldDateAsStringColumn's string value after conversion operation. After run this script, for example, 20090513024903 string value will be 2009-05-13 02:49:03.000...Continue Reading

    Mysql Replace Function Usage

    If you want to change some string content of a column, you can use REPLACE function as follow: UPDATE urls SET url = REPLACE(url, '', '') urls: Table Name url: Column Name REPLACE function first parameter is column name, second parameter string value to be changed, and third parameter is new string value....Continue Reading