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
}

Tuesday, November 16, 2010

Amazon web service ISBN Search

String DESTINATION = "https://ecs.amazonaws.com/onca/soap?Service=AWSECommerceService";
String MY_AWS_ID = "ACCESS_ID";
String MY_AWS_SECRET = "SECRET_ID";



ItemSearchRequest objRequest = new ItemSearchRequest();
objRequest.SearchIndex = "Books";
objRequest.Power = "ISBN:9780557230648";
objRequest.ResponseGroup = new string[] { "Small", "AlternateVersions", "Large", "Medium", "Offers" };
objRequest.Sort = "salesrank";



ItemSearchRequest[] requests = new ItemSearchRequest[] { objRequest };

ItemSearch itemSearch = new ItemSearch();
itemSearch.AWSAccessKeyId = MY_AWS_ID;
itemSearch.Request = requests;



// create an instance of the serivce
AWSECommerceService api = new AWSECommerceService();

// set the destination
api.Destination = new Uri(DESTINATION);

// apply the security policy, which will add the require security elements to the
// outgoing SOAP header
AmazonHmacAssertion amazonHmacAssertion = new AmazonHmacAssertion(MY_AWS_ID, MY_AWS_SECRET);
api.SetPolicy(amazonHmacAssertion.Policy());

// make the call and print the title if it succeeds
try
{

ItemSearchResponse response = api.ItemSearch(itemSearch);
Items info = response.Items[0];
Item[] items = info.Item;
for (int i = 0; i < items.Length; i++) { Label1.Text += "Book Title: " + items[i].ItemAttributes.Title.ToString() + "<br />";} } catch (Exception ex) { Label1.Text += ex.Message.ToString(); }

Note:-
==================================================
AmazonHmacAssertion class is available in client project of below link
http://associates-amazon.s3.amazonaws.com/signed-requests/samples/amazon-product-advt-api-sample-csharp-soap.zip

Tuesday, October 5, 2010

configure log4Net

Web.Config:-


under configsection

<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>

<log4net>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
<param name="File" value="logs\\error_04112009.log" />
<param name="AppendToFile" value="true"/>
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} - %m%n" />
</layout>
</appender>
<logger name="File">
<level value="All" />
<appender-ref ref="LogFileAppender" />
</logger>
</log4net>


Global.asax:-

void Application_Start(object sender, EventArgs e)
{
log4net.Config.XmlConfigurator.Configure();
}