Jump to content
Xtreme .Net Talk

Nerseus

*Experts*
  • Posts

    2607
  • Joined

  • Last visited

Everything posted by Nerseus

  1. If you want to compile .NET code on the fly, take a look at these threads: Programmatically Compiling Using .NET Languages to make your Application Scriptable -ner
  2. 1 more for HL2.
  3. Doing a search on "tiff compression EncoderParameter" in Google turned up a number of good hits. No direct sample code to do exactly what you want, but very close (including getting the parameters needed for each mime type when using the EncoderParameter object). -ner
  4. I'd use Environment.NewLine first. If you need or want the \n I would assume the backslash needs to be doubled up: "name\\nname2" becomes: name name2 -ner
  5. I'd recommend this book or this website (with the online tutorial being the first place to look). If you really want to learn C++ (no one "MUST" learn any language) regardless of .NET or not, start with the language and get that down solid. For most learning excersizes, you'll be writing console apps. If you use Visual Studio just choose "Win32 Console Project" instead of "Console Application (.NET)". Most samples will use cout which is a lot easier to use with a Win32 console project. Keep in mind that there is a BIG leap between knowing the syntax of C++ and knowing how to use it effectively. If your plan is to "learn" C++ by reading through tutorials/books and then jump into any existing code or a large project, you're going to have a very tough time at things. Just a "heads up". -ner
  6. Maybe he wants intellisense? Just type "Me." and you'll get a list of all available members, even those in the base class (as long as they're not private of course). -ner
  7. Four things: 1. Since NameS is declared as string you don't need a CType or a ToString on it. Not important, but thought I'd mention it. 2. A better thing to do than CType would be to Replace any single quotes with double single quotes. Without that, a malicious user could send commands to your database. Something like this would help: Dim NameS As String = txtName.Text.Trim().Replace("'", "''") 3. If searchPart is just "Fax" then you can't use that in the Find method. The find method wants a pseudo-WHERE clause. A filter would look something like "Name_doc = 'fax'". Here's a code snippet: searchPart = "Name_doc ='" & NameS & "'" objRow = DataSet99.Tables("Documents").Rows.Find(searchPart) 4. If NameS and searchPart are meant to filter on the same column/value then I don't know WHY you'd do the Find. It's not going to filter any more than the SQL call. -ner
  8. The IDC is just a name into the resource file. If this is standard C++, you'd best buy a book or start reading the help files :) Or, if you're using Visual Studio .NET I'd suggest trying a .NET C++ project as it's much simpler to use. As a side note: Since you only want one checkbox checked at a time, I think you'd be better off using radio buttons. A radio button has this behavior by default (only one radio button in a group can be checked at a time). -ner
  9. You need to add the row back to the datatable. NewRow just gives a new row, but doesn't add it to the Datatable: DirectoryRow("Birthday") = txtBirthday.Text [b]DirectoryTable.Rows.Add(DirectoryRow)[/b] MySqlAdapter.InsertCommand = CreateDataAdapterInsertCommand() -ner
  10. MSDE is the free version of Microsoft's SQL Server. It is the exact same engine, but restricted to 5 users max. -ner
  11. WYSIWYG = what you see is what you get, very common... As for divil's original comment about this site being "graphically intense", I'd say that's mostly true. While the graphics are small, mostly 1k-8k, there are 84 of them (on this page). That means 84 connections back to the webserver assuming cacheing isn't working which, as divil pointed out, it probably isn't. I don't think "graphical" means just JPG and GIF images. I would guess divil meant this website is very user interactive friendly with dropdown menus, hover images, quick reply boxes, etc. Those things all take space - 100k of pure source code for a simple 1 word post (I tested). There are certainly optimizations that can be made - using a separate CSS file rather than inlined styles for example. Some of these have been brought up in private - helpful comments that we all appreciate. As for the original question: Why are there fewer people? I think someone (Bob maybe?) answered this awhile back. One factor is that it's summer and "kids" aren't in school as much, asking the questions they normally do. I would like to hope that as time goes by, the more common answers or FAQ type questions can be found easier and hence less of the common posts. With a robust search available here and being able to search Google for posts, I would hope more people find the answers they need rather than post a question that's already been answered. I don't think the original questions has much value by itself, other than for curiosity. I propose a different question: Does anyone feel like they're not getting the answers they seek? If only 10 people used these forums but all 10 always found the answer they sought, I think the forums would be a success. As it is, I see most questions getting answered and generally in a very quick response time (within a day or so). The other important question would be: Does anyone feel like they're afraid to post a question? If so, why? -nerseus
  12. The Visual Studio 2005 technical preview can sit side by side with 2003, but from my experience, the help integrated into both (not good for me). I had 2003 on first then put on 2005 and installed 2005's help. Whenever I pressed F1 in 2003, it brought up the 2005 help. I haven't tried the new VB 2005 release. I found the 2005 technical preview to be a bit buggy, but very nice in terms of features (language, Visual Studio, and more). The refactoring alone would be worth an upgrade in my mind. -ner
  13. If you need to worry about negative numbers, you'll need to use Ceiling. Here's a function I use which takes a decimal. Feel free to change it for use with double or other types. public static decimal RoundUpToWholeNumber(decimal val) { if(val<decimal.Zero) return (decimal)Math.Ceiling((double)val - 0.5); else return (decimal)Math.Floor((double)val + 0.5); } -nerseus
  14. From sin's original thread, he only asked two questions: 1. Do you hear "this type" of comment a lot (VB isn't a proper language)? 2. Any tips on how to convince management to go with VB? For #1, if you do hear comments like that, just ignore them unless you just want a pointless argument. It's not much different than any other opinionated and mostly baseless comment. The only thing you should take away from that conversation is that the person making the comment is someone who likes to spout their opinions. For #2, why convince them to go with VB? It sounds like YOU might know VB, but the contractors know Delphi (mostly). I'd say management is choosing to go with contractors, so let them do the work in whatever language they want. The question management should have is not what language to use, but one of consistency and project management. They should make sure that all the systems being build use a consistent language (hopefully) for maintenance purposes. Also, a project manager is needed to ensure that the code is "good", again for maintenance once the contractors are gone. Now if you're asking about #2 because YOU want to do some programming (in VB.NET or otherwise), then go talk to your boss and let him know! -Nerseus
  15. The #define in C++ did not carry over to C#. As far as I know, there is no equivalent. When using #define in C++, you're basically defining a "macro function" - it's only for inlining code. I guess they decided that wasn't a necessity with C#, the same way they left out the "inline" keyword for functions/methods. -ner
  16. You can do it one of two ways, both manual but one more so than the other. I assume the DataSet's have tables with the same columns already? The manual-manual method: loop through each row in your filtered DataView. Then loop through each column in your source table and copy the data elements to a NewRow created from the destination datatable. The auto-manual method: Use dataset.Copy to get a new dataset then delete the unwanted rows (use a filter that's backwards to what you have). Use MergeRows on the destination table, passing in the slimmed down copied dataset. -ner
  17. You should be able to add/retrieve a form from a hashtable. You'll need to cast it to a form when you take it out - that's the compile problem. Here's the line to change: Dim CurrentForm As frmAddItemNumber = DirectCast(MyHashTable(1), frmAddItemNumber) -ner
  18. I believe the standard behavior for "SUM" and addition is that if any column of any row is NULL, then the entire result is NULL. My guess would be that the SUM (or the addition - doesn't really matter) is returning NULL. ExecuteScaler should be able to return System.DBNull.Value, but you're casting it directly as Integer which will definitely blow. If you want 0, you could handle it a number of ways. If Oracle supports it (don't have my reference handy), try something like this: SELECT IsNull(SUM(C_POINT + C_POLYGON + C_POLYLINE + C_ANNO), 0) FROM DRAW (I added the IsNull function). If that doesn't work, look at Coalesce (or Coallesce). If all else fails, you can do this in VB with something like: cmdStat.CommandText = strStat1 Dim o As Object = cmdStat.ExecuteScalar If o = System.DBNull.Value Then Total = 0 Else Total = System.Convert.ToInt32(o) End If -ner
  19. To convert from/to arbitrary bases, use Convert: int i = 33; string binary = Convert.ToString(i, 2); string hex = Convert.ToString(i, 16); int binaryToInt = Convert.ToInt32(binary, 2); int hexToInt = Convert.ToInt32(hex, 16); Though I prefer the ToString method to convert an int to hex, when needed. I would guess that internally, the ToString method for an int is using Convert.ToString behind the scenes so it might be a bit faster. I'd go with whatever seems easier to read/understand for you. -ner
  20. Here's the simple answer (I might not be using DirectCast right): Private Function findObjectByName(ByRef formID As Form, ByVal objectName As String) As String Dim ctl As Control For Each ctl In formID.Controls If ctl.Name = objectName Then Dim t As TextBox = DirectCast(TextBox, ctl) Return t.Text End If Next Return String.Empty End Function The "better" approach might be to use Reflection to find the control by the string name, rather than the looping approach. A search of these forums should return some threads where this has been discussed. If you're going to use this looping code a lot you may want to store the control references in a hashtable so you can easily look up a control by it's name. You would fill in the hashtable with every control on the form using the name as the key. Later, you could get the control from the hashtable by name. By the way, the parameters to the function seem to have their ByVal/ByRef's backwards. There's no need to pass the form ByRef (it would allow changing what the variable pointed to - meaning, you could null out the pointer by accident). The string should probably be passed ByRef so that it doesn't have to be copied (which is what ByVal will do). Minor, minor issues - but worth noting since you're using someone else's code. -nerseus
  21. You should be able to use the Compute method: object maxDate = ds.Tables[0].Compute("MAX(colname)"); -nerseus
  22. If your endgoal is to get this as an int, I'd suggest using BitVector32 (part of System.Collections.Specialized). It's faster and easier to use, mostly. I don't know if there's a handier way of converting a BitArray into an int than the manual looping approach you mention. You might be able to use CopyTo to get the bits into a different array and then convert that array into an int, but that seems like almost as much work. -nerseus
  23. If you wanted to update all of tblQuestions at one time, then the "formula" approach would work well. Two possibilities come to mind: set the bit flag (you called it Answered) to the SUM of the answers that are from "Admin" or use a CASE... END to check the count(*). As it is, I think the best approach would be to use triggers. Or, if you frown on triggers, then in the "insert an answer" proc. If you wanted to keep it simple, you would do: * insert into tblQuestions - always default "Answered" to false. * insert into tblPosts - in the insert trigger, if the sender was "Admin" then update the tblQuestions row to true. At worse case, a second post by an admin might update the column to true when it already was true - no big deal in my book. Certainly better than having to do the subselects each time. A couple of unsolicitied pieces of advise (ignore if you want): you might want to do some reading up on naming conventions if you're going to be designing tables and columns. For example, tables are generally named singular - so tblQuestion instead of tblQuestions. Also, "Answered" to me means that there's at least one tblPosts row. Maybe the column should be something like AnsweredByAdmin or ReplyFromAdmin. -Nerseus
  24. I assume this is ASP.NET? If so, make sure you're using the right type of button. -Ner
  25. Offhand, I can't think of any reason why the ToString would ever cause a problem. Have you tried using Debug.Assert right after the line that instantiates *line, to see if it's empty string or null? -ner
×
×
  • Create New...