Showing posts with label blogging. Show all posts
Showing posts with label blogging. Show all posts

Monday, March 30, 2015

Customizing Blogger

Introduction

I want to start by blaming Markus Eisele for my misadventures. I was looking at his blog and liked the makeover he gave it. I did find the template he was using, but decided that I would write my own. Well I thought this should be an easy thing to do. I severely underestimated the challenge of making a custom template for myself. It turns out that one of the easiest things turns out to be the hardest. Alright Markus you are off the hook... it may just be my bravado, and belief I can build a better mousetrap that led me down the long lonesome road.

Google is well known for having good and sometimes great APIs for their technology. Blogger is an exception to that rule. There is not one clear cut schema for their layout that I can find ironically using Google itself. You figure with all of the templates and bloggers that this would be covered ad nauseum.  It is not though.

Technologies

I was looking for a simple and elegant framework to make my blog sites look professional, and also make them portable. I had the following requirements:
  1. Mature framework
  2. Can be found on a CDN
  3. Easy to use
  4. Simple to implement
  5. Well Documented
  6. Lots of examples
  7. Flexible
  8. Customizable
  9. Response UI
  10. HTML5
  11. Portable
  12. JSF Compatible
  13. Works with NetBeans IDE for Tooling
I looked at a number of frameworks including Foundation, and Bootstrap. I ended up choosing Foundation since it seemed to be easier to use for me. Your milage my vary.

The first thing I wanted to know was what was the minimum required for a template on Blogger. I discovered that are a couple of versions of the template: an HTML 4.01 version (v.1) and an HTML 5 version (v.2) which are somewhat a hybrid mix of XML, and (X)HTML. I published the basic templates on Gist as shown below.

I have a couple of different blogs and found them to be different so I thought I would share my findings.

The next thing I needed to find out was what was the minimal template I would need for using with Foundation. The template below uses a CDN to deliver the required JS/CSS. The template below is the culmination of a lot of work to make it work with the visual tools on Blogger. Remember to backup your existing template before installing mine.

Conclusion

I finally have a working blog site using the new template, and will update all of my sites to use it. My personal non-technical blog site was the first to use the new template. It is still a work in progress, but it looks very nice. Take a peek for yourself at John Yeary Blogger site.

I have compiled a list of links that I found helpful in trying to figure out their layouts and tags in the references below.

References

Tags

Template References

Additional References

Monday, January 20, 2014

SourceServlet: Displaying the Source Code and Pages from a Project on your Blog

SourceServlet
I had been working on a way to create nice examples that include a way to display the page and source code for it. I created a servlet that will display the code as plain text that I would like to share with all of you.

SourceServlet.java


Saturday, January 18, 2014

HOWTO: Adding SyntaxHighlighter to Blogger

If you want to use SyntaxHighlighter in your blog, you can simply add the code below to the <head /> element in the template for your Blogger blog.

Friday, August 20, 2010

Why Movable Type, Drupal, or Wordpress on GlassFish?

WordPress





The question of relevance has come up on why would you implement Movable Type, Drupal, or Wordpress on GlassFish. Is it because you can?

The answer is one of technology fundamentals and implementation strategies. I am a Java developer (if you could not figure that out from the blog title). I have access to GlassFish which I use for all of my web based application deployments. I want to be able to simplify my administration requirements by using a unified deployment platform. I also want to be able to combine the extensive libraries and frameworks that are available for Java. I want a simple intuitive administration console to handle most of my day-to-day needs. I want administration, and deployment to be scriptable. GlassFish solves a number of these issues, along with using Java, and Java based implementations of some popular languages like JRuby, and Jython.

First, GlassFish versions 2 and 3 are the reference implementations for Java Enterprise Editions (EE) 5 and 6 respectively. If you are doing enterprise software development, and want to use the latest reference versions, you should use GlassFish. I often write about Java Enterprise Edition (EE). I try to focus on the core technology since this keeps it compatible across other EE containers should you choose to move it to another container. GlassFish version 3 has made a number of positive steps in JEE 6 to make it easier to use. The new profiles in GlassFish make it easier to do web development.

