
mhildner
Avatar/Signature-
Posts
29 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by mhildner
-
Hello marble_eater, Those last two posts were excellent. I might go play with some MSIL - it'd be interesting to check this out in VB.NET and C# and see what the compilers do. Regards, Mike
-
Hello Kejpa, You know, I'm not really sure - do they both behave the same? I'm thinking it's a difference between VB.NET and C#. VB.NET seems to do more behind the scenes and you don't have to do that much manual work. If both ways work the same, you're probably saving some code doing it your way. But I'm not an expert at VB.NET and a newbie when it comes to delegates - although I have managed to get some code to work :) Mike
-
Sounds like you should be using the observer pattern. This article first discusses how to implement using interfaces, then the section titled "Observer Pattern in the .NET Framework" discusses how to achieve using events and delegates. I'd use the event/delegate way. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/observerpattern.asp Mike
-
FWIW, I've seen this error when connected to sql and you shut down the database. I imagine you'd get the same if you rip out the network cable, but I haven't tried that <s> Mike
-
FWIW, when I do this I append the data received into a StringBuilder. That way you don't create as many objects, if you're worried about that. The messages I received have a start of text and end of text markers, so I look to see if both are there and extract the stuff in between them. In your code, I'm not sure why you append the received data if it contains your marker, but pre-pend if it doesn't - but I don't know if that's a problem for you. Mike
-
Hope I understand you correctly. Do you want to have the BinaryLog listen to events in other objects?
-
Sorry, missed that part about 2.0. I was going to start a test project, but I don't even see a web app as an option in my Beta 2 ??? I usually do windows forms. I know in a windows form project I have, the InitializeComponent is in a file underneath my form, named something like "MyForm.Designer.cs". What happens when you double-click the button at design time? That should take you to the method that will execute when you click the button at run time.
-
You betcha :) Let's say your button is named "Button1". In the "Web Form Designer generated code" there's a method named "InitializeComponent". In InitializeComponent, there should be a line that looks like this.Button1.Click += new System.EventHandler(this.Button1_Click); This is saying you want to execute a method named "Button1_Click" when you click Button1. You should also have a method something like private void Button1_Click(object sender, System.EventArgs e) { } Make sure the button is wired to the right method name. If that's not enough info for you, post your code so we can check it out. Mike
-
I'm not sure if this helps, but I've had the same problem with a deployed app. Windows updates, un/re-install of both .NET and the app did not help. I compiled again and things worked fine. So I thought I just had a buggered assembly. You may want to try just copying your debug or release folder over and run by clicking the .exe. You don't need anything else, except .NET installed on the machine, or any other folders you create for help, images etc.
-
That's the general idea. Joe Mama is correct in that you're mixing up some terminology. Those methods exist in the business object, not the data access class. Our business objects usually have a few basic methods we use from a template, such as: public DataSet GetAll() public DataSet GetByPK(int primaryKey)More "get" methods are added and tweaked as needed. Note that a DataSet is returned (although it's not limited to that). Because of all the code in your base business objects and ADO.NET, you get your DataSet, change/add/delete data if you want, then call something similar to myBusinessObject.Save(). There's no need to write any of your "Set" methods. A couple posts ago you mentioned a business object method and a form method. Both those methods should reside in the business object (you might tweak 'em a bit first). As far as moving your multipled INNER JOIN etc. code, you might think about making them stored procedures or views and creating business objects from that. I was going to go on about why all this is a good idea, but this post is too long already. Adios, Mike
-
LOL. The first time I heard that I thought the same thing - why? You'll see the 16 byte rule mentioned over and over. My question is, why is that? Not that I have any evidence myself, I've never bothered to perf it out. Sometimes you hear something so many times from people that are smarter than you, you just take it for granted. Here's a better explanation, along with a disclaimer of course. Scroll down to "Data Size". Mike Edit: Allow me to point out that the above link mentions that there is a trade off between copying the bytes of a value (structure) and allocating a new reference on the heap (class). That does make sense.
-
This is a decent write up on that - http://www.developerfusion.co.uk/show/4341/7/ Two things I think are important with structures is speed - the 16 byte rule and that they're allocated on the stack, not the heap, like clases are. Mike
-
Yes. By far the best way to seperate things is through the use of business objects. Business objects usually have an associated data access class. The data access class is DB specific, but the biz object is not. Unfortunately Microsoft doesn't do much for you here. They do have a Data Access Application Block, I haven't used it as I've seen no support for biz objects. It's a free download, and I'd use it over using nothing. Although pricey (USD $700), the Mere Mortals Framework has (among other things) really well designed biz ojbects. It also ships with the source code. Mike
-
Have you tried setting the timeout for receiving? //Receive operations will timeout if not received within 1000 milliseconds. s.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 1000); Note, I haven't tried it, as I usually use asynchronous methods, but it should block for one second.
-
I'm guessing normally your query would return one row? Then you use the "Count(PresentationArchive.PubID)" column to get your number to use? You can either use the method your using, check to see that the row count = 0. If there are no rows returned, then just put a zero in there. Alternatively, if you're only interested in the count, and no other column information, you could modify your query to be something like "SELECT COUNT(... WHERE...". Then you can ExecuteScalar and just retrieve the value of COUNT.
-
The Code Project has a lot of goodies, maybe this would be of some use.
-
While it's easy enought to break up a string given a certain delimiter, my point (which may not even be applicable) is that it is difficult, if not impossible, to parse names correctly. For example, the second token within a space-delimited string is not always the last name. I agree with kejpa that one should seperate out the name parts, unless of course, you have no need to know the individual parts :p Lately I've been using the Department of Justice's Global Justice XML Data Model for name parts. This goes much further that just first name, last name, and includes name prefix, suffix etc.
-
While dynamic_sysop's reply is correct, you may run into other troubles parsing free text names. For example, if the person's name is Oscar De LaHoya, or W. C. Fields - you get the idea. I've been parsing free text names and addresses, or trying to, for years, and can say with confidence there's no fool-proof algorithm. Not sure how fancy you need to get, but our current app gives its best attempt to parse, then displays the results to the user to see if it's ok and give a chance to correct.
-
Not sure what you mean when you say it doesn't run. Do you have a timer that ticks every 15 minutes? You may want to try logging stuff to a text file to help debug.
-
x-bit just means that x is the size of the key. So 128 bit encryption uses a key that's 128 bits.
-
Can't you just fire the MyControl.GetUser() call from the button click event?
-
Parameterized queries not subject to Sql injection?
mhildner replied to mhildner's topic in Database / XML / Reporting
Cool, now that makes sense. Explanation is much appreciated, thanks PlausiblyDamp. -
Parameterized queries not subject to Sql injection?
mhildner replied to mhildner's topic in Database / XML / Reporting
Thanks for the replies. I can see via MS Sql Server's profiler tool the actual sql that gets sent to the db using paramaterized queries or not. I'm probably just ignorant, but I still don't get it. I mean, I understand Sql injection to be something like your app sends "SELECT * FROM MyTable", someone tacks on ";DROP DATABASE MASTER" or whatever. I see that paramaterized queries end up as "EXEC ...@param1...@param1='blah'" (not checking syntax here, but you get the idea). So why can't the hacker tack on a semi-colon and execute more sql? Or change the contents of your original sql? Like I said, I just don't get it.