Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 593

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/saibote/public_html/blog/wp-includes/classes.php on line 710

Strict Standards: Redefining already defined constructor for class wpdb in /home/saibote/public_html/blog/wp-includes/wp-db.php on line 58

Deprecated: Assigning the return value of new by reference is deprecated in /home/saibote/public_html/blog/wp-includes/cache.php on line 99

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/saibote/public_html/blog/wp-includes/cache.php on line 404

Deprecated: Assigning the return value of new by reference is deprecated in /home/saibote/public_html/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/saibote/public_html/blog/wp-includes/theme.php on line 576

Warning: Parameter 1 to ace_where() expected to be a reference, value given in /home/saibote/public_html/blog/wp-includes/plugin.php on line 163

Warning: Parameter 1 to ace_join() expected to be a reference, value given in /home/saibote/public_html/blog/wp-includes/plugin.php on line 163
Life of the IT-Drummer
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 932

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/saibote/public_html/blog/wp-includes/kses.php on line 933

Life of the IT-Drummer

A web log from Tobias Rusås Olsen.

Posting feeds to IRC with Pircbot and Spring Integration 2.0

Hi!

Please view the official documentation for more information about Spring Integration 2.0

This will show you how to combine Spring Integration with the PircBot IRC-framework in order to create a bot that can post new updates to IRC.

Before you start off, you need Maven and eclipse. You can manage to do this without eclipse, but I guess you need to do some steps more manually.

First off, we create a file structure for our new project, make the folders like this:

MyProject
-main
–src
—java
–resources

Create the maven pom.xml in the root folder, and add the following contents:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.saiboten.integrationfeed</groupId>
  <artifactId>integrationfeed</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>integrationfeed</name>
  <url>http://maven.apache.org</url>
 
<dependencies>
 <dependency>
   <groupId>org.springframework.integration</groupId>
   <artifactId>spring-integration-core</artifactId>
   <version>2.0.3.RELEASE</version>
</dependency>
 
<dependency>
    <groupId>org.springframework.integration</groupId>
    <artifactId>spring-integration-feed</artifactId>
    <version>2.0.1.RELEASE</version>
</dependency>
 
<dependency>
    <groupId>rome</groupId>
    <artifactId>rome</artifactId>
    <version>0.9</version>
</dependency>
 
<dependency>
    <groupId>pircbot</groupId>
    <artifactId>pircbot</artifactId>
    <version>1.4.2</version>
</dependency>
 
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>
 
</dependencies>
</project>

This will get our spring integration dependencies, the pircbot framework, rome for feed parsing and I also included log4j for good measures.

Open a terminal window, maneuver to the root folder and write: mvn eclipse:eclipse to create the project. Import the project into eclipse by using import -> existing projects into workspace.

First we need to create the bot, add a new package declaration, create a new class in that package with the name of your bot, I called mine SaibotBot, and it looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package no.saiboten.pircbot;
 
import org.jibble.pircbot.PircBot;
 
public class SaibotBot extends PircBot {
 
	public SaibotBot() {
		this.setName("saibotboten");
	}
 
	public void startBot() throws Exception {
		// Enable debugging output.
		this.setVerbose(true);
 
		// Connect to the IRC server.
		this.connect("irc.freenode.net");
 
		// Join your channel.
		this.joinChannel("#channelname");
	}
}

Next, we need to define an application context for configuring the spring integration parts. We need a channel where messages can be sent, we need a message handler to handle message sent to the channel, we need a channel adapter to read a feed and a poller attached to it in order to define how often we should read the feed for new updates. In this example, it will read from my twitter feed. The polling is sat to 600000 milliseconds, that’s 10 minutes. The service activator is used to connect a channel to a message handler. I also defined the bot here in order to get a singleton object of this class.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:int-feed="http://www.springframework.org/schema/integration/feed"
	xmlns:si="http://www.springframework.org/schema/integration"
	xsi:schemaLocation="
			http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
            http://www.springframework.org/schema/integration/feed http://www.springframework.org/schema/integration/feed/spring-integration-feed-2.0.xsd
            http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.0.xsd
                        ">
 
    <si:channel id="feedChannel" />
 
	<!--  Saiboten -->
	<int-feed:inbound-channel-adapter channel="feedChannel" url="https://twitter.com/statuses/user_timeline/14285281.rss">
		<si:poller fixed-rate="600000" max-messages-per-poll="100" />
	</int-feed:inbound-channel-adapter>
 
    <si:service-activator input-channel="feedChannel" ref="messageHandler" />
 
    <bean id="messageHandler" class="no.saiboten.integration.feed.MessageHandler">
    	<constructor-arg ref="bot" />
    </bean>
 
    <bean id="bot" class="no.saiboten.pircbot.SaibotBot" />