Apache web server is very powerful. There is no question about that, but installing modules, and configuring it is not simple. If a module is not available in one of the pre-configured and installed versions on your system, you must compile it yourself. I am a very competent Apache administrator, and I have never had a simple download, and compile deployment. Let me contrast that with GlassFish, if you have Java 6 installed on your system, download and run it. If you are using JRuby, or Jython, GlassFish can handle it right out  of the box. In the case of JRuby, there have been a number of performance tests to show JRuby on Glassfish is faster that Ruby on WEBrick, or Mongrel. The Common Gateway Interface (CGI) servlet will allow you to take advantage of additional CGI technologies with simple configuration on a server wide basis, or on a per application basis.

Apache Web Server and GlassFish can take advantage of a number of frameworks. Apache Web Server can run Ruby applications with the appropriate module. However, it can not take advantage of other independent frameworks. Java on GlassFish allows Ruby developers to use Java frameworks like Swing within their applications. You can even create polyglot applications which use JRuby, Jython, and Clojure. This may be possible  with Apache Web Server, but I am unaware of it. This is a comment point for readers.

Simple and Intuitive administrative interface. That describes GlassFish administration console to a tee. I would even include elegant, and beautiful.

GlassFish Administration Console

Glassfish includes a very complete command-line interface. Anything you can do on the GUI based interface, you can do from the command-line. It also includes a number of advanced features which are not available in the adminstrative GUI.

Finally, as I noted above it has multiple configuration points with languages and technologies including Microsoft technologies.

I have found that GlassFish handles all of my Web based needs in a single platform. This combination of technology and integration points makes it easy to install relevant best of breed software like Drupal, Movable Type, or Redmine on the same platform and integrate functionality between them as necessary. It is very nice to have Redmine and Hudson CI running on the same platform. Combine it with Mercurial, and share a common SSO. This is not done easily on Apache Web Server, or any other platform.

I hope this clarifies my position on its relevance with Movable Type, Drupal, Wordpress, etc.

Wednesday, August 18, 2010

Movable Type 5.x on GlassFish 3.x

Image representing Movable Type as depicted in...Image via CrunchBase

As a number of you know I have done articles on connecting Drupal on GlassFish. The same procedure would work for WordPress on GlassFish using Quercus.

This is a change of track; Movable Type is a Common Gateway Interface (CGI) based application on Perl. GlassFish provides a means, in fact, a default for executing cgi-bin applications and specifically by default Perl.

I am a fan of Movable Type. Perhaps it stems from my earlier years as a developer using Perl. The movable type tags are familiar and follow a JSP/JSF tag library paradigm which also makes its use feel more native to me. So I spent the weekend tweaking the process. I will not move this blog to it since so many of you know where it is at, but I am going to move my personal blog on to it.

Software Requirements:

Movable Type 5.02
GlassFish 3.0.1
NetBeans 6.9.1
MySQL 5.x
Perl 5.8.1+ (OS X 10.6 has Perl 5.10)

Perl

The first step is to examine the requirements from Movable Type on which Perl modules are required to run the application. There are also a number of additional modules listed for more functionality. You can add these later as you need them, or be proactive and download them in advance. I will not repeat the requirements from the Movable Type site, but here is a link: Perl Modules.

MySQL

The MySQL portion simply is installing the database software, creating a database, and adding a user. It is very straight forward.
  1. Install MySQL 5.x.
  2. Create movable type database. From a mysql prompt:

    create database movable_type character set utf8;

  3. Create database user.

    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON movable_type.* TO 'movable_type'@'localhost' IDENTIFIED BY 'movable_type';

    Note: Do not do this in production!

Movable Type 5.x

  1. Download Movable Type 5.02
  2. Unzip the files.
  3. Change the name from MT-5.02 to mt
  4. Change permissions on the mt-static/support directory to 777, or 755 if the application server owns the directory.
    chmod 777 mt-static/support
  5. Create a directory called WEB-INF in the mt directory
