Posted in Codeigniter MySQL

Codeigniter – Select Unique Random Row Every Day From MySQL

I am going to show how to select a row from MySQL database as randomly as possible, but not repeating it. So I am going to select unique row from the MySQL database using PHP based Codeigniter framework. The original tutorial could be found as selecting a random row every day from MySQL.

Continue Reading... Codeigniter – Select Unique Random Row Every Day From MySQL
Posted in JavaScript

Write random elements to div having class names from array using JavaScript

This is an example where I am going to show you how to write random elements to div having class names from array using JavaScript. Let’s consider we have multiple div tags on a web page and these div tags are created dynamically based on certain condition but you are not sure how many div tags will be created on…

Continue Reading... Write random elements to div having class names from array using JavaScript
Posted in Java

Read last n lines from a file using Java

Introduction Here I will show you how to read last n lines from a file using Java programming language. I am using text file for this example. Last “n” lines means, last 10 lines or 20 lines or 30 lines, etc. So “n” should be replaced by an appropriate non-zero positive integer value. Obviously the tail of the file is…

Continue Reading... Read last n lines from a file using Java
Posted in Java

Generate File with Random Content in Java

Introduction This tutorial will show you how to generate file with random content in Java. I will generate random content in a text file using wordnet-random-name API in Java. You can set limit to any number of lines for the text file to hold generated random content in it. This kind of random content is a quick and an easy…

Continue Reading... Generate File with Random Content in Java