Ruby Lin's blog

What's new in Ext JS 4?

Ruby Lin's picture

Ext JS 4 uses MVC architecture. MVC(Model-View-Controller) can organize your code, maintain easy, reduce the amount of codes you have to write, and improve efficiency. It fits big projects.

Here is the folder structure:

application_name

app

controller

class1.js

model

class1.js

store

class1.js

view

Grid.js

Panel.js

data

class1.json

app.js

index.html

app.js - The Application class contains global settings for your application (such as the app's name), as well as maintains references to all of the models, views and controllers used by the app.

controller - listen for events (usually from views) and take some actions.

model - define a Model for real-world object that we want to model in the system.

store - tell it the Model and the Proxy to use to load and save its data.

view - usually defined as a subclass of an Ext JS component(such as grid, panel).

And Ext JS 4 enables you to load any number of records into a grid without paging. Past load a large amount of records will cause an error: out of memory. The new grid uses a virtualized scrolling system to handle potentially infinite data sets without any impact on client side performance.

Else like: multiple versions side by side, split DOM for high performance, more fantastic charts...etc.

More details can refer to the official website: http://docs.sencha.com/ext-js/4-0/

Semaphore functions in PHP

Ruby Lin's picture

Semaphore is a variable or abstract data type that provides a simple but useful abstraction for controlling access by multiple processes to a common resource in a parallel programming environment.

A useful way to think of a semaphore is as a record of how many units of a particular resource are available, coupled with operations to safely (i.e. without race conditions) adjust that record as units are required or become free, and if necessary wait until a unit of the resource becomes available.

Semaphores are a useful tool in the prevention of race conditions and deadlocks; however, their use is by no means a guarantee that a program is free from these problems. Semaphores which allow an arbitrary resource count are called counting semaphores, whilst semaphores which are restricted to the values 0 and 1 (or locked/unlocked, unavailable/available) are called binary semaphores.

The following are semaphore functions in PHP:
int ftok (string $pathname, string $proj) - Convert a pathname and a project identifier to a System V IPC key.

sem_acquire (resource $sem_identifier) - Acquire a semaphore.

resource sem_get (int $key [,int $max_acquire = 1 [,int $perm = 0666 [,int $auto_release = 1]]]) - Get a semaphore id.

bool sem_release (resource $sem_identifier) - Release a semaphore.

bool sem_remove (resource $sem_identifier) - Remove a semaphore.

resource shm_attach (int $key [, int $memsize [, int $perm]]) - Creates or open a shared memory segment.

bool shm_detach (resource $shm_identifier) - Disconnects from shared memory segment.

mixed shm_get_var (resource $shm_identifier, int $variable_key) - Returns a variable from shared memory.

bool shm_has_var (resource $shm_identifier, int $variable_key) - Check whether a specific entry exists.

bool shm_put_var (resource $shm_identifier, int $variable_key, mixed $variable) - Inserts or updates a variable in shared memory.

bool shm_remove_var (resource $shm_identifier, int $variable_key) - Removes a variable from shared memory.

bool shm_remove (resource $shm_identifier) - Removes shared memory from Unix systems.

http://php.net/manual/en/book.sem.php

CodeIgniter 2.0.2 Released

Ruby Lin's picture

 There are many PHP frameworks available today, and some of the top PHP frameworks used by developers today include: The Zend Framework, CakePHP, Symfony, CodeIgniter, Seagull, Yii. These frameworks bring a number of benefits to your PHP development, for examples:

1. MVC(Model-View-Controller) architecture

2. Separate PHP from HTML

3. User-friendly URL namespaces

4. Rapid development

These frameworks have their own positives and negatives. Each programer has a different style and different priorities when it comes to adopting a tool kit to use when building apps. CodeIgniter is an open source web application framework that helps you write incredible PHP programs, and it is well-known for following features:

1. a small footprint

2. exceptional performance

3. ease-of-use

4. clear, thorough documentation

5. nearly zero configuration

6. no command line

7. no large-scale monolithic library

CodeIgniter attracts me because of it is easy to understand and easy to extend. And it has a number of supporting helpers, libraries, and plug-ins that you can use. All the tools you need are in one little package. If it is not enough, you can create your own libraries. CodeIgniter also has some security tools. For both users and developers, security is a key question. Cross Site Scripting (XSS) is one of the most common application-layer web attacks. CodeIgniter comes with a Cross Site Scripting Hack prevention filter which can either run automatically to filter all POST and COOKIE data that is encountered, or you can run it on a per item basis.

CodeIgniter 2.0.2 was released. This is a security maintenance release. The security fix patches a small vulnerability in the cross site scripting filter.

http://codeigniter.com/