ALL
Simple PHP paging class
Frequently in our web applications, we may have many records in the database to display. In order to imrpove loading speed and efficiency, we may need to display some records at a time, so we need to paginate the records. For example, if we have 1 million book records and when users want to view the book list, it's inefficient to display all the records on the same page, we may need to have some pagination to allow displaying a portion of the records such as 20 records per page. This is a simple PHP pagination class, here is the code.paing.php<?phpclass Paging { public static $count =...
Three ways to define class in JavaScript
In object oriented programming, class is the template of object, it defines the properties and methods of a group of objects. Unfortunately, JavaScript doesn't support class, but we can have some workarounds to simulate class.1. Constructor functionThis is the classical approach, it is also the approach mentioned in many text books. It uses the constructor function to simulate class and it uses the keyword this to represent the object internally.function Cat() {  this.name = "Kelly";}when creating the instance, use the new keyword.var cat1=new Cat();alert(cat1.name); //KellyThe p...
12,053 0 JAVASCRIPT METHOD CLASS INHERITANCE PRIVATE
Top 10 essential Java classes
When we write Java programs, we will frequently use some classes such as java.lang.String. There are some essential Java classes which we may use frequently, there is no strict rules for the selection of essential Java classes, in fact there are no rules followed. It depends on what projects you are doing or what you have done,, so every one may have his own choices about the top essential Java classes in his mind. Here we list the top 10 essential Java classes you may agree with.1. java.lang.String2. java.lang.System3. java.lang.Exception4. java.util.ArrayList5. java.util.HashMap6. java.lang....
14,876 1 JAVA CLASS ESSENTIAL CLASS TOP 10
If PHP Were British
When Rasmus Lerdorf first put PHP together, he - quite sensibly, despite his heritage - chose not to write it in Greenlandic or Danish. Good job too - that would have been rather unpleasant to work with. He opted instead, being in Canada at the time, for the local tongue. No, not French - that bastard dialect of the Queen's English commonly referred to as "US English"1.PHP developers in Britain have been grumpy about this ever since. What was he thinking? And more importantly, how do we undo this travesty? How do we developers ensure the traditions of the British Empire continue to be upheld, ...
2,993 0 PHP CLASS BRITISH STATEMENT ENGILISH LIKE
Date interval add and sub prior to PHP 5.3
After PHP 5.3, we can use DateInterval object or date_interval_create_from_date_string() function to add or subtract days,weeks,months or years to or from a DateObject.But prior to PHP 5.3,we cannot do this. If we want to achieve the same effect. We need to use some skills. Here is one:We can use strtotime() function to achieve this. For example:$date=date('Y-m-d',time());$datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 day'); $datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 week'); $datestamp=strtotime(date('Y-m-d',strtotime($date)).' +1 month'); Her...
11,879 0 PHP CLASS DATEINTERVAL PHP 5.3 PHP 5.2
template function in class in C++
We can define template function in a class, but one thing we should pay attention to is that the member function template definition (in addition to the declaration) should be in the header file, not the cpp, though it does not have to be in the body of the class declaration itself.Example //Sorter.h#pragma onceclass Sorter{public: Sorter(void); ~Sorter(void); template <class type> static void qsort(type arr[],int start,int end);};template <class type> static void Sorter::qsort(type arr[],int start,int end){ in...
2,849 0 C++ TEMPLATE FUNCTION CLASS DEFINITION D