Archive

Archive for the ‘Uncategorized’ Category

SQL server 2005 connection issue

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

Converting a DVD VOB file to an AVI file

This is a technique I successfully used to convert a DVD VOB file to
an AVI, and reduced the filesize from 160MB to 27 MB in the process

1) Download SmartRipper from afterDawn.com
Unzip it, put the DVD in the drive then run it.
Select the chapter you want to rip, press the target icon, select
a filename, and press the Start tab

2) Download DVD2AVI from afterdawn.com
unzip it, and run the application
click file>open and select the VOB in step 1.
You can drop the audio down from 48khz 44.1khz and remove the dolby surround
to reduce file size.
Select file>Save Project to create the Audio (WAV) file.
Select file>Save AVI to create the vidio (AVI) file (without audio)
I selected DivX compression on the last step (not sure if this is necessary)

3) Download VirtualDub from afterdawn.com
unzip it, and run virtualDub.exe
Click File>Open Video file. Select the AVI from step 2.
Click Audio>Wav Audio. Select the audio from step 1.
Click Audio>Full processing mode then Audio>Compression. Select Mpeg 3
Click Video>Full processing mode then Video>Compression. Select DivX
Select File>Save as AVI.

Categories: Uncategorized

Reading a company’s VAT number from sage

Dim SDO                 As SageDataObject90.sdoEngine
    Dim WS                  As SageDataObject90.WorkSpace
    Dim sdoCompany          As SageDataObject90.SetupData
           
    Set SDO = New SageDataObject90.sdoEngine
    Set WS = SDO.Workspaces.Add("Myconnection")
   
    ‘Connect to data files
    WS.Connect SageLocation, SageUsername, SagePassword, "ThisIsUnique"
   
    ‘Create an instance of InvoicePost & Record object’s
    Set sdoCompany = WS.CreateObject("SetupData")
   
    Me.txtCompanyName.Text = sdoCompany.Fields("NAME")
    Me.txtVatNumber.Text = sdoCompany.Fields("VAT_REG_NUMBER")
   
    ‘ Disconnect
    WS.Disconnect
Categories: Uncategorized

Serving Google Earth Links from a website

If you want to automatically load a location in Google Earth from a website, here are the steps…
 
Write an ASPX page like this:
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
  <description>Whatever</description>
  <name><%=strName%></name>
  <address><%= strAddress %></address>
</Placemark>
</kml>
 
The code behind is:

public string strName = "";

public string strAddress = "";

private void Page_Load(object sender, System.EventArgs e)

{

   Response.ContentType="application/earthviewer";

   strName="name..";

   strAddress="Address…";

}

 
Then add an application mapping into IIS by pressing website > Properties > Configuration > Add
 
Executable: C:WINDOWSMicrosoft.NETFrameworkv1.1.4322aspnet_isapi.dll
Extension: KML
 
Then Add the following into the web.config
 

<system.web>

<

httpHandlers>

<add verb="GET, HEAD, POST, DEBUG" path="*.kml" type="System.Web.UI.PageHandlerFactory"></add>

</httpHandlers>

</system.web>

 
Now rename the ASPX file to a .KML file, and it can be called from a browser
 
Categories: Uncategorized

Sms-txt.co.uk

Categories: Uncategorized

Connection string for Sage ODBC via OLEDB

Provider=MSDASQL.1;Persist Security Info=False;User ID=Manager;Data Source=SageLine50v9;Extended Properties="DSN=SageLine50v9;UID="
 
When Sage Line 50 is installed, it creates a system ODBC DSN called SageLine50v9 (I assume other versions of sage have corresponding names). The "database "contains the following tables:
 
TABLES
COMPANY
PERIOD
SALES_LEDGER
PURCHASE_LEDGER
NOMINAL_LEDGER
AUDIT_HEADER
AUDIT_SPLIT
AUDIT_JOURNAL
AUDIT_VAT
AUDIT_USAGE
DEPARTMENT
BANK
STOCK
STOCK_TRAN
STOCK_CAT
STOCK_COMP
INVOICE
SALES_ORDER
PURCHASE_ORDER
RECURRING
FIXED_ASSET
FIXED_ASSET_CAT
PREPAYMENT
ACCRUAL
INVOICE_ITEM
SOP_ITEM
POP_ITEM
SALES_CONTACT
PURCHASE_CONTACT
SALES_DEL_ADDR
PURCHASE_DEL_ADDR
COMPANY_DEL_ADDR
PRICE
PRICE_LIST
GRN_ITEM
CHART_LIST
CAT_TITLE
CATEGORY
TAX_CODE
UPDATE_LEDGER
CURRENCY
VAT_SUMMARY
VAT_RETURN
REMITTANCE
Categories: Uncategorized

Bad page viewstate in asp.net

Everybody who has worked with ASP.NET will be aware of the page viewstate. .NET’s way of persisting session information using hidden values on the page. However, you may find that if you accidentally post a viewstate from one page to another, or for some reason the worker process looses track of the page viewstate (such as within a server farm, or, as I suspect, where multiple worker processes are handling the same client) – you get an error such as the following:
 
[HttpException (0x80004005): Unable to validate data.]
   System.Web.Configuration.MachineKey.GetDecodedData(Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Int32& dataLength) +195
   System.Web.UI.LosFormatter.Deserialize(String input) +60
[HttpException (0x80004005): Authentication of viewstate failed.  1) If this is a cluster, edit <machineKey> configuration so all servers use the same validationKey and validation algorithm.  AutoGenerate cannot be used in a cluster.  2) Viewstate can only be posted back to the same page.  3) The viewstate for this page might be corrupted.]
   System.Web.UI.LosFormatter.Deserialize(String input) +118
   System.Web.UI.Page.LoadPageStateFromPersistenceMedium() +101
[HttpException (0x80004005): Invalid_Viewstate
 
You can of course, use persistant storage, such as SQL server to store the viewstate, but if it is just a rare occurance, you can have the page handle the event gracefully as follows
 

protected override object LoadPageStateFromPersistenceMedium()

{

object pageState;

try

{

pageState = base.LoadPageStateFromPersistenceMedium();

}

catch

{

// Something has gone wrong, reload page back to a stable state.

pageState = null;

Response.Redirect(Request.RawUrl);

}

return pageState;

}

 
That is, if the viewstate’s bad. then reload the page without any post data.
 
You can also return null from this procedure without redirecting, but this may have some unusual side effects.
Categories: Uncategorized

Google Maps API

Categories: Uncategorized

Nokia 3210 opening instructions

Categories: Uncategorized

Iterating products from sage

I was working on a bit of code to iterate through all products stored within sage, eventually found it (code in VB.NET)
 

Dim SDO As New SageDataObject90.SDOEngine

Dim wsStock As SageDataObject90.WorkSpace

Dim srStock As SageDataObject90.StockRecord

Dim i As Short

Dim strDescription As String

Dim strStockCode As String

wsStock = SDO.Workspaces.Add("Myconnection")

wsStock.Connect(SageLocation, SageUsername, SagePassword, "ThisIsUnique")

srStock = wsStock.CreateObject("StockRecord")

srStock.MoveFirst()

Do

strDescription = srStock.Fields.Item("DESCRIPTION").Value

strStockCode = srStock.Fields.Item("STOCK_CODE").Value

srStock.MoveNext()

Loop Until srStock.IsEOF

wsStock.Disconnect()

Categories: Uncategorized