Category Archives: programming

Form filler (Chrome extension)

As a programmer, I deal a lot with forms. Build the form, test the form, debug the form, test again, test test and test again.

It is still ok to fill up only 2 to 3 fields forms but it eats up your time if you have to fill up more than 10 fields everytime you want to test a form.

Further more if the form fields are all mandatory!

With the following tools you can just fill up the forms with dummy data or some pre-set data. It maybe useful for other purpose as well. Don’t know.

1. Form Filler

2. JunkFill

Image manipulation in PHP

To manipulate image (e.g. resize, rotate, flip etc) could be hard since it is not done everyday. It is required sometimes on certain project.

I found this library really easy and helpful. Just one file and can ease your life. Take a look.

zebra image

Update: Another one (open source) that looks easy to use. WideImage

How to easily create PHP image gallery

This becoming my favorite image gallery now – fotorama.io. So easy to implement with plenty of customization that we can do.

If you don’t believe how easy it is, copy following source code, paste and save as an html file. Then open it and see what will happen.

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.css" rel="stylesheet">
<script src="http://cdnjs.cloudflare.com/ajax/libs/fotorama/4.6.3/fotorama.js"></script>

<div class="fotorama" data-width="100%" data-ratio="800/600" data-nav="thumbs" data-loop="true" data-allowfullscreen="true">
 <img src="http://s.fotorama.io/1.jpg">
 <img src="http://s.fotorama.io/2.jpg">
</div>

Alternatives:

http://photoswipe.com/

lightbox

Getting data from CI db query

1. All result set

$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
   foreach ($query->result() as $row)
   {
      echo $row->title;
      echo $row->name;
      echo $row->body;
   }
}

2. Just one row

$query = $this->db->query("YOUR QUERY");

if ($query->num_rows() > 0)
{
   $row = $query->row(); 

   echo $row->title;
   echo $row->name;
   echo $row->body;
}

Reference: CI2, CI3