Friday, August 26, 2011

TCP/IP Application

Below is link for sample application

http://www.dijksterhuis.org/building-a-tcpip-server-using-c/

It will give you amazing startup code in TCP/IP Communication.

If you are able to connect to the local machine via telnet command not able to connect from another machine then make sure to add exe and port into exception.

Friday, July 8, 2011

Temp table insert with sp_executesql

DECLARE @jobs TABLE
( jobcount int
)
INSERT
INTO @jobs
EXEC
sp_executesql
N’select 1 AS jobcount’
SELECT
*
FROM @jobs

Tuesday, July 5, 2011

How to recover suspect SQL server 2008 Database

DBCC CHECKDB (’YourDBname’) WITH NO_INFOMSGS, ALL_ERRORMSGS

Then run below query

EXEC sp_resetstatus ‘yourDBname’;
ALTER DATABASE yourDBname SET EMERGENCY
DBCC checkdb(’yourDBname’)
ALTER DATABASE yourDBname SET SINGLE_USER WITH ROLLBACK IMMEDIATE
DBCC CheckDB (’yourDBname’, REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE yourDBname SET MULTI_USER

Tuesday, June 21, 2011

SC command - Access denied

http://kevin.vanzonneveld.net/techblog/article/allow_windows_users_to_restart_service/

Friday, March 25, 2011

folders are hidden in pen drive

1. click start>>run>>type in "cmd"
2. type the location of your flash drive.. e.g. "d:", "e:", "f:", etc..
3. type "dir /ah"
*you will now see the files/folders with hidden attributes
4. type "attrib [name of file/folder] -r -a -s -h"
*if you're going to unhide files, you should type the whole name plus the extension (format).. example "attrib party.jpg -r -a -s -h"
**if you have folders with 6 characters and above, type the first 6 characters then "~1".. example for folder named "birthday"
"attrib birthd~1 -r -a -s -h"
5. you should repeatedly type dir /ah after unhiding some files/folders so you'll know if they're now working or not..
6. now check you flash drive.. it should be there..

Sunday, March 13, 2011

Jquery Auto complete plugin

$("#txtSearch").autocomplete("/test/searchitembyCode",{ matchCase: false ,
parse: prep_data,
formatItem: function(item) {
return item.Title;
}
}).result(function(event, item) {
alert(item.Id);
});



// Handle data from ajax request
prep_data = function(data){
tmp = eval('(' + data + ')');
parsed_data = [];
for (i=0; i < tmp.length; i++) {
obj = tmp[i];
// Other internal autocomplete operations expect
// the data to be split into associative arrays of this sort
parsed_data[i] = {
data: obj ,
value: obj.Id,
result: obj.Title
};
}
return parsed_data
}