</beans>

To Handle the messages retrieved, we need a message handlers. It will need to post the messages to your channel, so it needs to know about your bot. The class looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package no.saiboten.integration.feed;
 
import no.saiboten.pircbot.SaibotBot;
 
import org.springframework.integration.Message;
 
import com.sun.syndication.feed.synd.SyndEntryImpl;
 
public class MessageHandler {
 
	SaibotBot bot;
 
	public MessageHandler(SaibotBot bot) {
		this.bot = bot;
	}
 
	public void handleMessage(Message<SyndEntryImpl> message) {
		SyndEntryImpl syndFeed = message.getPayload();
	           bot.sendMessage("#channelname", syndFeed.getTitle());
	}
}

Next, create a bootstrap class that will use springs applicationContext and launch the bot. A

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package no.saiboten.integration.main;
 
import java.io.IOException;
 
import no.saiboten.pircbot.SaibotBot;
 
import org.springframework.context.support.ClassPathXmlApplicationContext;
 
public class BootStrapper {
	public static void main(String[] args) throws IOException {
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				new String[] { "applicationContext.xml" });
		SaibotBot bot = (SaibotBot) context.getBean("bot");
 
		try {
			bot.startBot();
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}

Aright! That’s it! Make sure you don’t poll to often, as some sites have limitations on how often your can read their feeds.

No comment
taintedsong.com taintedsong.com taintedsong.com

Basic Spring 3.0 eclipse-project with Maven 3

There are already lots of tutorials for Spring and for Maven, but many seemed outdated, and it was a challenge to collect all the pieces, so I’ve done it for you (and for the future me). Just follow these instructions! This is pretty much a “Getting started”, and it does not contain much details. If there are any questions or remarks, please use the comment field.

Download Maven:

http://maven.apache.org/download.html.

To be able to run mvn from the command line, add this to your environment variable “path”: ${install_folder}\apache-maven-3.0.2\bin. Replace ${install_folder} with your install folder, obviously.

Open a terminal and write mvn and verify that it runs.

Go to your eclipse workspace, create a new folder and add a pom.xml-file. This is Mavens “Project Object Model” which is used for configuring the project. I won’t go into details, but most lines define dependencies needed for Spring. Add this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.saiboten.testapp</groupId>
  <artifactId>testapp</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>testapp</name>
  <url>http://maven.apache.org</url>
 
  <build>
 
  <plugins>
  <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <version>6.1.10</version>
 
