Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Fiend
Dec 2, 2001

mr brown posted:

Victor makes an excellent point here, I neglected to read the stacktrace.

Googling some for "GetServerVariable NullReferenceException" yields these two threads in which someone runs "aspnet_regiis -i" which fixes the problem for them.

I'm really, really surprised your code was able to get that far without ASPNET being properly registered with IIS, but I suppose stranger things have happened. Reflector shows that ISAPIWorkerRequestInProc.GetServerVariable does a lot with looking up what appear to be internal IIS/ASPNET environment variables.
Holy tits! I think I set up that problem machine in a different order than the working machine. That fixed the issue. Thanks everyone :)

Adbot
ADBOT LOVES YOU

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

Boogeyman posted:

Here's how I usually do it. It might not be the most efficient way (I've never messed with anything else), but it works.

code:
' If you want to loop through nodes, do it like this...
' Note:  this is if you have multiple LoanName nodes under Application.
For Each currentNode As XmlNode In rootNode.SelectNodes("LoanName")
  Debug.WriteLine("LoanName text:  " & currentNode.InnerText)
Next
Hopefully that helps a bit. Maybe some other people will chime in if there are better ways of doing this type of thing.

After more testing, I came to realize that this code doesn't do what I thought it would do. I thought it would iterate through each node and treat it as a seperate element, but it instead goes through each node and concatenates the InnerText strings into one big string, then returns that.

So, my question is, how could I iterate through child nodes, grab the InnerText of each one, then put each InnerText of a node in an ArrayList? For example, say this is my XML file:

code:
<Ball>
   <Sack>
      <BallSack>butts lol</BallSack>
      <BallSack>nuts lol</BallSack>
      <BallSack>cuts lol</BallSack>
      <BallSack>huts lol</BallSack>
   </Sack>
