Older blog entries for waffel (starting at number 40)

no running imapd / slapd under gentoo

Today, I discovered that my mailserver was down on a root server (running gentoo). I tried to search why and whats the problem.

  1. I see error messages, that some processes cannot connect to ldap
  2. I tried to use phpldapadmin to check whats wrong. Here I got the next error: Fatal error: Cannot redeclare password_hash()
  3. I changed the used php version from php-5.5 to php-5.4 … phpldapadmin again works, but I cannot login
  4. I see imapd segmentation faults in dmesg in libwrappers …so I guess there is a problem with sys-apps/tcp-wrappers
  5. I rebuild tcp-wrappers, restarting nearly all processed from /etc/init.d without success
  6. I get deeper into the logfiles of my server (needed to take a look into the live logfiles (which logs all into one file, which is heavy under a root server with many hosted domains)
  7. I see an error, that some processes (one was also slapd) cannot read /etc/hosts.deny
  8. I see, that only root has the permission to read /etc/hosts.deny
  9. I change the permission to get all a read of this file
  10. Restarting slapd and all stuff works again … what a pain

Feels like one of my living years are gone … sometimes I love, but sometimes I hate gentoo.

I do not know who has changed the permissions on this file … but if I found he/it … *g*


Einsortiert unter:administration, webmaster

Syndicated 2014-03-13 12:46:59 from waffel's Weblog

no CSS in mediawiki anymore

After upgrading my gentoo system, I discovered a problem with one of my new mediawiki installations:

No CSS anymore!

That’s frustrating. Looking with my browser tools, I see, that the load.php from mediawiki returns nothing. Searching around and found only one place which helped:

https://bugs.php.net/bug.php?id=64836 <– the bug entry on php.

Now I tried to downgrade my gentoo package sys-apps/file back to 5.11 and restarting my apache … viola … it works.

emerge =sys-apps/file-5.11

Now the load.php works again and it looks like, that this has nothing to do with mediawiki itself.


Einsortiert unter:administration, webmaster Tagged: bug, css, gentoo, mediawiki

Syndicated 2013-09-07 15:22:00 from waffel's Weblog

testing REST interface with Spring 3.2 and a session scoped bean

There are some nice articles around the “spring 3.2 testing capabilities” like the spring documentation itself, this blog and this blog.

I wanted to not only test one request/response action against my REST interface. I wanted to simulate and test more of a conversation as it typical happens in the UI.

Following REST interface I wanted to create and test:

@RequestMapping("/customer")
public interface RESTCustomer {

@RequestMapping(
method = RequestMethod.POST)
@ResponseBody
Customer create(@RequestParam("firstname") final String firstname,
@RequestParam("lastname") final String lastname);

@RequestMapping(
method = RequestMethod.DELETE)
@ResponseStatus(HttpStatus.OK)
void delete(@RequestParam("id") final String... customerIds);

@RequestMapping(
produces = MediaType.APPLICATION_JSON_VALUE,
method = RequestMethod.GET)
@ResponseBody
Collection<Customer> getAll();

@RequestMapping(
value = "/update",
method = RequestMethod.POST)
@ResponseBody
Customer update(@RequestParam("id") final String id, @RequestParam("firstname") final String firstname);

}

Following test steps I had in mind, to test the create method:

  1. Get a list of all customers and remember the count
  2. Create a new customer
  3. Check, that the ID of the returning Customer was updated
  4. Get again a list of all customers
  5. Check the size of the customer list before and after creation … they should differ between one entry/li>

The new Spring Framework version 3.2 introduced some nice feature to do REST testing with minimal effort.

To test such conversion, you need beside the WebApplicationContext a MockHttpSession which has to be used between different mockMvc calls, on one test case.

The following base test structure is required:

@RunWith(SpringJUnit4ClassRunner.class)
@WebAppConfiguration
@ContextConfiguration(
  classes = {
    MyConfig.class,
  })
public class RESTCustomerTest {
  
@Autowired
  private WebApplicationContext wac;

  @Autowired
  MockHttpSession session;

  MockMvc mockMvc;

  ObjectMapper jsonObjectMapper;

  @Before
  public void setup() {
    mockMvc = MockMvcBuilders.webAppContextSetup(wac).build();
    jsonObjectMapper = new ObjectMapper();
  }

  @Test
  public void testCreate() throws Exception {
    ....
  }
}

Let assume, there is an implementation of the RESTCustomer service interface like this:


@Component
public class CustomerResource implements RESTCustomer {

  private final PlatformService service;

  @Autowired
  public CustomerResource(final PlatformService service) {
    this.service = service;
  }

  @Override
  public Customer create(final String firstname, final String lastname) {
    ...
    return service.createCustomer(firstname, lastname);
  }

  @Override
  public Collection<Customer> getAll() {
    ...
    return service.getAllCustomers();
  }

}

Assume also, that the autowired PlatformService is a Session scoped bean (somewhere configured inside the spring configuration).

Now our testing method can be like this:


  int countCustomers() throws Exception {
    final MvcResult mvcResult = mockMvc.perform(get("/customer").session(session).accept(MediaType.APPLICATION_JSON))
        .andReturn();
    final Collection<Customer> customers = getRawObjects(mvcResult);
    return customers.size();
  }

Collection<Customer> getRawObjects(final MvcResult mvcResult) throws Exception {
    return jsonObjectMapper.readValue(mvcResult.getResponse().getContentAsString(),
        new TypeReference<Collection<Customer>() {
        });
  }

Customer getRawObject(final MvcResult mvcResult) throws Exception {
    return jsonObjectMapper.readValue(mvcResult.getResponse().getContentAsString(),
        new TypeReference<Customer>() {
        });
  }

  @Test
  public void testCreate() throws Exception {
    // get default customer list and count
    final int originalCustomerSize = countCustomers();

    // create new customer
    final MvcResult mvcResult = mockMvc
        .perform(
            post("/customer/?firstname={firstname}&lastname={lastname}","testFirstname", "testLastName").session(session).accept(
                MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andReturn();
    final Customer customerObject = getRawObject(mvcResult);
    assertNotNull("id of new customer should not empty", customerObject.get("id"));
    assertEquals("newly firstname should match", "testFirstname", customerObject.get("firstname");

    // again get list of all customers and check, if one more is available
    assertEquals("after new customer was created, the size should be one more", originalCustomerSize + 1, countCustomers());
  }

To get such conversation to work, you need to pass the session with .session(session) between the mockMvc calls. Else, every new mockMvc call creates a new session and your test fail.

REMEMBER: The trick is to pass the autowired MockHttpSession between the mock MVC requests.


Einsortiert unter:java, spring Tagged: base test, conversation, language java, mvc, REST, scope, session, spring, spring framework, test

Syndicated 2013-02-27 18:00:24 from waffel's Weblog

cannot longer login into squirrelmail with chrome (solved)

In the last days I’m unable to login into my webmail client, which runs with squirrelmail on a gentoo box.

I have tried to check whats going wrong and googled a little bit around. I have inspect the cookies with chrome and saw, that a (in some posts mentioned) cookie named “key” was never set.

After that, I have start to deactivate some of my chrome extensions and viola … login works again … the problematic extension I have found out was
“Simple Adblock” which I have installed in the last weeks.

Now I’m using again “AdBlock Beta” and added my webmail domain to the white list filter.

Everything fine again :-)


Einsortiert unter:Uncategorized Tagged: ad block, adblock, chrome, extension, login, problem, solved, squirrelmail, webmail client

Syndicated 2012-10-04 08:00:17 from waffel's Weblog

2011 in review

Die WordPress.com Statistikelfen fertigten einen Jahresbericht dieses Blogs für das Jahr 2011 an.

Hier ist eine Zusammenfassung:

Das Sydney Opera House bietet Platz für 2.700 Konzertbesucher. Dieses Blog wurde in 2011 etwa 30.000 mal besucht. Das entspräche etwa 11 ausverkauften Konzertveranstaltungen im Sydney Opera House.

Klicke hier um den vollständigen Bericht zu sehen.


Einsortiert unter:Uncategorized

Syndicated 2012-01-02 19:08:15 from waffel's Weblog

epson perfection VT10 under gentoo

Today I make my Epson scanner perfection VT10 running under gentoo.

What I did:

  1. Emerge the iscan packages:

    USE="X gimp jpeg png tiff -doc" emerge -av media-gfx/iscan
    emerge -av media-gfx/iscan-data
  2. Create a backup of the /etc/sane.dll/dll.conf and create a new one with only one line:

    mv /etc/sane.dll/dll.conf /etc/sane.dll/dll.conf.org
    echo "epkowa" >> /etc/sane.dll/dll.conf
  3. Changing the /etc/sane.d/epkowa.conf configuration to match the Perfection VT10.

    changing/uncomment in /etc/sane.d/epkowa.conf following lines (nothing more!):

    usb
    usb 0x04b8 0x012d

  4. Now I need some binaries for the scanner and some libs. They can be downloaded here:

    http://linux.avasys.jp/drivers/iscan-plugins/iscan-plugin-gt-s600/2.1.2/iscan-plugin-gt-s600-2.1.2-1.i386.rpm

  5. I opened the archive and extracted the libs libesint66* to /usr/lib/iscan and also the /usr/share/iscan/esfw66.bin
  6. Now I need to register the libraries and scanner binary to iscan:

    iscan-registry --add interpreter usb 0x04b8 0x012d /usr/lib/iscan/libesint66.so /usr/share/iscan/esfw66.bin
  7. The next step was to create a file called „interpreter“ in /usr/share/iscan-data/interpreter and adding the lib and binary:

    echo "interpreter usb 0x04b8 0x012d /usr/lib/iscan/libesint66 /usr/share/iscan/esfw66.bin" >> /usr/share/iscan-data/interpreter

After that, I was able to start iscan, select the first entry from the founded scanners and start to scan :-)


Einsortiert unter:administration Tagged: epson, gentoo, iscan, perfection, scanner, VT10

Syndicated 2012-01-02 13:22:10 from waffel's Weblog

Run eclipse RCP application via WebStart

The last days I need to create a small prototype to demonstrate how to start a eclipse RCP application via webstart. After reading many tutorials and tipps I have now a working setup which I want to share with you.

The main tutorial which I followed was the eclipse help itself. But there are some hidden points which are important to respect.

Lets start:

You need 4 Projects:

  • Eclipse RCP plugin
  • Feature for the plugin
  • Wrapping feature for webstart
  • entry or start JNLP file

At least you need an webserver which can deliver your files.

Create eclipse RCP plugin with a example RCP application provided by eclipse:

This plugin will provide the RCP application with a small demo UI. In a larger project you will normally have more than one plugin. But for demonstration proposed this would be enough.

  1. From the eclipse main menu, go to File > New > Project… (the New Project wizard opens), select Plugin-in Development > Plug-in Project
  2. Press Next > enter „org.test.webstart.demo.plugin“ as Project name
  3. Press Next > change the Version to „0.1.0″
  4. Press Next > select RCP application with an view > press Finish

At this point you should have a small RCP „application“ which can started from eclipse. Select the project root > select Run from the menu > select Run As > Eclipse Application. Now you should see the demo UI.

Next we need a Eclipse feature project which uses the plugin.

Create eclipse feature which contains the plugin and a reference to the eclipse rcp feature:

We need a feature which depends on the demo plugin and on the eclipse rcp feature. The dependency to the eclipse rcp feature is required to export later all required plugins and features for webstart, to run the complete rcp application.

  1. In the eclipse main menu go to File > New > Project… (the New Project Dialog opens), select Plug-in Development > Feature Project
  2. Press Next > enter „org.test.webstart.demo.feature“ as project name > change the Version to „0.1.0″
  3. Press Next > select „org.test.webstart.demo.plugin“ from plug-ins list > press Finish

The feature editor opens. Now you need to add the eclipse rcp feature as included feature. To do so select Included Feature tab in the feature editor > add „org.eclipse.rcp“ as feature. Save and close the feature editor.

This feature contains now all you need to run your application as a full featured eclipse RCP application. Now we need another wrapping feature to get the Webstart launcher on board.

Create wrapping feature for webstart

This feature will be used to export all required JAR files with the eclipse java webstart exporter into a local filesystem.

  1. From the eclipse main menu select File > New > Project… (the New Project Dialog opens), select Plug-in Development > Feature Project
  2. Press Next > enter „org.test.webstart.demo.wrapperfeature“ as project name > change the Version to „0.1.0″
  3. Press Finish. The feature editor opens.

Now we need a dependency to the equinox launcher plugin and include our own feature.

  1. In the feature editor select the Plug-ins tab > add „org.eclipse.equinox.launcher“.
  2. Select the Included Feature tab > add „org.test.webstart.demo.feature“ > save the editor.
  3. From the project root select the eclipse main menu > select File > Export… > select Deployable Features (the export wizard opens)
  4. Press Select All
  5. In the Desitination tab select a directory where you want to export the JAR and JNLP files.
  6. In the Options tab only select Package as individual JAR archives. If you select Generate metadata repository nothing will be exported!
  7. In the JAR Signing tab fill in all fields with the information from your keystore. If you do not have an keystore you can create your own by follow these instructions.
  8. In the Java Webstart tab select Create JNLP manifests for the JAR archives > add the Site URL like http://localhost:8080/demoui-webstart > set 1.5+ for the JRE version > pess Finish

Now you should have in your destination folder a folder structure like
– features
– plugins

Under the features folder you should have some JNLP files. Because of an error in the eclipse exporter you need to adjust the JNLP files. For example the JNLP file of the feature looks like:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/demoui-webstart">
	<information>
		<title>Demo_rcp_feature</title>
		<offline-allowed/>
	</information>
	<security>
		<all-permissions/>
	</security>
	<component-desc/>
	<resources>
		<j2se version="1.5+" />
	</resources>
	<resources>
		<extension href="features/org.eclipse.rcp_3.5.2.R35x_v20100119-9SA0FxwFnoCU5XxWItFdXXb27BA6.jnlp" />
		<jar href="plugins/demo_rcp_0.1.0.201103241351.jar"/>
	</resources>
</jnlp

You need to change the tag and add the required vendor information. The resulting information tag should look like

	<information>
		<title>Demo_rcp_feature</title>
		<vendor>Me</vendor>
		<offline-allowed/>
	</information

You need to do this for all JNLP files in the features folder!

Create start.jnlp file as the entry point for the web application

As a final step you need to create your entry JNLP file which is the starting point of your webstart application. Here is an example for start.jnlp:

<?xml version="1.0" encoding="UTF-8"?>
<jnlp
    spec="1.0+"
    codebase="http://localhost:8080/demoui-webstart"
    href="start.jnlp">
  <information>
    <!-- user readable name of the application -->
    <title> Demo UI Application </title>
    <!-- vendor name -->
    <vendor>Me</vendor>
    <!-- vendor homepage -->
    <homepage href="http://www.me.org" />
    <!-- product description -->
    <description>description</description>
    <offline-allowed/>
  </information>

  <!--request all permissions from the application. This does not change-->
  <security>
    <all-permissions/>
  </security>

  <!-- The name of the main class to execute. This does not change-->
  <application-desc main-class="org.eclipse.equinox.launcher.WebStartMain">
    <argument>-nosplash</argument>
  </application-desc>

  <resources>
    <!-- Reference to the launcher jar. The version segment must be updated to the version being used-->
    <jar href="plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v20090715.jar"/>

    <!-- Reference to all the plugins and features constituting the application -->
    <!-- Here we are referring to the wrapper feature since it transitively refers to all the other plug-ins  necessary -->
    <extension
        name="Wrapper feature"
        href="features/
org.test.webstart.demo.wrapperfeature_0.1.0.jnlp"/>

    <!-- Information usually specified in the config.ini -->
    <property
        name="osgi.instance.area"
        value="@user.home/Application Data/demoui-rcp"/>
    <property
        name="osgi.configuration.area"
        value="@user.home/Application Data/demoui-rcp"/>
    <!-- The id of the product to run, like found in the overview page of the product editor -->
    <property
        name="eclipse.application"
        value="org.demo.webstart.plugin.application"/>
  </resources>

  <!-- Indicate on a platform basis which JRE to use -->
  <resources os="Windows">
    <j2se version="1.5+"/>
  </resources>
  <resources os="Linux">
    <j2se version="1.5+"/>
  </resources>
</jnlp>

Some remarks according the main JNLP file:

You need to adjust (or take care) of the lines 04, 30, 36, 48.

Line 04 defines the codebase. Every time you want to deploy you application on an websever you need to adjust the codebase (in every JNLP file in your project!) to the web application location.

Line 30 depends on you eclipse distribution (I have used eclipse 3.5 with some updates). You have to check the right version in your plugins folder and update the start.jnlp file.

Line 36 defines the starting feature JNLP file. This file itselfs refers to the other JNLP files in the features folder (which is automaticly done from the eclipse exporter). You need to adjust this line if your project name differs from this example.

Line 48 defines the entry point to your application. This is the application ID from the example plugin. You can find the ID if you open the plugin editor of your example plugin. To do so open your example plugin and open the plugin.xml file. Under the tab Overview you can find the ID: „org.demo.webstart.plugin“. Now you also need to open the tab Extensions. Under the Extensions Details you can find the ID of your application. The complete application ID which you need to refer in the JNLP file is then „org.demo.webstart.plugin.application“.

If you now put the main JNLP file and the plugins + features folders under an webserver which delivers the files from http://localhost:8080/demoui-webstart/ you can see your test application. You should have following structure:

- start.jnlp
|– features
|– plugins

Simple click following link: http://localhost:8080/demoui-webstart/start.jnlp

Hint:
A small problem over which I stumbled while developing the example application:

If you start the application and you get from webstart a exception that plugin with *wpt* are not found, you can have a look into the JNLP files in the features folder. Some of these files define resources which are not exported by the eclipse webstart exporter. I have simple removed these resources from the JNLP files and it works.


Filed under: java Tagged: application, eclipse, export, java, jnlp, rcp, server, web, webstart

Syndicated 2011-03-28 17:07:33 from waffel's Weblog

actual images from Cryo-Tekk gig in Leipzig

Some nice pice from a gig from Cryo-Tekk in Mandragora in Leipzig now available on Schwarzepresse. It it nice to see me from the other side (as you may know: I’am the singer of the Band).

it's me

Very nice pics … I like them all. Thanks to Schwarzepresse.


Filed under: Cryo Tekk Tagged: concert, Cryo Tekk, schwarze presse

Syndicated 2011-02-23 13:00:05 from waffel's Weblog

2010 in review

The stats helper monkeys at WordPress.com mulled over how this blog did in 2010, and here’s a high level summary of its overall blog health:

Healthy blog!

The Blog-Health-o-Meter™ reads Fresher than ever.

Crunchy numbers

Featured image

A helper monkey made this abstract painting, inspired by your stats.

The average container ship can carry about 4,500 containers. This blog was viewed about 24,000 times in 2010. If each view were a shipping container, your blog would have filled about 5 fully loaded ships.

In 2010, there were 6 new posts, growing the total archive of this blog to 28 posts.

The busiest day of the year was February 5th with 128 views. The most popular post that day was expanding richfaces tree on datamodel changes.

Where did they come from?

The top referring sites in 2010 were community.jboss.org, stackoverflow.com, ahoehma.wordpress.com, ocpsoft.com, and de.wordpress.com.

Some visitors came searching, mostly for valuebinding deprecated, div bottom, java copy stream, java stream copy, and createvaluebinding deprecated.

Attractions in 2010

These are the posts and pages that got the most views in 2010.

1

expanding richfaces tree on datamodel changes September 2008
11 comments

2

Fast stream copy using java.nio channels October 2007
17 comments

3

How to test spring session or request scope beans April 2009
1 comment

4

Replacing deprecated ValueBindung stuff from JSF with ELResolver September 2007
2 comments

5

place a div element always bottom June 2008
9 comments


Filed under: Uncategorized

Syndicated 2011-01-03 11:04:22 from waffel's Weblog

disable maven enforcer rule

Apache maven enforcer rules are very useful in large projects. A common usage of such enforcer rules is to define them in a central point like a project parent pom.xml. For example following enforcer definition can be set in a pom parent:

package-parent pom.xml:

...
<plugin>
  <artifactId>maven-enforcer-plugin</artifactId>
     <executions>
       <execution>
         <id>enforce-java-1_4</id>
         <goals>
           <goal>enforce</goal>
         </goals>
         <configuration>
           <rules>
             <requireProperty>
                <property>java.compiler.version</property>
                <regex>1\.4</regex>
                <regexMessage>You must compile with Java 1.4, as long our servers run in old NetWeaver!</regexMessage>
              </requireProperty>
            </rules>
            <fail>true</fail>
         </configuration>
      </execution>
    </executions>
</plugin>
...

This enforcer rule should ensure that all projects, which using the parent POM using a Java 1.4 compiler.

Often such parent pom defines many other useful properties and settings for projects. If you want to use these definition and ONLY want to disable the enforcer rule you can simple do follow „trick“:

...
<parent>
  <groupId>org.waffel</groupId>
  <artifactId>package-parent</artifactId>
  <version>1.1</version>
</parent>

<build>
   <plugins>
     <!-- we need to overide the enforcer rules here because we have java 1.6 and not the  old 1.4 -->
      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-java-1_4</id>
            <phase>none</phase>
          </execution>
        </executions>
      </plugin>
   </plugins>
</build>
...

I use the same approach here as described in my article how to diable a inherited maven plugin.


Filed under: software Tagged: disable, enforcer, maven, plugin, rule

Syndicated 2010-11-18 16:33:22 from waffel's Weblog

31 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!