        <configuration>
                <scanIntervalSeconds>10</scanIntervalSeconds>
                <stopKey>foo</stopKey>
                <stopPort>9999</stopPort>
        </configuration>
</plugin>
</plugins>
</build>
 
<!-- Shared version number properties -->
<properties>
    <org.springframework.version>3.0.5.RELEASE</org.springframework.version>
</properties>
 
<dependencies>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-core</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-expression</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-beans</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-aop</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-context</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-web</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-webmvc</artifactId>
  <version>${org.springframework.version}</version>
</dependency>
 
<dependency>
  <groupId>org.springframework</groupId>
  <artifactId>spring-test</artifactId>
  <version>${org.springframework.version}</version>
  <scope>test</scope>
</dependency>
 
<dependency>
    <groupId>geronimo-spec</groupId>
    <artifactId>geronimo-spec-j2ee</artifactId>
    <version>1.4-rc4</version>
</dependency>
 
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.16</version>
</dependency>
 
<dependency>
    <groupId>cglib</groupId>
    <artifactId>cglib</artifactId>
    <version>2.2</version>
</dependency>
 
<dependency>
    <groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.1.2</version>
</dependency>
 
<dependency>
    <groupId>commons-lang</groupId>
    <artifactId>commons-lang</artifactId>
    <version>2.5</version>
</dependency>
 
<dependency>
    <groupId>taglibs</groupId>
    <artifactId>standard</artifactId>
    <version>1.1.2</version>
</dependency>
 
</dependencies>
</project>

Create the following file structure:

1
2
3
4
5
6
7
8
9
10
11
12
13
root
-src
--main
---java
---resources
---webapp
----META-INF
----WEB-INF
-----jsp
 
-test
--main
---java

Open a new terminal window, navigate to the folder with the pom.xml, and write mvn eclipse:eclipse. This will create a new eclipse project based on the file structure and the contents of the pom.xml.

Import the project into eclipse by using “Existing projects into Workspace” in the import meny. The root dir is the testapp-dir of your new project.

Add a web.xml-file in the src/main/webapp-folder with the following contents:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
	id="WebApp_ID" version="2.5">
	<display-name>testapp</display-name>
 
	<context-param>
		<param-name>contextConfigLocation</param-name>
		<param-value>WEB-INF/dispatcher-servlet.xml</param-value>
	</context-param>
 
	<servlet>
		<servlet-name>dispatcher</servlet-name>
		<servlet-class> org.springframework.web.servlet.DispatcherServlet 
		</servlet-class>
		<load-on-startup>1</load-on-startup>
	</servlet>
 
	<servlet-mapping>
		<servlet-name>dispatcher</servlet-name>
		<url-pattern>/</url-pattern>
	</servlet-mapping>
 
	<listener>
		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
	</listener>
	<listener>
		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
	</listener>
 
</web-app>

Also add a dispatcher-servlet.xml in the same folder, it should have this content:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans
        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
        http://www.springframework.org/schema/context
        http://www.springframework.org/schema/context/spring-context-3.0.xsd">
	<context:annotation-config />
 
	<bean id="viewResolver"
		class="org.springframework.web.servlet.view.UrlBasedViewResolver">
		<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
		<property name="prefix" value="/WEB-INF/jsp/" />
		<property name="suffix" value=".jsp" />
	</bean>
 
 
</beans>

Let’s create some classes. First we need a controller. I have called mine DefaultController. Annotate the class with @Controller, and add a method called helloWorld, and annotate it with @RequestMapping(”hello”). Requests with path “hello” will be forwarded to this controller by the dispatcher servlet.

The full class looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package com.saiboten.testapp.controller;
 
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
 
@Controller
public class DefaultController {
 
	@RequestMapping("hello")
	public ModelAndView helloWorld() {
		ModelAndView mav = new ModelAndView("hello");
 
		mav.addObject("hello", "Hello Spring!");
 
		return mav;
	}
 
}

For the class to be made available in the application context, we need to scan the package for components. Add this line to your dispatcher-servlet.xml:

1
<context:component-scan base-package="com.saiboten.testapp.controller" />

Now we need a jsp-file called “hello.jsp”. Add it in the jsp-folder underneath WEB-INF. Add the following contents:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Hello Spring!</title>
</head>
<body>
<p>${hello}</p>
 
</body>
</html>

Add a log4j.properties-file in the src/main/resources folder. This will attach a log-appender to the project.

1
2
3
4
5
6
7
8
9
# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1
 
# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
 
# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

Go to the terminal window again and write “mvn install jetty:run”. This will compile the project, install it to your local maven repository and start the lightweight application server jetty by using the maven-jetty-plugin defined in your pom.xml. Open your browser and navigate to: http://localhost:8080/testapp/hello.

4. ?
5. Profit

2 Comments
taintedsong.com taintedsong.com taintedsong.com

A simple quiz program for guessing guitar chords.

I recently have gotten a bit more familiar with the jQuery framework, and my latest little program is a guitar chord guesser. The program plays a sound, and you guess what chord it is, there’s also a bit of statistics for your guesses.

You can try it here.

It’s a fairly simple program, see the source code if you are interested in that sort of thing. For sound, it uses Soundmanager 2. For now, the chords are played by me, with a pretty bad mic, I’ve discovered that it’s pretty much impossible to search and find chords in mp3-format on the web.

Now go out there and guess those chords!
I will try to extend the program to include minor chords at a later time, and maybe even make an advanced version with some more funky chords.

Update: It now has support for minor chords, and I’ve also added some more statistics. I’ve also med a playground page where people can practice. You can find it here: saiboten.com/chordplayground.

No comment
taintedsong.com taintedsong.com taintedsong.com

December 24: Ungdomskulen - Idunno

Ungdomskulen - Idunno from the album Bisexual.

Nuns?

Spotify link: http://open.spotify.com/track/6IXlH5b8FXeJTkhyiwxLMR

Ungdomskulen (The Junior High) is a .. progressive indie rock (?) three piece from Bergen, Norway. Their debut album Cry Baby was a very decent album, and obviously the start of something good. For some reason I only got into them after seeing them live at the second time here in Bergen, right before they released their second album, Bisexual. The album is perhaps even better than Cry Baby, and should definately put them on the world music map.

The song I have selected is the most astonishing track: “I Dunno”. The song has a pretty massive groovy right from the start. Beautiful bass and gitar combinations and great use of cow bells, which is a Ungdomskulen trademark. Then there’s a break down, and a pretty funky slow part. When the song kicks in again, it’s amazing what they accomplish with just bass and guitar. Just a plain amazing track.

And the concludes this christmas calendar. :-)