</Ball>
I thought I could modify the code Boogeyman posted to add the InnerText strings to an ArrayList...but I was wrong :(. I know there has to be some ridiculously easy solution that I'm overlooking, but I've been pulling my hair over the MSDN docs trying to find something straightforward.

Thanks as always.

Boogeyman
Sep 29, 2004

Boo, motherfucker.

pliable posted:

After more testing, I came to realize that this code doesn't do what I thought it would do. I thought it would iterate through each node and treat it as a seperate element, but it instead goes through each node and concatenates the InnerText strings into one big string, then returns that.

So, my question is, how could I iterate through child nodes, grab the InnerText of each one, then put each InnerText of a node in an ArrayList? For example, say this is my XML file:

code:
<Ball>
   <Sack>
      <BallSack>butts lol</BallSack>
      <BallSack>nuts lol</BallSack>
      <BallSack>cuts lol</BallSack>
      <BallSack>huts lol</BallSack>
   </Sack>
</Ball>
I thought I could modify the code Boogeyman posted to add the InnerText strings to an ArrayList...but I was wrong :(. I know there has to be some ridiculously easy solution that I'm overlooking, but I've been pulling my hair over the MSDN docs trying to find something straightforward.

Thanks as always.

Piece of cake! This should do it...

code:
Dim valueList As New ArrayList

Dim doc As New XmlDocument

doc.Load("c:\whatever\yourfile.xml")

For Each currentNode As XmlNode In doc.DocumentElement("Sack").SelectNodes("BallSack")
  valueList.Add(currentNode.InnerText)
Next

Dromio
Oct 16, 2002
Sleeper

Jethro posted:

It seems to me that Victor's idea of using a constructor is the best idea. If you just wanted a ChildClass object to always know what it's a member of, then what happens if you make a ChildClass object that isn't a member of anything? And if you would never, ever, ever do that, then why would you ever want to access the Parent through the Child when you'll always have the Parent sitting around?

I'm already using a constructor, and it works fine but is a bit tedious. There's also the issue with the System.Runtime.Serialiazation engine not calling the constructor when deserializing (I'm still amazed it can do this).

I want the Child itself to have access to the properties of the Parent. So when a Step returns a bit of text, it can know the overall context of the document it's a part of and use that in it's logic. If the child doesn't actually belong to a parent, then I can deal with nulls just fine.

I guess I'm just way off base. When I get the puzzled looks (or in this case replies) to a question like this, it's usually a good indicator I'm doing something wrong and there's a simpler/better way to accomplish my goals.

Fiend
Dec 2, 2001

pliable posted:

After more testing, I came to realize that this code doesn't do what I thought it would do. I thought it would iterate through each node and treat it as a seperate element, but it instead goes through each node and concatenates the InnerText strings into one big string, then returns that.

So, my question is, how could I iterate through child nodes, grab the InnerText of each one, then put each InnerText of a node in an ArrayList? For example, say this is my XML file:

code:
<Ball>
   <Sack>
      <BallSack>butts lol</BallSack>
      <BallSack>nuts lol</BallSack>
      <BallSack>cuts lol</BallSack>
      <BallSack>huts lol</BallSack>
   </Sack>
</Ball>
I thought I could modify the code Boogeyman posted to add the InnerText strings to an ArrayList...but I was wrong :(. I know there has to be some ridiculously easy solution that I'm overlooking, but I've been pulling my hair over the MSDN docs trying to find something straightforward.

Thanks as always.

code:
XmlDocument xmlWhat = new XmlDocument();
string sXml = "<Ball><Sack><BallSack>butts lol</BallSack><BallSack>nuts lol</BallSack><BallSack>cuts lol</BallSack><BallSack>huts lol</BallSack></Sack></Ball>";
xmlWhat.LoadXml(sXml);
XmlNodeList xnl = xmlWhat.SelectNodes("Ball/Sack/BallSack");
string[] arr = new string[xnl.Count];
for (int i = 0; i < xnl.Count; i++)
{
	arr[i] = xnl[i].InnerText;
}
for (int i = 0; i < arr.Length; i++)
{
	Console.WriteLine(arr[i]);
}
Edit: When you said ArrayList you mean "ArrayList" and not "Array" :o
code:
XmlDocument xmlWhat = new XmlDocument();
string sXml = "<Ball><Sack><BallSack>butts lol</BallSack><BallSack>nuts lol</BallSack><BallSack>cuts lol</BallSack><BallSack>huts lol</BallSack></Sack></Ball>";
xmlWhat.LoadXml(sXml);
XmlNodeList xnl = xmlWhat.SelectNodes("Ball/Sack/BallSack");
ArrayList arr = new ArrayList(xnl.Count);
for (int i = 0; i < xnl.Count; i++)
{
	arr.Add(xnl[i].InnerText);
}
for (int i = 0; i < arr.Count; i++)
{
	Console.WriteLine(arr[i].ToString());
}

Fiend fucked around with this message at 20:19 on Jan 19, 2007

Dromio
Oct 16, 2002
Sleeper
ArrayList is easier than that.

code:
            XmlDocument xmlWhat = new XmlDocument();
            xmlWhat.LoadXml("<Ball><Sack><BallSack>butts lol</BallSack><BallSack>nuts lol</BallSack>" + 
                 "<BallSack>cuts lol</BallSack><BallSack>huts lol</BallSack></Sack></Ball>");
            XmlNodeList SackNodes = xmlWhat.SelectNodes("Ball/Sack/BallSack");
            System.Collections.ArrayList ListofBallSacks = new System.Collections.ArrayList();
            foreach(XmlNode MyBallSack in SackNodes)
            {
                ListofBallSacks.Add(MyBallSack.InnerText);
            }
            foreach(string S in ListofBallSacks)
            {
                Console.WriteLine(S);
            }

SLOSifl
Aug 10, 2002


fankey posted:

What's a good technique to inspect/interact with the Garbage Collector so I can make sure I don't have any dangling references hanging out there. I've looked at System.GC and there doesn't appear to be a way to list the objects that are ready for collection. At certain points in my code I should be 'releasing' all references to particular objects - I'd just like to verify that it's actually happened.

Commercial tools are fine if they work well.
I use this:

http://memprofiler.com/

You still have to have a pretty good idea where to look, and you should always know when to use a using statement or other Dispose/cleanup construct. I had to change the entire messaging core of my program to use WeakReferences at one point, because there was no reliable way to determine an object's scope at design time. So sometimes the solution isn't obvious.

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

Boogeyman posted:

Piece of cake! This should do it...

That didn't work, since DocumentElement is a property :(. Is it a method in Visual Basic? I'm not very familiar with VB, so.

Dromio posted:

ArrayList is easier than that.

Booyah, loving perfect. I love you guys :).

EDIT: Ah ballhair, one more question...

If no inner text was present (ex: <BallSack></BallSack>), and currentNode.InnerText was called...what in the gently caress does it return? I tried doing an if statement to test and see if it was and empty string or null, and it's apparently none of them.

I'm confused :psyduck:.

EDIT 2: Ah wait, I have to call ToString() on the ArrayList to properly test. :doh:

poopiehead posted:

It should be an empty string.

<3

pliable fucked around with this message at 21:28 on Jan 19, 2007

poopiehead
Oct 6, 2004

pliable posted:

That didn't work, since DocumentElement is a property :(. Is it a method in Visual Basic? I'm not very familiar with VB, so.


Booyah, loving perfect. I love you guys :).

EDIT: Ah ballhair, one more question...

If no inner text was present (ex: <BallSack></BallSack>), and currentNode.InnerText was called...what in the gently caress does it return? I tried doing an if statement to test and see if it was and empty string or null, and it's apparently none of them.

I'm confused :psyduck:.

It should be an empty string.

code:
using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication12
{
	class Program
	{
		static void Main(string[] args)
		{

			string xml = @"<Ball>
   <Sack>
      <BallSack></BallSack>
      <BallSack>nuts lol</BallSack>
   </Sack>
</Ball>";

			System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
			doc.InnerXml = xml;

			foreach (System.Xml.XmlNode node in doc.SelectNodes("//BallSack"))
			{
				Console.WriteLine(node.InnerText.Length);
				Console.WriteLine(node.InnerText.Equals(string.Empty));
				Console.WriteLine(node.InnerText.Equals(""));
			}

			Console.Read();
		}
	}
}
output:
code:
0
True
True
8 
False
False

Victor
Jun 18, 2004

Dromio posted:

I'm already using a constructor, and it works fine but is a bit tedious. There's also the issue with the System.Runtime.Serialiazation engine not calling the constructor when deserializing (I'm still amazed it can do this).
What you're trying to do, minus the serialization part, is pretty common. It may not be perfectly OO (some would say exposing references of any type isn't OO), but who says that pure OO is the best way to do things anyways?

That being said, I don't think MS has included any serialization code that understands parent properties -- I think you'll have to do that on your own. Don't take this comment as official, as I have not dug into serialization much. As you've discovered, doing it right when the data structure is anything beyond simple can be a pain. It'd be nice to see a site where these different patterns are codified and tradeoffs explained. It's on my todo list...

Boogeyman
Sep 29, 2004

Boo, motherfucker.

pliable posted:

That didn't work, since DocumentElement is a property :(. Is it a method in Visual Basic? I'm not very familiar with VB, so.

Well, poo poo...guess that's what I get for posting code without testing it first. It's a property in Visual Basic, and I'm not sure why it didn't work. Not that it matters, you got a working answer from Dromio. :)

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

Dromio posted:

I'm already using a constructor, and it works fine but is a bit tedious. There's also the issue with the System.Runtime.Serialiazation engine not calling the constructor when deserializing (I'm still amazed it can do this).

I want the Child itself to have access to the properties of the Parent. So when a Step returns a bit of text, it can know the overall context of the document it's a part of and use that in it's logic. If the child doesn't actually belong to a parent, then I can deal with nulls just fine.

I guess I'm just way off base. When I get the puzzled looks (or in this case replies) to a question like this, it's usually a good indicator I'm doing something wrong and there's a simpler/better way to accomplish my goals.
Hmm. I don't know poo poo about serialization, so if I'm saying poo poo you already know, or if what I'm saying makes no sense whatsoever, just ignore me.

It would seem that the best way to do it is to not even think about the _ParentStep member when you're (de)serializing the StepTextCollection, or whatever. When you deserialize the Step, do something like
code:
this.StepTexts = info.GetValue("StepTexts",StepTextsCollection);
this.StepTexts.Step(this); //does this even make sense?

pqweriou
Aug 21, 2006
hey guys, question about deploying a web service project...

whats the proper way to do this? right now, whenever I have updates and need to redeploy. I am copying over the project folder (say the webservice is 'service') directly over the previous one. But when I access the service it always seems to load the previous version until after some amount of time, when it will start to load the new one.

There seems to be some caching going on but I don't know how to flush it to force it to load the new version or even if this is the correct procedure for deploying a webservice.

I'm developing this in VS2005 for asp.net 2.0

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
Have you tried doing an iisreset on the server?

pqweriou
Aug 21, 2006

Jethro posted:

Have you tried doing an iisreset on the server?

I haven't, but this is a production server so hopefully there is a better solution.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
I'll admit I don't know a ton about webservices, but I'm going to bet that iisreset and "wait some indeterminate amount of time" are going to be your main two options.

On the plus side, iisreset doesn't take too long, so if you can find a low-usage time you shouldn't break too much poo poo.

wwb
Aug 17, 2004

pqweriou posted:

hey guys, question about deploying a web service project...

whats the proper way to do this? right now, whenever I have updates and need to redeploy. I am copying over the project folder (say the webservice is 'service') directly over the previous one. But when I access the service it always seems to load the previous version until after some amount of time, when it will start to load the new one.

There seems to be some caching going on but I don't know how to flush it to force it to load the new version or even if this is the correct procedure for deploying a webservice.

I'm developing this in VS2005 for asp.net 2.0

ASP.NET is very, very smart. It keeps serving old requests using the previous versions of the dlls until it can clear them out, then will unload the app domain and load the new stuff.

As for deployment:

1) Do not deploy project files. You should be deploying outputs only. Easy way to get there is to use the Deployment wizard in VS 2005 to deploy the site to a local folder.

2) Depending on how much access you have to the server, a valid tactic might be to create a new folder for the service, then point the virtual site/directory there.

