Archive for February, 2011

Parse a varchar to bigint using a regex (Regular Expression)

select convert(bigint,’6592370590..’) will fail with the error below due to the two dots at the end of the string, or a newline, or infact anything non-numeric.

Msg 8114, Level 16, State 5, Line 1
Error converting data type varchar to bigint.

Here’s a more brute-force way of converting ‘dirty’ varchars into numbers:

create function [dbo].[UDF_ExtractNumber](@NumStr varchar(100))
returns bigint
WHILE PATINDEX(‘%[^0-9]%’,@NumStr)> 0
SET @NumStr = REPLACE(@NumStr,SUBSTRING(@NumStr,PATINDEX(‘%[^0-9]%’,@NumStr),1),”)
return convert(bigint,@NumStr)

This does have the side-effect of viewing complete nonsense as the number zero, but that’s fine for my application.

Categories: Uncategorized

make [package] error 127 (PhoneGap WebOs on Windows)

This is a sceenshot of a web-page that was converted into a webOs Palm App using  Phonegap. Relatively straightforward until you hit this error “make: *** [package] Error 127”

In CygWin, you navigate to the webos folder, and type “make” and you get:








$ make
mkdir -p lib
rm -f lib/phonegap.js
cat js/phonegap.js.base >> lib/phonegap.js
cat js/acceleration.js >> lib/phonegap.js
cat js/accelerometer.js >> lib/phonegap.js
cat js/audio.js >> lib/phonegap.js
cat js/camera.js >> lib/phonegap.js
cat js/contacts.js >> lib/phonegap.js
cat js/debugconsole.js >> lib/phonegap.js
cat js/device.js >> lib/phonegap.js
cat js/file.js >> lib/phonegap.js
cat js/geolocation.js >> lib/phonegap.js
cat js/map.js >> lib/phonegap.js
cat js/network.js >> lib/phonegap.js
cat js/notification.js >> lib/phonegap.js
cat js/orientation.js >> lib/phonegap.js
cat js/position.js >> lib/phonegap.js
cat js/sms.js >> lib/phonegap.js
cat js/storage.js >> lib/phonegap.js
cat js/telephony.js >> lib/phonegap.js
cp lib/phonegap.js framework/www/phonegap.js
cp framework/www/index.html framework/www/app/views/First/First-
palm-package framework/www/
make: palm-package: Command not found
make: *** [package] Error 127

So, it can’t find palm-package, which means you need to set a path to

/cygwin/c/program files/palm/sdk/bin

then navigate back to the /phonegap-0.9.4/webos folder, and type

User@Satellite /cygdrive/e/research/phonegap/phonegap-0.9.4/webos
$ palm-package.bat framework/www/
creating package com.phonegap.example_1.0.0_all.ipk in E:\research\phonegap\phon

User@Satellite /cygdrive/e/research/phonegap/phonegap-0.9.4/webos
$ palm-install.bat com.phonegap.example_1.0.0_all.ipk
installing package com.phonegap.example_1.0.0_all.ipk on device “castle-linux” {
a339f527fe6d98a2b95b9f2ef036d503042181c9} usb 49346

User@Satellite /cygdrive/e/research/phonegap/phonegap-0.9.4/webos
$ palm-launch.bat com.phonegap.example
launching application com.phonegap.example on device “castle-linux” {a339f527fe6
d98a2b95b9f2ef036d503042181c9} usb 49346

– With the palm phone in developer mode, and plugged into the USB all the while.

In a few seconds it pops up.

– Now, the challenge, to do something usefull with it 🙂

Categories: Uncategorized

A simple Chrome App

This morning, I submitted a simple chrome app to the google app store,

It was simply a manifest file as follows:
“name”: “Freebie SMS – Free SMS UK”,
“version”: “1.0”,
“description”: “Send free SMS text messages from Chrome to UK mobile phones, no pre-payment or signup required. All networks supported.”,
“browser_action”: {
“default_icon”: “sms.gif”,
“popup”: “popup.html”
“permissions”: [”

Then the file “popup.html” is the generated HTML from the FreebieSMS Affiliate form.

Categories: Uncategorized
%d bloggers like this: