|
That depends on how you store the settings. For a bunch of Services I wrote a while back I stored the settings in a database (recommended), so my Administration Interface maintained them there.
|
|
|
|
|
|
Hi,
I am new to this group and I have a doubt.
I have completed my C# recently so now should I go for windows apps, WPF or Windows Forms. If we talk about future, then Apps is the best thing, windows forms is definitely not the future but what about the job opportunities for a beginner, which one should I practice:.
Thanks,
Munish
|
|
|
|
|
Don’t worry about job for now. As a beginner try to learn basic about Webform, Winform, MVC, mobile App Development and WPF and etc. Who said that Windows forms are not the future? Depends on company where you will work, some company will need project should be developed only for web, some company needs for winform; some might need Web, Winform and Mobile App. So as a beginner its good you should get idea about all Microsoft technology for 2 years till you get experience .Once you get experience in Microsoft Technology then you can focus on any one development and start your carrier from there.
|
|
|
|
|
Thanks for your quick reply.
I do agree with you on everything but the thing is I am a 2013 pass out so I have to study keeping my pass out year in mind. I was thinking I should focus on something which is in demand right now or will be in the future in 3 years like apps, I could be wrong. I don't know what should I do, what path should I choose with C#.
and by demand means majority of medium or small scale companies.
|
|
|
|
|
No problem it’s about you passed out in 2013 .You can start your carrier as a fresher and prepare for interview questions,Lots of interview questions available in internet don’t focus on asp.net or winform or Mobile App development for now focus .Now you need to learn on C# OOPS concepts ,Basic SQL ,ASP.NET page life cycle and basic interview question about asp.net. Study for what is MVC related interview question. Don’t think about future for now as I told you it depends on your company where you will work. We cannot predict future so enjoy learning new things and keep on update with new technology. Get well prepare for your interview hope in a year later you will be as successful programmer. One thing keep in mind as a Microsoft software Engineer we should be ready to work on any application like asp.net, MVC, Mobile App, win form etc. If you see from long sight it will be difficult, once you get into it you feel good with learning all.
|
|
|
|
|
Member 11287260 wrote: I have completed my C# recently No, you are just at the beginning of learning to use C#, and the most demanding education is still ahead of you.
You are like someone who understands how cars are built, and driven, and what roads and highways are, but who has never actually driven a truck to deliver a load without damage to a far-off destination with a tight deadline in effect so you won't get paid unless you meet the deadline.
You may know that you must stop on a red-light, but when to pass another vehicle is a skill, and an art, on which your payday, and life, may depend: you learn that on the job.
So, yes, plunge into WinForms, WPF, ASP.NET: learn to use Controls (they're quirky beasts). Learn how to access the Web, scrape a page for content and display it hierarchically.
Learn RegEx, and Linq. Learn some flavor of SQL, and NoSQL. Know how to write a database query.
And, practice, practice, practice.
When you go to that job interview, people are going to be evaluating you for entry-level positions ... that are beyond just phone-line support and quality testing ... on enthusiasm, and curiosity, and eagerness to learn new things, as well as on the basis of what you have studied, and your grades, and diplomas.
cheers, Bill
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
Many companies still use COBOL, or C to do much of the work, so although it looks like companies are only using the newest thing, this is not true at all. Some of the reasons include the price of software and "if it's not broken don't fix it" attitude.
If you're going C# I wouldn't start by taking directions. In fact, there is a learning curve and I would start with winforms then ASP.Net then WPF. Also learn WCF, but I found this to be a complete seperate track.
hope this helps.
|
|
|
|
|
VB6 here. Have you heard the latest of Backstreet Boys? I was wondering if buying that cassette...
We switched from Win2k to XP a few years ago, to say... And we are in the top 5 companies worldwide in our sector.
|
|
|
|
|
I have completed my C# certification and have recently completed my SQL, HTML, CSS and Javascript.
That's why I am moving towards more advanced C#, now I am not sure where to start with, should I opt for win forms, aps or WPF.
and I don't want to go with ASP.NET, not right now, I already got my hands full.
So what say you.
|
|
|
|
|
1. aps does not exist.
2. please read my post more thouroughly as it holds the answer...
|
|
|
|
|
I got it bro, thanks.
just read it again and got your point.
Sorry for not reading it thoroughly in the first go.
|
|
|
|
|
would you suggest some tutorial or books for win forms.
I did some research but couldn't find anything constructive.
|
|
|
|
|
O reilly´s have a good reputation. I would go through Amazon en check out the ratings.
|
|
|
|
|
There are many situations where an object has to be able to change its calculation based on a user input. Examples are applying discounts to an order, calculating shipping charges, and so many more. There are also many examples on the web that show if you implemented this logic using an enum, a switch statement and private methods, you should refactor the code using the strategy pattern. I don’t have an issue with understanding how to refactor the code. At the bottom of this post I have included sample code that shows the before and after refactored code.
However, I have found myself asking three questions after reading these posts and I am hoping that some one can explain it to me.
1. Suppose these calculations really will only apply to this object. Why do I want to make them more accessible by putting them in their own class that at a minimum is accessible to the entire assembly?
2. In the examples on the web; there is a class that calls the context object. The code below is typical of what you will find in posts. It creates the context object for each calculation method. I know it serves to show you the different results, however, I believe it hides an issue.
public class ClassThatCallsContextObject
{
public void StartCalculation ( )
{
decimal calculationResult = 0.0M;
ContextObject contextObject;
contextObject = new ContextObject(new CalculationMethod1());
calculationResult = contextObject.Calculation();
contextObject = new ContextObject(new CalculationMethod2());
calculationResult = contextObject.Calculation();
}
}
In an actual application, only one of the choices will be selected. This selection can be made by the user, by a business rule, read in from the database, etc. That selection requires different code. I think you need to add back the enum and the switch statement to implement this code. Below is an example of the code.
public enum CalculationStrategies { Method1, Method2}
public class ClassThatCallsContextObjectWithUserSelection
{
public void StartCalculation ( CalculationStrategies userInput )
{
decimal calculationResult = 0.0M;
ContextObject contextObject;
switch (userInput)
{
case CalculationStrategies.Method1:
contextObject = new ContextObject(new CalculationMethod1());
calculationResult = contextObject.Calculation();
break;
case CalculationStrategies.Method2:
contextObject = new ContextObject(new CalculationMethod2());
calculationResult = contextObject.Calculation();
break;
}
}
}
Is there a better way to implement this selection code?
3. Assuming item 2 is the best way to do this, when the time comes to add a new calculation (and we all know that it will be here eventually), the following work has to be done:
A. Add the new calculation to the enum.
B. Add a new switch statement to the object that calls the context object.
C. Create a new class that implements the new calculation.
If I didn't refactor the code, here is the work I would need to do.
A. Add the new calculation to the enum.
B. Add a new switch statement to the context object.
C. Create a new private method that implements the new calculation.
This looks like pretty much the same thing. So, what is the advantage of the refactored code?
Complete code examples for reference:
Switch Statement Code
public class ClassThatCallsContextObject
{
public void StartCalculation ()
{
decimal calculationResult = 0.0M;
ContextObject contextObject = new ContextObject();
calculationResult = contextObject.Calculation(CalculationStrategies.Method1);
calculationResult = contextObject.Calculation(CalculationStrategies.Method2);
}
}
public enum CalculationStrategies { Method1, Method2}
public class ContextObject
{
public ContextObject ()
{
}
public decimal Calculation ( CalculationStrategies selectedStrategy )
{
decimal calcualtedValue = 0.0M;
switch (selectedStrategy)
{
case CalculationStrategies.Method1:
calcualtedValue = CalculationMethod1();
break;
case CalculationStrategies.Method2:
calcualtedValue = CalculationMethod2();
break;
}
return calcualtedValue;
}
private decimal CalculationMethod1 ( )
{
return 1.0M;
}
private decimal CalculationMethod2 ()
{
return 2.0M;
}
}
Strategy Pattern Code
public class ClassThatCallsContextObject
{
public void StartCalculation ( )
{
decimal calculationResult = 0.0M;
ContextObject contextObject;
contextObject = new ContextObject(new CalculationMethod1());
calculationResult = contextObject.Calculation();
contextObject = new ContextObject(new CalculationMethod2());
calculationResult = contextObject.Calculation();
}
}
public enum CalculationStrategies { Method1, Method2 }
public class ContextObject
{
private ICalculationMethod _calculationMethod;
public ContextObject ( ICalculationMethod calculationMethod )
{
_calculationMethod = calculationMethod;
}
public decimal Calculation ()
{
return _calculationMethod.CalculationMethod();
}
}
interface ICalculationMethod
{
decimal CalculationMethod ();
}
public class CalculationMethod1 : ICalculationMethod
{
private decimal CalculationMethod ()
{
return 1.0M;
}
}
public class CalculationMethod2 : ICalculationMethod
{
private decimal CalculationMethod ()
{
return 2.0M;
}
}
|
|
|
|
|
1) you don't new up the strategies on start, you new them up when they are requested
2) its not really necessary to cache the strategy objects unless they are expensive to create (new'ing up a class with an empty constructor is very cheap)
3) at the bottom of a strategy pattern is a switch
4) you are doing too much in the switch, all the switch should do is return the instance and the switch should be "internal". I.e., you'd have a static strategy factory class that has a static GetStrategy(someEnum) and returns the ICalculationMethod object. So your caller just needs to do StrategyFactory.GetStrategy(someEnum); The GetStrategy() method is going to have the switch.
5) your suggested use case is a trivial case and probably strategy is overkill for simple calculations... a more realstic scenario might be FedEx vs UPS shipping for example. Your strategy class will have methods for calculating the shipping, tracking, interacting with FedEx or UPS web service, etc. So it'll be much more then just a single method.
If your strategies are all 5 to 10 lines, I'd say strategy is overkill.
|
|
|
|
|
Voted-up. Seems like a very good analysis to me. Why build a rocket-ship that can go to outer-space if your destination is the moon
«OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. » Alan Kay's clarification on what he meant by the term "Object" in "Object-Oriented Programming."
|
|
|
|
|
BillWoodruff wrote: Why build a rocket-ship that can go to outer-space if your destination is the moon I seem to recall that the moon is in outer space!
A positive attitude may not solve every problem, but it will annoy enough people to be worth the effort.
|
|
|
|
|
Hi,
I am using dynamic datetimepicker that the user can add to any number. But I am having postback problem. Once I submit it, the return page should have all the submitted values including those added dynamic datetimepicker. Right now when i submit and when the page returns, all other static controls with data are there but no dynamically added datetimepicker controls.
Below is the code I used to add datatimepicker dynamically using javascript:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui.css" />
<link rel="stylesheet" media="all" type="text/css" href="jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="jquery-ui.min.js"></script>
<script type="text/javascript" src="jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
$(function () {
var counter = 1;
jQuery("#<%= btnD1Add.ClientID %>").click(function (event) {
event.preventDefault();
jQuery("<li>").appendTo(".Date1More");
jQuery("<label id='lblD1StartTime" + counter + "'>StartTime:</label><input type='text' id='txtD1StartTime" +counter + "' name='txtStartTime1'/>").timepicker({
hourGrid: 10,
minuteGrid: 10,
timeFormat: 'hh:mm tt'
}).appendTo(".Date1More");
counter++;
});
});
</script>
<asp:Button ID="btnD1Add" runat="server" Text="Add more time slots" />
<li>
<ul class="Date1More">
</ul>
</li>
</html>
Now how to use postback for these controls? I had tried to use following code in code but didn't work. I even tried it using !Ispostback() function under pageLoad but no effect.
protected string[] txtStartTime1;
protected void Page_Load(object sender, EventArgs e)
{
txtStartTime1 = Request.Form.GetValues("txtStartTime1");
}
protected void Page_Init(object sender, EventArgs e)
{
try
{
if (txtStartTime1.Length > 0)
{
TextBox txtStTime1 = new TextBox();
txtStTime1.ID = "txtD1StartTime";
txtStTime1.CssClass = "timepicker";
this.Controls.Add(txtStTime1);
}
}
catch(Exception ex){}
}
Please help..
Dhyanga
modified 4-Dec-14 11:06am.
|
|
|
|
|
|
Thanks. Yes I did.
Dhyanga
|
|
|
|
|
My function takes resource file name as input and returns Bitmap object.
GetManifestResourceNames returns fully qualified resource names. Sample Input is like "Fileopen.png".
How to find the required resource without doing any string operation ? Or any other way is also welcome.
public static Bitmap GetBitmap_FromResource(string ImageName)
{
Assembly assembly = Assembly.GetExecutingAssembly();
string strResName = GetReqdResourceName(assembly, ImageName);
if (string.IsNullOrEmpty(strResName))
return null;
Stream imgstream = assembly.GetManifestResourceStream(strResName);
if (imgstream == null)
return null;
Bitmap Img = new Bitmap(imgstream);
return Img;
}
public static string GetReqdResourceName(Assembly assembly, string strResName)
{
string[] resNames = assembly.GetManifestResourceNames();
return null;
}
|
|
|
|
|
What exactly do you mean by "find the required resource without doing any string operation"? Please explain exactly what problem you are trying to solve.
|
|
|
|
|
Hi! I have a problem with how my program handles an invalid input.
It goes like this:
Enter string: Apple
Enter integer: 1
Enter string: Orange
Enter integer: 2
Search array: Apple
Search found with string name Apple with integer number 1
Search array: Banana
Search found with string name Apple with integer number 1
Object searchValue = null;
string searchString;
do
{
searchString = GetCorrectInput.String(message);
if (!searchString.Equals("Quit"))
{
for (int i = 0; i < objectArray.Length; i++)
{
if (searchString== objectArray[i].studentName)
{
searchValue = objectArray[i];
}
}
if (searchValue == null)
{
Console.WriteLine("{0} was not found", searchString);
}
else
{
Console.WriteLine("Search found string name {0} with integer number {1}", searchValue.stringName, searchValue.integerNumber);
}
}
} while (!searchString.Equals("Quit"));
Console.WriteLine("Thank you!");
Banana is supposed to be not found but its not
|
|
|
|
|
You forgot to set searchValue back to null. The proper place to do that would be at the top of the loop right after searchString is being set.
Regards,
Manfred
"I had the right to remain silent, but I didn't have the ability!"
Ron White, Comedian
|
|
|
|
|