|
That is one the short list of classic Ajax applications. There are three ways to tackle this: 1) Use MS Ajax Extensions. Pretty much a waste if this is the only AJAX powered thing you wish to do. Otoh, you could wire this up without writing a lick of javascript and they are loving awesome if you are doing alot of random ajax powered stuff. 2) Use a lighter-weight framework (My favorite is http://www.ajaxpro.info/). And write some javascript/some handlers. 3) If this is a quick, one-off, just write your own hand-tooled ajax bits. For something like this it is pretty easy. Just a bit o JS and a http handler to serve the list based on a query string parameter.
|
# ? Jan 30, 2007 23:19 |
|
|
# ? Jun 10, 2024 09:14 |
|
JediGandalf posted:I think I might have convinced the programming department @ school to use C#/.NET. Go me! However, they don't know a lick of C#, but they were very impressed with what they saw. I did a side-by-side comparison of the same program written in MFC and in C#. They liked how C# looked less menacing than MFC and easier to maintain. It's not to hard to pick up as long as you don't do anything like threading (simple in theory sure). There are a ton of internet tutorials out there. I'd expect your java guy to pick it up faster then the c++ guys but overall if you know a base language, it's one of the easiest to pick up.
|
# ? Jan 30, 2007 23:22 |
|
DarkPaladin, surely a bit of AJAX would work? An asynchronous request could be fired when the first drop down is changed to get the contents of the second.
|
# ? Jan 30, 2007 23:26 |
|
DarkPaladin posted:It's not to hard to pick up as long as you don't do anything like threading (simple in theory sure). There are a ton of internet tutorials out there. I'd expect your java guy to pick it up faster then the c++ guys but overall if you know a base language, it's one of the easiest to pick up.
|
# ? Jan 30, 2007 23:31 |
|
Anyone have any experience with CodeSmith? http://community.codesmithtools.com/blogs/tutorials/archive/2006/02/13/nettiers.aspx I've been researching code generation tools to speed up developement. XSD seems a bit bulky for the need and does not appear to be easily modifiable. A tool that help build skeletal templates of entity objects and data access layer can be a great boon. What are your guys thoughts?
|
# ? Jan 31, 2007 05:45 |
|
Gatto posted:Anyone have any experience with CodeSmith?
|
# ? Jan 31, 2007 07:29 |
|
I have to just jump in here to say this: I love SQL CLR. I went from writing passable SQL daily to writing some really goood SQL stuff in a few minutes. I now have an entire System.IO complete filesystem written in two layers. A very powerful, "hands-on-data" SQL layer combined with a nice C# interface to complete an API. It's a bit of a pain to deploy a SQLCLR DLL though. If anyone at MS is listening - dropping 30 functions/SPs, upgrading a DLL and then ADDing is a bit annoying. I don't always have the option of deploying from my machine. But really, writing SQL stored procedures in C# has made me amazingly happy. I don't know what the performance hit is, but I can lay some complicated SQL code down *right on the data* very quickly now.
|
# ? Jan 31, 2007 08:07 |
|
I just wanted to give users of the x64 .Net a heads up. Microsoft Update was having issues installing .NET 3.0 x64 today. I expect them to be fixed by tomorrow, or at least by the time Microsoft has the next version of Windows out.
|
# ? Jan 31, 2007 08:21 |
|
Gatto posted:Anyone have any experience with CodeSmith? It rocks. I don't fully take advantage of it--I am not quite disciplined enough to get into a fully functional code generation scheme as part of the build process. But I do use it to write alot of guts of things. In any case, it paid for itself after it generated all 600 crud stored procs for one project.
|
# ? Jan 31, 2007 12:58 |
|
Gatto posted:Anyone have any experience with CodeSmith? Anyways, I wrote a code generator based on proprietary templates, with a little GUI that is a limited version of Enterprise Manager, so that I could choose which DB columns to include, which to make writable, and which should be made parameters to my SelectSql method. The table-wrapping classes expose properties for all the DB columns (not OO, I know, but the pattern has worked so far), a constructor which takes a SqlDataReader, and four TSQL generating methods: SelectSql, DeleteSql, UpdateSql, InsertSql. I can elaborate more if you would like. The above pattern has worked well so far; the strength is that I can customize the table-wrapping classes very easily; the weakness is that including more columns than originally is a bit of a pain, as I typically customize the class, making regenerating it from scratch not work very well. However, I have a feeling a bit of nifty merging action could solve that problem. I'll deal with it when it becomes an issue; most of the time, the only modifications I make are to the SelectSql method. Oh, I've had no experience with CodeSmith. I just wrote my own code generator; I'm not sure CodeSmith has the flexibility to do what I implemented. I'm getting into more code generation these days, so perhaps I should look into it.
|
# ? Jan 31, 2007 16:06 |
|
quote:I can elaborate more if you would like. The above pattern has worked well so far; the strength is that I can customize the table-wrapping classes very easily; the weakness is that including more columns than originally is a bit of a pain, as I typically customize the class, making regenerating it from scratch not work very well. However, I have a feeling a bit of nifty merging action could solve that problem. I'll deal with it when it becomes an issue; most of the time, the only modifications I make are to the SelectSql method. This is the downfall of code generation. Of course, .NET 2.0 and partial classes solves alot of this. quote:Oh, I've had no experience with CodeSmith. I just wrote my own code generator; I'm not sure CodeSmith has the flexibility to do what I implemented. I'm getting into more code generation these days, so perhaps I should look into it. CodeSmith could have done this with ease.
|
# ? Jan 31, 2007 16:38 |
|
wwb, your stating that CodeSmith allows this indicates to me that it is quite powerful, offering an API interface that basically takes care of templating for me so that I do not have to implement it myself. Instead, I can focus on the unique parts; is this the case? I'm still working on the issues that cause this "downfall" of code generation. It involves more than just technology: I would need to separate issues of pure data access and business logic; currently I put them both in the same class. Hmmm, I think a light just went off in my head: perhaps I implement a layer between the table-wrapping classes and the classes that my application code accesses. I guess this is the 3-tier architecture (which never made a ton of sense to me, partly because I wanted to derive it instead of learn it)? I don't think I need to go this route yet, due to the nature of the applications I am writing. However, I think I just made a big personal discovery (of 3-tieredness); thanks for prompting that.
|
# ? Jan 31, 2007 17:00 |
|
Yes, Codesmith is very, very sweet. Note you can try it for 30 days for free. On the whole downfall, it is alot easier to get around with 2.0 because of partial classes. Basically, you can now have a MyClass.generated.cs (made by tool) and a MyClass.user.cs both compile to the same class. It is the same thing the VS designer does (MyForm.cs; MyForm.designer.cs for the tool generated stuff). In 1.x you had to go the inherited classes route, which had some pitfalls--such as what if one wanted to inherit from a different class hierarchy. As for the three tiered bit, I tend to let it straddle some these days. The data classes have some responsibilities, principally for data integrity and such. But major processes are split off into Manager classes which control the process. I help enforce this by making a fair part of the API internal so that you need to patch through the manager to do alot of things.
|
# ? Jan 31, 2007 17:21 |
|
The partial class approach wouldn't work particularly well right now, due to how I generate my classes. Now that I think about it, a bit more abstraction might make this separation work out well. I came up with the data layer idea a while ago (frustratingly, I couldn't find the thread in the archives where I discussed it) and have used it for a while, so I have some good experience upon which to reflect. A coworker is also interested in using it; it needs to be reviewed and get some more documentation before that happens. Edit: perhaps I should talk to my boss about open-sourcing the data layer code I have now. I like to think of it as a lightweight but extremely flexible base for those who like to see and exactly what goes on behind the scenes, instead of relying on O/R M magic, ahem, algorithms. The critique would probably be worth it as well.
|
# ? Jan 31, 2007 17:42 |
|
The talk about generated code has me wondering: does anyone have expierience with tools that take objects and generate databses from them? As an example, right now I'm looking through the demo of DeveloperExpress and checking out its object to database conversion tool, which we think is a more logical solution than generating our objects to suit the database. It's also apparently able to taget 12 different popular databases, which seems like it will be great for portability. Are there significant drawbacks to this approach that I don't see?
|
# ? Jan 31, 2007 22:09 |
|
Munkeymon posted:The talk about generated code has me wondering: does anyone have expierience with tools that take objects and generate databses from them? What you're looking for is a ORM, object-relational mapper. There are a number of ORM solutions, and I would assume you have or will investigate more. article with a lot of possible pitfalls of ORM: http://www.codinghorror.com/blog/archives/000621.html post regarding the difference between object persistence and data analysis: http://jimcassidy.ca/2007/01/15/persistance-vs-analysis/ purely object oriented database possibility to look into: http://www.db4o.com edit: I just noticed db4o is linked in both articles. well, anyhow, look at it.
|
# ? Jan 31, 2007 23:01 |
|
Someone please explain to me how two byte arrays that both contain { 0x15, 0x02, 0x04 } are not equal. For reference here are some relevant code snippets: code:
Goon Matchmaker fucked around with this message at 23:25 on Jan 31, 2007 |
# ? Jan 31, 2007 23:22 |
|
Safrax posted:I'm stepping byte by byte through a file of well byte values until I find the StartDelimiter and then I do some other voodoo that isn't up there in code. I've stepped through the code and seen it compare buffer and StartDelimiter twice now and hit the continue instead of going on down and doing the other stuff. If you write a boolean function to actually compare every byte in the array, I suspect it would work as expected. It doesn't look like there's a default array comparison function.
|
# ? Jan 31, 2007 23:28 |
|
genki is correct. You can reflect into different objects to see if they are class-types and if they do not override System.Object's equals operator. This is actually something [some of those on] the C# team wish they could have done differently -- it's confusing to have == sometimes test reference equality and sometimes test value equality. Too bad we won't have a language to overcome C#'s weaknesses like it did for some of Java's weaknesses for some time. I propose the name "Z==", which would be pronounced "zequals".
|
# ? Jan 31, 2007 23:34 |
|
Thanks genki and Victor. I guess I'll just have compare the 3 values in each array by hand. Edit: Not by hand but by messy buffer[0] == DelimiterStart[0] junk. Edit: Oh hey what do you know, it works now. Goon Matchmaker fucked around with this message at 23:40 on Jan 31, 2007 |
# ? Jan 31, 2007 23:36 |
|
Victor posted:You are in luck (I hope) -- I think I was in a very similar position to you about a year ago. I had been following the practice of creating a class for every DB table I needed and using a single "Data Access Layer" (DAL) class to take care of CRUD operations and anything that involved SQL. I got tired of manually writing the table-wrapping classes, so I spent a bit of time designing a mini-DAL system. It included some base classes, one being DalConnection, which offers methods that remove the need to continually instantiate SqlCommand objects (you just call conn.ExecuteNonQuery). I create an log object for every bit of SQL executed so that if an exception occurs, I can see the SQL that caused it. I'm naughty and don't use parametrized SQL very often -- instead, I use a ToSqlString method which wraps its argument in single quotes and escapes all single quotes within the argument, or returns NULL if it were passed NULL. I know people think I'm an idiot for me, but it is quite foolproof -- the string '{0}' should never exist in the first argument to string.Format, it should always just be {0}. That way, the SQL has no chance of working when I test if I forget to call ToSqlString in the following arguments. Your idea sounds pretty good. You put a lot thought behind it but I'm wondering why you didn't just use XSD to achieve some of what you were trying to do. I know the logging part can't be achieved but the robustness of xsd should make up for that fact. What I don't think xsd is really good for is the n-tier programming model that some of us want to achieve. Separation of business objects and data layers. Did you have any problems putting all data access in one class, it seems like to me if there were sufficient number of functions things can get unorganized. Another thing I thinky our generation tool is pretty good but it doesn't generate stored procs into sql as codesmith would do. That's a nasty requirement that a code generation tool must have. I would be interested into seeing more of your model and how you structured your code. Codesmith seems to let you declare your own template files to do the generation. The template file contains structuring, syntax, and content info. So the flexibility is there, if you want to customize it to suit your code generation needs. It does look pretty promising and indeed takes some of the tedious plumbing out of your work load.
|
# ? Feb 1, 2007 09:04 |
|
Gatto, I didn't do any sort of stored procedure work, so you are probably best to go with CodeSmith. I didn't jump right into strongly typed data sets because they looked too "packaged" for my tastes. They might work well for 3-Tiered architecture, where only the data layer ever deals with the data sets, but I didn't want to go that way. My method has been working well so far, but it is pretty tightly coupled to a SQL database backend (it shouldn't be too hard to switch from MSSQL to something else). I'll see about posting a picture of the class diagram when I get into work this evening. My biggest question for you is this: what do you want your data access code to look like? For some reason, I couldn't find much of this on the web when I was designing my DB layer, but I should think it would be a fairly important trait. If I were choosing between O/RMs and two products both satisfied my requirements, I would choose the one with the better glue code. Anyways, let us know what direction you take and perhaps some insights about the experience.
|
# ? Feb 1, 2007 17:16 |
|
Just in case anyone is wrapping C++ with C++/CLR to use in C#, be warned that VS SP1 appears to break boost::threads. I have a simple network discovery library which spawns 1 boost::thread which I've wrapped up in a CLR object to use in my WPF app. After installing SP1 ( which apparently happened automatically!? ) and rebuilding both my app and boost, my program stopped working - I'd just get an error saying the image was bad. Uninstalling SP1 fixes the problem. I reported this during the beta of SP1 but apparently they never bothered to fix it. My guess is that my old workaround of using the .dll version of boost::threads would probably still fix the problem.
|
# ? Feb 1, 2007 19:00 |
|
I'm using an HtmlTextWriter control to generate output. I can get server-side controls to render, but the event that I've assigned isn't firing.code:
|
# ? Feb 1, 2007 23:47 |
|
Fiend, what are you trying to do? Where are you adding the ImageButton to the form? Why are you calling its RenderControl method, instead of letting The Page/parent control do it? Note that you will want to assign the click event handler before adding the control to its parent if you do it after Viewstate is loaded. The viewstate article I mentioned above explains in more detail.
|
# ? Feb 2, 2007 15:13 |
|
Here's an ugly one. I'm having trouble with generics and interfaces:code:
|
# ? Feb 2, 2007 21:04 |
|
Dromio posted:I want a ChildList<T> where the T has to implement the IChildObject interface, but could be anything that implents IChildObject. Is this not possible? http://msdn2.microsoft.com/en-us/library/d5x73970.aspx It's so simple it's almost confusing.
|
# ? Feb 2, 2007 21:07 |
|
Oh thank you. I was having a hell of a time searching for "generics interface inheritance".
|
# ? Feb 2, 2007 21:12 |
|
SLOSifl posted:class ChildList<T> where T : IChildObject code:
|
# ? Feb 2, 2007 21:12 |
|
Inquisitus posted:
<T> where T : whatever So at least I didn't totally give up.
|
# ? Feb 2, 2007 23:16 |
|
^^^that can be handy, but you can really, really box yourself into corners using kinda sorta generic generics, especially when combined with inheritance. Be very careful where you use where. More often than not, you probably just need a traditional object that is written to an interface definition and not something tied to a generic. Especially where interfaces are involved.
|
# ? Feb 3, 2007 01:32 |
|
If I use an sqlcommand object and add parameters, how can I make the value of a parameter null? I want to update a field to null or insert nothing (and I have a fixed amount of data, I don't want to dynamically build the command text)
|
# ? Feb 3, 2007 07:56 |
|
Nurbs posted:If I use an sqlcommand object and add parameters, how can I make the value of a parameter null? I want to update a field to null or insert nothing (and I have a fixed amount of data, I don't want to dynamically build the command text) Just add a null value. I forget the exact syntax but: code:
code:
|
# ? Feb 3, 2007 08:15 |
|
poopiehead posted:Just add a null value. I forget the exact syntax but: Thanks. edit: I do need to add parameter because I can't say insert this parameter if it isn't there? I'm getting this error: System.Data.SqlClient.SqlException was unhandled Message="Parameterized Query '(@ID uniqueidentifier,@name nvarchar(36),@organizationTypeID uni' expects parameter @description, which was not supplied." commandtext is selectStatement = "SELECT ID FROM tableOrganization WHERE name = @name AND description = @description AND websiteAddress = @websiteAddress AND organizationTypeID = @organizationTypeID"; for an executescalar operation. (I'm checking to see if it already exists) The following sets all the defaults. I have IF statements that change the values of the null parameters to data if its available. In the case of this error, these are all null. sqlCommand.Parameters.AddWithValue("@ID", mediusOrganizationID); sqlCommand.Parameters.AddWithValue("@name", emcOrganizationName); sqlCommand.Parameters.AddWithValue("@organizationTypeID", mediusOrganizationTypeID); sqlCommand.Parameters.AddWithValue("@creationDate", DateTime.Now); sqlCommand.Parameters.AddWithValue("@creationUser", CommonVariables.userName); // sqlCommand.Parameters.AddWithValue("@description", null); sqlCommand.Parameters.AddWithValue("@websiteAddress", null); sqlCommand.Parameters.AddWithValue("@bsrNumber", null); sqlCommand.Parameters.AddWithValue("@notes", null); Nurbs fucked around with this message at 08:44 on Feb 3, 2007 |
# ? Feb 3, 2007 08:23 |
|
I've been looking into getting a C# book and learning C# to get back into programming. It has been a few years since I've programmed anything and my experience back then only took me up to the Programming AP test (Computer Science AB I think). Are there any good in-depth tutorials online for a novice programmer? If not, what book would you recommend?
|
# ? Feb 3, 2007 12:56 |
|
Nurbs posted:Thanks. try adding System.DBNull.Value. (again I'm probably off a bit with the spelling/name.). sqlCommand.Parameters.AddWithValue("@notes", System.DBNull.Value);
|
# ? Feb 3, 2007 16:54 |
|
Waffle Zone posted:I've been looking into getting a C# book and learning C# to get back into programming. It has been a few years since I've programmed anything and my experience back then only took me up to the Programming AP test (Computer Science AB I think). http://www.microsoft.com/mspress/books/5028.aspx
|
# ? Feb 3, 2007 19:44 |
|
Waffle Zone posted:I've been looking into getting a C# book and learning C# to get back into programming. It has been a few years since I've programmed anything and my experience back then only took me up to the Programming AP test (Computer Science AB I think). http://www.amazon.com/Programming-C-Jesse-Liberty/dp/0596006993/sr=1-1/qid=1170549983/ref=pd_bbs_sr_1/002-8546920-4153610?ie=UTF8&s=books
|
# ? Feb 4, 2007 01:48 |
|
Inquisitus posted:This one's good: code:
SLOSifl fucked around with this message at 09:13 on Feb 4, 2007 |
# ? Feb 4, 2007 09:09 |
|
|
# ? Jun 10, 2024 09:14 |
|
I have a dialog that I basically want to stay "open" all the time - though its visibility can be toggled through an option in the "Windows" menu of my main form. The problem I'm having is that clicking the X in the control box at the top right of the dialog causes it to be closed and disposed. Is there any way to override this behaviour? I've tried overriding the OnClosing, OnClosed, OnFormClosing and OnFormClosed methods, but to no avail. I don't really want to hide the control box. edit: Never mind, found the solution myself. Had to set the Cancel property of the Closing event to true Darn Cotts fucked around with this message at 16:13 on Feb 4, 2007 |
# ? Feb 4, 2007 16:00 |