|
Hey buddys I was making a POS Software ... and it realy huge size ... & wen i made some changes and want to run it ... it takes lot time ... So I was hoping if there is a way to just compile the modified line of code and then to run it ... I thought it will not compile the hole code again ? is that possible?
|
|
|
|
|
Are you looking for Snippet compiler[^]?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I dont know what it is ... and I followed the link but there is just a picture of some lines of code ... can u tell me briefly please?
|
|
|
|
|
Below that image, there is are download links based on the framework version. Now, instead of compiling you entire project, you can place the lines of code inside that main method in Snippet compiler and run as you would do in the VS.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
CoderForEver wrote: I was making a POS Software ... and it realy huge size ..
A single executable? How large is "huge"? Are we talking more than 10 Mb?
CoderForEver wrote: So I was hoping if there is a way to just compile the modified line of code and then to run it ..
Sounds like you want to divide your project into different subprojects. Try and move some of your code to an assembly that can be loaded during runtime. That way you only need to (re)compile the assembly that you're working on, as opposed to the entire codebase.
I are Troll
|
|
|
|
|
the Executable is not huge ... but there are a lot of forms .... in which they contain a lot of buttons and pictures to make our pos system high quality graphics ... so when I i change some line of code ... it debugs the whole program ... but I I want to compile that line of code only and to run it .... I hope u got what i meant...
Thank you for your kind help
|
|
|
|
|
Try to move a form to a DLL, and load it from that assembly. That way you'll only have to compile the assemblies that are actually modified. As an example, add a new class-library to the project. Next, create a form in that class library. Lastly, add a reference from your main-project to the new classlibrary - you'll see that you can access your form and display it within the original project. If you make any changes in the form, remember to recompile the classlibrary too.
Resources like images can also be loaded at runtime
I are Troll
|
|
|
|
|
You have three options:
0) Put the code you want to test into a separate assembly and just compile that assembly (easiest/cheapest way out).
1) Use compiler definitions to omit code from the compile (NOT recommended).
2) Buy some decent hardware - 8gb of RAM, the fastest quad-core CPU you can find, a large SSD (at least 128gb), and a normal SATA drive to put the system swap file on. Finally, use Weven64 for your OS.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
Another technique is to use the "Edit and Continue" functionality of VS. Set a breakpoint near the code to be modified, when it hits, you can make your edits and when you continue running (or step), the changes are recompiled.
This approach is somewhat limited (i.e. you can't add a new method, alter a try/catch, etc -- the IDE will tell you when you've made a change that requires a full build), but for tweaking procedural code, this is a great technique (and it has the advantage of forcing you to step through the code and make sure it's doing what you expect)
|
|
|
|
|
That's more or less what incremental builds are for, but they are on an Assembly (project) level. If your "huge" application isn't already broken up into several projects, I suggest you do so.
|
|
|
|
|
Thank you everybody ... am working on ur suggestions.
|
|
|
|
|
hi,
im new to windows mobile development on .net.
im using:
visual studio pro 2008;
windows 7
Windows mobile SDK 5.0
On the File menu, i select New->Project. In the Project Types pane on the left, expand Visual C# and select Smart Device. In the Templates pane on the right, select Smart Device Project and click OK. When the Add New Smart Device Project wizard pops up, i select Device Application and click OK.
so i start debugging and ran the emulator. i open windows media player wanting to play some songs. how do i use the media player to open songs from my computer or import the songs from my computer to the emulator?
|
|
|
|
|
|
hi all,
i am having two forms , form1 and form2. Form1 is having 3 labels , i have to fill all these levels from form2. I am calling form2 via form1 . Can someone help me please , how to fill labels of form1?
Thanks,
Vikas
vikas da
|
|
|
|
|
1. If you want to set the text in some event, have a delegate and handle that event in Form1. There you can set the text.
2. Have static properties for the label text and set them in the Form2. Static because then you will not need to pass the current instance of Form1.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
its not on some event...when i say ok on form 2 the values shown on form2 should comeback and reflect on form1 and form 2 should be closed after that...
its something like i have a connect button..on click of that button it opening a page and there u can select a database and its instances. when u say ok on the form these values database name and instances should be set on base form where connect button resides.
vikas da
|
|
|
|
|
Have two static properties for label text in your form1. In the OK button click event, set these to the values you want.
In form1,
public static string Label1Text{
get{
return this.label1.Text;
}
set{
this.label1.Text = value;
}
}
In form2, inside OK button click event,
Form1.Label1Text = "some value";
}
}
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
There are two problems here:
1) Declaring the property as static means it won't compile - static properties have no "this" object.
2) While this method will work with a little tweak, it is not good practice (and it's best to use good practice as early in the learning process as possible, or it gets harder to break the bad habits).
A better way to do it it to signal a "data changed" event from the button form to the label form:
Form 1:
private void Form1_Load(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Changed += new EventHandler(Changed);
f2.Show();
}
private void Changed(object sender, EventArgs e)
{
ChangedArgs ca = e as ChangedArgs;
if (ca != null)
{
label1.Text = ca.strData;
}
else
{
label1.Text = "Fired!";
}
}
Form2:
public event EventHandler Changed;
private void button1_Click(object sender, EventArgs e)
{
EventHandler eh = Changed;
if (eh != null)
{
eh(this, new ChangedArgs("Hello!"));
}
}
Additional:
public partial class ChangedArgs : EventArgs
{
private string _strData;
public string strData
{
get { return _strData; }
set { _strData = value; }
}
public ChangedArgs(string str)
{
_strData = str;
}
}
The ChangedArgs class allows you to transfer all the relevant data Form2 needs to pass to Form1.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
OriginalGriff wrote: 1) Declaring the property as static means it won't compile - static properties have no "this" object.
Correct. Typed here itself so missed out.
OriginalGriff wrote: it is not good practice
May I ask why? I think properties are meant share data between the forms. In case you think exposing controls properties are not a good practice, then I had mentioned use of delegates in my first reply. I would handle the OK button click event in the Form1 and either pass the values through Tag property of the button or would have a property in the form2 which can be accessed in the Form1.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Thanks Danish for the help and suggestion...i got it now working..
vikas da
|
|
|
|
|
d@nish wrote: May I ask why?
OOP is based around a small number of key concepts - how many depends on who you talk to - but most agree that important ones are Encapsulation, Modularity, and Abstraction.
Public properties do provide these, yes, but only in one direction - from the outside world to the class containing the property definitions.
So, if Form1 consumes the info and Form2 generates it as in the earlier posts, handling it with public properties needs:
Form2:
form1instance.property = value;
Form1:
property set method - Handle value.
What happens if you have two copies of Form1, both of which need to consume the data?
Form2:
form1instance1.property = value;
form1instance2.property = value;
Form1:
property set method - handle value.
Yes - you have to change the data provider to cope with the new instance of the data consumer. The same thing happens if you want to reuse the data provider for some other purpose which does not need a data consumer. Either you have to change the provider to cope with the lack of a consumer, or you have to provide a consumer which does nothing to cope with the provider.
If instead you throw an event "I have data to be consumed" and subscribe to that event as needed in your consumers, you can have as many consumers of the data as you like without changing consumer or provider. This includes zero consumers, that's why the "if (ca != null)" in my original post was there.
There is nothing wrong with using public properties - I do on a regular basis - but when the event handling mechanism is both there and simple to use, it is worth getting used to as early as possible.
Does that make sense? (It was typed quickly and may be a little impenetrable)
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Well said! Using constructor overloads to pass instance data, or static objects/properties on instances to avoid using events and delegates is far too common. Unfortunately, custom events and event args is quite confusing for a noob so the quick and dirty is often adopted and even recommended
For anyone else that comes accross this - it's not that hard to do it properly!
public class YourClass
{
public event EventHandler<YourEventArgs> YourEvent;
private int yourProperty;
public int YourProperty
{
get { return yourProperty; }
set
{
if (yourProperty != value)
{
yourProperty = value;
OnYourEvent(new YourEventArgs(yourProperty));
}
}
}
protected virtual void OnYourEvent(YourEventArgs e)
{
EventHandler<YourEventArgs> eh = YourEvent;
if (eh != null)
eh(this, e);
}
}
public class YourEventArgs : EventArgs
{
private int yourProperty;
public YourEventArgs(int parameter)
{
this.yourProperty = parameter;
}
public int YourProperty
{
get { return yourProperty; }
}
} An example of useage
public class Consumer
{
private YourClass yourClass;
public Consumer()
{
yourClass = new YourClass();
yourClass.YourEvent += new EventHandler<YourEventArgs>(yourClass_YourEvent);
yourClass.YourProperty++;
}
private void yourClass_YourEvent(object sender, YourEventArgs e)
{
Console.WriteLine(e.YourProperty);
}
}
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
OriginalGriff wrote: Does that make sense?
Yes, it does. I have seen a lot of data sharing posts here and I almost always provide both the mechanisms by which this can be done. i.e. delegates and properties. Then, it is up to the OP to choose. I prefer it that way since it is their application and they are supposed to understand it, not me. For instance, the multiple instance problem you mentioned is something that only OP would know is possible or not.
Although, I do not prefer having a new event when one can very well achieve the thing using existing ones. Like in this case, handling button click event in the Form1 itself should be sufficient.
As far as having properties is concerned, exposing the controls of the page/form is something I do not prefer. So if I was OP, I would have handled OK button click in Form1. Still, as I had said before, it is his/her application and it is up to him/her to decide which approach is better.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Thanks OriginalGriff
it worked well i guess o am using callback functionality here to post the data back to parent page...
Thanks once again
vikas da
|
|
|
|
|
Hi,
I'm running into a very strange behavior of HttpWebRequest.BeginGetResponse().
Instead of returning immediately, and executing the request in a new Thread from the ThreadPool, the method blocks, and the request is executed in the same thread. Actually, it behaves like HttpWebRequest.GetResponse().
Basically I do a very simple task, in which I call a big number of web requests and run them asynchronously:
private void scheduleMyWebRequests()
{
for (int i = 0; i < someNumber; i++)
{
…
IAsyncResult result = httpWebReq.BeginGetRespons(processMyData, state);
ThreadPool.RegisterWaitForSingleObject(result.AsyncWaitHandle, timeoutCallback, state, timeout, true);
}
}
private void processMyData (IAsyncResult result)
{
...
...
if(noMoreRequestsToProcess)
callAnotherMethodToContinue()
}
This code works perfectly when the web requests use HttpMethod.GET
All the requests run asyncronously.
However, when I started using requests which are HttpMethod.POST something strange happens:
After the first BegineGetResponce() the control doen't return immediately.
Instead, the same thread starts runing the processMydata() method. Only when this method finishes, the control returns to the calling method.
All my web requests are performed syncronously rather then asyncronously (I've dumped the Thread's Id and all the calles use the same Thread Id).
When I use HttpMethod.Get I can see that indeed, each request uses a different Thread Id, as expected.
Does anyone have a clue why is this happening?
P.S. the cause is not an unhandled exception. I've already checked…
Tnx
Roy
|
|
|
|