NetBeans 6.9.1

  1. Download and Install NetBeans 6.9.1.
  2. Create a new Web Project from Existing Sources.




  3. Name the project mt-project to keep it separated from project code.




  4. Select the directory where the source (.cgi files) are located.
  5. Select the WEB-INF directory you created previously. Alternatively you can download my pre-configured files including the web.xml files here.



  6. The project should be complete and look like the following.



  7. Create a web.xml file which will contain the servlet information needed to run the CGI based applications. Alternatively you can download my pre-configured files including the web.xml files here. The file should contain the following:



    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <description>This is a dummy web.xml file that configures GlassFish 3.x to handle Common Gateway Interface (CGI) applications. Specifically, it is configured for Movable Type 5.x.
    If you need to set additional parameters, please see the default-web.xml file located in the domainX/config directory.
    </description>
    <display-name>Movable Type 5.x Web Project</display-name>
    <servlet>
    <description>Default GlassFish Common Gateway Interface (CGI) Servlet</description>
    <servlet-name>cgi</servlet-name>
    <servlet-class>org.apache.catalina.servlets.CGIServlet</servlet-class>
    <init-param>
    <description>0 = Off 1 = On
    </description>
    <param-name>debug</param-name>
    <param-value>1</param-value>
    </init-param>
    <init-param>
    <description>A required parameter. It defaults to perl.</description>
    <param-name>executable</param-name>
    <param-value/>
    </init-param>
    <init-param>
    <description>You may change this to point where the *.cgi
    files are located. This sets the path to the main
    project directory. The default is WEB-INF/cgi
    </description>
    <param-name>cgiPathPrefix</param-name>
    <param-value/>
    </init-param>
    <load-on-startup>5</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>cgi</servlet-name>
    <url-pattern>/cgi-bin/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>
    30
    </session-timeout>
    </session-config>
    <welcome-file-list>
    <!-- This is set to point to the default Movable Type application -->
    <welcome-file>cgi-bin/mt.cgi</welcome-file>
    </welcome-file-list>
    </web-app>
    
  8. This completes the project.
    Note: You will not be creating a .war file for the application since this will remove the permissions, and executable flags from the *.cgi scripts.
  9. Close the application and move it to a directory location of your choosing for example /usr/local/mt.
GlassFish 3.x

  1. Download and Install GlassFish 3.0.1
  2. Start the application server and verify that it is running correctly.
  3. Deploy the Movable Type application

    asadmin deploy /usr/local/mt

  4. Examine the application from the GlassFish administration. You should see it deployed as an application.



  5. Launch the Configuration Wizard. http://localhost:8080/mt/cgi-bin/mt-wizard.cgi



  6. Set the location of the mt-static static web path. I changed mine to http://localhost:8080/mt/mt-static/
  7. Ensure that the mt-static absolute path is correct.
  8. The next step checks to make sure all of the required Perl modules are installed. If it shows any requirements missing, install them before continuing. This is a clean example.



  9. Configure the database. In this case everything is called movable_type.
    Note: Do not do this in production.



  10. Test the connection. If the connection is successful, you should see the screen below.



  11. Next configure Email. The example below is a representative sample where I chose Sendmail.



  12. Test email.



  13. Congrats! You have configured Movable Type!



  14. Configure your account (Administrative Account).



  15. The next set of steps can be customized depending on how you want to deploy web sites, and blogs to your GlassFish instance. This example will install the files in the document root on the server to make it the default site and blog. Configure your site. Please note in the image below, I have set the root to http://localhost:8080 and the file location to the ../domains/domain1/docroot folder



  16. Click Finish Install



  17. Click on your website and add any parameters you need to set, and click on publish.
    Note: If you don't publish, the site will not be available.



  18. Check out your new Movable Type site!




I hope you enjoyed this tutorial, and will take advantage of Movable Type for creating a web site and blogging.

A great article which describes a lot of detail around CGI on GlassFish v2 and v3 was done by Shing Wai Chan called Common Gateway Interface in GlassFish. His blog explains the Common Gateway Interface (CGI) Servlet in GlassFish, and without it none of this is possible.

Enhanced by Zemanta

Popular Posts