Sencha Forms For Connecting With PHP

The following code snippet will create an EmployeeCreateForm in sencha. Try this out:

EmployeeCreateForm = new Ext.FormPanel({
labelAlign: 'top',
width: 600,
items: [{
layout: 'form',
items: [FirstNameField, LastNameField]
buttons: [{
text: 'Save and Close',
handler: createEmployee
text: 'Cancel',
handler: function(){

EmployeeCreateForm= new Ext.Window({
id: 'EmployeeCreateForm',
title: 'Creating a New Employee',
width: 610,
height: 250,
layout: 'fit',
items: EmployeeCreateForm

Efficient List Loader – Load Infinite Lists in Android

public class Test extends ListActivity implements OnScrollListener {

    Aleph0 adapter = new Aleph0();

    protected void onCreate(Bundle savedInstanceState) {

    public void onScroll(AbsListView view,
        int firstVisible, int visibleCount, int totalCount) {

        boolean loadMore = /* maybe add a padding */
            firstVisible + visibleCount >= totalCount;

        if(loadMore) {
            adapter.count += visibleCount; // or any other amount

    public void onScrollStateChanged(AbsListView v, int s) { }    

    class Aleph0 extends BaseAdapter {
        int count = 1; /* starting amount */

        public int getCount() { return count; }
        public Object getItem(int pos) { return pos; }
        public long getItemId(int pos) { return pos; }

        public View getView(int pos, View v, ViewGroup p) {
                TextView view = new TextView(Test.this);
                view.setText("List Item " + pos);
                return view;

This will create a list integers. On reaching the end of list next 10 will be loaded into list. This is efficient way to load chunks of items in a long list.

Use of str_pad in php

This functions returns the input string padded on the left, the right, or both sides to the specified padding length. If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.

$input = "Hello";
echo str_pad($input, 10);                      // produces "Hello     "
echo str_pad($input, 10, "-=", STR_PAD_LEFT);  // produces "-=-=-Hello"
echo str_pad($input, 10, "_", STR_PAD_BOTH);   // produces "__Hello___"
echo str_pad($input, 6 , "___");               // produces "Hello_"