How to create / consume a .Net web service

[WebService(Namespace = “http://server”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class myservice : WebService { [WebMethod] public string someq(string var1, string var2) { return var1+var2; } <?php $wsdl = “http://server/service.asmx?wsdl”; $client = new SoapClient($wsdl); var_dump($client->someq(array(‘var1’=>”val1″, ‘var2’=>”val2″))); ?>

How to fix a database in one simple step

DECLARE @db nvarchar(50) set @db=’my.datab.name’ –close all connections DECLARE @SPId int DECLARE @CMD varchar(100) DECLARE my_cursor CURSOR FAST_FORWARD FOR SELECT SPId FROM MASTER..SysProcesses WHERE DBId = DB_ID(@db) AND SPId <> @@SPId OPEN my_cursor FETCH NEXT FROM my_cursor INTO @SPId WHILE @@FETCH_STATUS = 0 BEGIN SELECT @CMD = ‘KILL ‘ + CAST(@SPId AS varchar(10)) EXEC (@CMD) […]

How to read a .ini file in .Net

There is no ready-made class, so you’ll have to call the Windows API [DllImport(“KERNEL32.DLL”, EntryPoint = “GetPrivateProfileStringW”, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true, CallingConvention = CallingConvention.StdCall)] private static extern int GetPrivateProfileString( string lpAppName, string lpKeyName, string lpDefault, string lpReturnString, int nSize, string lpFilename); [DllImport(“KERNEL32.DLL”, EntryPoint = “WritePrivateProfileStringW”, SetLastError = true, CharSet = […]

Useful Perl date tricks

perl -MDate::Manip -e ‘Date_Init(“Language=Romanian”,”DateFormat=non-US”); print UnixDate(DateCalc(“azi”,”+ 18 zile lucratoare”),”%A, %e %B %Y%n”)’ Output: marti, 8 decembrie 2009 perl -MDate::Manip -e ‘Date_Init(“Language=Romanian”,”DateFormat=non-US”); @date=ParseRecur(“fiecare simbata din decembrie”); foreach (@date) {$d=UnixDate($_, “%A, %e %B %Y%n”); $d=~s/(\w+)/\u\L$1/g; print $d}’ Simbata, 5 Decembrie 2009 Simbata, 12 Decembrie 2009 Simbata, 19 Decembrie 2009 Simbata, 26 Decembrie 2009

Bad Behavior has blocked 85 access attempts in the last 7 days.