Hey all, I was looking for nice and easy form validator in javascript/ jQuery which displays the error messages as absolute div and not block div. Because the most of validators displays messages next to input element or below them.
The issue with such validators is, some time it becomes very difficult to manage the ui when large no of input elements are there on page and proper space is not there on page. It also makes issues across browsers.
Solution is : Display absolute error messages.
I found a great great jQuery plug in : download from here
This is really very nice form validator in jquery which displays error messages in absolute div. With all best features and customization included.
Here are some custom functions for this plug in.
Allow all ASCII characters with regular expression. - javascript
function checkAsciiValues(field, rules, i, options){
var value = field.val();
var length = value.length;
for(var i = 0; i< length; i++){ if(value.charCodeAt(i) < 1 || value.charCodeAt(i) > 255){
return "* Please enter only ASCII values.";
}
}
}
____________________________________________________________________
easy jquery form validator absolute message box
Posted by
php helper
at
2:20 AM
0
comments
Labels: javascript
What is polymorphism in php?
Polymorphism helps a sub class to behave like a parent class. When an object belonging to different data types respond to methods which have a same name, the only condition being that those methods should perform different function.
Posted by
php helper
at
8:37 AM
0
comments
what are the most common caching policy approaches ?
1)Time triggered caching (expiry timestamp).
2)Content change triggered caching (sensitive content has changed, so cache must be updated).
3)Manually triggered caching (manually inform the application that information is outdated, and force a new cache creation).
Posted by
php helper
at
8:29 AM
0
comments
Labels: cache
what are the database space-saving functions available in php ?
Use ip2long() and long2ip() to store the IP addresses as Integers instead of storing them as strings, which will reduce the space from 15 bytes to 4 bytes. This will also increase search speed and make it easy to see if a ip falls within a specified range.
# Use gzcompress() and gzuncompress() to reduce the strings before you store them in a database.
The gzcompress can compress plain-text up to 90%. The only reason why you shouldn’t use it is when you need full-text indexing capabilities.
Posted by
php helper
at
8:27 AM
0
comments
Labels: code optimization, php
What is meant by Session Clustering?
The Session Manager session support allows multiple server instances to share a common pool of sessions, known as a session cluster.
Session clustering setting up methods :
#1)First methods, is to have a NFS shared where session will be store. Setting this is quite easy, just a little modification on php.ini file to change the “session.save_path ? directive to point to the NFS share. The main problem with NFS is on high traffic, NFS share is really slow. So synchronisation and data corruption can arrive and this can be very frustrating.
#2) The Second method is to use a Database to store session datas. This solution suppose to write custom session handler. The only real problem of this method is that will generate a very big amount of the number of connections and database query. And this required a dedicated server and a cron job to clean all unused session datas.
#3)The third method is to use the MCache. MCache is a daemon (a server) that deal with session storing only. It support from RAM storage to data serialization in file/fatabase. It is said that MCache access is native as a session handler in PHP, so it’s just about configuration via php.ini … but I did not investigate yet on how to make it work.
#4)The fourth method is Memcache, another daemon for “distributed memory object caching system ?. Advantage to Memcache, as it’s integrated in PHP as PECL (look at the documentation on how to install). This method can be very interesting as it provide great performance but this will require a single or couple dedicate server of it use.
#5)The last method is commercialized by Zend. The product is the Zend Platform and integrate many component of some previous Zend products (Zend Server, etc.) and some new products (Zend Core…). The Zend Core is a Cluster manager that can handle multiple server. It can be use to remote debugging (from Zend Server), performance monitoring and sessions replication. As described, there are many advantage using Zend Platform so I could only to advise you to use it simply first to profile your application and for session clustering ! But there are a little probleme, session are replicated from a server to the other servers. So if a server crash maybe the Platform could not have the time to replicate session data. It can result to session destruction. But be sure that Zend know the problem and will surely fix this soon or later.
Posted by
php helper
at
8:24 AM
0
comments
Labels: php, php sessions
common php questions and answers
- What does a special set of tags = and ?> do in PHP? - The output is displayed directly to the browser.
- What’s the difference between include and require? - It’s how they handle failures. If the file is not found by require(), it will cause a fatal error and halt the execution of the script. If the file is not found by include(), a warning will be issued, but execution will continue.
- How do you define a constant? - Via define() directive, like define ("MYCONSTANT", 100);
- Explain the ternary conditional operator in PHP? - Expression preceding the ? is evaluated, if it’s true, then the expression preceding the : is executed, otherwise, the expression following : is executed.
- How do I find out the number of parameters passed into function? - func_num_args() function returns the number of parameters passed in.
- What’s the difference between accessing a class method via -> and via ::? - :: is allowed to access methods that can perform static operations, i.e. those, which do not require object initialization. :: is called as "scope resolution operator".
- How do you call a constructor for a parent class? - parent::constructor($value)
- What are the two new error levels introduced in PHP5.3? -
E_DEPRECATED
The E_DEPRECATED error level is used to indicate that a function or feature has been deprecated.
E_USER_DEPRECATED
The E_USER_DEPRECATED level is intended for indicating deprecated features in user code, similarly to the E_USER_ERROR and E_USER_WARNING levels.
Posted by
php helper
at
8:38 PM
0
comments
Labels: php, php questions
Twitter result found in google SERP
I was googling out the keyword "codeignitor" and I got this result in google SERP.
I am not using any monkeyscript in my mozilla browser.
Posted by
php helper
at
9:30 PM
0
comments
Labels: seo
