-
StreamReader (?) problem
Date: 06/01/05
Keywords: no keywords
Hello all.
I have a program that freezes for no reason that I can see. I've been trying to figure this out for two days now and I think it's time to ask for help.
Here's a snippet of the code that's giving me trouble:
private ArrayList ExecuteCommand(string cmd)
{
cmd_count += 1;
string command = CMD_PREFIX + cmd;
ArrayList buffer = new ArrayList();
byte[] data = System.Text.Encoding.ASCII.GetBytes(command.ToCharArray());
string result;
try
{
nStream.Write(data,0,data.Length);
while((result = rStream.ReadLine()) != null)
{
buffer.Add(result);
}
}
catch
{
throw new CommandException(cmd);
}
return buffer;
}
Pretty straightforward, right? nStream is a network stream that operates over a TCP connection to the MS Exchange server. The whole thing works (or should) over IMAP protocol. CMD_PREFIX is just a property that creates a tag for the command. rStream is an instance of StreamReader class operating over the same connection.
The problem: The while loop freezes the program. Function calls go like this: Login() function is called that calls Connect() to establish the TCP connection. If that doesn't fail, Login() then calls ExecuteCommand and passes it the LOGIN command to be sent to the server. ExecuteCommand() sends the command in byte form and then reads the result into an array that's returned to Login.
For some reason, it goes through the above while() loop once just fine. On the second go, it gets as far as the condition and then freezes. There are no error messages, it doesn't break out of the loop, doesn't continue in the loop... it just does nothing else. LOGIN should return only one line of output, so I would expect the program to break out of the while loop, return the buffer, and be done with it.
Also, (and I'm using VS.NET to debug this) when I step into ExecuteCommand, I can no longer view the contents of local variables for some reason.
So, there's that... I've absolutely no idea what's going on, so any help would be greatly appreciated. Thanks!
Update: apparently if I wait half an hour, the Exchange server times me out, at which point breaking out of the while loop goes through and the program continues as normal... hrm. That'd mean the problem lies in ReadLine somewhere (because the server sends the timeout goodbye message over the stream and it is read fine)... *goes off to think*
Source: http://www.livejournal.com/community/csharp/30055.html
-
IE like text box
Date: 05/28/05
Keywords: no keywords
I'm looking to develop a text box that behaves like IE or (preferably) Firefox's url bar. I have a list of about 10,000 items and I want autocomplete suggestions after the user keys in the first few letters of the item. Anyone have code samples that would help?
A discussion of the most expedient way to achieve this would be nice as well.
Source: http://www.livejournal.com/community/csharp/29856.html
-
remoting function calls
Date: 05/21/05
Keywords: no keywords
Hello guys,
a quick question. I have a server application and a client application. From the client, using remoting, I am creating remote object on the server and pass him a callback function so that server can notify client when it feels like it. The signature is Callback(Hashtable ht). And this ht contains hierarchical data, meaning that one of the values in ht can be Hashtable itself. So far so good, it all works fine, until I need some values to be not Hashtable, but my own class MyHashtable, derived from the Hashtable. As soon as I make the change, client doesn't receive notifications anymore, and server fires an exception the type MyHashtable is not marked as serializable. Well, it is inherited from Hashtable that supports ISerializable interface, so it should support it too. But OK, I can imagine the approach when each derived class has to resubmit it's adherence to interfaces. So I added all Hashtable supported interfaces in the declaration of MyHashtable. Yet, the same result: MyHashtable is not marked as serializable.
So, if somebody has an idea about what's going on, please share before I start reading MSDN. I sincerely hope it's not like some [Serializable] attribute is required or something...
Source: http://www.livejournal.com/community/csharp/29520.html
-
viewing certificate services database
Date: 05/20/05
Keywords: database, asp, security, web, microsoft
Hello All!
I need to have access to certificate services database from the c# web application. Approach described in msdn lib(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/viewing_the_certificate_services_database.asp) does not seem to work. Or maybe i can't understand what the realy mean...
certadm.dll doesn't provide class implementation for IEnumCERTVIEWROW, IEnumCERTVIEWATTRIBUTE and IEnumCERTVIEWEXTENTION. Interface is an abstract entity as far as i know. (Unfortunately i don't know much...) So, how can one (as "ICertView::OpenView creates a IEnumCERTVIEWROW object") create an instance of an interface object with no corresponding class?
One version of my code looks something like this:
CERTADMINLib.IEnumCERTVIEWROW cvr;
CERTADMINLib.IEnumCERTVIEWATTRIBUTE cva;
CERTADMINLib.CCertViewClass CertView = new CERTADMINLib.CCertViewClass();
CertView.OpenConnection("pcitis31.cert.cern\\CERTSubCA");
CertView.SetTable(0);
CertView.SetResultColumnCount(-2);
cvr = CertView.OpenView();
cva = cvr.EnumCertViewAttribute(0); //-here i get COMException with 0x8000ffff code (Catastrophic failure)
Am i missing something, or am i absolutely on the wrong way?
Examples shown in msdn are quite similar(but in vb):
ex.1
' Declare the IEnumCERTVIEWROW object variable.
Dim objRow As IEnumCERTVIEWROW
' Instantiate the row object.
Set objRow = objView.OpenView
' Use the object as needed.
' When done processing, free the object.
Set objRow = Nothing
ex.2
' Initialize an IEnumCERTVIEWCOLUMN object.
Dim objCol As IEnumCERTVIEWCOLUMN
Set objCol = objRow.EnumCertViewColumn()
' Use objCol as needed.
' ...
' Free objCol when done.
Set objCol = Nothing
Any help, ideas are very much appreciated!
Thanks in advance!
Source: http://www.livejournal.com/community/csharp/29256.html
-
multithreading exit doesn't kill my threads
Date: 05/08/05
Keywords: no keywords
I'm writing an application that copies files from one place to another, and for obvious reasons, I'm using a background thread to do the actual copying. One thing I've run into is that if I exit the application while the background thread is copying a big file, the UI closes, but the background thread continues to execute. Does this mean I need to override the application.exit method to kill the background thread, or what is the best way to handle this?
Any help is appreciated!
Source: http://www.livejournal.com/community/csharp/28966.html
-
BitSet
Date: 05/04/05
Keywords: no keywords
Remember some time ago I asked for the collection that has Add() and Contains() methods and a least possible overhead? Here we are. This is a specialized collection of this kind that will work for positive integers.
public class BitSet
{
private const int BIT_COUNT = 64;
private ulong[] data;
private int count = 0;
public int Count { get { return count; } }
public int[] Values
{
get
{
int index = 0;
int[] values = new int[count];
for (int i = 0; i < data.Length * BIT_COUNT; i++)
if (Contains(i))
values[index++] = i;
return values;
}
}
public BitSet(int max_value)
{
data = new ulong[max_value / BIT_COUNT + 1];
}
public bool Contains(int value)
{
ulong bit_mask = (ulong)1 << (value % BIT_COUNT);
return bit_mask == (data[value / BIT_COUNT] & bit_mask);
}
public void Add(int value)
{
if (!Contains(value))
{
data[value / BIT_COUNT] |= (ulong)1 << (value % BIT_COUNT);
count++;
}
}
public void Remove(int value)
{
if (Contains(value))
{
data[value / BIT_COUNT] ^= (ulong)1 << (value % BIT_COUNT);
count--;
}
}
public void Clear()
{
for (int i = 0; i < data.Length; i++)
data[i] = 0;
}
}
Source: http://www.livejournal.com/community/csharp/28738.html
-
новое суперкоммьюнити
Date: 05/04/05
Keywords: no keywords
Создано новое суперкоммьюнити rabota_hitech которое будет представлять информацию
о работе ТОЛЬКО в Хайтеке.
Присоединятесь,друзья
Source: http://www.livejournal.com/community/csharp/28582.html
-
Code Coverage Tools
Date: 05/04/05
Keywords: no keywords
Just wondering if anyone's had success with any code coverage tools for .NET.
Our build process is currently using CruiseControl.NET, NAnt, and NUnit (all of which we're quite happy with), and we're looking to integrate code coverage into the works. I've looked at NCover and the other NCover, as well as clover.net.
All of the above have their pros and cons. Has anyone used any of them (or something else) on a regular basis?
Source: http://www.livejournal.com/community/csharp/28390.html
-
Hello again!
Date: 04/28/05
Keywords: database, asp, web
It's time for another round of questioning from julisana!
Alright. I'm not sure if this question would be more suited in aspdotnet, but I figured I'd ask here, anyway. I've got a web application, with an external data access layer for connecting and accessing a database. The problem I'm running into is this:
What's the best way to connect the data layer to the pages!
Also, and this is just a dumb little piddly question: Seeing how this is a web application, should the file format for my data layer be *.cs or *.aspx?
Thanks so much!
--Lisa
Source: http://www.livejournal.com/community/csharp/27967.html
-
AxoSoft OnTime defect tracker.
Date: 04/27/05
Keywords: database, sql, web, tracker
AxoSoft OnTime defect tracker
I thought I'd bring this nifty app to your attention. I'll start by saying that I'm not affilated with AxoSoft, I just happened upon their site one afternoon and found that they offer their bug tracking tool free of charge for single-user installations. They basically offer a Windows client, Web client and VS.NET client and database backend to a well featured bug and new feature tracking tool. It utilises a SQL Server database, so you'll need either a version of MSDE or SQL Server Personal Edition but obviously they're availble free of charge too.
After you've installed it, you can get a product key from the site to unlock the tool(s) you've installed indefinitely. I realise that outside of a team environment lone Developers often find it unnecessary to use such a tool, but I've found it to be pretty useful since installing it. So, I suppose YMMV :)
Source: http://www.livejournal.com/community/csharp/27649.html
-
Arrays and Vectors
Date: 04/20/05
Keywords: java
Hey guys! Got another question for you.
I'm wanting to use an array in an application I'm writing, but I've got an issue. I don't know how large the array is going to be when I start out. I was thinking of using vectors (like they have in JAVA and C++) but I can't find any information regarding them in my C# books (Both by Ditel).
If you could point me in the right direction, I'd greatly appreciate it.
Thanks!
--Lisa
Source: http://www.livejournal.com/community/csharp/27266.html
-
VS.NET debugger question
Date: 04/02/05
Keywords: web
I've build a rather impressive SDK that I want to consume in my web app. I've referenced my debug bits (with the .PDB) in my web app, but when I try to step into the SDK's code, I get disassembly rather than readable source code.
My question is, how can I tell the debugger where to find the source code?
Source: http://www.livejournal.com/community/csharp/26980.html
-
Hey
Date: 04/01/05
Keywords: asp, web
Hey everybody. I'm a little new to the C# development, but I'm trying to muddle my way through it for a project I was asked to create (online exams that submit to the instructor via e-mail).
So I was wondering...
I'm trying to use the System.Web.Mail
namespace to creat the message that will be submitted, but I've run into a bit of a snag. I'm wondering if it's possible to use this, if the SMTP server is not going to be the same for each person who takes the test.
Again, I'm quite new to C# and I ask that you go easy on me. ^_^
Cheers!
--Lisa
X-posted to aspdotnet
Source: http://www.livejournal.com/community/csharp/26652.html
-
user groups
Date: 03/18/05
Keywords: no keywords
Anyone here in an Atlanta C# User group?
Or anyone have info about past topics from one near them?
Source: http://www.livejournal.com/community/csharp/26299.html
-
fast set
Date: 02/21/05
Keywords: no keywords
I need a collection with the following properties: O(1) bool Contains(object), O(1) Add(object). Well, I can live with O(logN) Add(object) if there is no O(1). Does framework provide anything like it? (I guess I could use Hashtable with my object as a key, but I'd prefer smth more lightweight). Thanks.
Source: http://www.livejournal.com/community/csharp/25826.html
-
MD2 Model Loader
Date: 02/20/05
Keywords: no keywords
Hi, does anyone know of any good tutorials for loading and rendering MD2 models using C# and OpenGL?
I have a working C++ version, but I'm having a hard time converting it...
Source: http://www.livejournal.com/community/csharp/25429.html
-
Encryption ideas requested.
Date: 02/06/05
Keywords: security, google
Hey folks, I've recently popped into the community, as I've been rather yearning a place where I can talk to anyone else who develops in .NET (C# specifically, but I've gotten less picky, as I know about ONE person besides me who codes in .NET) so I can bounce some of my more interesting questions off them. So yeah, thanks for being here. ;)
Anyways, I'm developing an application that can be best described as a file mirroring program: a file is synchronized between two computers when a change is made on one of them. For example, a Quicken file kept on both a laptop that travels heavily and a workstation or home PC, so when a change is made to the Quicken file, it's mirrored to the other PC. I've written my own file transfer protocol with MD5 verification (works fantastic in LAN testing so far) and most of the UI design and implementation is completed.
However, the problem I now hit comes with dealing with encryption. Because of the potentially sensitive nature of data being sent, I'm conscious of the reality that the data could be intercepted, and I feel an encrypted stream option or mandate is pretty much a requirement for this program. This is where I haven't sufficient exposure, though. Going through the MSDN library and many, many Google searches and newsgroups, it seems to me that using RSA encryption for the local components (e.g. configuration file encryption) is the best, as I can store the keys in a CspContainer so they persist and are at least better secured than if I were to try storing them myself. The bigger problem comes up when I try to come up with a reasonable solution for encrypting the TCP stream itself between two clients. So far, it would seem that Rijndael or DES are more suited for these tasks, but how am I going to reasonable get the Key and IV between the two systems?
So far, my best solution to this is the following:
- Add in another command to the server to allow a client to request the server's public RSA key.
- Create a thumbprint file that has the generated Rjindael or DES Key and IV as well as the needed information about the file to be synced, and encrypt it using the provided public key.
- Have the thumbprint sent to the remote system, either by simply transferring the file via TCP (easiest) or having it placed on a floppy or flash drive and physically moved (safest).
I think this is the best idea in terms of both security and usability. What I am asking you folks is two things: 1) do you feel this is a good solution as designed here, and 2) do you have an alternate solution for my scenario that may work better?
As a bonus question, I'm curious to hear stories about how any of you have implemented encryption systems in the past.
Thanks for your help, folks!
Source: http://www.livejournal.com/community/csharp/25039.html
-
Introduction and what I'm working on
Date: 02/02/05
Keywords: no keywords
Hi all. I am new to C# (started working on it full time in August) but I think I'm picking it up pretty quickly. I thought I would join this group because I think I can learn from you and you from me.
I am trying to come up with a good way to do the following:
I have this problem. I was really disorganized with my digital pictures. I have thousands of them. Many of them are probably duplicates.
So I wrote a program that would tell me 1) how many pictures I have 2) how many are duplicate.
Right now, just to test, I have a test set of 4 pictures. I know that 2 are duplicate of each other but with different names
I wrote some quick code that would discover the pictures and get an MD5 of them just to see what differences I might have.
The problem is, I've threaded it poorly someplace, because my IComparable.CompareTo sometimes shows that there is one duplicate, sometimes 4, and sometimes 0.
Anyone interested in helping me see where I've gone wrong?
Source: http://www.livejournal.com/community/csharp/23875.html
-
Exchange Server via .NET?
Date: 01/31/05
Keywords: web
(x-posted).
Hi all,
I'm new here and in a bit of a time crunch, so forgive me for not searching all the archives yet, but I'm hoping somebody can help me.
I'm looking for info on how to talk to Exchange Servers with .NET. Specifically, I'd like to get things like the Calendar out of Exchange for my users, via .NET so I can post that info on a website on a different server. If anyone can point me in the direction of good documentation or (better yet) sample code for these sorts of things, I'd really appreciate it.
Thanks in advance.
Nolan
Source: http://www.livejournal.com/community/csharp/23635.html
-
a little smile for the fellow developers out there
Date: 01/25/05
Keywords: no keywords
HI everyone,
I was trying to build an antenna in C++. I don't know where to start. can anyone help me?? if there is some code that would be even better. I don't care about the type of antenna as long as it communicates.
THanks
Shastri
Source: http://www.livejournal.com/community/csharp/23549.html