Determine Stream Is Empty?

Sep 26, 2011

I have a WCF service which is returning PDF files as a stream over a NetTcp endpoint. This is all working fine. However, if the file is not found, or if I can't find the related row in the database to retrieve the filepath then I return Stream.Null from the service.

However I can't seem to find a way to compare the returning stream to check and see if it is empty or not.[code]...

View 3 Replies


ADVERTISEMENT

File Container - "Attempting To Deserialize An Empty Stream."?

Dec 13, 2011

I found this on MSDN and the issue never got resolved, but I figure it would give me an idea of where to start for creating a container to hold a set of files of varying file types. No compression is needed, so just something very simple.

Imports System.IO
Public Class Form1
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

[code].....

View 7 Replies

Stream Read Return Length 0 While Stream Is Open And Has Valid Data In It?

May 25, 2012

in an winForm app in VS2010 win 7 compiling to x86, I try to do what Alvas.Audio seems to work. See (c# ex: [URL] for reference.

Dim data() As Byte = wr.ReadData(second * i, second)

The result give me data.length()=0. I do not have any exception, I can read format from it and whatever reader I use I got this problem.EDIT : After some tests, it seems like the uncompressed file I create in the first step (in PCM format, with .wav extension) can not be recognized by the Alvas.audio library for the second step. I must miss something around Audio file markups or something alike.

Here is the code that might be the source (basically this is step 1):

Dim functOut As String = String.Empty
Dim wr As Alvas.Audio.IAudioReader = Nothing
Dim fs As IO.FileStream = Nothing

[code]....

How can I write the resulted stream to be sure I can read it again later?

View 1 Replies

VS 2010 Make Shoutcast Stream Info Like The Stream Name

May 5, 2011

Im making a desktop player for a online web radio, and for the program I wanna make it show all the stream info. Like the stream name, and such. However I dont know how to do this? I looked everywhere

The server url is setup like this "[URL]" And it has all the stream info and that there. So is there a way I can get the info from there onto like say a label? Live updates btw.

View 1 Replies

Crypto Stream To Memory Stream?

Nov 22, 2011

I have a problem with the cryptostream, if i write the stream to a memorystream the memory that the stream used is still alocated and i have no way of unalocating it.what am i missingdoing wrong? im using-using on the streams,readers and crypto stuffs so the framework should shut them all down right? i tryed calling .close and .dispose but nothing ,in fact i moved it all over I have provided the sub that im using for the encrytion im in .net 4.5 so there is a lil async stuff but i know thats not the problem coz i moved this code out of my main app(.net 4) for testing to see if i could fix the problem.[code...]

View 12 Replies

DataGridView - Convert Nulls To Empty Strings And Display It In The Grid As Empty Strings

May 14, 2009

I have a DataGridView that has some columns with dates. It binds to an in-memory Datatable which gets loaded from an string array of data passed back from the backend Some of the rows returned have nulls for the date columns. Solution 1: If I define the Date column in the DataTable as "string" I can easily convert those nulls to empty strings and display it in the grid as empty strings (desired results). However, if the user clicks on the date column header to sort by date, it doesn't order the rows as you want. You get a purely string sort order. Not acceptable

[Code]...

View 2 Replies

Nothing Equals String.Empty, Null Does Not Equal String.Empty?

Jun 28, 2010

This must've have been asked before but I couldn't locate it. In a mixed code project (VB and C#) we were debugging some old Visual Basic code where a statement as follows could be found:

If Request.Params("xxx") <> "" Then
'do something

I considered this a bug as Request.Params could be null, in which case the statement would've become false which wasn't the idea. So I thought. I just found out, -- probably for the tenth time and I will keep forgetting -- that the following two statements are not equal, while Nothing in VB should be equal to null in C# (thought I):

if(String.Empty == null) // always false
If String.Empty = Nothing Then ' always true

Should I dismiss this as a typical Microsoft backward compatibility effort, or should I consider this a huge error in the VB.NET compiler? Does anybody know the Microsoftean opinion on this oddity?

View 3 Replies

Arrays - If Not String.Empty Ignoring Empty String

Aug 11, 2010

I have a array of strings and I am looping through them, but the string might be empty so I am trying this:

[Code]...

View 3 Replies

C# - .Net - How To Prepend A Stream

Nov 21, 2011

I'm loading blobs out of a database as a byte array and I put them in a memory stream so that I can load them into an xmldocument for parsing.However there are blobs that have multiple root nodes, this causes the parser to blow up.My solution is to just make a new root node that encompasses the whole blob. I can add onto the end just fine with a streamwriter however I can't figure out how to add onto the beginning.How can I prepend to a stream?

Update:I was having too much trouble getting this to work. The "XML" I was extracting was not proper XML and I kept on having to add more and more regexes to remove bad XML before the XmlDocument Load. I ended up using the HtmlAgilityPack to parse out my valid sections of XML and I put those inside their own xml documents.

View 3 Replies

C# - Get The Bytes From A Stream?

Jun 4, 2012

I'm writing a VB.net application (but you can answer in C# if you want, no problem) that uses a 3rd party .NET library. In particular, one method in this library takes an IO.Stream as input (among other things) and writes the results of its processing to said stream. My problem is that the method CLOSES the stream after writing to it, so I can't read back the data that it wrote in it!To be more specific: it works, of course, if the stream is a FIeStream , since it writes the data on disk, but what if I want to read the data directly to memory? I tried using a MemoryStream, but as I said, when the method returns the stream is already closed, and I can't read back anything from it.

Imports System.IO
Public Class CloseHijackedMemoryStream
Inherits MemoryStream

[code]...

View 3 Replies

C# - Play MP3 From Stream

Jul 28, 2010

Is there any way to play MP3 directly from a memory stream (without any temp. files) using VB.NET or C#? or play from SQLCe database?

View 2 Replies

Get HtmlElement From A Stream?

Jul 25, 2010

How can I get html elements from a stream?

This is a part of a code that get me the stream[code]....

View 1 Replies

Get HtmlElement From Stream?

Jul 26, 2010

I am trying to get html element from a stream

this is the stream:

Dim request As WebRequest = HttpWebRequest.Create("http:www.mysite.com/")
Dim response As WebResponse = request.GetResponse()
Dim stream As Stream = response.GetResponseStream()

How can I get the html elements from it? (I DO NOT WANT TO USE WEBBROWSER CONTROL)

Then I will do something like...

For Each element As HtmlElement In XXXXXXXX
ListBox1.Items.Add(element.GetAttribute("href"))
Next

View 4 Replies

Get Key's Value Using A Stream Reader

Jun 18, 2012

How can i get my key's value using a stream reader [code]

View 3 Replies

Possible To Extend Stream From 128 To 256

Jan 17, 2010

about the id3 tags.can be possible to extend the stream from 128 to 256.some parts of the title is missing

View 5 Replies

Read A XML Stream?

Jul 9, 2009

I am trying to read the following xml stream but am really struggling.

<channelSnapshot xmlns="urn:betfair:games:api:v1">
<channel gameType="BLACKJACK" id="1444077" name="Exchange BlackJack">
<status>RUNNING</status>

[code]....

If the element is between a start tag and end tag such as

<status>RUNNING</status>

Then I can access the value ok. I have been using Select Case xmlnodetype but using this when the nodetype is a whitespace I can't get to the element beyond the whitespace.So that in the following line

<property name="Card 1" value="NOT AVAILABLE"/>

I cant get to anything beyond the word property.

View 4 Replies

Reading XML From A Stream?

Mar 29, 2010

I'm trying to read data from some local XML files and process data from them using VB.net.

The format is:
<?xml version='1.0' standalone='yes' ?>
<DataFeed>

[code].....

View 2 Replies

Stream Media To WMP?

Mar 23, 2012

I want to be able to go open URL in wmp and put in http://mycomputer:8090 and have it play a media file ... like it does if i host the media file on a web site...sofar i have:

Private Sub HTTPStreamer(ByVal Reciever As IO.Stream)
System.Threading.Thread.Sleep(1000)
Dim listener As New System.Net.Sockets.TcpListener("localhost", 8090)

[code].....

View 4 Replies

Stream My Webcam Over Lan?

May 14, 2010

I have to develop an application where I have to stream my webcam over lan. I have a server where my webcam will be connected and when requested I have to send my webcam over lan. i need to view the server webcam from another network pc.

View 4 Replies

Stream Video Over LAN?

Mar 16, 2011

I want to stream video from a simple webcam over LAN for object detection purpose. Is it a good idea to grab frames and send them continuously over network with NetworkStream.Write()?

I did this but usually on client side i lost half of image data and I got noise, I don't know what is wrong. I'm looking for a fix or a better idea.

I put the client and server source codes here, first run the client and click "START LISTENING" then run server and click "Send pic".

[URL]

View 2 Replies

.net - Error Stream Was Not Readble

Jan 22, 2011

I wrote the code below and I got an error (Stream was not readble) while execute this line SR = New StreamReader(FS) why and how to fix it

the code :

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FS As FileStream

[Code].....

View 3 Replies

.net - Load An Unmanaged DLL From A Stream?

May 18, 2012

I have an application written in .NET 4.0 that needs to load in memory a native DLL (written C). At the moment I am using a P/Invoke call to LoadLibrary passing the path where the DLL is located. This works, but due to the fact that this DLL comes from a DB, I would like to know if it is possible loading it through a stream, avoiding then the necessity to store the DLL somewhere in the filesystem.

View 2 Replies

.net - Overlaying Images From Stream

Dec 27, 2009

I'd like to overlay a number of images (PNG, same size for all, with transparency). So far, my code is as follows.

[Code]...

Now, I would like to overlay one more image, but this is based on a user's input from a textbox. So, to get that image, we need to take the user's input, and get the respective resource file. I do it as follows:

[Code]...

The overlay works correctly. So question is: Why is the overlay not working from the stream? Edit: It turns out that the overlay does actually work, but seems to overlay an enlarged image rather than the true size. Would there be any reason for this?

View 1 Replies

.net - Stream Connection Using Httpwebrequest?

Apr 3, 2012

I have created a httpwebrequest connection to a streaming API after trying a tTCPClient which just never ended up working. My concern is whether my code is correct and that I am actually reading in new data and that the connection is maintained. Initially I had been reading into a buffer and just loaded everything into a file after max size, but figured it would be simpler to read a line, since each entry was being sent delimited by line feeds.

rStream = webrequest.GetResponse().GetResponseStream
rStream = New GZipStream(rStream, CompressionMode.Decompress)
If rStream.CanRead then

[code]....

It looks like I am continuously reading and not sure if I am reading redundant data here. Also another question is that if I were to use a thread to appendToFile, would that maintain the connection to the stream?

View 1 Replies

.net - WCF Function Won't Return Stream?

May 11, 2011

So I have a function which returns a pdf stream. The calling procedure gets the stream and writes it to disk Normal VB code is as follows:

[Code]...

View 2 Replies

Audio Stream Capture From Web

Nov 18, 2009

I have link: [URL]

I want capture the audio stream on my computer in mp3/wav.

I have no idea from what i should start. What should i use for start developing? I'm working in VS2008 on VB. Can i do it in VB? What additional software i need?

View 2 Replies

Cannot Convert To 'System.IO.Stream

Jul 31, 2011

I am trying to convert the image from 'System.Drawing.Bitmap' to 'System.IO.Stream', but i am getting an error.

the error is: Value of type 'System.Drawing.Bitmap' cannot be converted to 'System.IO.Stream'.[code]...

View 1 Replies

Clear Memory Stream?

Apr 17, 2009

'in form class
Dim PIC_PATH As String
Dim PICTURE As Image

[code].....

View 6 Replies

Compressing A Stream Rather Than A File?

Apr 3, 2010

I've downloaded ZLIB.NET from here and the example VB.NET code they provide works fine. It's very short so I'll paste it here for reference:

vb
Public Shared Sub CopyStream(ByRef input As System.IO.Stream, ByRef output As System.IO.Stream)
Dim num1 As Integer

[Code]...

Note that the CopyStream() subroutine is identical. The problem is that although decompressing seems to work fine, compressing does not. If I take a byte stream, compress it and then decompress it using the above code, I get a truncated version of the original stream (as an example, a 360485 byte stream becomes 311518 bytes). The resulting bytes match the original stream up until the point where it's cut off.

The only information I can find about streams being truncated is due to missing stream.Flush() commands but the output stream is flushed in the CopyStream() subroutine.

View 5 Replies

Detect The Encoding Of A Stream?

Sep 6, 2011

I would like to know the way a stream or a string is encoded before converting it. If a string is not utf-8 it would be converted to utf-8.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved