Archive

Archive for January, 2011

Array to String Conversion using php

January 21, 2011 1 comment

it normally happen you are convert  some delimited string to array and php do it as using “explode()”

array explode ( string $delimiter , string $string [, int $limit ] )

php also provide the facility to convert array to string and most commonly used method is “implode”

string implode ( string $glue , array $pieces )

e.g lets we have an array of student names and we want to print  Read more…

Advertisements

How to extract the query string parameters.

January 20, 2011 Leave a comment

This was simplest method that i found very much help full, to extract the query string parameters .

  1. <script type=”text/javascript”>
  2. function getParameter(queryString, parameterName){
  3. var parameterName = parameterName + “=”;
  4. if ( queryString.length > 0 ) {
  5. begin = queryString.indexOf ( parameterName );
  6. if ( begin != -1 ) {
  7. begin += parameterName.length;
  8. end = queryString.indexOf ( “&” , begin );
  9. if ( end == -1 ) {
  10. end = queryString.length
  11. }
  12. return unescape ( queryString.substring ( begin, end ) );
  13. }
  14. return “null”;
  15. }
  16. }
  17. /* now we can call this javascript method as follows */
  18. var queryString = window.top.location.search.substring(1);
  19. var urlStr = getParameter(queryString, ‘url’);
  20. </script>

Thanks to mohsin who shared this code with me .

DWR configuration using jsp

January 12, 2011 Leave a comment

To configure DWR, please place files & codes  as follows

1. /WEB-INF/lib/dwr.jar

2. /WEB-INF/lib/common-logging-1.1.1.jar

3. /WEB-INF/lib/common-logging-api-1.1.1.jar

4. /WEB-INF/lib/log4j-1.2.15.jar   which require property file log4j.properties

5. /WEB-INF/classes/log4.property has following code  Read more…

Categories: java, Software Engineering, Web