filestream

SQL Server 2008 FILESTREAM performance

核能气质少年 提交于 2019-12-02 20:43:38
I had some questions around the FILESTREAM capability of SQL Server 2008. What would the difference in performance be of returning a file streamed from SQL Server 2008 using the FILESTREAM capability vs. directly accessing the file from a shared directory? If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 second window, would SQL Server 2008 performance slow to a crawl? marc_s If 100 users requested 100 100Mb files (stored via FILESTREAM) within a 10 second window, would SQL Server 2008 performance slow to a crawl? On what kind of a server?? What kind of hardware to

Returning a stream from File.OpenRead()

孤人 提交于 2019-12-02 19:58:11
I'm in the process of writing a WCF service that will allow an ASP.Net web site to retrieve files (based on this article ). My problem is that when I return the stream, it's blank. For simplicity, I've isolated the code into a simple winforms app to try and find what the problem is with returning a stream and this is the code: private Stream TestStream() { Stream fs = File.OpenRead(@"c:\testdocument.docx"); return fs; } // This method converts the filestream into a byte array so that when it is // used in my ASP.Net project the file can be sent using response.Write private void Test() { System

C++: What is a stream

会有一股神秘感。 提交于 2019-12-02 16:33:41
I have been hearing about stream, more specifically file streams. So what are they? Is it something that has a location in the memory? Is it something that contains data? Is it just a connection between a file and an object? Any help would be appreciated The term stream is an abstraction of a construct that allows you to send or receive an unknown number of bytes. The metaphor is a stream of water. You take the data as it comes, or send it as needed. Contrast this to an array, for example, which has a fixed, known length. Examples where streams are used include reading and writing to files,

What does a hash do to a variable in VB?

那年仲夏 提交于 2019-12-02 14:13:27
问题 I have to refactor a VB6 program to C# and am stuck at understanding the following lines: Set myFileSystemObject = New FileSystemObject Set myTextStream = myFileSystemObject.OpenTextFile("myTextFile.txt") Open sPrinterPort For Output As iFileNumber Print #iFileNumber, myTextStream.ReadAll Close #iFileNumber I do know what's generally happening, but as I'm not used to the VB syntax, I'd like to know exactly what Print #iFileNumber, myTextStream.ReadAll does. And more specifically, what the #

How can I remove the oldest lines in a file when using a FileStream and StreamWriter?

[亡魂溺海] 提交于 2019-12-02 13:05:11
Based on Prakash's answer here , I thought I'd try something like this to remove the oldest lines in a file prior to adding a new line to it: private ExceptionLoggingService() { _fileStream = File.OpenWrite(GetExecutionFolder() + "\\Application.log"); _streamWriter = new StreamWriter(_fileStream); } public void WriteLog(string message) { const int MAX_LINES_DESIRED = 1000; StringBuilder formattedMessage = new StringBuilder(); formattedMessage.AppendLine("Date: " + DateTime.Now.ToString()); formattedMessage.AppendLine("Message: " + message); // First, remove the earliest lines from the file if

how to stream file to client in django

纵饮孤独 提交于 2019-12-02 12:47:17
问题 I want to know how can I stream data to client using django. The Goal The user submits a form, the form data is passed to a web service which returns a string. The string is tarballed ( tar.gz ) and the tarball is sent back to the user. I don't know what's the way. I searched and I found this, but I just have a string and I don't know if it is the thing I want, I don't know what to use in place of filename = __file__ , because I don't have file - just a string. If I create a new file for each

How to pass credentials during writing file at server path?

泪湿孤枕 提交于 2019-12-02 12:33:02
问题 I would like to write a file at server path but when I tried to do that we got exception that we have no permission to do that. We have an application ID and password who has permission to write at the server path but I do not know how can I pass this credentials : My current code : //Create a new GUID, extract the extension and create a new unique filename string strFileGUID = System.Guid.NewGuid().ToString(); string extension = Path.GetExtension(attachment.AttachmentFileName); string

Out of Memory Exception when using File Stream Write Byte to Output Progress Through the Console

不想你离开。 提交于 2019-12-02 11:02:55
问题 I have the following code that throws an out of memory exception when writing large files. Is there something I'm missing? I am not sure why it is throwing an out of memory error as I thought the Filestream would only use a maximum of 4096 bytes for the buffer? I am not entirely sure what it means by the Buffer to be honest and any advice would be appreciated. public static async Task CreateRandomFile(string pathway, int size, IProgress<int> prog) { byte[] fileSize = new byte[size]; new

How to upload/update file by FileStream and ResumableUploader in C#

折月煮酒 提交于 2019-12-02 10:57:05
I wanna upload/update file by System.IO.FileStream in Google Documents List API(C#)? I use two way below: Google.GData.Client.ResumableUpload.ResumableUploader (1) public void UpdateAsync(Authenticator authentication, AbstractEntry payload, object userData) (2) public void UpdateAsync(Authenticator authentication, Uri resumableUploadUri, Stream payload, string contentType, object userData) (1) Success. (2) Failed with 403 Forbidden or another... So, does someone have any sample code about (2)? My Code for (2): This code is edited by sample code from Claudio Cherubino , and it's work for

Reading first N bytes of a file as an InputStream in Java?

左心房为你撑大大i 提交于 2019-12-02 10:50:12
问题 For the life of me, I haven't been able to find a question that matches what I'm trying to do, so I'll explain what my use-case is here. If you know of a topic that already covers the answer to this, please feel free to direct me to that one. :) I have a piece of code that uploads a file to Amazon S3 periodically (every 20 seconds). The file is a log file being written by another process, so this function is effectively a means of tailing the log so that someone can read its contents in semi