3) Another option would be to put the service in its own app pool, then recycle that when you redeployed, forcing it to reload the server.

I would also advise communicating to clients about downtime.


PS:

quote:

I'm already using a constructor, and it works fine but is a bit tedious. There's also the issue with the System.Runtime.Serialiazation engine not calling the constructor when deserializing (I'm still amazed it can do this).

Don't be so amazed. It's called reflection and it is pretty drat powerful.

Fiend
Dec 2, 2001
I have another issue. On another machine, with the same configuration, after IIS is installed and ASP.NET is reregistered with aspnet_regiis -i, I experience this fuckery:

code:
The XML page cannot be displayed 
Cannot view XML input using XSL style sheet. Please correct 
the error and then click the Refresh button, or try again later. 


--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 
'http://gibson/'. Line 1, Position 2 

<%@ Register TagPrefix="uc1" TagName="what" Src="_what/leet.ascx" %>
_^
For some reason it's trying to display an ASPX as an Xml file. How I fix?

EDIT: Already uninstalled and reinstalled with aspnet_regiis

Fiend fucked around with this message at 02:10 on Jan 20, 2007

pliable
Sep 26, 2003

this is what u get for "180 x 180 avatars"

this is what u fucking get u bithc
Fun Shoe

Boogeyman posted:

Well, poo poo...guess that's what I get for posting code without testing it first. It's a property in Visual Basic, and I'm not sure why it didn't work. Not that it matters, you got a working answer from Dromio. :)

