.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Extra characters are writing tex file

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :.NET Framework
 

While i am creating an .tex file using FileStream and binar writer getting some extra characters as below.

Eg:                                
Plese help me out from this..




View Complete Post


More Related Resource Links

file upload in chunks or not buffering in memory before writing to disk?

  

What are the options for handling file uploads to reduce the memory footprint?  Is there a way to upload in chunks?  Is there a way to stream upload directly to disk instead of loading entire file in server memory?


Thanks


Writing to a text file

  

Hello,

I have the following  subroutine in an asp.net application class. The subroutine writes data to a text file upon application login.   My question is that if this function was called at the same time by two different  users would it cause any kind of error. Is there a need for a try catch?

 Public Shared Sub writeToLogFile(ByVal UserName  As String)
        Dim strLogMessage As String = String.Empty
        Dim strLogFile As String = System.Web.HttpContext.Current.Server.MapPath("~/Log.txt") Dim swLog As StreamWriter
        strLogMessage = DateTime.Now.ToShortDateString().ToString()  " ==> " & UserName

        If Not File.Exists(strLogFile) Then
            swLog = New StreamWriter(strLogFile)
        Else
            swLog = File.AppendText(strLogFile)
        End If


        swLog.WriteLine(strLogMessage)
      &nbs

Extra file is included on the Page directive inherits =

  

Hi;

I am trying to understand where the additional file name is coming from in my Page directives Inherits

attribute like so :

inherits ="Track_Milestones2, App_Web_techsrvcs_track_milestones2.aspx.cdcab7d2"

Is the result of this app being published on my local server at one time or could this

page have been compiled on a server ?

Thanks for your insights !


Writing the windows forms data to an HTML file

  
I have a windows forms application ready now i need to transfer data from the windows forms to the web and to do this i need to write an HTML file that contains the form data, i mean the data contained in the form should be written to an HTML file to be submitted and this HTML file should be generated on the local PC. I have the code for the HTML file but how can i write this HTML file with the data values contained in my windows forms. Please give your suggestions. Best Regards, Syed

How do you specify special characters as flat file delimiters?

  
I have a flat file that has fields delimited by tilde {~} and rows delimited by {CR}{LF}.  The problem is, my source is spitting out the {NULL} (&H00) at the end of the row. The data displays correctly in the pre-viewer (with a non-print symbol at the end of the last field), but gives an error when I try to run the package. Example: "data"~"data"~"data"{NULL}{CR}{LF} I can process the row in c# using: "\0\r\n" as the row delimiter.   What is the equivalent notation for SSIS?   Thanks,

Drag drop functinality not working on Explore View control for file containing special characters in

  
We have created a control which uses explorer view control for file drag and drop. This functinality works fine for a file having filename without special characters but it gives an error if we drag and drop a file having special characters in the file name. The reason for this is Sharepoint uses WebDAV protocol for file transfer to the Sharepoint document library and WebDAV protocol has limitation that it does'nt accept file with special characters. Please let me know the way how I can accomplish drag and drop of file with special characters in file name, onto Explorer View control with WebDAV.

Drag drop functinality not working on Explore View control for file containing special characters in

  
We have created a control which uses explorer view control for file drag and drop. This functinality works fine for a file having filename without special characters but it gives an error if we drag and drop a file having special characters in the file name. The reason for this is Sharepoint uses WebDAV protocol for file transfer to the Sharepoint document library and WebDAV protocol has limitation that it does'nt accept file with special characters. Please let me know the way how I can accomplish drag and drop of file with special characters in file name, onto Explorer View control with WebDAV.

Writing connection string in web.config file by code or dynamically

  
I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

Writing French accent characters in ASP .NET Textbox

  
How to write French accent characters such as - é - in ASP/HTML text box? I can copy and paste it in the text box like I did now - so there is nothing wrong with the encoding - but the problem is how to type it (write it!).I also know that é in HTML mean é but cant know how this may help!Appreciate your help! Thanks,

writing xml data to a string instead of a file

  
Hi   I have a code that generate xml file from a database table and write the data in a xml file that is created by the program itself  // create xml file and xml writer XmlTextWriter xmlwrtr = new XmlTextWriter("c:\\SitemapTEST2.xml", null); I would like to write the xml data as a string and pass it to a datasource connection , how is this possible? something like this  this.ExplorerBarDataSource.Data = @"<?xml version='1.0' encoding='UTF-8'?> <countries> <country name='United States'> <state name='Alabama'> <city name='Montgomery' pubulation='22,000'/> <city name='Birmingham'/> <city name='Tuscaloosa'/> <city name='Huntsville'/> </state> </country> </countries>";     thanks    

Strange characters exporting a blob file using bcp

  
Hi, I am trying to insert and export a binary file into SQL 2005. I need that word, pdf and txt file work. I can't use file path and this is the only choice I have. I am using this way: 1) Create a file test.txt and write "hello" into it. 2) CREATE TABLE [dbo].[myfiles]( [file] [varbinary](max) NOT NULL) ON Primary 3) INSERT INTO [myfiles]([file]) SELECT BulkColumn FROM OPENROWSET ( BULK 'C:\test.txt', SINGLE_BLOB) AS BinFile 4) declare @SQLcommand nvarchar(4000) set @SQLcommand =       'bcp "SELECT top 1 [file] FROM myfiles" queryout "c: \temp\test.txt" -T -n -SMYPC' exec xp_cmdshell @SQLcommand When I open file c:\temp\test.txt I can see strange characters before "hello" Trying to insert a word file says me that the file is corrupted. How can I solve this ? Thanks.

