|
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.
|
|
|
|
|
Very funny.
BTW, putting pieces of code in a document file is really not a bad idea. The document can then be sent to a publisher to make a book titled something like: "A Cook Book for Every Programmer."
|
|
|
|
|
Your response is a little cryptic but i will adapt it to my needs.
The ASCII table(like this one: http://www.hobbyprojects.com/ascii-table/ascii-table.html[^]) is a very good way to look at simplest forms of code storage. And yes, is a very good way visually to remember tricks and hints, special code usage, or even the basic usage of methods and rules in general. Why I could not think of that? thanks man- you give me a nice idea about how to implement it.
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.)
The "VT101 user guide" is more complicated to achieve(programatically). It is a treeview at core, and the page you must edit(add new codes) is a bit complex and require a lot of attention and patience. I need something easy to edit and then something easy to view/search into.
Both your suggestions are great. Thanks. But I didn't try your "like ASCII" model implementation. If you have an example of your "like ASCII" model to inspire from, it will be very nice. I need to see others how they did it. Maybe I can come with something useful to what I see.
Thank you again.
|
|
|
|
|
You have a strange view on the subject. Source code is kept in source files, not in docx or HTML documents. And reusable code should be built and its executable code should reside in DLL files.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
I have done that. Is the wright way, of course but it won't helped me.
Ok, I will repeat from what I write in last responses.
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.)
Yes, it can be store in a dll "the complex forms", but visually is hidden. I suppose you spent hours to look into all dlls to find a specific piece of code that must be adapted to your current needs / or find that special method that do some specific work. If you have 100 or maybe 1000 dll ; or 1 dll with 1000 methods/properties in it, I will, for example, spent hours to search for them. Maybe after lots of usages you learn it and you have a easy way on looking at it...its possible.
But yes, its a right way with making a dll. I am not accustom with making it. I know how to make it, but its usage I dont find it easily for my needs. I need a solution for something fast to look/search/edit visually and explicitly.
|
|
|
|
|
I always have a solution called Reusables in my computer. It has very well structured set of classes where I keep the code. It has a variety of things I have felt like keeping in last five years.
As Luc said, code should be in source files and not anywhere else.
|
|
|
|
|
As I responded to Luc, I need a solution for something fast to look/search/edit visually and explicitly.
I did what you say, I have made a solution and inside it stored lots of pieces of codes. As a editable and storage way is a good way, yes, but if i have to search (visually and/or explicitly) inside them, well..., I have to guess a lot to find what i need(and i usually repeat a lot of codes to find them more easily).
As I said, I done this type of storage, but for me is not the right way.
Its a good idea to keep in mind, you must accustom with it and finally adapt to it.
Thanks for your response. Its a good one...but unfortunately not what I need. Maybe others will find it ok for them.
|
|
|
|
|
A well designed solution should be good Maybe you can try some source control software. I personally, name classes appropriately so I do not have to search a lot for what I need.
|
|
|
|
|
Sometimes as a simple .snippet[^]-file, or as an item-template[^] if it's a complete class. One can share the locations to these snippets and paths in a team
If both categories don't fit, I'll most likely write another article; since an article would describe the problem that's being solved and probably would have example-code.
I are Troll
|
|
|
|
|
Tons of simple notepad files.
However, this is a very generic topic and not an ideal topic for discussion in the C# forum.
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.
|
|
|
|
|
yes, I am actually using this idea with txt files. But I also search for alternatives...that's why this topic.
I am not sure if im doing it right, but at some level it seem that is the best way of storing my custom codes.
I am curious if anybody have such a code library in the txt file format.... I wish to see how you do it. An example is great. thx.
|
|
|
|
|
I think what you are looking for is what I use, it's a program called notetab (www.notetab.com). It's not free but cheap, and the best advantage is that you can create outline files. In an outline file you have at the left the table of content and you can jump to that page. If you organise your notes in appropiate outlines (tabbed at the top of the page) you can quickly jump to the correct note.
I use this tool for "howto's" like push this button, and choose this checkbox etc.
An example of this; if I need to display PDF's in a solution I choose my csharp outline, and click the page "pdf", there I have collected all my notes on how to handle pdf files (including links to my FTP notes).
As I use a version of about 10 years old, I can't advise between the standard and pro version of the tool, but you definiately need outlines.
Pure reusable code I have in a utilities DLL that is linked to every project. E.g. I use MySql as a database in almost all my projects, so code to connect to the database and manage the connection is all in the utilities DLL.
Hope this helps.
Rob
|
|
|
|
|
Notetab definitely is a great help. Thank you for pointing it to me. I was trying a lot of editing software (MS.Word, MindManager, Dreamweaver,ysitebuilder,html editors even C#-as a editing tool , but in time i give up and I return to the old txt files.)
Why? -Because I needed a fast way to look/search/edit visually and explicitly.
Changing the subject from notetab a bit,...The best wysiwyg software I encounter until now remain MS.Word - I have worked with it a lot and tried other variants of wysiwyg's but Word remain the no# 1...for me. So, if they could manage to make some search capabilities between docx files (not only infile)... then I will be not so stressed...but until that will appear, I'll stick with the oldies. Why I specify about that, is because the txt files are the inexpensive files for search inside them with minimum of hardware stress and with great speed (manual or automatic). That is the only reason I come back for them...though my heart is crying after wysiwyg friendliness. This is my "of".
|
|
|
|
|
I have the XML below coming from a SQL table. I want to display the data in a 2 column grid, so that the user can edit the values. Anyone know how to do this?
<CustomerSettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/WALZ.DataTransformation.PlugIn">
<_customerSettingsDictionary xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>DepartmentID</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">7</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>Delimiter</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">~</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>ReferenceColumn</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">0</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>DelimiterCount</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:int">22</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>SupplimentalTableConnString</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">Data Source=san-qa-db-01;Initial Catalog=NOI_Registration;Integrated Security=True</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
<d2p1:KeyValueOfstringanyType>
<d2p1:Key>LogFileName</d2p1:Key>
<d2p1:Value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string">c:\temp\NOILogFile.txt</d2p1:Value>
</d2p1:KeyValueOfstringanyType>
</_customerSettingsDictionary>
</CustomerSettings>
Everything makes sense in someone's mind
|
|
|
|
|
Why are you getting xml from the database instead of using a datatable or dataset?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Other apps are using this data. Right now it's manually entered using a script. I'm writing a UI for it.
Everything makes sense in someone's mind
|
|
|
|
|
This brings up even more questions, but whatever...
If you can't query the database and use a DataTable you can create a XSLT to transform this format into a different structure then either use DataSet.ReadXml[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
I can get the data back as XML, I just need to put it in an editable format.
Everything makes sense in someone's mind
|
|
|
|
|
I must be missing something.
I'm telling you, take the xml you have, transform it to a different structure (without the garbage), load it into a DataSet using ReadXml, then bind the DataSet to grid in edit mode, or any other controls you want.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Sounds like he needs to write it back in the same format, so by "removing the garbage", he loses that info.
|
|
|
|
|
Tht's correct. And, each row's XML will be different.
Everything makes sense in someone's mind
|
|
|
|
|
I was typing out a response when you answered, so I'll just throw that out and respond to this since you answered most of my questions.
You could use xsd to generate a schema and then use xsd again to generate wrapper class(es) from the schema, but the end result here will be that you'll end up with a typed DataTable, etc. which wouldn't really be 2-way bindable directly. You'd also end up with a ~50k to ~100k C# wrapper class. EDIT: Not sure about part of my answer here, maybe DataGrid has a method to bind to a DataTable? EDIT #2: Even if DataGrid does have a method to bind to a DataTable, getting the XML out of a DataTable in the precise way you want it is often a practice in futility.
So, your best bet would be to use the C# XML parser to parse the file yourself into an ObservableCollection<> or whatever and then write it back out to the DB after you are done editing.
|
|
|
|
|
Ya, that was my thinking. I was hoping for a canned solution instead of coding it all myself. But hey,. I'v got nothing better to do today
Thanks
Everything makes sense in someone's mind
|
|
|
|
|
I have a ListView in my main window which displays data from a bound List<T> . This List is re-sorted according to different criteria according to user actions.
I want to apply conditional formatting to this ListView for both Font and Background , based on the contents of two different fields of the <T> objects.
At least the values of the field responsible for the Font formatting can change during run time.
I don't have any idea how to code this...
Hopefully
---Dirk Bock
|
|
|
|