Yeah, it's all good in the hood. I appreciate you trying anyways :).

Now I just need to hope that my boss won't care too much that my website is a week late...:(.

mr brown
Feb 26, 2003
Mr. Brown? That sounds too much like Mr. Shit.

fankey posted:

What's a good technique to inspect/interact with the Garbage Collector so I can make sure I don't have any dangling references hanging out there. I've looked at System.GC and there doesn't appear to be a way to list the objects that are ready for collection. At certain points in my code I should be 'releasing' all references to particular objects - I'd just like to verify that it's actually happened.

Commercial tools are fine if they work well.

Windbg is really good and packed with functionality, but has a pretty sharp learning curve. This MSDN blog does a pretty great job at explaining how to use it with ASP.NET (or .NET in general, really); the author is a MS employee in Product Support Services.

goose on fire
Jun 9, 2004

Ho! Ho! Ho! To the bottle I go, to heal my heart and drown my woe.
Basically, I'm struggling to get properties to show up in the Properties window. From the docs I've read, it should happen by default. And I quote

quote:

By default, all public control properties implemented with an explicit pair of get/set accessors show up in the Visual Studio .NET Properties window.

Did something change in VS2005? Am I missing something completely obvious? Should I go back to the boatyard and ask for my old job grinding fiberglass back?