Merry Christmas!

No comment
taintedsong.com taintedsong.com taintedsong.com

December 23: Mew - Introducing Palace Players

Mew - Introducing Palace Players from the album No More Stores …

Butterflies, or something

Spotify link: http://open.spotify.com/track/0Xd6YqpdN4MIGS2tlqiHK2

Mew has, since I first discovered them at a concert in Roskilde in 2005 been a band I’ve always had a good eye to. I think that their first two releases were pretty decent, with many solid tracks. The first album was maybe a bit pop, and the second a bit darker. This year they released “No More Stories…” (I don’t bother writing the whole name), the first album since 2005. I think the album is quite the masterpiece, with lots of great tracks. I think they succeed in sounding interesting the first time you hear them, and later on your discover new parts, or still can’t figure out some rhythm section, which I found fascinating.

The track I’ve selected for today, is the first single “Introductin Palace Players”, which also was on the No More Stories EP. The track begin with a weird rhytm intro, not all that unlike the start of And The Glass Handed Kites, and then crashes into a more open riff. The drums then play a pretty progressive drum beat with interesting fills, before the vocal kicks in. The end is also quite unusual for a band with such broad audience. I hope that this album will get more people into more challenging music.

1 Comment
taintedsong.com taintedsong.com taintedsong.com

December 22: Isis - Threshold of Transformation

Isis - Threshold of Transformation from the album Wavering Radiant.

Spotify link: http://open.spotify.com/track/53lHOhfHoDAGEqUWoChdJF

Isis, this post-metal band from the states, released the follow up to In the Absence of Truth, Wavering Radiant this year. I have always experienced that I seem to like one track from their albums better than the rest. On both Panopticon and Oceanic, I’ve enjoyed the first track, but on wavering radiant, this changed. I think that last track, Threshold of Transformation is the best from this album.

It starts off with a quite brutal way, by Isis standards. The drums are pretty awesome, and they change from hard to soft a couple of times before the amazing part around 04:50, which kinda reopens the song, and I feel it’s quite a reminder of what’s to come when they cool it down around 05:30. Then there’s an amazing build up, the bass line around 07:00 is just plain amazing, for me the highlight of the track.

No comment
taintedsong.com taintedsong.com taintedsong.com

December 21: Mastodon - Crack the Skye

Mastodon - Crack the Skye from the album Crack the Skye.

Awesome cover art, as always

Spotify link: http://open.spotify.com/track/4nwwFLQqopxAL0g2L0Fg0B

