Mcisendstring in .NET for recording audio

Just found out how to record and playback audio. Really easy.
 

Private Declare Function mciSendString Lib "Winmm.dll" Alias "mciSendStringA" _

(

ByVal lpstrCommand As String, ByVal lpstrReturnString As String, _

ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long

 

Public Sub recordToWave(ByVal filename As String)

mciSendString("open new type waveaudio alias capture", vbNullString, 0, 0)

mciSendString("record capture", vbNullString, 0, 0)

blnIsRecording =

True

While blnIsRecording

Application.DoEvents()

End While

mciSendString("save capture " + filename, vbNullString, 0, 0)

mciSendString("close capture", vbNullString, 0, 0)

End Sub

Public Sub playWave(ByVal filename As String)

mciSendString("Play waveaudio!" + filename, vbNullString, 0, 0)

End Sub

Categories: Uncategorized

RentACoder Rants

I have developed a personal hatred for RentAcoder.com, after they asked me for $100 up-front for a programming project, then cancelled my account as soon as I paid.
 
Whatever their excuse is, I lost $100, and have nothing to show for it. So avoid them like the plague.
 
Here is a good alternative GetaFreelancer (RSS feed)
 
 
Categories: Uncategorized

Speaking clock in VB.NET

Categories: Uncategorized

Yahoo Adsense

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>
 
 
Categories: Uncategorized

Internationalising www.sms-txt.co.uk

Categories: Uncategorized

Hotfix for KB 896181

 
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

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

Categories: Uncategorized

Generating a 1×1 pixel jpeg in a aspx page

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

Categories: Uncategorized