I made pictures rather than trying to explain what's going on because it seemed easier.

1) I create a property like so


2) I look at the class diagram. Looks okay to me. (click for readability)


3) Why is the "Testing" category and the "ChannelCount" property not appearing in the properties window? (again, clicky)


edit: I don't need to supply a custom UITypeEditor for the basic value types like int, do I?

goose on fire fucked around with this message at 03:00 on Jan 20, 2007

csammis
Aug 26, 2003

Mental Institution

goose on fire posted:

Basically, I'm struggling to get properties to show up in the Properties window.

Don't hate me for asking, but have you recompiled the UserControl?

quote:

edit: I don't need to supply a custom UITypeEditor for the basic value types like int, do I?

Not unless VS2005 is actually stupider than VS2003, and I just don't think that's possible :psyduck:

goose on fire
Jun 9, 2004

Ho! Ho! Ho! To the bottle I go, to heal my heart and drown my woe.

csammis posted:

Don't hate me for asking, but have you recompiled the UserControl?
Sir, yes sir. I think I found my own answer:

goose on fire posted:

Am I missing something completely obvious?
Yes you are, nub. Did you really expect instance-specific properties to show up while you're designing the control istelf?

As soon as you switch to a form and drag that control onto it (from the Toolbox where it magically appeared), the properties for that instance will show up in the properties window.

