Posts

Showing posts from January, 2016

Compare two files with PSPad

Image
You can go to http://www.pspad.com/en/download.php and download PSPad text editor. To get the difference between two text files open PSPad editor. Then go to Tools menu and select Text Differences then select first option that is Text Diff with This File...

Input string was not in a correct format in ASP.NET/C#

Image
ERROR:   Server Error in '/' Application. Input string was not in a correct format. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error: Line 31:         int ppi = Convert.ToInt32(Text1.Text); SOLUTION: I tried to change int ppi = Convert.ToInt32(Text1.Text); statement to int ppi = int.Parse(Text1.Text); and int ppi = Int32.Parse(Text1.Text); and int ppi = Int16.Parse(Text1.Text); but it didn't work. The reason was I was using a float value and parsing into an integer one, so I change the erroneous statement to the following, and it worked: float ppi =  float.Parse(Text1.Text);

Data analysis not available in Excel

Image
If you are using MS Excel version older than 2016 and if Data analysis option is not available in Analysis section under Data tab then follow the instructions below. Data analysis option is not available. Go to File menu > Options > Add-Ins > Select "Excel Add-ins" in Manage drop-down list that is located at the end of the window and hit go. Then select Analysis ToolPak and click OK it will add Data Analysis option under Analysis group in Data tab. This is how it looks like after enabling the add-in.

R: 'file' must be a character string or connection

Image
I was using the Shiny app in R , and I was trying to read a file using fileInput control, but I faced the following error:   Listening on http://127.0.0.1:3558 Error in read.table(file = file, header = header, sep = sep, quote = quote,  :   'file' must be a character string or connection Problem code: if(is.null(input$file1))       return(NULL)  file <- read.csv(file=input$file1,head=TRUE,sep=",", stringsAsFactors=FALSE) csv <- str(file) Solution: inFile <- input$file1 if (is.null(inFile))       return(NULL)     csv <- read.csv(inFile $datapath , header=TRUE, sep=",") The resolution was to use the datapath property of the input file and not the file itself.