| 個人檔案Blogs部落格清單 | 說明 |
|
|
11月27日 70-526 exam passedLast monday, one week after passing the 70-536, I also passed the 70-526 exam which in my opinion was far easier than the 70-536, except the setup and deployment stuff, where i got only 40% correct answers. anyway, at the other 6 categories I made only one false answer and I don't care about memorizing the exact name of the dialog, treeview, tab page and button i need to click to configure anything. If I need it, I'll find it.
I had only one week of preparation, while also still working. But it was easy for me as windows and component development is my big domain, where I'm most experienced (except setup and deployment) so I didn't have much to memorize for preparation.
I also discovered, that there have been questions about classes that weren't part of the ms self paced training book. For instance the TransactionScope class that I had to handle with on several questions, but didn't read anything about it in the book.
No that have all required exams, I'm a MCTS for windows applications and currently prepairing for my next exam, the 70-528 (web applications) and finally the 70-529 (web services) that I'm anxious to pass both this year. Then, january 2008 I will complete my exams by passing the 70-549 to finally be granted to the most valuable MCPD of enterprise architect and make some additional MSSQL and Sharpoint MCTS afterwards.... 1月25日 Encoding and Decoding of code pagesSometimes you'll have to read from a file that has a specific codepage.
Using the FileStream class you can decode the bytes read using the following method:
protected string Read(int size) string s; if (codepage != null) return s.Trim(); 9月11日 RemotingRemoting describes how to call methods on a server using the tcp protocoll: http://www.microsoft.com/germany/msdn/nettv/folge1.mspx#EAC 9月7日 Lists, arrays and collections.Sometimes you need to build a class that requires a property that holds several objects of the same type.
Intuitively, you'd choose a generic List<myobject> type for the property, but thats not the optimal choice.
Because using a List means that the list must be previousely created with several List.Add() calls. But sometimes it could be easier to create a simple ObjectType[] array like
if the objects for the list are constant and only a view.
This is much more shorter than
To offer both possibilites, simply don't specify List<> as the property type rather than ICollection<>, as both List<myobject> and myobject[] have implemented the ICollection<myObject>.
So finally we come to the conclusion:
Prefer to specify ICollection<myobject> as a property type rather than List<myobject>.
9月5日 Encryption and Decryption of stringFor some circumstances, you might need to encrypt a string and later decrypt it, using a symmetric key. This is an examply, how to easily do this with less effords: private void button1_Click(object sender, EventArgs e)
/// set the symmetric key from an xml string: rsa.FromXmlString(XmlKey); byte[] bytes = Encoding.ASCII.GetBytes(textBox2.Text); /// to display the encrypted data as a string, the BitConverter does a /// now decrypt the encrypted bytes[] and convert it into a readable string: Of course there are also other possibilties in .NET that might be more accurate for the purpose, like the class EncrytpedXml which is specialized for xml encryption, or take a look at the System.Security.Cryptography namespaces to explorer a varity of different symetric and asymetric encryption classes like DES, RAS, Rijandel and also common hashing algorithms like the commonly known MD5. 2月8日 The DeltaNode classThe DeltaNode[1] classIn 2003, because I wanted to implement a browser, that is capable to edit huge files, I developed a new algorithm that is capable to handle inserting and deleting of memory blocks inside such a big file without realizable delays. Imagine a big file, and you need to remove some bytes at the beginning. Therefore you need to move a large memory size for the delta of the bytes that have been removed. When you’re using a text editor that holds each line in a separate pointer, you only need to move the pointers from the deleting position down to the file end. This takes less efforts, but when it’s a really big file, such a bdt file, that can hold millions of lines(!), you will even recognize a delay for this movement.
It also needs much space if you use a line array to edit such a file. Eg. a file that has about 6 million lines would need 8million * (2*pointer) bytes. 2, because a pointer for the string itself (that can be pointer to the file offset) and a pointer to the value when it’s edited. This makes 8 million * 16 bytes = 128 MB that would at least necessary to edit such a file. Nowadays, it seems to be acceptable, but in 2003 it was too much! So I developed two techniques to reduce the necessary memory. On technique was to use an arithmetic compensation for the line pointer that points to the file’s offset. Instead of 4 bytes for each line, I only need 1.625 bytes! (because the value is not even, it’s called arithmetic). Maybe I will explain that algorithm later, but now I come back to the second technique, the DeltaNode algorithm:
To avoid to hold a pointer for each changed line, I use the DeltaNode algorithm. Whenever a change is made, when lines where removed or inserted, these changes are stored in so called delta nodes. Basicly the delta node algorithm converts a virtual position (that is the position, after insert/deletions) to a physical position. Of course this conversation must be fast, and indeed the order is less than O(ln(N), where N are the number of nodes. Adding a node has the maximum order O(N), depending on the position, so the average order is O(0.5*N).
When you insert or delete lines, it’s not necessary to move all lines from the deleting/inserting position to the end of file. This algorithm, is fast, as long as you don’t make too much changes on the file, but picture a file of about 80 MB size, and can you honestly imagine to manually make changes about more than 10% ?
The code was implemented with Delphi 2005, and in all that years, it worked properly and I was very glad that it works, because it’s more complex as you think, because changing the node, requires very complex modifications and several cases that must be handled. Now, February 2006, I have rewritten this code for .NET and generalized and enhanced the code. Now it it’s not only usable for virtual lines, but for any kind of elements. To enable this, a IDeltaNodeValue interface must be implemented, which is simply a Collection of the elements you want to handle. The interface has a view functions that need to be implemented, that’s all. Additionally, to access the physical memory, an event must be implemented to get access to it. A specialized DeltaNode class, the DeltaNodeString class, has already implemented the interface for strings, and so you only need to implement the OnGetPhysicalString event to work.
|
|
|