Archive for the ‘Windows’ Category

I’ve been using PowerShell quite a bit of late, bit of a learning curve but when you get into it it really is amazingly powerful (the ability to pipe objects (and not just text) is a game changer). Hence the name I suppose!
In the last while, I’ve been using PowerShell 2.0 in Windows 7, and with it the excellent ‘New-WebServiceProxy’ cmdlet. In a nutshell, this allows you to use Web Services API’s directly from the shell, which I’m finding incredibly productive.
Here’s a short example of using a relatively non-trivial Web Service: the BetFair API.
$bfExchange = New-WebServiceProxy -uri
https://api.betfair.com/exchange/v5/BFExchangeService.wsdl -Namespace
BFE
$bfGlobal = New-WebServiceProxy -uri
https://api.betfair.com/global/v3/BFGlobalService.wsdl -Namespace BFG
$loginReq = new-object BFG.LoginReq
$loginReq.username = <your betfair username>
$loginReq.password = <your betfair password>
$loginReq.productId = 82
$loginReq.vendorSoftwareId = 0
$loginResp = $bfGlobal.login($loginReq)
# Get some Betfair Events, happening in the next 3 hours
$marketsReq = New-Object BFE.GetAllMarketsReq
$marketsReq.header = New-Object BFE.APIRequestHeader
$marketsReq.header.sessionToken = $loginResp.header.sessionToken
$marketsReq.fromDate = Get-Date
$marketsReq.toDate = (Get-Date).AddHours(3)
# Invoke the call
$marketResp = $bfExchange.getAllMarkets($marketsReq)
# The format of the Markets, etc, is all documented here:
# http://bdphelp.betfair.com/API6/6.0/RefGuide/wwhelp/wwhimpl/js/html/wwhelp.htm
foreach($market in $marketResp.marketData.Split(‘:’)) {
$data = $market.Split(‘~’)
Write-Host “Market: ” $data[1] “Path: ” $data[5]
}
Although trivial, its a good example of ‘feeling your way around’ an external Web Service without having to write any real code (i.e. fire up VSTS).
If your thinking of trying out powershell, give PowerGui a look http://www.powergui.org, and also I find Console to be way better than the default Windows cmd. I’ve also plenty of interesting Powershell links bookmarked on delicious: http://delicious.com/dberesford/powershell

I’ve been using PowerShell quite a bit of late, bit of a small learning curve but when you get into it it really is amazingly powerful (hence the name I suppose!). The ability to pipe objects, and not just text, makes it excellent ‘glue’ for which to bind things together (e.g. data in SQL Server, Excel, Email, your own .NET components/services, etc).

In the last while, I’ve been using PowerShell 2.0 in Windows 7, and with it the excellent ‘New-WebServiceProxy’ cmdlet. This allows you to use Web Service API’s directly from the shell, which I’m finding incredibly useful. (You could do this in Powershel 1.0 but it was a bit more involved)

Here’s a short example of using a relatively non-trivial Web Service, the BetFair API:

#short script to log on to Betfair and grab some upcoming events

$bfExchange = New-WebServiceProxy -uri https://api.betfair.com/exchange/v5/BFExchangeService.wsdl -Namespace BFE

$bfGlobal = New-WebServiceProxy -uri https://api.betfair.com/global/v3/BFGlobalService.wsdl -Namespace BFG

$loginReq = new-object BFG.LoginReq

$loginReq.username = <your betfair username>

$loginReq.password = <your betfair password>

$loginReq.productId = 82

$loginReq.vendorSoftwareId = 0

$loginResp = $bfGlobal.login($loginReq)

# Get some Betfair Events, happening in the next 3 hours

$marketsReq = New-Object BFE.GetAllMarketsReq

$marketsReq.header = New-Object BFE.APIRequestHeader

$marketsReq.header.sessionToken = $loginResp.header.sessionToken

$marketsReq.fromDate = Get-Date

$marketsReq.toDate = (Get-Date).AddHours(3)

# Invoke the call

$marketResp = $bfExchange.getAllMarkets($marketsReq)

# The format of the Markets, etc, is all documented here:

# http://bdphelp.betfair.com/API6/6.0/RefGuide/wwhelp/wwhimpl/js/html/wwhelp.htm

foreach($market in $marketResp.marketData.Split(':')) {

$data = $market.Split('~')

Write-Host "Market: " $data[1] "Path: " $data[5]

}

Although trivial, its a good example of ‘feeling your way around’ an external Web Service without having to write any real code (i.e. fire up VSTS).

If your thinking of trying out powershell, give PowerGui a look, and I also  find Console to be way better than the default Windows cmd. I’ve also plenty of Powershell links bookmarked on delicious.

I was doing a bit of research into SIP development and I struggled to find to pre-built binary for PJSUA (a sample console application for the excellent PJSIP) for windows.

There are quite a few steps involved in building PJSIP on windows, so if anyone is looking for a pre-built binary for PJSUA for windows, here it is. It’s built with MS SDK 7, and version 2914 of the pjsip trunk.

Although it is billed as a reference application, PJSUA is really quite comprehensive in terms of functionality, and works very well when run against my Blueface account.

Many thanks to everyone behind the PJSIP project, I hope to use it in earnest in the near future.