|
i guess you did, but using pre and post build events for building multiple projects in not a good approach, should be one solution with multiple projects
|
|
|
|
|
Yeeesss... isn't that kinda what I said?
|
|
|
|
|
I have the following problem:
I use Microsoft.DirectX.AudioVideoPlayback class for playing video on our school TV (connected with HDMI also with the sound). Video works fine, but I´ve got a problem with audio. I need to redirect audio (represented by Audio object implemented in my Video object) to another output (Display audio output) in Windows 7. But all other sounds (also from my app) I want to send to default output.
I need to send audio directly from directX playback. I don´t wanna extract audio form AVI for example.
If there is some solution, please answer. Thanks.
|
|
|
|
|
As far as I remember it cant be done with basic audiovideoplayback.
You might want to take a look at DirectShow instead, since you can define exactly what you want the player to do. You can start with the simple-playback sample from http://directshownet.sourceforge.net/[^] and add a DsDevice (aka soundcard output) to the graph (google how to).
|
|
|
|
|
hello , I got exception in my application that is :
Unhandled exception has occurred in yourl application.
Exception form HRESULT 0*800AC472
help me the solution of this problem:
thanks in advance
|
|
|
|
|
Without having more details it is tough to guess the problem. Here[^] is something that may help.
|
|
|
|
|
I think , i should range in this code please help me how i use range in this code
private Excel.Application app = null;
private Excel.Workbook workbook = null;
private Excel.Worksheet worksheet = null;
object misValue = System.Reflection.Missing.Value;
public void createDoc()
{
try
{
app = new Excel.Application();
app.Visible = true;
workbook = app.Workbooks.Add(1);
worksheet = (Excel.Worksheet)workbook.Sheets[1];
}
catch (Exception e)
{
Console.Write("Error");
}
finally
{
}
}
public void addData()
{
string s;
int i = 1;
foreach (ListViewItem li in listView2.Items)
{
s = "A" + i.ToString();
worksheet.get_Range(s, misValue).Formula = li.Text;
i++;
}
}
public void addData1()
{
string s;
int i = 1;
foreach (ListViewItem li in listView1.Items)
{
s = "A" + i.ToString();
worksheet.get_Range(s, misValue).Formula = li.Text;
i++;
}
}
|
|
|
|
|
|
|
Information provided is too little.
With this information, at best, you can search on msdn for this error.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
I have a collection class marked with [Serializable]. Its purpose is "lazy" loading of data. I have overriden all the accessor methods so I can call the item factory to load the items. All works perfect.
A user recently pointed out that if he uses the XML serializer, it doesn't work.
I do have a method thats marked with OnSerialized. Works great with the binary formatter, but doesn't get called with the XML one.
[OnSerializing]
internal void OnSerializing(StreamingContext context)
{
LazyLoad();
}
Whats the work-around to support both? Without a lot of wheel reinvention .
modified on Friday, April 1, 2011 11:13 PM
|
|
|
|
|
SledgeHammer01 wrote: A user recently pointed out that if he uses the XML serializer, it doesn't
work.
Define "doesn't work". What happens and what is expected?
Correct me if I'm wrong, but isn't the method tagged with OnSerialized called AFTER serialization of the object is completed? I thought OnSerializing is called before serialization giving the object a chance, like in your case, to finalize values in prep for serialization.
|
|
|
|
|
Yeah, sorry, I posted the wrong snippet.
It *is* OnSerializing. Fixed the original post. I was testing if OnSerialized was called. Its not. I saw on google that the XmlSerializer doesn't support those attributes. By "not work", I mean, I don't get a notification that somebody is serializing the object, so I don't have a chance to perform the lazy load and the serializer writes out an empty collection. The serializer is doing what its supposed to because the collection IS empty at that point. Thats kind of what this special collection does. It only loads the items when needed. So I was looking for something to hook into for the serialization so I know its time to load.
The work-arounds on google that I found were:
1) use BinaryFormatter or the soap formatter which support the attributes (yes, BF does work, but thats besides the point -- if the user wants to use XmlFormatter, they should be able to). Not an acceptable solution.
2) Implement ISerializable. This does get called with all the serializers, but its pretty much reimplementing serialization from the ground up. Really a last resort after I've exhausted every single other last resort.
I also have work-arounds myself: a) have the user call a property that forces the lazy load b) add a "forceload" method. I'd prefer to not do either of these and do it automatically .
|
|
|
|
|
OK. From everything you've posted, the only automatic solution you've got that works with all the formatters is ISerializable. Yeah, It's a pain to use (I always use it myself), but it's the only way to go.
|
|
|
|
|
The collection I'm working on is derived from ObservableCollection<T>. That means I would need to implement ISerializable to basically mimic everything the .NET serialization does on *any* type of object and I'd spend the rest of my life trying to handle all the cases Not a good idea IMO.
BUT GOOD NEWS!!
After spending an hour or so in Reflector, I managed to find a little hole that I can cram myself into. Works with all the different serializers. Much easier solution then implementing ISerializable . NOTE: this is NOT a general / generic solution, I just wanted something to work automatically with my ObservableCollection<T> derived class and this is it.
ObservableCollection<T> is derived from Collection<T>. Collection<T> implements the ICollection interface.
What I found was, that somewhere deep in the bowels of .NET XML serialization, they special case ICollection and call the ICollection.Count getter very early on.
So all I did was implement ICollection in my class:
int ICollection.Count
{
get
{
LazyLoad();
return Count;
}
}
for ICollection.IsSyncronized, they simply return false, so I did the same.
ICollection.SyncRoot and ICollection.CopyTo, well, those are a bit trickier functions that I didn't really want to bother re-writing, so I just used reflection & expression trees to call the ones in Collection<T> .
And voila! Now my class will perform the lazyload automatically when its serialized.
|
|
|
|
|
Interesting and cool. Good work!
|
|
|
|
|
"Most used" codes are the ones that you as a programmer put them away in a safe directory and from time to time peak at them when you are in trouble. You put them there and you know their order and meanings just enough to came in handy when you most in need of them.
My question is:
-How you people do this collection?
... more specific, in what form do you save these "most used" codes of yours?
(my presumption is:
You have a bunch of docx files with ton of codes inside them?
You have some html pages saved from internet and stored somewhere safe?
A bunch of simple text files, each one containing codes?)
|
|
|
|
|
I don't do what you are suggesting in any form.
The vast amount of code is not generic. It has a specific purpose that has little if no meaning elsewhere.
Code that actually usable, as is, in multiple places is managed as a library.
Code copying is done when code has a relationship to new functionality but requires modification. In those case I know where the original code is so I just go get it.
And finally your suggestion of the internet is problematic from a moralistic and legal perspective. Most of my code is written for an employer. They own the code not me. I cannot use it for any purpose except to the owners betterment. So I can't use it on my personal projects nor for any other employer. So there would not be any point in having it accessible from the internet.
|
|
|
|
|
Yes I know that, and I agree. In essence is as you say.
Well, suppose you make 5 year ago a very good code (for yourself) and now you remember that you have that code, you have a similar application to make (some modification is required but at the base that code from 5 years ago remain the same at the core). You have the project from 5 years ago, saved into a 30G Hdd somewhere in your house? You make, back then for yourself, a library (as you suggested in your response)?
1-the simplest form of what is to store is like this:
[this is a pure example -I don't want critics about this code here!]
//IndexOf usage with string; Benchmark result String version: 1154 ms
int i = s.IndexOf("a"); //Finds first "a" string in s.
//IndexOf usage with char; Benchmark result Char version: 172 ms
int i = s.IndexOf('a'); //Finds first 'a' char in s.
2-the complex form are entire programs, objects,methods, even controls.
(You made them for your simplification in coding for later uses, as reminders or as core codes.)
Thank you. Your response is the closest of what I intend to know.
I hope that with your help I can decipher this mystery I am in to.
|
|
|
|
|
merlinq12 wrote:
<SPAN class=code-comment> Well,
suppose you make 5 year ago a very good code (for yourself) and now you remember
that you have that code, you have a similar application to make (some
modification is required but at the base that code from 5 years ago remain the
same at the core). You have the project from 5 years ago, saved into a 30G Hdd
somewhere in your house? You make, back then for yourself, a library (as you
suggested in your response)?
I create lots of good code. How would I know that when I created that code that I would want to use it 5 years from now?
|
|
|
|
|
Well, the idea is not how you will know, because you never know what you will need in 10 minutes or 10 years from now on. The idea is how you find some very good code write sometime ago by you and put it to use (in the same direction or an alternative one with slight modifications).
Lets presume...that you work on a game now, and after 5 years you will have a similar project somewhere else...it wont be beneficial if you will be able to take the entire or a part of "AI" from this game and reproduce it to the future one? (its just an example-but who knows). The really important blocks of codes from a big project or a small one, is not worth to copy it away in some deposit known only by you? The code and some nice directions/explanations, etc. But in the same time to be able to browse with no headache, search in a currently page or in all files at once and re/edit it as you go very fast and no headache involved also.
To achieve this, the file format that you storage must be very well choose.
thanks.
|
|
|
|
|
When I started programming I created a lot of small code-samples to the the hang of the more complex things, and they are zipped with search-tags in their filenames.
Now I'm doing the same for the abandoned projects thats worth saving.
|
|
|
|
|
Can you provide me with some examples of your search-tags for filenames you use?
And what kind of files are you using for storage -txt,html,doc? -or it dont matter.
Thank you.
MostUsedCodes .txt
stringsCase-Insensitive Equals_b.txt
stringsSearch Contains_b.txt
stringsSearch IndexOf_i.txt
stringsSearch IndexOfAny_i.txt
stringsSearch LastIndexOf_i.txt
stringsSearch LastIndexOfAny_i.txt
stringsTest EndsWith_s.txt
stringsTest StartsWith_s.txt
|
|
|
|
|
I use both zip (for solutions) and plain txt for other more simple things.
That way I can do a simple windows-search on the filenames.
A simple class:
GetFileIcon (win32, shell, pinvoke).txt
A solution with the basic send/recieve and conversion:
TcpClient-TcpListener (network, socket).zip
|
|
|
|
|
You mean like an ASCII table? I usually refer to my VT101 user guide.
|
|
|
|