Mastodon, the band known for complex, progressive music, crazy drumming (in fact, some claim that the drumming is doing the riffing, and the guitars are just trying to glue it all together) and very cool artwork, released their newest album “Crack the Skye” in 2009. This time they have gone a bit back to the basics, focusing on creating good, solid tracks instead of trying to push boundaries. They also had the privilege of having some great guest musicians join them, which they also have done earlier with Josh Homme and two of the guys from Mars Volta, and Scott Kelly from Neurosis on the album Blood Mountain, and Scott Kelly is also present on this album, on the track Crack the Skye.

The song has many similarities to Neurosis, especially the very powerful riff at about 01:04. I actually though to myself: “Hey, this part is a goddamn Neurosis ripoff”, before I even knew that Scott Kelly was a guest musician on the album. I guess it’s ok to steal some Neurosis riffs if you are doing the scheme with Neurosis and the music turns out as good as this.

No comment
taintedsong.com taintedsong.com taintedsong.com

December 20: The Pains of Being Pure At Heart - Higher than the Stars

The Pains of Being Pure At Heart - Higher than the Stars from the EP Higher than the Stars

This looks like a picture of Munch

Spotify link: http://open.spotify.com/track/3Mu70nOHEJpxWff0ZPm9MZ

The Pains of Being Pure at Heart is a fairly new Indie pop band from New York City. They have released two EPs and one album, and for some reason, I discovered their EP “Higher than the Stars”, first (it’s their latest release), and that’s also where I found the beautiful title track.

Solid bass lines, great use of keyboards, good vocals. This track has it all.

No comment
taintedsong.com taintedsong.com taintedsong.com

December 19: Nile - Utterances of the Crawling Dead

Nile - Utterances of the Crawling Dead from the album Those Whom the Gods Detest

Nile - Those Whom The Gods Detest album cover

Spotify link: http://open.spotify.com/track/2vYznzc0S0KAADPw9cUnA5

To those unfamiliar to Nile, they are a technical death metal band with inspirations from the ancient Egypt. I remember discovering Nile before seeing them at the Hole-in-the-Sky Festival here in Bergen, and remember that their extreme expression, and the gig was about the most extreme thing I’ve ever seen, George Kollias sure as something. After the gig I really got into them, especially Annihilation of the Wicked and In Their Darkened Shrines were two of the records I’ve played a lot in my life. The follow up to AotW, Ithyphallic was maybe not all that great, and that’s why I had lowered my expectations a bit when they released Those Whom the Gods Detest this autumn. But ow boy, did they deliver.

While Ithyphallic was quite the nut to figure out, Those Whom the Gods Detest has gone a bit back to basics, it’s still as extreme as it gets, but they focus more on killer riffs, and repeats them a bit, which makes it easier to get into their songs. Fun fact: The drums are engineered by Erik Rutan, and they sound damn amazing. And George Kollias is still one of my favorite extrem metal drummers.

The song I’ve selected is Utterances of the Crawling Dead, a track containing those killer riffs, and the song actually is quite groovy, something which is tough to do at higher tempoes. But please check out the rest of the album as well, the opening track Kafir is .. amazing, 4th Arra of Dagon (check out the last third), Permitting … and more.

No comment
taintedsong.com taintedsong.com taintedsong.com

December 18: Sworn - Damnation Spawned

Sworn - Damnation Spawned from the album Bastards And Conquerors.

Go gadget, go!

Spotify link: http://open.spotify.com/track/5ySqZzYOLIlXX9eEYX8qTX

Sworn is a Melodic Black Metal band from Bergen, Norway. They have existed for quite a few years and released their second album “Bastards and Conquerors” this year, after their brilliant debut album “The Alleviation” in 2007. The album is a very high quality follow up, The Alleviation had some weak spots in that some tracks where better than others, but on this album the general quality of the songs are higher. It was therefore harder to choose one favorite, but I’ve selected the great song Damnation Spawned, an eight minute epic with all that’s great about Sworn.

The song starts in “In Medias Res”, with a great melodic riff and blast beats. The next riff is just as great, very tender. In the middle of the track there’s the obligatory quiet part before the end, and a tender solid end part which last a few minutes.

They are playing at Rockefeller today (!), so if you are in Oslo, hurry up and attend. :-)

No comment
taintedsong.com taintedsong.com taintedsong.com