SharePoint file url more than 256 characters length problem

  
Hi, I am facing a small issue which is giving big trouble. We are having lots of data in hard drive and for giving access to all users, we have planned to move data to SharePoint. While moving data, when there are multiple folders in a root directory. So, url grown more than 256 characters and when I try to upload the file it is giving the exception message. Below are the details of my SharePoint server. Version: 12.0.6425.1000 And I followed the support KB article and tried to install this. http://support.microsoft.com/kb/956056/ But, the version the KB article showing as  12.0.6327.5000. So, when I run the hotfix in my system, it is saying this fix is not for the version installed. So, not able to find out the problem. Can you please suggest me any other solution? Because of this issue, we are not able to move/migrate data. thanks for all your help.   ASP.NET and SharePoint developer Company: http://www.rampgroup.com/ Blog: http://praveenbattula.blogspot.com

Writing to excel file - The field is too small to accept the amount of

  

Hi

I am writing to excel file using jet driver. If the length of value exceeds 255 characters i get the below error.

'The field is too small to accept the amount of data you attempted to add.  Try inserting or pasting less data'

Please could you provide a solution to how can i add values with length greater than 255. Excel file is 97-2003 format.

System.Data.OleDb.OleDbCommand command = new System.Data.OleDb.OleDbCommand();
 
 System.Data.OleDb.OleDbConnection connection =
          new System.Data.OleDb.OleDbConnection(
              "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + destinationFilePath + ";Extended Properties=Excel 8.0;");
 
command.CommandText = "Insert into [sheet1$] (col1, col2) values ('1', 'TEXT Message greater than 255 characters')
 

Writing to a csv file

  

Once again I have trawled the web for a WPF (VB) example of writing to a CSV file. I have found several in C# and Forms VB and managed to work out reading from CSV. However, the writing version I have come up with adds a blank line after each actual line. Also the first cell written to the CSV file contains some wierd characters just before the genuine content. (i.e. #?!Name1 instead of just Name1); I have shown the code below.

  Sub writeCSVData()
    If File.Exists("resources\csvData.csv") Then
      File.Delete("resources\csvData.csv")
    Else
      MsgBox("resources\csvData.csv doesn't exist")
    End If
    MyFileName = "resources\csvData.csv"

    myCSVWriter = My.Computer.FileSystem.OpenTextFileWriter(MyFileName, True)

    For y = 0 To 14
      myNewLine = ""

parsing tab delimited spanish characters file

  

Using vb.net/asp.net 2005.

another spanish character issue:  I am parsing special spanish characters, removing the tildes (EX:  "ñ" becomes "n") that customers send us in files, in tab delimited files that is.

When the characters are valid spanish characters (like "ñ") then this is not an issue, however some of the files that we get have characters such as:

"Ni±o"

Which should actually be:

"Niño"

Has anyone seen this and know any solution?  The "ñ" is fine but I am not certain what to do about the "±".

this is only one example, other spanish characters are listed as a question mark "?" so this is causing some issues.


thanks

MC



Control Characters in Log file

  

SQLMessage = "This task ran at " & Now() & " - InfoMessage - "

 Dim sw As StreamWriter
        Dim path As String = outputfilepath
        Try
            'Append test to existing log file
            sw = File.AppendText(path)
            sw.WriteLine(SQLMessage)
            sw.Flush()
            sw.Close()
        Catch ex As Exception

        Finally
        End Try


In some of my logs I see this:

Actually I can't show you what I'm seeing

When I copy the Control characters from Notepad to here they are converted to Chinese characters!! ARGH!

Obviously I'd expect to at least see the
This task ran at <<time>>  - InfoMessage -

Where does this control string come from that gets written to the log file??

I'd seen the large log files were all looking like this.  I cl

unable to unzip XML file with unicode characters in it's name.

  

Finally I did manage to build an application that supports unicode characters..

Now my application generates a zip file which contains an XML file. I want to unzip the zip file to view the contents of an XML file.

i am unable to unzip because the name of the zip file/as well as XMl file has Unicode characters(i.e. japanese Name) and it gives some error.

 

If i generate the XML file  with same contents but name of the files in English then i can view the contents of the XML file.

 

My query is i want to be able to unzip the XML file when the name of the file contains unicode characters in it.

as per my research up till now,  we either require a compatible winzip software or we have to create an utility for the same.

I need to know how to go about it. It's a little urgent as well.

Thnx in advance.

 

 I can unzip file with the name: PMTI_MSPS_US_GAB_JAPANESE_PWA_Project Plan1_PPM_2010100105260495.zip

 

I am unable to unzip the file with the name: PMTI_MSPS_US_GAB_JAPANESE_PWA_????????1_PPM_2010093006260431.zip

I wanto unzip this file.


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend