Freitag, 3. Juni 2011

Dig and Cygwin

Just a quick tip today. If you need dig, a handy DNS query tool, on your cygwin bash you have to install bind package. Searching for Dig in cygwin's setup tool does not help, so after I figured out it is part of BIND I thought I help save some time ;)
Bind is a full blown DNS server but it's not that big to install and dig is definitly worth it ;)

Montag, 14. März 2011

My PowerShell Profile

Starbuck's Powershell profile
This article contains my growing PowerShell profile file. For those of you that are familiar with Unix shells this is a file similiar to .bashrc/.cshrc/... Per default executing this file this forbidden by policy, so you not to activate that. See this article for an interesting introduction to aliases and activation of profile files.

For the impatient reader execute the following command on a PS started as administrator:
Set-ExecutionPolicy Unrestricted 

And here is my (growing) Profile:

# implements a simple curl, lots of stuff still to do :)
function curl($url) {
    if($url){
        if(!$url.StartsWith("http://")) {
            $url = "http://" + $url;
        }
        return (new-object System.Net.WebClient).DownloadString($url);
    }
    else {
        return "Please provide a URL";
    }
}

# this is my tail -f
function tf ($file) {
    if($file) {
        get-content -wait $file;
    }
    else {
        write-host "Please provide a file to listen!";
    }
}

Montag, 28. Februar 2011

Call user functions with USER_INT

Custom PHP in Typoscript

These two listing just shall show you a working example of calling custom PHP functions from Typoscript. I just publish this because in all the existing examples I found some details were missing.

The following listing shows usage of USER_INT which causes no caching of this content element. Please note that your class needs to have a prefix "user_" to be excuted via userFunc. Use admin panel to get according feedback.

includeLibs.hashTools = fileadmin/hashTools.php
page.200 = USER_INT
page.200 {
  userFunc = user_MyTools->testFunction
 }

Following PHP listing shows a simple function to be called via Typoscript.
<?php

class user_MyTools {

  function testFunction($content,$conf) {
     return "Hallo Welt!";
  }

}

?>

Typoscript link with parameters

How to create an external link with parameters with Typoscript

Have you ever had the need to add to an external link some dynamic parameters? Well before you grab your PHP editor and start developing have a look into the following Typoscript listing:

[loginUser = *]

page.201 = COA_INT
page.201 {
10 = TEXT
10.value = My fancy link
10.typolink.parameter {
  dataWrap = http://www.mysite.de/index.php?param=value&id={TSFE:fe_user|user|uid}&name={TSFE:fe_user|user|username}_{TSFE:fe_user|user|city}
 }
}
[global]
What this script does is it creates a link using typolink function and you can add some parameters to it. Good thing here is, that can add some dynamic parameters such as user name of current logged in user.

With accessing TSFE which is the central array that Typo3 uses to store almost everything you can add many more interesting parameters.

Please note that content object used here is COA_INT and that means this is generated every time a page is displayed. This way for every user this example creates a proper parameter.

Dienstag, 22. Februar 2011

Powershell test Web Service

For all of you who haven't touched it yet - Microsoft has put an interesting shell to Windows operating systems called Powershell. Following code creates a web service stub (proxy in dot.net speak) and calls a method. If you call a web service that is running on a IIS you often need some kind of authentication.
#  build credential object 
$Pass = ConvertTo-SecureString " xxxx " –AsPlaintext –Force
$Cred = New-Object System.Management.Automation.PsCredential "domain\User",$Pass

# just a simple web service tester
$wsProxy = New-WebServiceProxy -Credential $Cred -URI http://yourserver.com/path?WSDL
$result = $wsProxy.WebServiceMethod('Parameter') 
$result


To use this example you need to replace WebServiceMethod with the web service method you want to use. It is up to you to provide proper parameters. Having a look into service's WSDL file will help here.

General note, execution of unsigend srcripts needs to be activated. Please see
http://www.windowsecurity.com/articles/PowerShell-Security.html for more information.

Montag, 26. Juli 2010

propCom - requirements and todos

This post is a collection of requirements for propCom. Keep in mind, that this is work in progress.

Requirements
The following list contains desired functions and requirements  for propCom. It's a kind of wish list and don't hesitate to comment your suggestions.
  • Two modes: simple comparison of two Java property files and multiple comparison defined by a CSV-File
  • build ant task in order to integrate property file checking to your ant scripts
  • Comparison means checking equality of key sets in two property file. It means not checking if property values are identical
  • Output is a CSV/XML-File (not decided yet) , maybe similar to JUnit test results
  • proper exception handling (e.g. when comparing multiple files, define what to do if one file can not be found)

ToDos
  • restructure code (input, functional code, output formatter)
  • write proper readme
  • add license statement
  • add proper bash script

propCom - first Release

We proudly present propCom version 0.1 that can be downloaded at SourceForge on the propCom repository. This is a first release and far away from being usable in real world projects. For now propCom is a command line tool and we will develop all desired functions for command line usage. When the functional code is somewhat mature and structured a custom developed ant task will make use of that code.

Dienstag, 13. Juli 2010

propCom - some more details

When developing Java Enterprise (JEE) applications property files are widely used. Even in medium projects soon you have at least half a dozen of these property files. So deploying (see and please read http://en.wikipedia.org/wiki/Software_deployment) such a software is a sophisticated step in software devlopment. Now a productive version is usually only one of several instances to establish.
Especially when using agile development methods like scrum setups for feature testing, user acceptance testing, integration testing,... are necessary. Therefore your half dozen property files multiply with the number of setups (or environments). And that means you waste a lot of time and panic to find that forgotten property needed for that feature that has to be tested till yesterday the latest...
So this is the motivation for developing a tool like propCom. First step is developing a java command line tool that can be used to quick check if a given list of property files have the same key sets. As this is not that useful (I know Java on CLI will never match Bash or Perl) but eventual goal is an Ant/Maven integration. This way completness checks on property files can be done automatically.
Ok folks that's it for today. Next post I will show the then finished CLI version.