I like to read techcrunch.com the post very often and very very interesting things and ideas to follow. One of them I got after reading the article about drons. After that article I typed in google “how to build a drones” and found very interesting tutorials: diydrones.com and aeroquad.com from another TechCrunch article.
I found if someone has passion and energy and time. ( like my brother-in-law he has lot’s of time but he is fucking lazy ass and not motivating potato crisps eater) Could make a great business of making those drones and sell them to all groups of fans especially here in my country where you have problems to buy anything cool.

Posted

I’ve already mentioned about that project. We used great library for it it’s called TinyRadius. In the sources you get extra example codes of TestClient and TestServer implementation. That is really helpful. The project is written using Netbeans and Maven tools. That is really comfortable. You just got your pom.xml and it does care about all dependencies. It’s simply download them from the web.

<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>pl.johnnyjavago.developement.radiustest</groupId>
    <artifactId>MyWebRadiusServer</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>MyWebRadiusServer JEE5 Webapp</name>
    <url>http://maven.apache.org</url>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>3.8.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.tinyradius</groupId>
            <artifactId>tinyradius</artifactId>
            <version>0.9.9</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>1.1</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.novell.ldap</groupId>
            <artifactId>jldap</artifactId>
            <version>4.3</version>
        </dependency>
        <dependency>
            <groupId>xstream</groupId>
            <artifactId>xstream</artifactId>
            <version>1.2.2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javaee</groupId>
            <artifactId>javaee-api</artifactId>
            <version>5</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>
</project>

That is simply amazing technique. To start and instance of the server I implemented well know ServletContextListener :)

public class ActivatorServletContextListener implements ServletContextListener {

    MyRadiusServer server = new MyRadiusServer();

    @Override
    public void contextInitialized(ServletContextEvent arg0) {
        server.start(true, true);
        System.out.println("Server started.");
    }

    @Override
    public void contextDestroyed(ServletContextEvent arg0) {
        System.out.println("Stop server");
        server.stop();
    }
}

It does a great job too. And for logs we used log4j, it cool also. You can drive your logs wherever you want. Here is log4j.properties file: (from path src/main/resources)

# #### Use two appenders, one to log to console, another to log to a file
 log4j.rootCategory=debug, R
#
# #### First appender writes to console
 log4j.appender.stdout=org.apache.log4j.ConsoleAppender
 log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
#
# # Pattern to output the caller's file name and line number.
 log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F%L) - %m%n

log4j.appender.R = org.apache.log4j.DailyRollingFileAppender
log4j.appender.R.File = logs/my-radius.log
log4j.appender.R.Append = true
log4j.appender.R.DatePattern = '.'yyy-MM-dd
log4j.appender.R.layout = org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n

Posted

Hi, lately I wrote about radius project. It’s already done. Now we are testing. But in a meantime I just want to mark one thing about sending jms message to remote server. All you need to do is to set “addresslist” property in QueueConnectionFactory on local machine and of course create comparable QueueConnectionFactory on remote.
For
Glassfish Admin Panel / Resources/ JMS Resources/ connection factories:
jms/akira/connectionfactory + property addresslist= 10.17.210.66:7676 (host:port)
Glassfish Admin Panel / Resources/ JMS Resources/ JMS Destination Resources
jms/queue/devilman + queue name devilman
and simple example of code to send msg using that remote JMS Connection Factories

    public void sendTestMSg(String msgText) throws NamingException, JMSException {
        QueueConnection queueCon = null;
        try {
            // get the initial context, refer to your app server docs for this
            Context ctx = new InitialContext();

            // get the connection factory, and open a connection
            QueueConnectionFactory qcf = (QueueConnectionFactory) ctx.lookup("jms/akira/connectionfactory");
            queueCon = qcf.createQueueConnection();

            // create queue session off the connection
            QueueSession queueSession = queueCon.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);

            // get handle on queue, create a sender and send the message
            Queue queue = (Queue) ctx.lookup("jms/queue/devilman");
            QueueSender sender = queueSession.createSender(queue);

            Message msg = queueSession.createTextMessage("hello...");

            msg.setBooleanProperty("ACK_DEBUG", true);
            msg.setFloatProperty("ACK_BALANCE", 24234.44f);
            sender.send(msg);

            System.out.println("sent the message");
        } finally {
            // close the queue connection
            if (queueCon != null) {
                queueCon.close();
            }
        }
    }

And of course you need to make appreciate imports to test this method.
That was a simple tip. I was searching through the web for it and it wasn’t obvious to find it on oracle pages.

Posted

Here is a thanking e-mail I’ve got (that made me really happy and gave a good karma):

Hello Jan,
Regard http://www.jankowalski.pl/category/glassfish-2, I wish to thank you deeply for your explanations how you worked out the JB cache under Glassfish.

I have been spending hours just looking and trying several cache solutions. Finally the JB cache seemed promising, except all docs seemed made for the JB AS only. I was really on the point to give it up and either look for , again, another cache solution or , after all, start from scratch and write my own.

At that point I started to think about, if I was to write my own, I may use the servlet context to handle some kind of pointer to the cache. That is while looking for that I finally find your page, and thank you Jan, the information you gave I tried and it worked directly for me.

Thank you thank you thank you. Your idea of using the naming way in context and the code example made things crystal clear.

This should bring you good karma :)

Best regards,

Fabrice Duche
www.fdicc.org

Posted

Radius protocol is some sort of radio channel to authorize. We are going right now to implement authorization system with using token sms and bind to ldap active directory. :) We found tinyradius library online.

Posted