|
i have solved to read and replacing method.
but can u tell me what the procedures to store the value as i ask in my question.
|
|
|
|
|
assuming the order is not important and all keys are unique, I would store all this "key=value" information into a Dictionary<key, value> . If order is relevant or duplicate keys could exist, a List<KeyValuePair<key, value>> could do. And use string type for key, and probably for value too.
|
|
|
|
|
ahmad25 wrote: replace abc with mno and so on in C#
Do you mean replace like with the "C-Preprocessor"?
Using two arrays is not the way to go in any case.
|
|
|
|
|
Hi,
Scenario:
I have many user components added to a form. I wish to do some information reporting from each user control to a centralized destination, where many form can subscribe and acquire the information.
I have a class named MiscFunctions, contains an informationEvent handler which each forms subscribes too rather than subscribing to each UI component.
I want to trigger that event present in Miscfunctions class from my UI components with some arguments, and all my forms subscribing to an event in miscfunctions to listen it.
Any help please?
|
|
|
|
|
I assume you are using static Eventhandlers on your Miscfunction ...
what you need is another static method that is used to raise the event when ever you want, hope I got your question
static event EventHandler commonHandler;
static void raiseCommonHandler(object sender, EventArgs e)
{
if (commonHandler != null)
commonHandler(sender, e);
}
MiscFunction.raiseCommonHandler(new object(),null);
|
|
|
|
|
You need to create and call a method in your MiscFunctions instance (or static class) that raises your custom event passing an instance of your own event args class (derived from System.EventArgs ) as a parameter.
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier.
Please take your VB.NET out of our nice case sensitive forum.(Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|
|
Thank you guys.
Did some snopping around and found no other way than you guys mentioned.
Thank you...
|
|
|
|
|
Hi,
I'm having a big problem with a "data importer" code.
I'm working on this data importer since January and never have any problem before. The big difference is just that there is more data to load now than in january. And each entity is bigger (more properties)
I'm using .NET 3.5 C# nHibernate & spring
The exception is:
Exception of type 'System.OutOfMemoryException' was thrown. ------- at System.Collections.Generic.Dictionary`2.Resize()
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at NHibernate.Event.Default.AbstractFlushingEventListener.PostFlush(ISessionImplementor session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()
at NHibernate.Transaction.AdoTransaction.Commit()
at PagesJaunes.Adnc.DataAccess.Repositories.Repository`1.CommitTransaction()
There is a total of 500 000 entities to save.
My code is saving 10 000 entities, then commit and start a new transaction for the next 10 000
It take nearly 12 hours to save everything, and after ~400 000 entites i receive my OutOfMemoryException
I already try lots of things, can anyone help me having new ideas ?
- i tried to commit each 100 entites or each 1000 entites.
- i tried to call GC.Collect regularly
- if a commit throw the exception, i tried to rollback and start a new one. but then each commit throw the f** exception, no matter what.
- googling since 2 days and i can't find anything on this subject
- now i'm trying to do a commit/flush/clear each 10 000 entites (it's running i don't know the result yet)
--
Nicolas
|
|
|
|
|
Hi,
I see two possibilities: a real out-of-memory condition (just keeping too many objects alive at the same time), or a fragmentation problem (the memory for each individual object needs to be contiguous, big arrays/collections may fail their allocation).
Here is how to tell them apart:
- display or log the result of Environment.WorkingSet regularly; it shows how much memory is needed by your app. (You could divide by 1024*1024 to get megabytes rather than bytes).
- if it continues to increase, up to one or a few gigabytes, you're really running out of memory, and you must look for memory leaks (not disposing of things you should?) or too many objects that never die (e.g. a poorly implemented caching scheme trying to remember everything that ever lived).
- if the WorkingSet is well below 1 gigabyte when your app crashes, you have a fragmentation problem. They were common on older .NET versions when using collections that grow all the time. There is no 100% solution, you should try removing items you no longer need (or clear the collection ASAP), and allocate a sufficient capacity when starting a collection (see http://www.perceler.com/articles1.php?art=capacity1[^] for some background info).
|
|
|
|
|
Hi,I want to convert all types of files to pdf format without using any software..It should be done in programmatic way..Is that possible?If yes...Help me out please..
|
|
|
|
|
Yes. It is possible (not easy, but possible). You should download latest version of document from this[^] link, read it, and write your implementation of standard.
Next you will have to write lots of libraries to convert "all types of files" to some universal format, that will be understandable by your library.
And finally, when you're done, you can sell your application.
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
Hi,Thanx for you reply..I just want to do it in a very simple manner..Initially i will upload files to database and to a folder in my application.I am just storing the file name with some categories to database.While retrieving i will match the file name from database to that folder and retrieve them.I used iframe to display any type of file.
But now i am trying to convert all files to pdf and store in database.I want to do it in a very simple way.I am new to .net programming.So,i am not much familiar with libraries,tools etc etc..
|
|
|
|
|
Generally, there's no simple way... Don't know your scenario to good, but maybe you can try (as answer in the bottom says) virtual printer like PrimoPdf. It's free, and creates pdfs from evenry file-type, that you can print.
And one more thing: simple way isn't writing your own code that does what you want. Simple way is to find library, that already does what you want
Don't forget to rate answer, that helped you. It will allow other people find their answers faster.
|
|
|
|
|
|
sunithaganugu wrote: But now i am trying to convert all files to pdf and store in database.I want to do it in a very simple way.I am new to .net programming.So,i am not much familiar with libraries,tools etc etc..
How "new" are you? If we're talking less than a month's programming experience, it might be a good idea to start with something more straight-forward.
I are Troll
|
|
|
|
|
I have only one month experience in .net.My task is to convert files.I don't have any idea.I used sautin soft tool to convert files.I got code to convert only that particular aspx design format to pdf page.But i donno how can i convert pages dynamically..
|
|
|
|
|
You cannot do this without third party libraries. Since your code will never know the format of every type of file, and therefore cannot understand how to print it to a PDF file itself, you have to rely on the application for every file type. This is also impossible because you cannot have the application for every file type installed nor does every application expose a COM interface for your application to use it.
You're going to have to limit your scope to a known subset of file types in order to do this to any degree of success.
|
|
|
|
|
sunithaganugu wrote: I have only one month experience in .net.My task is to convert files.I don't have any idea.I used sautin soft tool to convert files.I got code to convert only that particular aspx design format to pdf page.But i donno how can i convert pages dynamically..
So, the conversion is working, albeit on a static page? What kind of files are you going to export?
I are Troll
|
|
|
|
|
Actually my concept is E-Books.So, if i upload any type of file book it should convert to pdf and then store into database.I want to convert msword/txt/html to pdf..
|
|
|
|
|
sunithaganugu wrote: I want to convert msword/txt/html to pdf..
That's not "any file". The good news is that these formats can be exported to PDF, using a third-party library - PDF isn't supported by the native classes. I'd be using SharpPDF, but that's based on the experience of others.
I assume that you already have the code to upload a file, storing data etc.?
I are Troll
|
|
|
|
|
Ya,I have code for uploading files to database.I am just storing the file name not the total file to database.I am storing files in a folder on my server.Do you have any idea how to use iTextSharp library or some other third party tools?
|
|
|
|
|
sunithaganugu wrote: Do you have any idea how to use iTextSharp library or some other third party tools?
No, and that's where Google comes in. This[^] would probably be the base, I'd try to build a prototype with that code as an example.
I are Troll
|
|
|
|
|
Actually we can use google docs embedded code for doing this.Its very simple.But i want to do it in a programmatic way.
|
|
|
|
|
Yes it's possible: you have to write on your own exactly what Acrobat, PrimoPDF and others already do!
However, if really want to translate a generic file format to PDF without knowing its internal format, your only chance is to write a device driver for a virtual printer: when you print to that device, the output goes to a PDF file.
|
|
|
|
|
i was writing this for a checkbox
pizzaInfo.IsFavourite = Convert.ToBoolean(chkIsFavourite.Text);
its error not sure how to call it
String was not recognized as a valid Boolean
|
|
|
|