Let say you have the following data in you database table t1 and you want to select the IDs for the row record that have the same value on COL1 and COL2. ID COL1 COL2 COL3 ====================== 1 100 200 300 2 200 300 400 3 100 200 500 4 300 300 300 5 200 300 400 And the expected result is ID = 1,2,3,5. The SQL to a … [Read more...]
Linux: How To Add Swap on CentOS
Linux divides its physical memory (or the RAM, random access memory) into chucks of memory called pages. When a program require more memory and there isn't enough physical memory, Linux will starts moving out inactive pages and store them on hard disk. The process of moving out the pages for physical memory to disk is called swapping. The size of "memory on disk" is … [Read more...]
Java: How To Use SQL LIKE Clasue with PreparedStatement?
One may find that using SQL's LIKE clause in Java PreparedStatement is not straight forward. There is no documentation on how the LIKE clause should be used when it is used with the PreparedStatement object. Thus, most of the programmer would rather use the full SQL to execute the statement. … [Read more...]
Java: How To Create A Simple Web Server Using HttpServer
To program a web or HTTP server from nothing could be very difficult. It's gonna to take you to write thousands of source instructions. The HTTP protocol it self is pretty to understand but it complicated to implement them in programming language. It involves a lot of parsing and need a lot of understanding how the HTTP requests and HTTP responses work together. … [Read more...]
Javascript: Get Query String and Key-Value Pairs from URL
In web development, it is important to know how to get query string at the client side from the URL being sent to the server. It is useful when your code (Javascript) that run at client's browser need to know what data has been sent to the server and use the information to produce further more useful information. … [Read more...]