Posts

Showing posts from September, 2010

Go/Golang: Regex and program execution demo

package main import ( "exec" "flag" "fmt" "os" "regexp" ) const UserHomeDir = "/Users/alex" const Compiler = UserHomeDir + "/my/dev/env/go/bin/6g" const Linker = UserHomeDir + "/my/dev/env/go/bin/6l" const Pwd = UserHomeDir + "/my/dev/prj/loxal/example/src/main/golang/" func compile() os.Error { cmd, err := exec.Run(Compiler, []string{Compiler, flag.Arg(0)}, nil, "./", exec.DevNull, exec.DevNull, exec.PassThrough) if err != nil { return err } return cmd.Close() } func link() os.Error { cmd, err := exec.Run(Linker, []string{Linker, "-o" + getFileStem(flag.Arg(0)) + ".out", getFileStem(flag.Arg(0)) + ".6"}, nil, "./", exec.DevNull, exec.DevNull, exec.PassThrough) if err != nil { return err } return cmd.Close() } func getFileStem(fileName string) string { va

Go Syntax Highlighting in Vim

mkdir -p ~/.vim/syntax mkdir ~/.vim/ftdetect cp $GOROOT/misc/vim/ftdetect/gofiletype.vim ~/.vim/ftdetect/ cp $GOROOT/misc/vim/syntax/go.vim ~/.vim/syntax/ ...and you'll get syntax highlighting support in Vi .

Hello World Bean in Spring

This example  demonstrates how you can setup a Spring context and reference a Spring Bean from this context or from a standalone configuration class.

Plans to support Go under App Engine?

"Both the Go and App Engine teams would like to see this happen. As always, it is a question of resources and priorities as to if and when it will become a reality."  I've used the Google translator to translate this GoogleSpeak and got this translation: Basically we have no intention to support Go on GAE yet. And why should we at all? There are just a few native Go libs and no real Go frameworks. And many (most?) Go libs that are available are actually C libs.

Chromium/Chrome has Go/Golang source code

The current Chromium source code has one single Go code file in it: idea-loxal:src find . -name *.go ./net/base/ssl_cipher_suite_names_generate.go ...whatever the implications might be.

Apple's evaluating a new JVM

To boost the Java performance on x64 Mac systems, Apple is evaluating a new Java VM  that is derived the BSD port. You can try the new JVM using the  -XXaltjvm=bsdserver VM args which is available in the recent JDK/JRE developer preview. Using this new VM may improve the Java performance and increase benchmark scores but performance drawbacks can be expected as well.

Check a Mercurial/Hg repo for pending changesets

...that haven't been pushed to the remote repository.  hg summary --remote Should return something like idea-loxal:example hg sum --remote parent: 3:4839fec7112a tip  + Maven sugar tags branch: default commit: (clean) update: (current) remote: 1 outgoing if there are pending changes that have to be pushed. If you see something like idea-loxal:example hg summary --remote parent: 3:4839fec7112a tip  + Maven sugar tags branch: default commit: (clean) update: (current) remote: (synced) there are no pending changesets that have to be pushed to the remote repo.

Resetting JetBrains' TeamCity

If you want to remove all data that is not stored within the TeamCity folder/war, do this: rm -rf ~/.BuildServer

Maven Error: Return code is: 401 - TransferFailedException

Problem: Uploading: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401 [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Error deploying artifact: Failed to transfer file: http://loxal.artifactoryonline.com/loxal/libs-snapshots-local/loxal/example/demo/1.0.1-SNAPSHOT/demo-1.0.1-20100908.151817-6.jar. Return code is: 401 Caused by: org.apache.maven.plugin.MojoExecutionException: Error deploying artifact: Failed to transfer file:

Factory Class Pattern with Interface

A sample implementation of the factory OO pattern incl. interface which is used in many languages. This example is implemented in Java but the concept is the same in all languages: Creating a factory class  that creates settings/environment/parameter-dependent classes. This pattern example can be easily translated into .NET/C#. To get the complete demo code quickly, just pull its source code from this Mercurial repo . class Cat extends Mammal {     String doWalking() {         return "Cat has been Informed to perform Walk Operation";     } } class Dog extends Mammal {     String doWalking() {         return "Dog has been Informed to perform Walk Operation";     } }  class Main {     private static MammalFactory forDogs = new MammalFactory() {         @Override         public Mammal createMammal() {             System.out.println("Dog created...");             return new Dog();         }     };     private static MammalFactory forCats = new MammalFacto