plasticboy.de

About the art of building metaphoric solutions to real world problems.

Archive for the ‘Programming’ Category

Super cool viszualisation done with processing.
Processing is a visualization all-in-one solution build on top of java. It’s very easy to learn and is intended to demonstrate basic programming concepts to people who usually don’t code (Designer, Musicians, …).

You can learn more about the creator of the video here:
http://www.flight404.com/blog/?p=111

Learn more about processing at http://processing.org/


Solar, with lyrics. from flight404 on Vimeo.

  • 0 Comments
  • Filed under: Programming, Videos
  • How I spent last weekend…

    Arghhh!!! Organ failure!

    Pain!

  • 0 Comments
  • Filed under: Programming
  • I bet you just rent your virtual root server from Strato (or any other hoster) and wonder, why you can’t install glassfish via sudo apt-get-install glassfish as you’re used to.

    The answer is easy. The installer consumes more than the 256mb of memory Strato reserves for you and the installer ends in an out-of-memory exeption. Yes, we all love that :)

    But there is help and it’s easier as you think:

    Install glassfish manually

    sudo apt-get install ant
    cd/opt
    sudo wget http://java.net/download/javaee5/v2ur2/promoted/Linux/glassfish-installer-v2ur2-b04-linux.jar
    #take whatever glassfish edition you want..
    sudo java -Xmx256m -jar glassfish-installer-v2ur2-b04-linux.jar
    cd /opt/glassfish
    sudo ant -f setup.xml

    You have just installed glassfish manually.

    Try your installation
    Now try this:

    cd /opt/glassfish/bin
    sudo ./asadmin start-domain domain1

    You still have a problem if you get this message:

    [...]
    Could not create the Java virtual machine.

    As default, glassfish’s domains have a fixed memory footprint of 196mb.
    We need to cut this down.

    Patch the memory settings
    All we have to do is to edit the file /opt/glassfish/domains/domain1/config/domain.xml:
    Search for this entry:
    -XX:MaxPermSize=196m
    and change it to
    -XX:MaxPermSize=128m

    Now restart your application server:

    cd /opt/glassfish/bin
    sudo ./asadmin start-domain domain1

    you should now be able to access the administration frontend at

    http://yourserver.com:4848.

    The default username and password are admin/adminadmin.
    You should change that quick.

    Watch out: 512 mb ram isn’t much in the java world – the out-of-memory exception will be your best friend in the future if you don’t code with care (as we all do, don’t we?) :)

  • 6 Comments
  • Filed under: Programming
  • You shuouldn’t but just in case you’re projects are as huge as mine and compiling with the tests would take an afternoon, here’s the flag:

    mvn install -Dmaven.test.skip=true
    

    Well.. you shouldn’t do that, but we all know the slim line between the perfect world and our realitiy… :)

  • 0 Comments
  • Filed under: Programming
  • This one is short but it really sucked an I didn’t find a quick answer in the web:

    The solution is easy:
    Update your /usr/bin/gem file with this line beneath the line require 'rubygems':

    require 'rubygems/gem_runner'
  • 0 Comments
  • Filed under: Programming
  • Here are some easy steps to use your Kopete (or any other Jabber IM) in the Google Talk network.

    Step 1
    Fire up your Kopete configuration and press “New…” in the accounts page.

    Step 2
    Chose “Jabber” as message service.

    Step 3
    In The “Basic Setup” tab, fill in your Google Mail address into the “Jabber ID” field and enter your password. The screen should then look somehow like the screenshot below.

    Step 4
    Go to the “Connection” tab and fill it out like the other screenshot below. Be sure to enable “Use Protocol Encyption (SSL)” and enter the server “talk.google.com” with port “5223″. Otherwise it won’t work.

    Step 5
    Save your configuration and restart kopete and…

    Step 6
    VoilĂ , you’re done! Have some fun.

    Drop me a comment if you think this tutorial was useful for you.

  • 1 Comment
  • Filed under: Programming
  • Despite I haven’t done any updates within the last month, my number of readers is growing.
    Thank you all for your interest and all the feedback I get.

    When I scan through all the data google analytics provides me about my readers, then can clearly see the two main topics you all come here :)
    Reading my article about my favorite eclipse plugins, my apache archiva installation instructions and how to write an eclipse keyword scanner.

    Now I have to make an announcement: I’m developing a D language plugin for eclipse.
    The current working title for the plugin is DClare and as soon as it’s available for download, you can get it here. If you want, drop me a comment down here, and I write you an email if the time has come :)

    The current project state is still pretty alpha, but I’m rushing towards a first beta release with high speed. At the current state I already have some screenshots to share with you:

    New project choice
    The new D language project choice.

    New project wizard
    Wizard page for a new D language project.

    DClare compiler settings
    Compiler settings page in the eclipse preferences.

    DClare Perspective
    The complete DClare D language perspective with Editor and compiler output.

      There are still some things to fix/do:

    • Fill the outline view with data.
    • Type assistance and auto completion
    • Code validation
    • Project specific compiler settings for DMD and GDC

    If you have any ideas/wished, please feel free to drop me a comment.

    In the meantime you can learn some D over at the site from digital mars. Have some fun.

  • 7 Comments
  • Filed under: Programming
  • Writing an eclipse keyword scanner

    I was writing a keyword scanner for my eclipse editor today. The beginning was easy (as usual) but in the end I had a highlighting issue with my org.eclipse.jface.text.rules.RuleBasedScanner:

    The list of language keywords was detected correctly – too correctly for my taste. The editor did not only highlight keywords like “case“, “new” and “import“, it also detected these keywords if they were parts of other tokens like “doImport()” or “renewSomething()“.

    After spending several hours only to find out, that there are more of you with exactly the same problem but no (or very complicated) solutions, I want to share a very simple solution I found out after some try and error.

    You have to add a predefined default Token to your org.eclipse.jface.text.rules.WordRule. There is a special constructor for this purpose.

    Look into line 54 for the solution.

    package demoPlugin.editors;
    
    import java.util.ArrayList;
    import java.util.List;
    
    import org.eclipse.jface.text.rules.EndOfLineRule;
    import org.eclipse.jface.text.rules.IRule;
    import org.eclipse.jface.text.rules.IToken;
    import org.eclipse.jface.text.rules.IWordDetector;
    import org.eclipse.jface.text.rules.MultiLineRule;
    import org.eclipse.jface.text.rules.RuleBasedScanner;
    import org.eclipse.jface.text.rules.SingleLineRule;
    import org.eclipse.jface.text.rules.Token;
    import org.eclipse.jface.text.rules.WordRule;
    
    /**
     * @author Lars
     *
     */
    public class MyScanner extends RuleBasedScanner {
    
    	private static final String[] dKeywords = {
    		"abstract", "alias", "align", "asm", "assert", "auto", "body", "bool",
    		"break", "byte", "case", "cast", "catch", "cdouble", "cent", "cfloat",
    		"char", "class", "const", "continue", "creal", "dchar", "debug",
    		"default", "delegate", "delete", "deprecated", "do", "double", "else",
    		"enum", "export", "extern", "false", "final", "finally", "float", "for",
    		"foreach", "foreach_reverse", "function", "goto", "idouble", "if",
    		"ifloat", "import", "in", "inout", "int", "interface", "invariant",
    		"ireal", "is", "lazy", "long", "macro", "mixin", "module", "new",
    		"null", "out", "override", "package", "pragma", "private", "protected",
    		"public", "real", "ref", "return", "scope", "short", "static", "struct",
    		"super", "switch", "synchronized", "template", "this", "throw",
    		"__traits", "true", "try", "typedef", "typeid", "typeof", "ubyte",
    		"ucent", "uint", "ulong", "union", "unittest", "ushort", "version",
    		"void", "volatile", "wchar", "while", "with"
    	};
    
    	public DScanner(ColorManager manager) {
    		IToken dDefault = new Token(DTextAttribute.DEFAULT.getTextAttribute(manager));
    		IToken dKeyword = new Token(DTextAttribute.KEYWORD.getTextAttribute(manager));
    
    		List rules = new ArrayList();
    		WordRule wordRule  = new WordRule(new IWordDetector(){
    			@Override
    			public boolean isWordPart(char c) {
    				return Character.isJavaIdentifierPart(c);
    			}
    
    			@Override
    			public boolean isWordStart(char c) {
    				return Character.isJavaIdentifierStart(c);
    			}
    		}, dDefault);  //HERE IS THE MAGIC!! Add the default token and you're finished.
    
    		for(String operatorString:dKeywords){
    			wordRule.addWord(operatorString, dKeyword);
    		}
    		rules.add(wordRule);
    		IRule[] aRule = new IRule[rules.size()];
    		rules.toArray(aRule);
    		setRules(aRule);
    	}
    }
    
  • 1 Comment
  • Filed under: Programming
  • I spent most of todays time with the installation of the Apache Archiva repository server for corporate use. I found out that there isn’t much documentation available on this topic, especially if you don’t want to use Apache Derby as a database and use the latest tomcat 5.5 installation that comes with the Ubuntu 7.10 server edition.

    Our approach is straight forward, but I’d like to share it with you because I’m sure some more people want to have the same type of installation.

    Get the .war File
    Download the archiva.war file from the official apache Archiva site. Be sure to get the .war version. The standalone version works out of the box but comes with it’s own jetty server instance.

    Create the archiva deployment directory
    Create a directory with the name archiva.

    mkdir /usr/share/tomcat5.5/archiva
    cd /usr/share/tomcat5.5/archiva
    wget http://apache.atviraskodas.com/maven/binaries/apache-archiva-1.0.war
    

    Check for mail.jar and mysql jdbc driver
    Check if the file mail.jar and the mysql jdbc driver (mysql-connector-java-X.X.X-bin.jar) are present in /usr/share/tomcat5.5/common/lib.

    Create the mysql database and user
    In Mysql create a database with the name archiva and create a user with the name archiva. Don’t forget to grant all privileges to the archiva user and set the Hosts column to “%” for this user in the user table of the mysql database.

    Create the Archiva context file
    Create the file /usr/share/tomcat5.5/conf/Catalina/localhost/archiva.xml

    
    
        
        
        
    
    

    Set the appserver.base environment variable
    Add the appserver.base java environmet variable to the CATALINA_OPTS line in /etc/default/tomcat5.5 to

    CATALINA_OPTS="-Dappserver.base=/var/lib/tomcat5.5 -Djava.awt.headless=true -Xmx128M -server"

    Fix the tomcat policies

    Create a file named 30archiva.policy in the directory /etc/tomcat5.5/policy.d and insert this code:

    archiva.policygrant codeBase "file:${catalina.home}/webapps/archiva/-" {
        permission java.security.AllPermission;
    //  permission java.util.PropertyPermission "*","read";};

    Restart the server

    /etc/init.d/tomcat5.5 restart

    And finally…
    Now you can gaze at your new Archiva installation.
    Go and send your browser to http://yourServerName/archiva

    … and now party. :)

    BTW: The steps to install Apache Continuum are quite the same. Just change “archiva” to “continuum” in the steps.

  • 4 Comments
  • Filed under: Programming

  • Recent Comments

    Links


    Add to Technorati Favorites

    Archives