all groups > c# > march 2007 > threads for thursday march 29
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
Is this easy locking of a Hashtable's element too good to be true?
Posted by Mark S. at 3/29/2007 11:25:47 PM
Much to my surprised the code below compiled and ran. I just don't know
enough about threading to know for sure if this is too good to be true.
I'm attempting to isolate the Hashtable lock to "row level", the whys aren't
important at this time. Does this code actually do what I want?
using... more >>
Marshal-by-refrence Warning.
Posted by preitymathur0422 NO[at]SPAM gmail.com at 3/29/2007 11:22:58 PM
I m working on a MDI application. Here on the parent form I had two
variables declared as
public int curUserID = 0, ViewUserID = 1;
the form is inherited by the "Form" class.
I m using these variables on all the other forms.
But this gives the warning - "Accessing a member on
'LabTest.frmS... more >>
WebResponse ContentLength=-1
Posted by nakul.reddy NO[at]SPAM gmail.com at 3/29/2007 11:04:36 PM
I'm trying to use HTTPWebRequest to POST data to a website using
multipart/form-data.
It's HTTPS, and it returns a response object with -1 ContentLength.
Any help would be appreciated!
Below is my code:
private string HTTPPost(string URI, string Parameters)
{
System... more >>
Writing to AD using LDAP/C#
Posted by Robert Iver at 3/29/2007 9:33:25 PM
Hello,
I am developing an application in C# using VS .NET 2005 that
will be accessing and updating Active Directory via LDAP. So, far I
have written the main portions, but now I am stuck on the code to
CHANGE and ADD/DELETE entries.
I'm pretty sure my problem is security relat... more >>
Are there classes for NIS, SCP, SFTP, RCP for connecting to Unix?
Posted by Pucca at 3/29/2007 6:12:01 PM
Hi, I'm using VS2005, .net 2.0 and created a stand-alone windows application.
I need to connect to Unix server on the network to read in a couple of files
from it. I also am required to provide the user with all those protocols and
FTP for user to select. I found a FTPWebRequest class for .... more >>
get name of variable as string?
Posted by Zytan at 3/29/2007 5:49:45 PM
Shot in the dark, since I know C# doesn't have macros, and thus can't
have a stringizer operator, but I know that you can get the name of
enums as strings, so maybe you can do the same with an ordinary
variable (like an int) somehow. Is it possible? int.ToString()
returns the value of the int ... more >>
Get derived class from base class (find actual exception from Exception)?
Posted by Zytan at 3/29/2007 5:16:20 PM
I deal with a bunch of exception handlers by calling a function that
writes the info to a log file. Of course, this takes in Exception, so
I can pass it any exception class. But, it'd be great if somehow I
could state what the type of the exception it was. I do know that I
cannot really make ... more >>
2 char's to 1 integer - and back.
Posted by Mantorok at 3/29/2007 4:44:31 PM
Hi
Is it possible to convert 2 char values to an integer and be able to reverse
it?
I'm sure there must be some algorithm to achive this.
Any ideas?
Thanks
Kev
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
switch(nullable type)
Posted by John Grandy at 3/29/2007 3:10:19 PM
Is it considered good practice to perform a switch operation on nullable
types ?
... more >>
How do I get the type of the elements underlying an enumerable object
Posted by Hermann Klinke at 3/29/2007 2:41:51 PM
This is what I mean: I have the an enumerable object (implements
IEnumerable => GetEnumerator() method) and I would like to find out
what types underly this enumerable object. For example, if I have the
following:
int[] numbers = new int[] {1,2,3}
I can do this:
foreach(int number in num... more >>
Windows Services Tutorial not working out................
Posted by weird0 at 3/29/2007 2:37:27 PM
On this link http://msdn2.microsoft.com/en-us/library/aa984464(VS.71).aspx,
i tried this tutorial and it lists the following steps:
Next you will add the output from the Windows Service project,
MyNewService.exe, to the setup.
To add MyNewService.exe to the setup project
1. In Solut... more >>
right after InitializeComponent(), how do I close the application?
Posted by titan.nyquist NO[at]SPAM gmail.com at 3/29/2007 12:58:23 PM
Right after InitializeComponent() is run, I do some error checking...
when an (very bad) error occurs I show it to the user and I want to
close down the application.
QUESTION: How do I close the application down? I am assuming I can
do it nearly right after InitializeComponent() is run, in t... more >>
Object null but read as empty?
Posted by PokerMan at 3/29/2007 12:20:07 PM
I have this
object o = ds.Tables[0].Rows[i].ItemArray[j];
the item read from my dataset is null. I check on the next line :
if(o!= null)
//then do something
My prob is the object o is getting passed that if statement then i crash, in
debug it shows it with a value of {}.
So wha... more >>
Repost: batch files and c#
Posted by Gaurav at 3/29/2007 11:30:00 AM
I have a simple .bat file (TESTMAIN.bat):
"C:\fo.bat" -xml "C:\07.xml" -xsl "C:\fo.xsl" "c:\output.pdf"
I call this using C#:
System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.FileName =@"c:\TESTMAIN.bat";
But I want to remove the hardcoded parameters ("C:\07.xml... more >>
"Unable to load assembly"
Posted by GMiller at 3/29/2007 11:26:41 AM
I have deployed a .NET 2 application on a customer's system. I'm
trying to use the .NET 1.1 configuration tool to load the assembly but
I always get an 'unable to load assembly" message. What is causing
this?
Thank you,
Gary
... more >>
need to init data stored in static class (use constructor? what if it fails?)
Posted by titan.nyquist NO[at]SPAM gmail.com at 3/29/2007 11:25:00 AM
I need to initialize data to be stored in a static class (for all my
code to see), but I'm lost on how to do so.
If I use the class constructor, what if it fails? I am reading it
information from files that (could potentially) not exist. If it
throws an exception, it could be thrown wherever... more >>
Array or hash table to store value/pair?
Posted by Ronald S. Cook at 3/29/2007 11:12:30 AM
In my Windows app, I want to keep track of previous "screens" visited (like
a browser does in a web app). On some screens (e.g. Employee Detail), there
would be an EmployeeID to retain to retrieve not just thayt they were on the
Employee Detail screen, but that they were looking at Jane Smith... more >>
How do I get the last generated sequence number in Oracle?
Posted by chance at 3/29/2007 9:57:45 AM
I need to write some c# code to get the last automatically generated
sequence number from an Oracle database. Can anyone provide an
example.
tia,
chance.
... more >>
How do I use DataTable.ImportRow with a DataView
Posted by Rob Dob at 3/29/2007 9:17:58 AM
Hi,
I'm trying to archive orginal records, so what I am trying to do is upon
saving the changed record also writing the orginal record version to a
different table. The problem I'm having is that the DataTable.ImportRow
does not accept a datarowview as a parameter. My code is below, can s... more >>
Signing an assembly
Posted by GMiller at 3/29/2007 8:49:55 AM
I'm trying to sign my assembly so that I can use the caspol.exe tool
to create a permissions set for it. This is my first experience
signing the assembly. In VS 2005 I went to properties->signing,
checked the "sign the assemply" box, clicked the "new" option, typed
in a name and password. Now... more >>
c# algorithms / c# puzzles
Posted by CrmNewbie at 3/29/2007 8:36:01 AM
Hi,
1) I want to hone my problem solving skills and be good at logic. How do I
achieve
this?
2) Where can I find c# puzzles or c# algorithms.
3) How do I print the values of a N X N matrix using c#.
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
How do I prin... more >>
Values of Unknown Custom Attributes
Posted by pagates at 3/29/2007 7:56:07 AM
Hello All,
I am sure that I am just overlooking something, but here's something I can't
quite get right...
I want to be able to get the value of a parameter of an unknown custom
attribute at runtime. All of the examples I have seen use casting of known
custom attributes to get these val... more >>
mouse position with respect to screen
Posted by Neeraj at 3/29/2007 7:21:30 AM
hi
I want to use ContextMenuStrip .For that i use show() method.i can
not bind it as control.ContextMenuStrip= menu; becouse its
automatically comes on right mouse down.
So i am using menu.show() .method.
this method use parameter as point which is repect to screen .
How i can get mouse pos... more >>
Run time limit for function
Posted by markon at 3/29/2007 7:10:18 AM
Hi,
I would like to run few lines of code and limit the time. If the
procedure would not be finished say in 1000ms I would like to stop
processing it.
Unfortunately I do not know where to begin to find resources how to do
it.
Thanks
--
Martin
... more >>
VS 2003 C# - threads?
Posted by Chris at 3/29/2007 7:04:02 AM
I have a win app. this a form with a button. after pressing the button a new
form is shown. when looading the form is being filled by data taken from a
database. the problem is that it takes a few seconds, so a user has to wait a
long time. i want to do something like that - when you have pres... more >>
Constant expressions' implicit conversions not performed at runtim
Posted by Axel Dahmen at 3/29/2007 6:52:09 AM
Hi,
disassembling following expression I noticed that the implicit conversion
between int and decimal appears to be performed at runtime. Why?
TIA,
Axel Dahmen
void Main()
{
decimal a=1.2m, b;
b = a + 0;
}... more >>
Get Set property - access modifier
Posted by Eran.Yasso NO[at]SPAM gmail.com at 3/29/2007 4:58:21 AM
Hi All,
this issue curious me for long time.
Any one knows why Microsoft didn't allow to different access modifier
for set and get?
To be more specific, why didn't they allow us to do it like this?
static string CSVFileName
{
public get { return _CSVFileName; }
private set { _CSV... more >>
How to get the size of managed class?
Posted by Sharon at 3/29/2007 4:52:00 AM
I need to know the size, in bytes, of System.Drawing.Color.
In general; how to get the size of managed object of class instance and of
class type?
--
Thanks
Sharon... more >>
Calling function with pointer from a C like dll into a C# program.
Posted by Calin at 3/29/2007 4:32:38 AM
I'm trying to build a wrapper but the pointer gives me a hard time.
the C code:
typedef enum
{
MANYMOUSE_EVENT_ABSMOTION = 0,
MANYMOUSE_EVENT_RELMOTION,
MANYMOUSE_EVENT_BUTTON,
MANYMOUSE_EVENT_SCROLL,
MANYMOUSE_EVENT_DISCONNECT,
MANYMOUSE_EVENT_MAX
} ManyMouseEv... more >>
Anyone understood what InnerExceptions are?
Posted by muler at 3/29/2007 4:24:17 AM
Hi all,
Why am I getting a null value to the InnerException object?
namespace InnerException
{
class D
{
public static int Divide(int i, int j)
{
if (j == 0)
throw new DivideByZeroException("Division by zero is
forbidden.");
... more >>
How to print to the Debugger output ?
Posted by Zeba at 3/29/2007 4:18:28 AM
Hi ,
>From what I remember, in Java if you give a System.Out.Println
statement for a website, the webserver will send the output the server
output window. Is there any such provision in .net where, say using my
Console.Writeline I can print to the Debugger Output ?
Thanks !
... more >>
CSharp Coding Standards
Posted by auratius NO[at]SPAM gmail.com at 3/29/2007 3:44:26 AM
http://www.auratius.co.za/CSharpCodingStandards.html
Complete CSharp Coding Standards
1. Naming Conventions and Styles
2. Coding Practices
3. Project Settings and Project Structure
4. Framework-Specific Guidelines
Naming Conventions and Styles
Use Pascal casing for type and method names... more >>
Csv Serialisation via Xml
Posted by bg_ie NO[at]SPAM yahoo.com at 3/29/2007 3:33:55 AM
Hi,
I have a comma seperated file which I use to store data, and a
simplified version of it looks like this -
TestPeriod1 , ,
,TestTime , 55
,TestAction ,
, Phase1
, Phase2
,RunTest ,
... more >>
Interaction of windows service with UI
Posted by sonali_reddy123 NO[at]SPAM yahoo.com at 3/29/2007 3:09:37 AM
Hello all,
I am trying to develop an application which will run as a windows
service.
The application should have Normal options available with service
like start, stop and pause but along with this I need an option to
show the windows application which
my service has started as a re... more >>
Error when Iterating through a bitmap data with palette
Posted by Sharon at 3/29/2007 2:56:06 AM
I'm using a Bitmap that has a palette of 256 colors (256 bytes).
I'm taking the Bitmap data by:
System.Drawing.Imaging.BitmapData refData = myBitmap.LockBits(new
Rectangle(0, 0, bmp.Width, bmp.Height),
System.Drawing.Imaging.ImageLockMode.WriteOnly, bmp.PixelFormat);
byte* buff = refData.... more >>
Raw Disk Access?
Posted by mqudsi NO[at]SPAM gmail.com at 3/29/2007 1:41:09 AM
Is there any way to get raw disk access in C#?
e.g. get the first XX bytes from drive0, partition1 starting from byte
YYY?
(something like the dd command in Unix maybe?)
If I have to use P/Invoke can anyone tell me what libraries are
needed?
Thanks.
... more >>
questioni about SqlBytes class
Posted by scottrm at 3/29/2007 1:18:05 AM
I have the following code
System.Data.SqlTypes.SqlBytes bytes = reader.GetSqlBytes(columnIndex);
MemoryStream ms = new MemoryStream(bytes.Buffer);
My question is will the Buffer property of SqlBytes reliable get all the
data from the bytes retreived from the GetSqlBytes function. It seems... more >>
stored procedure in sqlexpress
Posted by jed NO[at]SPAM auto-soft.co.za at 3/29/2007 12:48:18 AM
I have created this example in sqlexpress
ALTER PROCEDURE [dbo].[gettaxbracket]
@annualtax FLOAT
AS
BEGIN
SELECT begin1,end1,deductedamount,pecentageextra
FROM tax
WHERE @annualtax BETWEEN begin1 AND end1
END
can u please tell me how to gain access to the @annualtax parameter in
C#. ... more >>
Stepping into handler class
Posted by Zeba at 3/29/2007 12:25:11 AM
Hi guys,
This is related to one of my previous posts, but I felt I deserved a
new post.
Is there any way to debug my HttpHandler class ? From what I
understand, the handler class is compiled and it is the assembly file
( .dll file ) which is used for the handling. I have not actually/
manu... more >>
Implement a Thread Safe Circular Byte Buffer
Posted by shofu_au NO[at]SPAM yahoo.com.au at 3/29/2007 12:08:42 AM
Dear readers,
Before poorly reinventing the wheel I thought I would ask if a class
already exists.
I need to use a circular byte buffer that is thread safe.
I cannot use MSMQ, my regular choice, due to complicated reasons -
don't go there.
This must be pretty common, so any suggestions... more >>
ArrayList storing objects of only one type
Posted by bg_ie NO[at]SPAM yahoo.com at 3/29/2007 12:02:39 AM
Hi,
I currently use ArrayList to store a set of objects all of which have
the same type. The reason I use ArrayList is because it allows me Add
new items to the array. Should I be using something other than
ArrayList to serve this purpose? Its just that i have to cast my
objects each time I a... more >>
Typed DataSets in VS2005
Posted by Peter Bradley at 3/29/2007 12:00:00 AM
Hi all,
This post is sort of tangentially related to my earlier posts on
configuration files for DLLs.
Does anyone know how to create typed DataSets using VS2005's new DataSet
designer, but with the ability to configure the connection string via a
config file? The designer seems to hard... more >>
How to Set Empty String in "System.DateTime?" The nullable DateTimeType.
Posted by Sugandh Jain at 3/29/2007 12:00:00 AM
Hi,
I am using property like this..
private DateTime? _propName;
public DateTime? PropName
{
get { return _propName; }
set { _propName = value; }
}
Now, the objects of this properties parent Type are shown in a grid in our
application.
This date is populated when user does... more >>
Best way to print a paper form ?
Posted by Rodo at 3/29/2007 12:00:00 AM
Hi all,
We have a "testing report" form at work that we fill with data (typing for
now). The form has a table, other lines and a company logo. I can make a
windows form that will get the data from the user (although eventually it
will need to be read from a serial port) and generate a print... more >>
.NET and Network Interfaces
Posted by Dave at 3/29/2007 12:00:00 AM
Hi everyone,
I've got a program which sends UDP data which works perfectly on my PC but
not on my laptop. The problem experienced is that sometimes on the laptop
packets that I send just dissapear. There is no error, but they do not
appear on any of the networks I have. After some testing ... more >>
|