Archive
Archive for August, 2005
Speaking clock in VB.NET
August 31, 2005
Leave a comment
I never realized how easy it is to use SAPI in .NET, I developed a "Speaking clock" with just these three lines of code:
Dim
Voice As SpeechLib.SpVoiceVoice =
New SpeechLib.SpVoiceVoice.Speak(DateTime.Now.ToShortTimeString(), SpeechLib.SpeechVoiceSpeakFlags.SVSFlagsAsync)
This needs a reference to SAPI 5.1. (Microsoft Speech Object Library)
Categories: Uncategorized
Yahoo Adsense
August 29, 2005
Leave a comment
Just saw that Yahoo has released their own version of Adsense to counter Google’s amazing Adsense system. http://publisher.yahoo.com/ – It’s still in beta, but from what I’ve seen, it’s virtually identical to Google Adsense, as you can see from the Javascript below:
<script language="JavaScript">
<!–
ctxt_ad_partner = ‘<some number>’;
ctxt_ad_section = ”;
ctxt_ad_bg = ”;
ctxt_ad_width = 336;
ctxt_ad_height = 280;
ctxt_ad_bc = ‘FFFFFF’;
ctxt_ad_cc = ‘FFFFFF’;
ctxt_ad_lc = ‘A80054’;
ctxt_ad_tc = ‘000000’;
ctxt_ad_uc = ‘000000’;
// –>
</script>
<script language="JavaScript" src="http://ypn-js.overture.com/partner/js/ypn.js">
</script>
<!–
ctxt_ad_partner = ‘<some number>’;
ctxt_ad_section = ”;
ctxt_ad_bg = ”;
ctxt_ad_width = 336;
ctxt_ad_height = 280;
ctxt_ad_bc = ‘FFFFFF’;
ctxt_ad_cc = ‘FFFFFF’;
ctxt_ad_lc = ‘A80054’;
ctxt_ad_tc = ‘000000’;
ctxt_ad_uc = ‘000000’;
// –>
</script>
<script language="JavaScript" src="http://ypn-js.overture.com/partner/js/ypn.js">
</script>
Categories: Uncategorized
Internationalising www.sms-txt.co.uk
August 27, 2005
Leave a comment
Just been translating www.sms-txt.co.uk into French (www.envoyezSMS.com) and German(www.handyspruche.com). It’s 90% done with Google Translate 10% done with a bit of manual translation, to try and pin down the odd turkey that Google translate comes up with.
On a seperate note, 2-18,1-14. A sad day for Dubs – even though I’m more of a Donegal fan myself.
Categories: Uncategorized
Hotfix for KB 896181
August 20, 2005
Leave a comment
I recently found two of my websites (www.sms-txt.co.uk & www.findpeoplefree.co.uk ) were throwing up the following error:
Unable to generate a temporary class (result=1). error CS0011: Referenced class ‘ASP.webservice_aspx’ has base class or interface ‘System.Web.UI.Page’ defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Web’. error CS0011: Referenced class ‘ASP.webservice_aspx’ has base class or interface ‘System.Web.SessionState.IRequiresSessionState’ defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Web’.
After searching on Microsoft, they said it was an issue with "This problem occurs because the temporary serialization assemblies do not reference the System.Web assembly. This behavior causes the Web service to fail at run time. "
Unfortunately, the gix won’t be available unil .NET 1.1 SP2 is out, and I don’t know hos to email microsoft for the hotfix. – anybody know?
I found a temporary work around, by migrating both sites from ASP.NET 1.1. to 2.0 beta 2. This threw up an error "Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster." – but went away after I closed and re-opened the page.
Categories: Uncategorized
Spoofing an IP address using a VPN
August 15, 2005
Leave a comment
I was looking for a way to appear to have a different IP address from the point of view of a remote website. When I remembered a quirk with VPNs.
When you set up a computer to accept incomming VPN connections, and connect to it, all packets will be routed through it by default. This means that if you navigate to a website without a VPN connection you will appear to have a different IP address to when you navigate to a website with a VPN connection open.
Usiually, I would disable this feature, since generally, routing all internet traffic via a VPN is much slower than a direct connection. To disable VPN default gateway routing, hit the VPN conection | properties | Networking | TCP/IP | Settings | use default gateway on remote network.
Categories: Uncategorized
Double joins in access
August 13, 2005
Leave a comment
With SQL server, there is no problem with joining multiple tables in the same query like so:
select * from a
join b on a.bid = b.id
join c on b.cid = c.id
But this doesn’t work in MS Acess, but this format does
select * from a,b,c
where a.bid= b.id and c.id = b.cid
Categories: Uncategorized
Generating a 1×1 pixel jpeg in a aspx page
August 13, 2005
Leave a comment
I was looking at a way to track website referers using aspx, and to my horror, I found that Request.ServerVariables["HTTP_REFERER"] was blank under many circumstances. However the javascript equivalent , document.referrer works much more reliably. However, ths javascript variable is only available after the page has loaded. So it needs to do a round-trip to the server to store this variable, without distracting the user by refreshing the page. There are a number ways to do this (a) hidden IFrame (b) out of band calls using XMLHTTP (c) aspx image tag Option C., was what I decided to go for…
Categories: Uncategorized
Automatically expanding drop down lists
August 11, 2005
Leave a comment
Just noticed that pressing F4 will automatically expand a drop down list (or 5 on a numeric keypad).
This came in quite handy in a VB project with "SendKeys "{F4}""
Categories: Uncategorized
Reading Sage Purchase Orders
August 11, 2005
Leave a comment
Once again, another post about Sage. But – there’s virtually no information on the web about Sage Data Objects, so I thought, I’d fill that void with my findings…
Here’s code to read Sage Purchase Orders
Dim WS As SageDataObject90.WorkSpace
Dim ppOrder As SageDataObject90.PopRecord
Dim PiOrderLine As SageDataObject90.PopItem
Dim ppOrder As SageDataObject90.PopRecord
Dim PiOrderLine As SageDataObject90.PopItem
‘Create instance of Engine and Workspace
Dim SDO As New SageDataObject90.SDOEngine
Dim blnHasFoundCustomer As Boolean
Set WS = SDO.Workspaces.Add("Myconnection")
Dim SDO As New SageDataObject90.SDOEngine
Dim blnHasFoundCustomer As Boolean
Set WS = SDO.Workspaces.Add("Myconnection")
‘Connect to data files
WS.Connect SageLocation, SageUsername, SagePassword, "ThisIsUnique"
WS.Connect SageLocation, SageUsername, SagePassword, "ThisIsUnique"
‘Create an instance of InvoicePost & Record object’s
Set ppOrder = WS.CreateObject("PopRecord")
Set ppOrder = WS.CreateObject("PopRecord")
ppOrder.MoveFirst
Do
DoEvents
‘ ppOrder has the following fields
‘ACCOUNT_REF: CAN012
‘ADDRESS_1:76 DUNCRUN ROAD
‘ADDRESS_2: BALLARENA
‘ADDRESS_3: LIMAVADY
‘ADDRESS_4: BT49 OJD
‘ADDRESS_5:
‘AMOUNT_PREPAID:0
‘CARR_DEPT_NUMBER:0
‘CARR_NET:0
‘CARR_NOM_CODE:
‘CARR_TAX:0
‘CARR_TAX_CODE:0
‘CONSIGNMENT_REF:
‘CONTACT_NAME:
‘COURIER:1
‘CURRENCY:0
‘CURRENCY_USED:0
‘DEL_ADDRESS_1:
‘DEL_ADDRESS_2:
‘DEL_ADDRESS_3:
‘DEL_ADDRESS_4:
‘DEL_ADDRESS_5:
‘DELETED_FLAG:0
‘DELIVERY_DATE:
‘DELIVERY_NAME:
‘DISCOUNT_TYPE:0
‘DUE_DATE:
‘EURO_GROSS:126.63
‘EURO_RATE:1.407
‘EXTERNAL_USAGE:0
‘FIRST_ITEM:2
‘FOREIGN_GROSS:90
‘FOREIGN_RATE:1
‘GLOBAL_DEPT_NUMBER:0
‘INVOICE_NUMBER:
‘ITEMS_NET:90
‘ITEMS_TAX:0
‘NAME: G.CANNING
‘NOTES_1:
‘NOTES_2:
‘NOTES_3:
‘ORDER_DATE:2003/08/09
‘ORDER_NUMBER:1
‘ORDER_TYPE:0
‘PAYMENT_REF:
‘PAYMENT_TYPE:3
‘POSTED_CODE:1
‘PRINTED_CODE:0
‘SETTLEMENT_DISC_RATE:0
‘SETTLEMENT_DUE_DAYS:0
‘STATUS:8
‘SUPP_DISC_RATE:0
‘SUPP_ORDER_NUMBER:
‘SUPP_TEL_NUMBER:
‘TAKEN_BY: william
‘TOTAL_BYTES:0
Set PiOrderLine = ppOrder.Link
PiOrderLine.MoveFirst
Do
‘ PiOrderLine has the following fields
‘ ADD_DISC_RATE:0
‘ COMMENT_1:
‘COMMENT_2:
‘DELIVERY_DATE:2005/06/01
‘DEPT_NUMBER:3
‘DESCRIPTION: Mushrooms P / P
‘DISCOUNT_AMOUNT:0
‘DISCOUNT_RATE:0
‘FULL_NET_AMOUNT:36.72
‘INVOICE_NUMBER:13
‘ITEM_NUMBER:3
‘JOB_REFERENCE:
‘NET_AMOUNT:36.72
‘NEXT_ITEM:0
‘NOMINAL_CODE:4100
‘OFFSET:0
‘PREV_ITEM:0
‘QTY_ALLOCATED:0
‘QTY_DELIVERED:72
‘QTY_DESPATCH:0
‘QTY_INVOICED:72
‘QTY_ORDER:72
‘SERVICE_FILE: Mushrooms P / P
‘SERVICE_FILE_SIZE:864904
‘SERVICE_FLAG:0
‘SERVICE_ITEM_LINES:864904
‘STOCK_CODE: MUXX02
‘TAX_AMOUNT:0
‘TAX_CODE:7
‘TAX_FLAG:0
‘TAX_RATE:0
‘TEXT: Mushrooms P / P
‘UNIT_OF_SALE:Each
‘UNIT_PRICE:0.51
Loop Until Not PiOrderLine.MoveNext
End If
If ppOrder.IsEOF Then
Exit Do
Else
ppOrder.MoveNext
End If
Loop
WS.Disconnect
Do
DoEvents
‘ ppOrder has the following fields
‘ACCOUNT_REF: CAN012
‘ADDRESS_1:76 DUNCRUN ROAD
‘ADDRESS_2: BALLARENA
‘ADDRESS_3: LIMAVADY
‘ADDRESS_4: BT49 OJD
‘ADDRESS_5:
‘AMOUNT_PREPAID:0
‘CARR_DEPT_NUMBER:0
‘CARR_NET:0
‘CARR_NOM_CODE:
‘CARR_TAX:0
‘CARR_TAX_CODE:0
‘CONSIGNMENT_REF:
‘CONTACT_NAME:
‘COURIER:1
‘CURRENCY:0
‘CURRENCY_USED:0
‘DEL_ADDRESS_1:
‘DEL_ADDRESS_2:
‘DEL_ADDRESS_3:
‘DEL_ADDRESS_4:
‘DEL_ADDRESS_5:
‘DELETED_FLAG:0
‘DELIVERY_DATE:
‘DELIVERY_NAME:
‘DISCOUNT_TYPE:0
‘DUE_DATE:
‘EURO_GROSS:126.63
‘EURO_RATE:1.407
‘EXTERNAL_USAGE:0
‘FIRST_ITEM:2
‘FOREIGN_GROSS:90
‘FOREIGN_RATE:1
‘GLOBAL_DEPT_NUMBER:0
‘INVOICE_NUMBER:
‘ITEMS_NET:90
‘ITEMS_TAX:0
‘NAME: G.CANNING
‘NOTES_1:
‘NOTES_2:
‘NOTES_3:
‘ORDER_DATE:2003/08/09
‘ORDER_NUMBER:1
‘ORDER_TYPE:0
‘PAYMENT_REF:
‘PAYMENT_TYPE:3
‘POSTED_CODE:1
‘PRINTED_CODE:0
‘SETTLEMENT_DISC_RATE:0
‘SETTLEMENT_DUE_DAYS:0
‘STATUS:8
‘SUPP_DISC_RATE:0
‘SUPP_ORDER_NUMBER:
‘SUPP_TEL_NUMBER:
‘TAKEN_BY: william
‘TOTAL_BYTES:0
Set PiOrderLine = ppOrder.Link
PiOrderLine.MoveFirst
Do
‘ PiOrderLine has the following fields
‘ ADD_DISC_RATE:0
‘ COMMENT_1:
‘COMMENT_2:
‘DELIVERY_DATE:2005/06/01
‘DEPT_NUMBER:3
‘DESCRIPTION: Mushrooms P / P
‘DISCOUNT_AMOUNT:0
‘DISCOUNT_RATE:0
‘FULL_NET_AMOUNT:36.72
‘INVOICE_NUMBER:13
‘ITEM_NUMBER:3
‘JOB_REFERENCE:
‘NET_AMOUNT:36.72
‘NEXT_ITEM:0
‘NOMINAL_CODE:4100
‘OFFSET:0
‘PREV_ITEM:0
‘QTY_ALLOCATED:0
‘QTY_DELIVERED:72
‘QTY_DESPATCH:0
‘QTY_INVOICED:72
‘QTY_ORDER:72
‘SERVICE_FILE: Mushrooms P / P
‘SERVICE_FILE_SIZE:864904
‘SERVICE_FLAG:0
‘SERVICE_ITEM_LINES:864904
‘STOCK_CODE: MUXX02
‘TAX_AMOUNT:0
‘TAX_CODE:7
‘TAX_FLAG:0
‘TAX_RATE:0
‘TEXT: Mushrooms P / P
‘UNIT_OF_SALE:Each
‘UNIT_PRICE:0.51
Loop Until Not PiOrderLine.MoveNext
End If
If ppOrder.IsEOF Then
Exit Do
Else
ppOrder.MoveNext
End If
Loop
WS.Disconnect
Categories: Uncategorized
SQL server 2005 connection issue
August 8, 2005
Leave a comment
This is a strange one, and it’d be nice if somebody could give some tips on how to solve it.
A number of my websites use the same database connection string "Server=.\SQLEXPRESS;Integrated Security=True;Database=dinfo" – It’s a SQL 2005 server. Strangely, one of the websites is giving a "SQL Server does not exist or access denied" error. Even though other websites, using the same connection string work fine.
The website in question seems to be running under IUSR_<machineName> which, I believe is pretty standard. I even ran it under Administrator, but with no joy. Changing the period (.) to localhost didn’t work either.
Anybody any theories?
Categories: Uncategorized