(I hate it when I spend two hours on something like that. It didn't click until I switched over to designing the form and saw the control in the toolbox. Argh.)

JediGandalf
Sep 3, 2004

I have just the top prospect YOU are looking for. Whaddya say, boss? What will it take for ME to get YOU to give up your outfielders?
I'm learning how to do asynchronous sockets in C#. I'm worried about memory usage. I look at taskmgr to see how memory is being used and it seems to go up more than it goes down :(. Here is how I'm receiving data from the socket. Is this way good enough or can it be improved to be more memory conscious?
code:
private Socket _recvSocket;
private byte[] _recvBuffer;
private StringBuilder _sb = new StringBuilder();
private void ReceiveCallback(IAsyncResult iar)
{
    _recvSocket = (Socket)iar.AsyncState;
    try
    {
        int bytes = _recvSocket.EndReceive(iar);

        if (bytes > 0)
        {
            _sb.Append(Encoding.ASCII.GetString(_recvBuffer,0,bytes));
            string input=_sb.ToString();
            if (input.Contains("\n"))
            {
                Console.WriteLine(string.Format("Client: {0}",_sb.ToString()));
                _sb.Remove(0,_sb.Length);
            }
            Array.Clear(_recvBuffer, 0, _recvBuffer.Length);
            _recvSocket.BeginReceive(_recvBuffer, 0, _recvBuffer.Length,
                SocketFlags.None, new AsyncCallback(ReceiveCallback), _recvSocket);
        }
        else
        {
            if (_recvBuffer.Length > 0)
                Console.WriteLine("Client disconnected.");
            _recvSocket.Shutdown(SocketShutdown.Both);
            _recvSocket.Close();
        }
    }
    catch (SocketException se)
    {
        Console.WriteLine(string.Format("Socket error {0}: {1}", se.ErrorCode, se.Message));
    }
}

csammis
Aug 26, 2003

Mental Institution

JediGandalf posted:

I'm learning how to do asynchronous sockets in C#.

Looks fine to me, except you don't have to pass _recvsocket as the AsyncState since it's already a private member variable.

One thing I do to save an allocation in this scenario is to use only one AsyncCallback instead of declaring a new one each time you read from the socket:

code:
private AsyncCallback _callback = null;

ctor
{
  _callback = new AsyncCallback(ReceiveCallback);
}

...

_sock.BeginReceive(, , , _callback, );

theJustin
Aug 12, 2005
This thread is pretty much way, way over my head as far as programming goes but I have a question that is slightly .NET related. I've been teaching myself C++ for about a year now, just recently moving from writing console programs to actual Windows programs using the Win32 API(not MFC) in XP. From what I understand the .NET framework seems to be the greatest thing ever invented as far as Windows development goes, and I assume Vista was built to support .NET first and foremost.

My question is, does Vista use the same API as Windows XP? If I were to install Vista, fire up the new Visual Studio C++, create a project and call Win32 functions (minor differences aside I assume) like I was kickin' it in XP, would it compile and run pretty much the same way?

I hope that isn't to vauge. I've googled the hell out of google trying to find a decent answer and I haven't found anything I understand. Hopefully one of you can put it into words I can.

ljw1004
Jan 18, 2005

rum

theJustin posted:

My question is, does Vista use the same API as Windows XP? If I were to install Vista, fire up the new Visual Studio C++, create a project and call Win32 functions (minor differences aside I assume) like I was kickin' it in XP, would it compile and run pretty much the same way?

Yes it would.

JediGandalf
Sep 3, 2004

I have just the top prospect YOU are looking for. Whaddya say, boss? What will it take for ME to get YOU to give up your outfielders?

theJustin posted:

This thread is pretty much way, way over my head as far as programming goes but I have a question that is slightly .NET related. I've been teaching myself C++ for about a year now, just recently moving from writing console programs to actual Windows programs using the Win32 API(not MFC) in XP. From what I understand the .NET framework seems to be the greatest thing ever invented as far as Windows development goes, and I assume Vista was built to support .NET first and foremost.

My question is, does Vista use the same API as Windows XP? If I were to install Vista, fire up the new Visual Studio C++, create a project and call Win32 functions (minor differences aside I assume) like I was kickin' it in XP, would it compile and run pretty much the same way?

I hope that isn't to vauge. I've googled the hell out of google trying to find a decent answer and I haven't found anything I understand. Hopefully one of you can put it into words I can.
Microsoft is not going to abandon it's Win32 API for a while. There are tons of reasons to keep the API. They are putting emphasis on .NET (C#) though.

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!
Book Question:

I'm sure this has been asked before, but it's kinda difficult to search for c#, being two characters and all.

I'm looking for a good C#/.NET book, or other resource. Pretty much all of my programming would be for use with my company's SharePoint server. As far as my programming experience goes:
  • I have a little bit of C experience, so I'm at least a little bit comfortable with C/C++ syntax
  • I do plenty of .bat scripting; I have a little bit of perl
  • I used to do a lot of mIRC scripting
  • I took Pascal way back in high school
  • I sometimes hack away at PHP
I don't really have much experience in the way of OOP, though I kinda have a basic idea of the concepts behind it. Encapsulation makes at least a little sense to me. Inheritence and polymorphism less so: I kinda know what they are, but I don't totally understand when and why you use them.

So, as I mentioned before, I was looking for a book. Does anyone have any experience with Learning C# 2005: Get Started with C# 2.0 and .NET Programming? Would my lack of OOP knowledge make this a good book for me, or would people suggest just diving right in to Programming C#, or is there a better book that you would suggest?

poopiehead
Oct 6, 2004

Jethro posted:

Book Question:

I'm sure this has been asked before, but it's kinda difficult to search for c#, being two characters and all.

I'm looking for a good C#/.NET book, or other resource. Pretty much all of my programming would be for use with my company's SharePoint server. As far as my programming experience goes:
  • I have a little bit of C experience, so I'm at least a little bit comfortable with C/C++ syntax
  • I do plenty of .bat scripting; I have a little bit of perl
  • I used to do a lot of mIRC scripting
  • I took Pascal way back in high school
  • I sometimes hack away at PHP
I don't really have much experience in the way of OOP, though I kinda have a basic idea of the concepts behind it. Encapsulation makes at least a little sense to me. Inheritence and polymorphism less so: I kinda know what they are, but I don't totally understand when and why you use them.

So, as I mentioned before, I was looking for a book. Does anyone have any experience with Learning C# 2005: Get Started with C# 2.0 and .NET Programming? Would my lack of OOP knowledge make this a good book for me, or would people suggest just diving right in to Programming C#, or is there a better book that you would suggest?



Progamming C# might be a bit tough with no OO experience. I've heard good things about(but have not read myself) Learning C# for less OOP experienced people.

poopiehead fucked around with this message at 20:19 on Jan 22, 2007

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

poopiehead posted:

I've heard good things about(but have not read myself) Learning C# for less OOP experience people.
Well, if it's good enough for people, it's good enough for me.

biznatchio
Mar 31, 2001


Buglord

Goonamatic posted:

Any know of an open source bittorrent client written in c#?

http://www.monotorrent.com/

It's kinda a satellite project of the Mono Project, so it's well-supported.

fankey
Aug 31, 2001

mr brown posted:

Windbg is really good and packed with functionality, but has a pretty sharp learning curve. This MSDN blog does a pretty great job at explaining how to use it with ASP.NET (or .NET in general, really); the author is a MS employee in Product Support Services.

Thanks. That's pretty much exactly what I was looking for. I've already found a few dangling references due to unremoved events. It looks like you can use the sos.dll debug stuff either from windbg or within VS2005 - is one better than the other as far as features go?

Victor
Jun 18, 2004
For those who use MembershipProvider, ProfileProvider and IPrincipal/IIdentity: do you have preferences for where you store the different pieces of information about a user? I get that the RoleProvider should cache roles, but where, say, telephone number goes, seems a bit up in the air. I'm leaning towards storing settings in the profile and most of the single-instance (like phone number) data in the MembershipUser (which is distinct from IPrincipal, right?). Do I put authentication-related info in (an object implementing) IPrincipal instead of MembershipUser? What about IIdentity? I wish there were a succinct diagram somewhere showing what information goes where, who gets information from whom, when that happens, and how to use it. I have taken some notes; I dunno if they'd be helpful to anyone. I feel like I'm finally cracking the authentication/authorization/user info puzzle! I just need a few tips.

Goonamatic
Sep 17, 2005
cunning linguist

biznatchio posted:

http://www.monotorrent.com/

It's kinda a satellite project of the Mono Project, so it's well-supported.

Perfect thanks!

Victor
Jun 18, 2004
Paging wwb or some other experienced ASP.NET goon to the thread. (My question is two posts above.)

havelock
Jan 20, 2004

IGNORE ME
Soiled Meat

Victor posted:

Paging wwb or some other experienced ASP.NET goon to the thread. (My question is two posts above.)

I tend to treat Authentication/Authorization/UserInfo as 3 separate concerns. I let my http module or whatever handle the auth stuff and then if I need some other form of user info beyond the user name and role I look it up in Session Start or something and cache it in Session. I have an employee domain object which is hydrated from an authoritative db table with all the goodies I need in it.

Alternatively, a small subset of the info I need is sync'd with Active Directory, so I can query some of it from there.

We have a more unified auth scheme, while each of our apps needs a varying set of user info, so it makes sense not to couple them too tightly.

poopiehead
Oct 6, 2004

I'm trying to make the defaultbutton for a textbox be a linkbutton. Sounds simple enough, but not really. There seems to be a bug(or at least weird feature) in ASP .NET that makes this not possible on firefox. Looking at their JS, they try to use the defaultbutton's click() method which firefox doesn't define for anchor tags.

This script fixes it so that there is a click method.
code:
var el = document.getElementById('<%=btnSearch.ClientID %>');
if(!el.click)
el.click = eval( "function (){  " + el.href.substring(11) + "; }")
In the linkbutton, the generated code has href="java script:__do_postback(....)", so I just grab that and call it.

Is there anything wrong with this besides the fact that if MS changes their LinkButton Control, then my code might die?

wwb
Aug 17, 2004

I am with [kinda sorta] havelock. I view authorization and authentication data as something that should be separated from application data, such as detailed user info.

Adbot
ADBOT LOVES YOU

Victor
Jun 18, 2004
I'm still confused. While MembershipProvider provides a ValidateUser method, it doesn't seem MS intended it to be restricted to authorization; otherwise, why would MembershipUser not implement IPrincipal or IIdentity? Let me put this another way: does anyone here use IPrincipal, MembershipUser, and ProfileProvider, all in the same app?

Do you typically maintain a 1:1 relationship between MembershipUser/IPrincipal and your custom, non-provider-model-based user data?

If I'm understanding you guys correctly, you don't find that ASP.NET provides any natural provider-model-supported location for user info like telephone number? It appears that it *does* have support for stuff like user options in ProfileProvider, and that it is reasonable to have multiple profiles for a given MembershipUser.

  • Locked thread