Posts

Es werden Posts vom März, 2015 angezeigt.

powershell: sending e-mail with attachments (using a pipe)

$PSEmailServer = "mailsrv"

Get-ChildItem("c:\temp") |
ForEach {$_.fullname} |
Send-MailMessage -to "x@regele.org" -from "y@regele.org" -subject "hi" -encoding ([System.Text.Encoding]::UTF8)


$PSEMailServer needs to contain the smtp ServerForEach ... $_.fullname is required if files are not in current path

windows powershell: execute select against an oracle instance. (System.Data.OracleClient)

in no way a powershell guy, but

powershell script:


[Reflection.Assembly]::LoadWithPartialName("System.Data.OracleClient") > null

 $connection=New-Object DATA.OracleClient.OracleConnection(
    "Data Source=eoxi;User Id=eoxrep;Password=***"
    )

 $connection.Open()
 $reader = (new-Object DATA.OracleClient.OracleCommand(
    "select * from eox.eox_log_ereignis_a where rownum < 10",
    $connection)).ExecuteReader()

 while( $Reader.Read()) {
    $id   = $reader["log_id"]
    $time = $reader["log_log_area"]
    write-output "$id $time"
 }
 $connection.Close()


executes as:

oracle select

GAC    Version        Location
---    -------        --------
True   v2.0.50727     C:\Windows\assembly\GAC_32\System.Data.OracleClient
174063524 ww Data Import: ISIN nicht gefunden: LU0097188931
174063532 ww Data Import: ISIN nicht gefunden: DE000A0MQR19
174063533 ww Data Import: ISIN nicht gefunden: LU0418839287
174063534 ww Data Import: ISIN nicht …

change git tracked files to executable on windows machines (here: gradle wrapper runner)

git update-index --chmod=+x gradlew

in my case: the ci server runs a linux environent, my currently used dev machine is windows

generate static swagger documentation or client stubs with codgen and gradle (with JavaExec)

Swagger ist a possible language independent solution to describe your REST based services. I use it currently together with spring-boot to provide my mobile json api.

To generate docs and client stubs with gradle I resort to:
task genSwagger(type: JavaExec) {
description "generate swagger doc or clients via codgen package and gradle"
    // needing buildscript dependency  classpath "com.wordnik:swagger-codegen:2.1.2-M1"
classpath = buildscript.configurations.classpath
args  = ["-i", "http://localhost:8080/........-rest-api", "-o", "${buildDir}/docs/rest-api", "-l", "android"]
main      = "com.wordnik.swagger.codegen.Codegen"
} run with "gradlew genSwagger"
As of today to my knowledge no stable gradle plugin exists for codegen (maven only), so starting it's Main class from gradle is my solution for now.

see also:
http://swagger.io/
https://github.com/springdox/springdox
https://github.com/swa…