|
We're a bit like Fight Club here and have similar rules:
http://www.urbandictionary.com/define.php?term=Rules+of+Fight+Club[^]
Of course, being programmers we're a lot more buff and better looking than those skinny, ugly guys in the film
How do you know so much about swallows? Well, you have to know these things when you're a king, you know.
modified 31-Aug-21 21:01pm.
|
|
|
|
|
Thanks mate. Nice catch. I posted this question here by mistake. I appreciate your response and I've moved the question to ASP.NET Forum.
My apologies for wasting your precious time.
|
|
|
|
|
0 - Well structured question! Well done for that!
1 - this forum is the Lounge where programming questions are not allowed.
Suggest you go to quick questions and ask this question again.
but as a really quick answer, you pass interfaces rather than objects so that you can pass any object that implements that interface - especially useful if you are unit testing, as you can pass fake objects that implement the interface.
PooperPig - Coming Soon
|
|
|
|
|
Thanks mate.I posted this question here by mistake. I appreciate your response and I've moved the question to ASP.NET Forum.
Regarding your answer, Thanks a lot for that. I got the point. I agree that was a stupid question but looking at someone else code in such a large application confused me. Thanks
|
|
|
|
|
There are no stupid questions - only stupid answers!
PooperPig - Coming Soon
|
|
|
|
|
There are many reasons for passing in an interface into a constructor. One reason is to be able to supply different implementations into the constructor, which is particularly useful when you want to unit test your code. Rather than having to pass in a concrete implementation, which might rely on things that are difficult to test, you can use a mocking tool to create a mock of the interface and pass this in. This makes it easy to do things like set up verifications.
|
|
|
|
|
Cross post.
I have already answered it in Asp.Net section.
Life is a computer program and everyone is the programmer of his own life.
|
|
|
|
|
how can i implement the custom shapes like Rectangle, Ellipse using Ink Canvas in wpf application
|
|
|
|
|
Probably by asking in the WPF forum.
|
|
|
|
|
Sir,
I have a question bank in the excel format or in the word format so by using this as a database to the c#.net(windowsbased application)i need these question want to be rise in randomly when each time login. i tried in many ways but its not working, there are only for the column wise data are in excel so its not apat for my project, can u please do me a favor.please try in windows based application not by using sql or mysql.
|
|
|
|
|
|
Hi,
I am developing HRMS .NET WinForm application using C# and DevExpress.
I want to know what's the best way practice to include reports in my application?
Should I use the RDLC, Crystal Reports or the XtraReports from DevExpress?
I want the reports to be physical files (in \Reports) and not embded within my application then I will browse it using a database table so it will be easy to add new reports whenever its required.
Thanks
Technology News @ www.JassimRahma.com
|
|
|
|
|
Jassim Rahma wrote: Should I use the RDLC, Crystal Reports or the XtraReports from DevExpress? The respective producers of each reporting tool say it is a best practice to use their suite.
Jassim Rahma wrote: I want the reports to be physical files (in \Reports) and not embded within my
application then I will browse it using a database table so it will be easy to
add new reports whenever its required. All three would support that scenario AFAIK.
I'd recommend a fourth option; exporting to HTML based on a template, since that is the simplest option that meets the requirements.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I have the code to insert data from one stock feed to a sql table.
but according to the curves, sometimes i have 3 columns and some others i got 5 columns. my problem is that i only get the 5 column data in the table.
how can i get the 3 column data in the same table?
|
|
|
|
|
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
So please, edit your question and provide better information.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Alexmarvel wrote: how can i get the 3 column data in the same table? By leaving 2 of the columns empty.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
Hi, I started converting the program last night up to 2AM (5PM here as of writing this).
I feel like I'm consuming much time in thinking and Trial and Error, I really need some help.
I bet this is easy for those who has experience in C#.
Take a look at this sample project (this project is a C# console, socket programming (telnet) ).
http://www.codeproject.com/Articles/19071/Quick-tool-A-minimalistic-Telnet-library
and then, what I need to do are the following:
1. Remove the user and password submission, since I'm going to telnet my microcontroller and
that microcontroller doesn't have such security. In the sample program above, if the ip
you are going to telnet doesn't have user and password requirement, it will return an exception.
(Actually, I have already done this, I modified the C# console sample
program, and magically it works. look at my code below)
static void Main(string[] args)
{
TelnetConnection tc = new TelnetConnection("news.thundernews.com", 23);
String prompt = "";
while (tc.IsConnected && prompt.Trim() != "exit" )
{
Console.Write(tc.Read());
2. In my windows form, I have there BUTTON1, and whenever you click that, it will CONNECT the program to the
desired ip address via TELNET. My problem is, I will consume much much time in thinking of this. I don't even
know yet how does my edited code posted above work.
3. I have too a BUTTON2, if you click this, the C# program will send a string from any controls, like textbox.
(I think, no need for this to answer. tc.WriteLine(prompt); <-- that code will send byte to the server)
4. finally, as soon as the BUTTON1 connect is clicked, the C# program will auto receive any incoming byte from the server,
and the program will put the received bytes into some controls, say.... RICH TEXT BOX.
I have tried my best to convert this C# program (which works 100%, but I really need a winform sample) to winform.
I just need a very example and I will take care of the rest of my project.
One of the things that make me go crazy is where should I put the WHILE LOOP part from C# console to C# winform?
That's all. Thank you so much in advance!
G
|
|
|
|
|
Member 10321059 wrote: where should I put the WHILE LOOP part from C# console to C# winform?
You don't.
Instead, Winforms apps rely on events to "decide to do something" instead of just "waiting for it to happen". It's a totally different execution model, and you can;t just "pick up" console based code and expect it to work as a winforms based application: the basic processing stuff my be the same (or at least similar) but the way the whole program is "hooked together" is very, very different.
For example, in a console app, you are likely to print a prompt, and wait for a user to enter a filename - and nothing else will happen until the user presses ENTER to indicate he is finished. That doesn't happen with WinForms apps: the user can type, edit, go do something else; a timer might "chip in" to make the code do something at a specific time; your Socket might signal "I got data!" and your code process it.
You can't just "convert a console app to WinForms" - you will have to think about how your console app is working, and what it is doing, and then consider how that fits into the Winforms execution model.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I'm coding for Windows Forms. The teacher has only gone over arrays so far, but likes arraylists better. Using arraylists b/c can mix types.
Out of range error from this line:
subtotal = (decimal)subList1[2] + (decimal)subList2[2] + ... (decimal)subList5[2]);
(What gets added previously is a decimal.)
If my menu item 'AddtoCart' has not filled all arraylists (i.e. 5 times) I get the error. Thinking the ones not "given" a value = -1. I don't care to use List<>, etc. as this teacher can get vy prissy.
I just want to change the values that I think are -1 to 0 so addition works. I can't pre-load anything due to how arraylists get 'loaded', obviously. I could Replace the last element: [2].
But I don't know how to loop b/c I can't use a variable such as i in the name of the arraylist itself. Been high and low online for a solution...
Thank you,
Mac
|
|
|
|
|
The out of range exception indicates that there is no element at 2 in one of your lists. Put a breakpoint on that line by pressing F9 and debug your application. Take a look at the size of each one of your lists.
|
|
|
|
|
Your teacher is an idiot. Arraylists are seriously out of date, simply because you can mix types, which means they give runtime errors instead of compile time. That means that it is more likely that a problem will get through to production than using a List<T> which insists on strong typing and doesn't need you to cast the variables.
But in this case, I'd use an array of decimal values instead of a List or ArrayList: unless you are adding items dynamically (at run time) and don't know the number of items in advance.
The error is probably because you are using "magic numbers" - the hard-coded "2" in your code - instead of using a loop to get the values.
Go back a step, and think how you would use a loop to access an array - I'm sure that your teacher has covered that - and then look at the whole of your code (not just the one line you show) and try using that method on your list.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Mac20nine wrote: But I don't know how to loop b/c I can't use a variable such as i in the name of the arraylist itself. Been high and low online for a solution...
I'm not sure what you mean with this sentence ?
if you need to check the values of each item in each list, I fail to see any reason why not using a loop.
|
|
|
|
|
What are the advantages and disadvantages of Entity Framework 4.0. What are best scenarios and cases where we should use EF 4.0. Many Experts including Martin Fowler hates ORM , what's your say on this ?
Do you prefer using Microsoft Enterprise Data Block over EF 4.0 ? There is lot of ambiguity while design your application and decide what to use while writing your DAL (data Access layer).
|
|
|
|
|
Not sure why you got downvoted so I countered it with an upvote.
I haven't used EF yet. I had some code that was partial EF and partial plain ADO.Net and I removed the EF and replaced with out sql helpers classes.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
In my experience, if your application is using OOD then I would prefer EF.
|
|
|
|