|
ASP.NET[^]
It's time for a new signature.
|
|
|
|
|
Everybody, I have some MVC of problem, I reference more information, and I write the Model, the Controller and more than one View, but I don't know my code is consistent with MVC? Please give some help! Thank you~
import java.util.*;
public class Initial {
public static void main(String[] args) {
View v = new View("View");
View2 v2 = new View2("View2");
Model m = new Model();
Controller c = new Controller(m);
c.add(v);
c.add(v2);
v.display();
v2.display();
c.showAryList();
}
}
public class Model {
private enum States {
Add, Subtract
};
private States state;
public Model() {
}
public void changeToAdd() {
this.state = States.Add;
}
public void changeToSubtract() {
this.state = States.Subtract;
}
public int caculate(int x, int y) {
int currentInt = 0;
if (this.state == States.Add) {
currentInt = add(x, y);
}
if (this.state == States.Subtract) {
currentInt = substract(x, y);
}
return currentInt;
}
public int add(int x, int y) {
return x + y;
}
public int substract(int x, int y) {
return x - y;
}
}
import java.util.*;
public class Controller {
private Model m;
private List aryList;
public Controller(Model m) {
this.m = m;
aryList = new ArrayList();
}
public void add(Viewable v) {
aryList.add(v);
System.out.println(v.getName() + "add!");
v.addController(this);
}
public void removeView(Viewable v) {
aryList.remove(v);
System.out.println(v.getName() + "remove!");
}
public void sumNumber(Viewable v, int N1, int N2) {
this.m.changeToAdd();
if (aryList.contains(v)) {
((Viewable) this.aryList.get(aryList.indexOf(v))).show(this.m
.caculate(N1, N2));
}
removeView(v);
}
public void substractNumber(Viewable v, int N1, int N2) {
this.m.changeToSubtract();
if (aryList.contains(v)) {
((Viewable) this.aryList.get(aryList.indexOf(v))).show(this.m
.substract(N1, N2));
}
}
public void showAryList() {
for (int i = 0; i < aryList.size(); i++) {
System.out.println(aryList.get(i).getClass());
}
}
}
public interface Viewable {
public String getName();
public void addController(Controller c);
public void show(int result);
}
import java.util.*;
public class View implements Viewable {
private int no1;
private int no2;
private Controller c;
private String name;
public View(String n) {
this.name = n;
}
public String getName() {
return this.name;
}
public void addController(Controller c) {
this.c = c;
}
public void display() {
Scanner s = new Scanner(System.in);
System.out.print("No 1:");
no1 = s.nextInt();
System.out.print("No 2:");
no2 = s.nextInt();
c.sumNumber(this, no1, no2);
}
public void show(int result) {
System.out.println(no1 + "+" + no2 + "=" + result);
}
}
import java.util.Scanner;
public class View2 implements Viewable {
private int no1;
private int no2;
private Controller c;
private String name;
public View2(String n) {
this.name = n;
}
public String getName() {
return this.name;
}
public void addController(Controller c) {
this.c = c;
}
public void show(int result) {
System.out.println(no1 + "-" + no2 + "=" + result);
}
public void display() {
Scanner s = new Scanner(System.in);
System.out.print("No 1:");
no1 = s.nextInt();
System.out.print("No 2:");
no2 = s.nextInt();
c.substractNumber(this, no1, no2);
}
}
|
|
|
|
|
I doubt that anyone will want to wade through your code on the off-chance it might be problematic. The purpose of the forum is to answer questions relating to specific issues not for peer review.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I am developing an e-commerce site.
I am confused with two payment choices.
1. Paypal and Credit Card.
2. Using a bank transaction to the merchant bank.
My doubt is whether we can do a bank transaction better than paypal and credit card.? We can associate an orderID with every paypal payment and the merchant can receive emails from paypal regarding orderid and payment. Is this flexibility is available with banks? What are the problems in integrating a bank account transfer concept?
|
|
|
|
|
I work in a small team developing a asp.net web app in C#. We have 15-20 pages (modules) that offer mostly different kinds of inventory tracking. On each page (amongst other things) there are various dropdown fields available for users to choose from. Almost none of these fields overlap so we have many different lists to manage.
We're currently in a development style argument though. Right now all the dropdown fields are manually listed. Meaning, on each page, for each dropdown field, we have the list items typed out in the aspx page.
For example:
<InsertItemTemplate>
<asp:DropDownList id="ddlStatusInsert" runat="server" >
<asp:ListItem Value="">Unknown</asp:ListItem>
<asp:ListItem>Available</asp:ListItem>
<asp:ListItem>Out of Service</asp:ListItem>
<asp:ListItem>Closed</asp:ListItem>
<asp:ListItem>Lost</asp:ListItem>
</asp:DropDownList>
</InsertItemTemplate>
Now, we want to create 'list managers' for these. So move the values to a separate database table and dynamically pull from the tables to populate the dropdowns.
First question, I'm curious what your typical projects look like in regards to this issue. Are the dropdown values manually listed out and what do you think of that method?
Second question (and the biggest source of disagreement on our team), when you do move the values out to separate tables, do you continue to store the string values in the original database tables and join to the 'list manager' tables on that string, or do you create IDs on the 'list manager' tables and do a bunch of JOINs on the IDs between the original tables and the new tables?
It's being hotly debated here and I'm curious what the projects out there face in similar situations.
Thanks!
|
|
|
|
|
anjelone2 wrote: First question, I'm curious what your typical projects look like in regards to this issue. Are the dropdown values manually listed out and what do you think of that method?
No. Just because you can manually add the items doesn't mean you should. What happens if you want to offer localised versions or you want to add a new item or remove one?
anjelone2 wrote: Second question (and the biggest source of disagreement on our team), when you do move the values out to separate tables, do you continue to store the string values in the original database tables and join to the 'list manager' tables on that string, or do you create IDs on the 'list manager' tables and do a bunch of JOINs on the IDs between the original tables and the new tables?
Why is this even being debated. Have they never heard of database normalisation? Look at the space that's being wasted in a table storing the string values for every row - store the id of the item from the lookup table and do a join instead. It's only a few extra characters. BTW - one objection I sometimes hear is that you can't delete a lookup item in future because this breaks referential integrity, and this is true - you should never delete a lookup that has been used. What you can do though is add a Deleted column which indicates whether or not the item has been deleted.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
To the second question, one side argues the point you make exactly. That is what relational databases are made for and allows scalability without much thought. It is also just good programming practice.
The other side argues something to your BTW point. They feel that when a list value changes, there is no way to capture what the old value was (for tracking sake). That side also argues that it makes joins to the main table lengthy, especially if there are 6-10 lists to join to. That's 6-10 LEFT OUTERs on that query.
|
|
|
|
|
anjelone2 wrote: They feel that when a list value changes, there is no way to capture what the old value was (for tracking sake).
Of course there is. Audit your lookup data and store the old value in a history table (along with the period it applies to).
anjelone2 wrote: That side also argues that it makes joins to the main table lengthy, especially if there are 6-10 lists to join to. That's 6-10 LEFT OUTERs on that query.
And that's just laziness. It's not a valid argument.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
anjelone2 wrote: That's 6-10 LEFT OUTERs on that query
Hide them behind a view
I are Troll
|
|
|
|
|
anjelone2 wrote: That is what relational databases are made for and allows scalability without much thought. It is also just good programming practice.
Surely this alone is enough to win the argument?
The counterarguments are pretty much just rubbish, as the other posters have just pointed out:
anjelone2 wrote: it makes joins to the main table lengthy, especially if there are 6-10 lists to join to
This is particularly offensive, anyone arguing this doesn't understand the nature of relational databases properly or is just plain idle. There is good, solid maths behind database design, if you understand this and apply it correctly your system will be much more scalable and robust. The only real problem with relational Databases is how to translate the real-world information into the abstract relational world, but all IT systems (except those modelling abstract systems themselves) inherently suffer from this problem.
|
|
|
|
|
Pete O'Hanlon wrote: add a Deleted column
Right, never* delete data. Archive perhaps, but don't delete.
* At least don't make it the first thing you think of.
|
|
|
|
|
I am now working with an ERP application, but the database is getting bigger and bigger, my application have database with 300MB size after 6 months only!!! and the application is getting slower because huge amount of data, especially when user ask for a report or do some inquiries in screens, I am thinking about partial loading solution to load the data partially when user scroll the data, but I have problems with sorting and hanging when user scroll data, what is the best solution for my application,
The environment is
VB.NET 2008
3 tiers architecture
SQL SERVER 2008
Possibly using VPN connection (makes application give time out)
Any help is highly appreciated
|
|
|
|
|
There are many areas that you need to look at. Are your queries running against indexed values? Are you bulk loading too much data? Should you be lazy loading? What can you cache? To be honest, whoever designed this system should have thought about these issues right at the start - it's going to cost a lot more to fix the system now that it's live than it would have cost at the design stage. BTW - 300MB isn't very big, you need to sort this out now before you get to terabytes.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
1.There is an object varying for two dimensionality which change commonly.we can decouple the two dimensionality ,so they can vary indepently and not mutually affect.For example ,when we want to draw a picture through pen.Pen may have different size like big pen or small pen.It also has different color like red or green.Apperently the pen as an object used to draw will vary through different matching of size and color.Now,we can utilize a "bridge" to connect the CSize class and CColor class.is it that?
1 abstract class Brush<br />
2 {<br />
3 protected Color c;<br />
4 public abstract void Paint();<br />
5 <br />
6 public void SetColor(Color c)<br />
7 { this.c = c; }<br />
8 }<br />
<br />
1 class BigBrush : Brush<br />
2 {<br />
3 public override void Paint()<br />
4 { Console.WriteLine("Using big brush and color {0} painting", c.color); }<br />
5 }<br />
1 class SmallBrush : Brush<br />
2 {<br />
3 public override void Paint()<br />
4 { Console.WriteLine("Using small brush and color {0} painting", c.color); }<br />
5 }<br />
1 class Color<br />
2 {<br />
3 public string color;<br />
4 }<br />
1 class Red : Color<br />
2 {<br />
3 public Red()<br />
4 { this.color = "red"; }<br />
5 }<br />
1 class Green : Color<br />
2 {<br />
3 public Green()<br />
4 { this.color = "green"; }<br />
5 }<br />
1 class Blue : Color<br />
2 {<br />
3 public Blue()<br />
4 { this.color = "blue"; }<br />
5 }<br />
1 class Program<br />
2 {<br />
3 public static void Main()<br />
4 {<br />
5 Brush b = new BigBrush();<br />
6 b.SetColor(new Red());<br />
7 b.Paint();<br />
8 b.SetColor(new Blue());<br />
9 b.Paint();<br />
10 b.SetColor(new Green());<br />
11 b.Paint();<br />
12 <br />
13 b = new SmallBrush();<br />
14 b.SetColor(new Red());<br />
15 b.Paint();<br />
16 b.SetColor(new Blue());<br />
17 b.Paint();<br />
18 b.SetColor(new Green());<br />
19 b.Paint();<br />
20 }<br />
<br />
2.Gof defines the bridge pattern as Decouple an abstraction from its implementation so that the two can vary independently.<br />
<br />
question:<br />
According to item 1 ,how to comprehend the definition of Bridge pattern by Gof ?Especially, what does the "abstraction" and "implementation " Gof stand for?
|
|
|
|
|
I have a question regarding class diagrams what is the relationship between following two classes
Class classA()
{
}
Class classB{
public MethodA(classA obj)
{
}
}
|
|
|
|
|
There is no relationship between these classes. The fact that classB::MethodA() takes a classA object as a parameter does not create a relationship between them. After all this method could take any object type as its input (or output) parameter.
It's time for a new signature.
|
|
|
|
|
Thank you for your answer
|
|
|
|
|
classB depends upon classA
[classB]-------->[classA]
|
|
|
|
|
Hi
I want to build a troubleshooting application for my existing software to ensure that it is correctly installed or not.for this I have around 9 test case to check to ensure that application is correctly installed. If any case fail it prompts user to correct it with the correction steps
Please tell me the design or architecture I have to follow for that application so that I can extend that in future.
Please tell me the arcitecture I follow like which base classes, interfaces etc to make for this application.
Thanks
|
|
|
|
|
I know you included the word "Design and Architecture" in your request but this is just another request for codz and as such has been downvoted and ignored.
However it is a slow Friday and I'm bored so...
When do you expect this process to run? Assuming on first startup
Your classes should reflect your test cases this can only be designed with the knowledge of the test.
The app should run the test processes before any other process
The tests should report and persist the results so subsequent starts do not repeat the tests
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Hi,
I'm working through the The Data Model Resource book volume 1, and I want to know how to draw data models in Visio 2010? I don't want tables, I want to be able to put entities on a form, and do relationships between them. Is this possible?
What are good data modeling tools?
Brendan
|
|
|
|
|
A decent UML tool should be able to do this for you. If you want a free one, then consider using StarUML[^] - if you want a more powerful one and can afford it, look at Enterprise Architect[^].
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Hi!
erwin - because, its the best.
--------------------------------------------------
custom logo design
|
|
|
|
|
I am using around 8-9 webapplications which are having similar kind of behaviour but used for different purposes. I need to bring all those applications under one umbrella. So if I login to one application, I should have access to all other applications. I don't want any major code change and the look and feel of all the applications should be same.
The WeApplications are relating to .Net Framework 2.0 and migrating to 3.5. A couple of application related to 1.1 (Visual Studio 2003) also.
Anybody have any idea what's the best way to approach this? Any article towards this would be of great help.
Thanks
meeram395.
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
modified on Wednesday, June 2, 2010 7:55 AM
|
|
|
|
|
For people looking for guidance on how to make the move to the new platform and make the most of it. Patterns & practices is a series of projects that target application design and development on this Windows Azure. Key themes: Moving to the Cloud, Integrating with the Cloud, and Leveraging the Cloud.
Visit http://wag.codeplex.com/[^]
|
|
|
|