Monday, September 27, 2010

how to get the returned value from stored procedure in asp.net

 private int GetReturnedValueFromStoredProcedure(string storedProcedureName, string connectionString, string paramValue)
        {
            SqlConnection connection = new SqlConnection(connectionString);

            // Command - specify as StoredProcedure
            SqlCommand command = new SqlCommand(storedProcedureName, connection);
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@orgID", System.Data.SqlDbType.NVarChar).Value = paramValue;

            // Return value as parameter
            SqlParameter returnValue = new SqlParameter("returnVal", SqlDbType.Int);
            returnValue.Direction = ParameterDirection.ReturnValue;
            command.Parameters.Add(returnValue);

            // Execute the stored procedure
            connection.Open();
            command.ExecuteNonQuery();
            connection.Close();

            return Convert.ToInt32(returnValue.Value);
        }

Wednesday, August 11, 2010

Counting Number of Files in a directory - UNIX/ Linux

Go to that directory first and then type the following command:


Command: ls | wc -l

Tuesday, August 10, 2010

jQuery UI CSS List in Google CDN


Sunday, July 18, 2010

Finding Full Size of a Directory in Human readable format - UNIX/LINUX

Command:   du -sh directory
here, -s, --summarize => display only the total of the specified directory

        -h, human readable format =>print size of a directory in human readable format e.g., 100K or 2000M or 4.9 G

Monday, July 12, 2010

Running a background process - Using the nohup command in UNIX

Command:  
            nohup command &


For example:


If you want to run a java program as a background process you can do the following:

nohup java -cp ./wikify/bin:./wikify/mysql-connector-java-3.1.13-bin.jar:./wikify/trove.jar:./wikify/weka.jar:/usr/share/tomcat6/lib/servlet-api.jar:./wikify/src/org/wikipedia/miner/service/ org.wikipedia.miner.service.WikipediaMiner &


You r program will be running in the background even if you logout from your terminal. Use Kill command to terminate the nohup command

Wednesday, June 16, 2010

Thursday, June 3, 2010

A generic error occurred in GDI+.

Got the following error when one of client was trying to upload a picture in his website after publishing the website in godaddy.com. It was a easy fix. Just give the “write” permission to the “image” directory of your solution folder in the godaddy domain where all the files resides. More specifically,

 

[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) +377630
System.Drawing.Image.Save(String filename, ImageFormat format) +69
iTalk.Controllers.AccountController.ChangePicture() in AccountController.cs:306
lambda_method(ExecutionScope , ControllerBase , Object[] ) +39
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +17
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +178
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +24
System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +53
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +258
System.Web.Mvc.<>c__DisplayClassc.<InvokeActionMethodWithFilters>b__9() +20
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +193
System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +382
System.Web.Mvc.Controller.ExecuteCore() +123
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +144
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +54
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


Solution: Login to godaddy.com –>on the top,  Content tab –> Click File manager –> check the folder which contains the images –> Click permission tab on the top – uncheck the already checked items –> check the read and write from the check box list –> Click ok at the bottom and you are done!