Tuesday, May 27, 2008

Google Analytics in Drupal

Been cracking my head in installing the Google Analytics script in my drupal sites. Have this drupal version 7 site, unfortunately the Google Analytics module available as of this writing is for versions 5 and up only. A dilemma for dynamic sites... Tried posting the script in the following as advised in www.drupal.org forum threads: template pages (page.tpl.php), index and incluldes, etc.

However, I think the best method that work for a test site is perhaps creating a block and publishing the google analytics script in there. To best have accurate analysis reports, publish analytics block accordingly, e.g. excluding the /node/edit* pages or /admin* pages. This way only anonymous visits are logged and recorded. On the other hand, reverse the publishing to determine administrative behaviors. Neat! Worked like a charm!

P.S.

the generated reports didn't come until after 24 hours... or a disclaimer from google that due to technical problems it may not generate some reports at all, somethin' like that... the adage, patience is a virtue... indeed!

Tuesday, May 13, 2008

Install and configure Tomcat for Windows (How to and step by step)

Trying my hands full with Jahia (pronounce "J-A-Y-A"), an integrated Enterprise Content & Portal Management software in the open source, and a few documentation on my Tomcat installs... personally, for my own reference... hope this might become useful to anyone searching.... full disclaimer/s apply haha!

To install and configure Tomcat, you will have to take the following steps:

  1. Download JDK 1.5 from Sun(tm) site at http://java.sun.com/javase/downloads/index_jdk5.jsp

  2. Install JDK to C:\Program Files\Java\jdk1.5.0_08

  3. Download Tomcat 5 from http://tomcat.apache.org/download-55.cgi

  4. Install Tomcat on C:\Program Files\Apache Software Foundation\Tomcat 5.0

  5. Set the port number to 8080, which is the default port. Set the name as admin and password as desired. The password column can even be left blank.


  6. Set the environment variables as follows:
    • Right-click My Computer and select properties.

    • Click the Advanced tab button.

    • Click Environment Variables.

    • Select New to set the properties as follows:

      1. Classpath: In the variable name field write classpath, and in the variable value field write the location of servlet-api.jar file as C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar

      2. Path: In the variable name field write PATH, and in the variable value field write the location of JDK installation as C:\Program Files\Java\jdk1.5.0_08\bin;.;

      3. CATALINA_HOME: In the variable name field write CATALINA_HOME, and in the variable value field write the location of Tomcat installation as C:\Program Files\Apache Software Foundation\Tomcat 5.0.



      4. JAVA_HOME: In the variable name field write JAVA_HOME, and in the variable value field write the location of JDK installation excluding bin as C:\Program Files\Java\jdk1.5.0_08.



  7. Write a small Servlet program to test the installation as follows:

    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;

    public class TestServlet extends HttpServlet
    {

    public void doGet(HttpServletRequest request, HttpServletResponse response)throws IOException, ServletException
    {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("");
    out.println("");
    out.println("This is a Servlet test!");
    out.println("");
    out.println("");
    }
    }

  8. Compile the Servlet file and put the class file in webapps/servlets/WEB-INF/classes directory inside the Tomcat directory.

  9. Open a new textpad file and write the following code:

    TestServlet
    TestServlet



    TestServlet
    /test


  10. Save the above textpad file as web.xml in the webapps/servlets/WEB-INF directory.


  11. Go to C:\Program Files\Tomcat 5.0\bin directory and start tomcat by double clicking on the startup batch file.


  12. Open a new instance of Internet Explorer and type the following URL in the Address bar:
    http://localhost:8080/servlets/test

Note: Whenever any change is made to the servlet, it should be compiled again. In such a case, either restart the Tomcat server or redeploy the application by going to http://localhost:8080/manager/html.

Source:
the fastest way to IT certification

Friday, May 9, 2008

'Forbidden Access' error and 'tag in POST' error while publishing / editing article in Joomla

Forbidden Access error, and 'tag in POST' error? while posting in http://www.doh.gov.ph/bihc_doh

This has not occurred before: frontend editing saves are rejected with a message 'Forbidden Access (flooding)' - or 'Forbidden Access (tag in POST)'. This is with Joomla 1.0.12 and 1.0.13 versions.

This is either (a) a Joomla built-in security block being triggered, or (b) more likely a server setting perhaps. I'm seeing it especially on Apache 1.1.3x / Unix servers.

If you Save and edit with a few words of plain text, it seems to be OK; but a fair-sized page with plenty of mixed content gets blocked - probably because of the number of HTTP requests at one time?

Of course, it means that frontend editing is impossible, which makes any kind of community use out of the question. Thought this was a joomla issue or server setting, but obviously an extension issue.

Solution:

Turn off security features of SH404SEF, that is of course assuming you have had the extension installed (being the issue here) :D

Thursday, May 8, 2008

Need to install Apache, MySQL, and PHP (Linux, Mac OC, Solaris or Windows)?



I was reminded of a friend who asked me the other day about installing a CMS package, as well as installation of Apache to his server... Thus, this article... He was asking for feedback on manually installing each application needed: Apache web server app, mysql and php... Manually installing each package separately may be the best, effective way. However, personally, I have had no problem in installing the three in a bundled package like most LAMP packages offer... Besides, I tried the manual installs and found it to be a tedious process... Personally tested XAMPP, a very easy to install Apache Distribution for Linux, Solaris, Windows and Mac OS X. The package also includes the Apache web server, MySQL, PHP, Perl, a FTP server and phpMyAdmin.

Download XAMPP and other add-ons at these links (for Linux, Mac OC, Solaris or Windows):

Apache Friends.Org: XAMPP Official Developers' Site
Sourceforge.Net

Simply download, extract, then enjoy! And by the way, it's free!

This blog has been archived and is not maintained any longer. For similar useful posts, please visit www.jeromeesperanza.com

Search

Google