tag:blogger.com,1999:blog-138174522009-02-21T04:22:42.393-08:00Experiencing dotNet with Sergey OsypchukWhat is internet ? Technology ? Protocol? Servers or Software ? Maybe Marketing or Community ?
I could not cover all, but going to talk about all what is interestingSergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.comBlogger38125tag:blogger.com,1999:blog-13817452.post-20823126953811365202008-02-19T11:54:00.000-08:002008-02-19T12:33:55.687-08:00How to autogenerate PK - Guid and other default properties in your LINQ class<span style="font-family:courier new;">partial class Invitation<br />{<br /> partial void OnCreated()<br /> {<br /> if (Id == Guid.Empty)<br /> {<br /> this.Id = Guid.NewGuid();<br /> this.CreatedDate = DateTime.Now;<br /> }<br /> } </span><br /><span style="font-family:courier new;">} </span><br />Also in this sample I am setting CreatedDate for my objects. Works fine.<br /><br /><hr /><br /><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-2082312695381136520?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-54503513184893738662008-02-19T11:50:00.000-08:002008-02-19T11:54:05.856-08:00LINQ - ChangeConflictException when updating row<h4>System.Data.Linq.ChangeConflictException: Row not found or changed</h4><p><br />I had very simple 4 lines: </p><p>ltsRmzLightDataContext data = new ltsRmzLightDataContext();</p><p>invitation = data.Invitations.SingleOrDefault(email => email.Id == invitationId);</p><p>if (invitation != null)</p><p>{</p><p>invitation.IsAccepted = true;</p><p>data.SubmitChanges();</p><p>}</p><p>and was getting System.Data.Linq.ChangeConflictException: Row not found or changed in this simple piece. </p><p>After long googling I fed up and reviewed my class in designer. For me, my problem was that I added few properties and one of them has incorrect name and NUllable property set.</p><p>After fixing this it all started to work fine.</p><p><hr /><br /><p></p><p><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-5450351318489373866?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-1164792665044642042006-11-29T01:18:00.000-08:002007-01-16T02:32:08.883-08:0010 Marketing trends in 2007<span style=";font-family:verdana;font-size:85%;" ><span style="font-weight: bold;"></span>Article covers consumer trends, trends in traditional media, and hot online trends.<br /><br />I was interested mostly in online trends which are:<br /></span><ul><li>Web conferencing as a tool to make demo or even sales from home<br /></li><li>Online research used by about 87% of customers before buying someting in person in store</li><li>Local search in major search engines used more often</li></ul><a href="http://marketing.osypchuk.com">Need internet marketing outsourcing services</a>?<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116479266504464204?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1164716224760247482006-11-28T04:13:00.000-08:002006-11-28T04:17:04.770-08:00Two catalogs of AJAX materialsList of AJAX development tutorials available at:<br />http://shibz.com/2006/11/15/web-development-tutorials/<br /><br />List of "all" AJAX free tools posted here <br />http://facers2006.blogspot.com/2006/11/free-ajax-tools.html<br />by GSINGH<br /><br />Most complex part - find best AJAX toolkit to your needs is not solved :)<br /><span style=";font-family:verdana;font-size:85%;" ><br /></span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116471622476024748?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1164375365762000352006-11-24T05:29:00.000-08:002006-11-24T05:36:05.860-08:00!relevance Software<h4>Relevance software <br /></h4><br />I happened to create a simple relevance calculation tool for texts and going to upload it online soon.<br />Project <a href="http://relevance.osypchuk.com">homepage</a> and blog <a href="http://relevance.osypchuk.com/blog/">here</a><br />Just wondered about huge opportunities for relevance calculations, and noone created good service for that.<br /><hr /><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116437536576200035?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1164359154743378912006-11-24T01:01:00.000-08:002007-01-16T04:45:59.461-08:00SimpleSEM blog<h4>Search Engine Marketing is simple<br /></h4>Good source of new stuff about all world trends in Search Engine Marketing and related is at www.simplesem.com<br /><br />For example, I discovered that MS create a products catalog - <a href="http://www.simplesem.com/blog/2006/showing-your-products-on-live-search/">http://www.simplesem.com/blog/2006/showing-your-products-on-live-search/</a><br /><br />AdWords changed landidng page scoring:<br /><a href="http://www.simplesem.com/blog/2006/alert-another-google-adwords-quality-scoring-update/">http://www.simplesem.com/blog/2006/alert-another-google-adwords-quality-scoring-update/ </a><span style=";font-family:verdana;font-size:85%;" ><br /><br /><br /><a href="http://marketing.osypchuk.com">Order internet marketing outsourcing</a><br /></span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116435915474337891?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1162544284985170052006-11-03T00:53:00.000-08:002006-11-03T00:58:04.996-08:00Code samples repository<h4>Sniprls<br /></h4>This is public source code repository. All code looks to be validated.<br />Ussually such things do not work as ultimate knowledgebase, but I do like for example this one - <a href="http://snipplr.com/view/1462/rounded-corners-with-no-images-just-css-that-works/">rounded corners in html without images</a>.<br />Also has section s for Javascript and css.<br />Could be useful for a developers who started with windows and not fluent with browser dependent technologies.<br /><hr /><span style=";font-family:verdana;font-size:85%;" > </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116254428498517005?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1162541994489682362006-11-03T00:16:00.000-08:002007-01-16T04:47:16.688-08:00Internet marketing for Free [Marketing]Nice article about importance of copyrighting in internet. I am totally agree that texts is most powerful in internet. Some quote:<br /><p style="font-style: italic;">1. Once you learn how to write an article, it’s easy to use this method of promotion. Writing articles is easy, and once you learn how to do it, you can write articles over and over to promote your business.<br /></p><p style="font-style: italic;">2. You don’t have to write a lot of articles either. I’m listed in Google over 47,000 times as I write this, and I’ve only written maybe 70 articles in three years. If I wrote more, it would mean more money.</p><span style="font-style: italic;">If you write one to two articles per week and submit them using a service like Article Marketer, you can do most of your marketing in a couple of hours per week.</span><br /><p style="font-style: italic;">3. With this internet marketing method, you have more control than a lot of other techniques. All you have to do is write good articles and send them out. They will get picked up.</p><span style="font-style: italic;">My articles have been published in over 40 countries, been featured in some of the largest ezines online like Site Pro News, and have also been published in print publications.</span><br /><p style="font-style: italic;">4. Articles brand you as an expert. I am an expert in teaching others how to market on the internet for free. Not really a big niche, but it works for me, and as I continue to promote myself as an expert in this niche, it helps me get branded in the larger internet marketing niche, which is huge.</p>And some more interesting facts for background...<br /><a href="http://www.askjinger.com/internet-marketing-news/free-reports-marketing-with-articles">http://www.askjinger.com/internet-marketing-news/free-reports-marketing-with-articles </a><br /><hr /><a href="http://marketing.osypchuk.com"><span style="font-style: italic;">Need internet marketing services outsourcing</span></a>?<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-116254199448968236?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1154689382167023622006-08-04T03:51:00.000-07:002006-08-04T04:03:02.176-07:00How spam filtering could close companyLast year I was leading of outsourcing office in Ukraine for a small US based company.<br />Because of known reasons, my partner asked me not to use company email for looking for new employees.<br />I created a new small account and setup forwarding to my company mailbox. You know, it is very annoying to check a number of mailboxes - email took a few hours a day for me and I tried to simplify all what is possible. All looks to be working fine.<br />After some moment of time, I noticed that it is very hard to get a new persons for an interview. I checked forwarding - it worked. However, I was able to get <strong>only 1 CV with matching skills during last 3 months</strong>. I tried to post info about job openings in dozen of sources, but it also did not worked out.<br />finally, few guys left, and we was still not able to find new software engineers. We was so late in all our projects that our management made decision to close our office.<br />Today I opened www.gmail.com to delete these mailbox. And I was shocked - 291 email! With real CV and real leads! 90% of all these emails was filtered out by our company ISP provider. <strong>82 of emails had a C# in body</strong>! Even if only 1 of 16 was a good candidate, it means at least +150% to our production forces.<br />As a result, too strict spam filtering cost us dozen of thousands in direct expenses and hundreds of dollars in lost profit for company. 6 of us lost job. Client projects was not done on time (I could not even imagine lost profit for our clients)...<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-115468938216702362?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-1149768552136719882006-06-08T05:06:00.000-07:002006-08-04T04:20:58.656-07:00Size of page - Client viewTeammate is working on HTML site. Customer compiants on size of page.<br />My cleague asked what size of page customer wants to have.<br /><br />Reply was:<br /><br />• Home Page: large background photo = 2550 x 2025 pixels<br /><br />• Contact Page: White / Photo Box = 2550 x 4125 pixels<br /><br />• How To Order Page: White / Photo Box = 2550 x 4350 pixels<br /><br /><br /><br />Does anybody has a ascreen with horisontal resolution 2550 or more pixels ?<br /><hr /><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-114976855213671988?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1148034910002231892006-05-19T02:25:00.000-07:002006-05-19T04:27:08.506-07:00OOP? Patterns? Relax, man!<p>We read a lot of books, study patterns, view webcasts, perform researches in order to be able to build architecture for our projects. </p><p>Recently our client aaaasked us to implement simple shopping cart solution, and we decided to look for something 3rd party. <a href="http://www.aspdotnetstorefront.com">www.aspdotnetstorefront.com</a> has a lot of features, we downloaded a demo version, and find out that we need to add only two features. Decision was made, and client bought it. I downloaded full version, and opened sources. </p><p>Are you ready?</p><p>So,</p><p>120 MB of C# code</p><p>NO inheritance</p><p>NO skins</p><p>NO Factories</p><p>Look & feel integrated into C# code</p><p>However, stings are in resource file, to support localization.</p><p>But not path to images</p><p>EVERYTHING is handled in page load & render. No control event handlers</p><p>NO User controls</p><p>NO Unit testing</p><p>And this is successfull product! I'm really shocked.</p><p>How can you make changes to this? How you can be sure that it will work for any combination of thousands of configuration keys?</p><p>I'm not writing this feedback because this aspdotnetstorefront is bad and do not worth to buy - maybe it is good for your tasks. But I do not like that good coding is not world wide practice and many software is really really bad inside.</p><p><hr /><br /><p></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-114803491000223189?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com2tag:blogger.com,1999:blog-13817452.post-1141066741407123062006-02-27T10:35:00.000-08:002006-02-27T11:18:21.603-08:00Combining WebParts and Master pages [Coding]<h4>Why you need this?</h4><br />Let's review benefits for Master Pages:<br />- all pages have similar layout.<br />- ability to change skin of site<br />WebParts could bring us:<br />- Customization of control properties<br />- Drag&Drop, Minimization, Layout changes, removing of unwanted blocks by user<br />- Exporting of Web Parts to email or something<br />Both set of features are pretty desireable to most applications. Is it possible to combine it corectly?<br /><h4>YES - we can use Masterpages and Web parts</h4><ol><li>Create Masterpage </li><li>Add Web Part Manager to it</li><li>Define layout of page using Tables</li><li>Insert WebPartZone controls into each cell respectively. Each of them could have separate settings. For example, u can allow users to edit some webparts, and move another, and some of areas will be fixed. Also u can change all properties from code later, according to user roles.</li><li>Each WebPage have WebParts which is inserted in it by default. This is called PageCatalog. We want to predefine PageCatalog for each of our Detailed page in WebZone1.</li><li>Put <asp:contentplaceholder id="ContentArea" runat="server"></asp:contentplaceholder> in ZoneTemplate</li><li>Create Detailed page</li><li>U can add web parts, user controls, or server controls to WebZone, which has ContentPlaceholder.</li></ol><hr /><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-114106674140712306?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1137920372331883292006-01-22T00:52:00.000-08:002006-01-22T00:59:32.346-08:00ASP.NET Validators and FirefoxWhen playing with Atlas, I was trying to install validators in dynami parts of page.<br />During this, I was forced to create a validators manually at client side, without server controls and use for this default WebUIValidation.js.<br />During all this i find out:<br />- Validators could work on Firefox - all u need is to render similar Html code. (Check with IE View Source)<br />- Only problem with WebUIValidation file - Microsoft uses a <strong>final</strong> as variable name - and that's why it is not compiles on Firefoix<br />You can download corrected file here: <a href="http://dotnet.osypchuk.com/Sources/WebUIValidation.js">http://dotnet.osypchuk.com/Sources/WebUIValidation.js</a><br />If neccessary, I can put guides how to add Validators without help of donet, but it seems to be obvious - comments are welcome.<br /><hr/><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113792037233188329?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-1136805456545838772006-01-09T03:11:00.000-08:002006-01-09T03:17:36.546-08:00How to find date without time? [Q&A]To find a date without a time, you should use Date property of DateTime structure:<br />DateTime dateWithoutTime = DateTime.Now.Date;<br /><hr/><br />Suggested by Google<br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113680545654583877?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-1136765749278930952006-01-08T16:11:00.000-08:002006-01-09T03:10:46.233-08:00Looking for future: AJAX via Atlas - good or bad [Articles]<h4>Web Services</h4><br /><P>Atlas provides us with very easy ability to call Web services. This is very simple now. <br />December release even support session (September releases didn't).<br />Any web service could be called if it is defined in <b><script></b> block. <br />Somewhere in client Page Load, Atlas generates a proxy class with function <br />which makes such call completely transparent from JavaScript.<br />Also very good that such function is asynchronous - you need <br />to provide additional parameter OnMethodComplete, <br />which will be called when result will be returned.<br><br />I was able to relatively easy create a simple demo - grid which operates through Web Services.<br />My Web service generates a Html code which was replaced into table cells using innerHTML property.</P><br /><h4>Atlas and Web Controls</h4><br /><p>This is good and simple when trying to work with HTML controls. If you need to add some ASP.NET controls - <br />you can count only on yourself. I lost many hours to add validators. In general, my strategy could be described as:<br></P><br /><li>Create ASP.NET page which renders necessary code</li><br /><li>Discover what is generated - HTML, JavaScript includes, JavaScript functions</li><br /><li>Generate similar HTML from Web Service</li><br /><li>Incorporate it dynamically into page</li><br /><li>Collect user input and transfer it back to web service</li><br /><li>Ensure that result is working on different browsers - ASP.NET perform different rendering for different browsers.</li><br><br /><p>Fortunately, I was faced with relatively simple controls: repeater, textbox, button, and RegularExpressionValidator.</P><br /><h4>"Atlas controls"</h4><br /><p>In September 2005 version of Atlas, it has a set of controls which <br />provided unique functionality - TextBox with autocompletition, ListView. <br />It was strange to see parallel hierarchy of controls in ASP.NET and it was removed in<br />December Release.<br><br />Instead, we get Extender concept. <br><br />For example, AutoCompleteExtender <br />able to turn simple TextBox, Input with type="text" (or maybe even something else) into<br />AutoComplete-style control.<br><br />DragOverlayExtender add drag to any control.<br><br /><b>How this is implemented?</b> Atlas generates a special xml in your page, <br />which defines all this behavior. On page loading, this xml is analyzed, and necessary<br />JScript classes instantiated, initialized, and configured.<br><br />And there is a fcuk. How we could even talk about dynamical page behavior, if we could not create new controls dynamically?<br />We cannot add AutoComplete to our edit box, which appears in Edit mode of grid.</p><br /><h4>Who will survive</h4><br /><p>I could see two options: <br><br />Some library which provides completely new and customizable(!) tree of controls to use <br />AJAX advances<br><br />--- or --- <br><br />we need to find (or create) reasonable and easy to use way to create and manage collection of atlas controls using JavaScript. </P><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113676574927893095?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1133733039407532522005-12-04T13:44:00.000-08:002006-03-01T10:36:59.710-08:00Unit testing in dotnet [Articles]<p>In addition to many good strategies for unit testing could be easily found in internet, I described few more things to care about: </p><h4>Application configuration</h4><br /><p>Use virtual class which defines configuration.<br />By default, this class can read data from .config file.<br />For unit testing, this class will have hardcoded values, and help to solve issue with .config file and NUnit.<br />Additional advantage that for different tests you can use different configurations, just create another instance of configuration.<br />Example of configuration strategy described in this article:<br /><a href="http://dotnet.osypchuk.com/2005/06/configuration-files-mapping-to-code.html">http://dotnet.osypchuk.com/2005/06/configuration-files-mapping-to-code.html</a></p><br /><h4>Dates</h4><br /><p>If function is working with date, for example – calculate a balance of user for today, never use DateTime.Now property.<br />If you want to check something which depends on time intervals, you will be forced to change system time during unit test, or ad some system sleeps which increase time necessary for unit testing.<br />Also this could cause incorrect results in distributed environments, when servers has different time zone</p><br /><h4>Separate logic and implementation</h4><br /><p>In ideal world, you should have a one function at business layer for each user operation.<br />However, often this is not true in real life. Very often we need to create complex input parameters for these methods, or call few business layer methods to perform single logical operation.<br />Define some helper in unit tests which hides entire functionality related to implementation. This greatly helps you in case some re-factoring and makes easier to observer logical part of unit test.</p><br /><h4>Reuse strategy</h4><br /><p>For common scenarios, define strategy is virtual class and reuse it.<br />You will have one test to create user, another one to create customer, and last one to create admin.<br />Does not use copy/paste. Please. This is really simple even for juniors.</p><br /><h4>Automatically create test environment</h4><br /><p>From very beginning of your project, implement code which make it live from very beginning.<br />Check and create all internal objects in database, such as administrator, types of payments, packages.<br />In unit tests, you need function responsible to create a necessary state of system, and check if this state is applied in each StartUp method.<br />If system can work in different situations it could be quite expensive to change system states automated. Some time ago I worked with budget system, and some operations was ok only when year is in state planning, some other when year is in state approved, and completely other in state Active. Each UT checked state of year and change it if necessary. Each execution of unit tests created about dozens of years :)<br />It was not simple but only in this way we can be sure that our method which we edit now do not broke data when system is in another state</p><br /><h4>Strings and numbers</h4><br /><p>Do not use hardcoded string and numbers.<br />If you test 2+2 = 4 it do not shows that your + operation is working. Maybe it is always return 4.<br />If you pass random number to function, you will at least knew that it works with other parameters. (And sometimes it may crash because of overflow).</p><br /><h4>Clean up your data after test</h4><br /><p>Add some attribute to objects created by unit tests. For example, all user names start from “UT_”.<br />If this is possible and system supports delete operation on objects, delete all what you created in UT.<br />Create script which drop al objects created by unit tests. Even if you have cleanup section in unit test, sometimes if it is completed unsuccessful you will get a test data in database.</p><br /><hr /><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><h4></h4><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113373303940753252?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1131298517821102132005-11-06T09:29:00.000-08:002005-11-06T10:56:07.753-08:00Visual Studio 2005 - first days<h4>VS.NET 2005 - first days</h4><p>Finally, I found some time to install and check what is VS.NET 2005 (Beta 2). Actualy, it is not so new as I expected. For example, our company already hase similar Master/Detail library for ASP.NET. Also for many of areas we already have internal know hows and time will show, what is better - our internal solution or solution from Microsoft.</p><p>What is really sad, that such feature like Generics require additional installtion - this is most interesting thing for me. For now I am not able to install it - going to try again in few days.</p><p>In meanwhile, I'm playing with Web Parts.</p><h4>Enums upgraded</h4><p><p>I noticed a good technique used to provide exandable enum. In dotnet 1.1, it ws very frustrating for me that a user of compinent could not add a enumeration member.</p><p>In class WebPartManager, property DisplayMode we can see another possibility for predefined choices. </p><p>WebPartDisplayMode is class without public constructor, which can be derived.</p><p>You can make a selection from predefined members using parent class - WebPartManager, and it contains:</p><p>WebPartManager.BrowseDisplayMode;<br />WebPartManager.CatalogDisplayMode;<br />WebPartManager.ConnectDisplayMode;<br />WebPartManager.DesignDisplayMode;<br />WebPartManager.EditDisplayMode;<br />So, we have predefined set of constants checked at compile time, and a possibility to increase this set of possible members in derived class. </p><h4>Possible implementations</h4><p>This classes should have some private random variable, which allow them to answer if it is qual to another instance. For example, it could be Guid.NewGuid, or simple GetHashcode(), or maybe best choice will be localized Name of this instance. </p><h4>Possible additional features</h4><p>Also, by using class, we able to to add extra options to be customizable - for example, Localized name, Behavior parameters (for stream - not only buffered, but also a buffer size), etc. </p><p>Those properties could be both readonly or not. (If not - it will be handy to implement Clone() method - not always needed to change behaviour for all system.</p><p><hr /><p></p><p></p><p><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113129851782110213?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1130333876493691642005-10-26T06:29:00.000-07:002005-12-24T03:26:18.853-08:00How to split text file by lines in one operator? [Q&A]<h4>Using of dotnet constants</h4><p>First of all, this is cheap solution which will do not work good for large files, but is completely OS independent.<br /><span style="font-family:courier new;"></span></p><p><span style="font-family:courier new;">StreamReader reader = File.OpenText(filename);<br /></span><span style="font-family:courier new;">string file = reader.ReadToEnd();<br />reader.Close();<br />string[] elements = file.Split(Environment.NewLine.ToCharArray());</span><br /></p><p>As I can see, I'm not first one who wrote such combination - <a href="http://www.google.com/search?hl=uk&rls=GGLG%2CGGLG%3A2005-30%2CGGLG%3Aen&q=Split+Environment+NewLine+ToCharArray">http://www.google.com/search?hl=uk&rls=GGLG%2CGGLG%3A2005-30%2CGGLG%3Aen&q=Split+Environment+NewLine+ToCharArray</a> </p><p><hr /><br /><p></p><p><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-113033387649369164?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1127469582119616972005-09-23T02:58:00.000-07:002005-09-23T03:05:03.876-07:00Writing sensible email messages<p>Interesting article about good principles for email.</p><p>Most of all, i liked this part:</p><p><em>Depending on the style of your team and the volume of mail they create, you might even consider adding functional text headers to the top of the body outlining the exact nature of the message. </em><pre><em>This email is: [ ] actionable [x] fyi [ ] social<br />Response needed: [ ] yes [x] up to you [ ] no<br />Time-sensitive: [ ] immediate [ ] soon [x] none</em></pre><p>However, I think that the exact options could be changed depending on your custom specific.<br /><hr /><br /><span style="font-family:verdana;font-size:85%;">Thanks to <a href="http://www.developers.org.ua">www.developers.org.ua</a></span><p></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112746958211961697?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1127059812722474362005-09-18T08:08:00.000-07:002005-09-18T09:10:47.206-07:00Intensive Attribute Programming [Coding]<h4>Intensive Attribute Programming - Searching of Attributes </h4><p>One common problem with attribute is to perform a search of it. DotNet do not have function to make deep search of attributes and forces developers to make a search for necessary attribute manually.<br /><em>For example, how to find classes with has methods with some attributes?<br />You need to make a loop on all loaded assemblies, all classes in them, all methods in them, all attributes of those methods, and if u find matching, add it to your result list.<br /></em>I’m sure this is not looks very simple. And of course, this executes to fast – if you enterprise level application use attributes, it requires searches like that. And it is important to find this result quickly.</p><h4>What my code do?</h4><p>My code, provided below, solves 2 problems:</p><ul><li>One function to search for all attribute include derived from specified class – it can search for attributes assigned to class itself, methods, properties, other members. </li><li>All results are cached Hashtable. Next time when application performs this search, result will be ready immediately.</li></ul><h4>How to use it?</h4><br /><p>Examples of usage attached in Unit test project.<br />Result returned as Hashtable. Key is element to which matching attribute applied to; Value – Array List of all attributes matching your criteria.</p><br /><h4>Future extensions</h4><p><br />Maybe it will be good to provide SQL-style search query for function, etc. I’m sure that you can derive implementations specific for your code.</p><br /><h4>DB Configurable attributes</h4><p><br />If your team start to use custom attribute searching function, u will be able to configure attributes dynamically, for example, from DB.For example, MandatoryAttribute set on business object field, could be turned on or off without needs to recompile (and redeploy!) you system.</p><p>Sources: <a href="http://dotnet.osypchuk.com/Sources/OsypchukAttributeSearcher.zip">OsypchukAttributeSearcher.zip</a></p><p><hr /><br /><p></p><p><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112705981272247436?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1124972852104380102005-08-25T05:27:00.000-07:002005-09-04T15:41:13.066-07:00Brainbench - Limited offer to pass 1 of 23 tests free<a href="http://www.brainbench.com/xml/bb/common/testcenter/freetests.xml">Brainbench - Predicting Employee Success</a><br />Limited time offer include few interesting tests:<br />- .NET Framework<br />- Microsoft project 2002<br />U can save $49.95 getting this tests<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112497285210438010?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1123324392114478462005-08-06T03:33:00.000-07:002005-08-06T03:33:51.660-07:00particletree - Successful Strategies for Commenting Code [Links]<a href="http://particletree.com/features/successful-strategies-for-commenting-your-code">particletree - Successful Strategies for Commenting Code</a>: "Successful Strategies for Commenting Code"<br />Good overview of aspects of commenting described, could be used as basis for a company Code Guide. Author used Java but this is also could be used in other languages.<div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112332439211447846?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1123158427740206152005-08-04T05:01:00.000-07:002005-08-04T05:27:07.753-07:00Hashed Aspect Oriented Programming [Articles]<h4>What is Aspect Oriented Programming</h4><p><em>Dictionary: AOP = Aspect Oriented Programming</em><br />The AOP model allows a developer to implement individual concerns of a system in a loosely coupled fashion and combine them into a whole. This enables one to easily modify the behavior of a system dynamically at runtime and thus better enables a system design to meet growing or changing requirements.<br />Idea is to force running environment to trigger event or method whenever that method or property is called or accessed. Also it should allow perform some action before, after, instead of target method/property call.</p><p>Microsoft provides a class <strong>System.ContextBoundObject </strong>to support AOP in dotnet. Classes derived from <strong>System.ContextBoundObject</strong> could use features of AOP, and this is described very well in <a href="1.http://www.theserverside.net/articles/showarticle.tss?id=AspectOrientingNET&News06_21_05-click">this article</a>, also author provides sample source code.</p><p>Microsoft generates proxy classes and uses mechanism similar with remoting. On each call developer able to determine context and add additional logic to basic functionality.However, this gives relatively low performance – performance test was able to run only about 20,000 of context bound operations per second. This is approximately <strong>100 times slower</strong> than virtual method call.<br />Why they have such performance problem?</p><ul><li>Environment is going to determine context each time when context bound method is called</li></ul><p></p><p>What we can do to implement AOP faster?</p><h4>Idea 1 – Context passed among with message</h4><p>Passing context information with message, we simplify task of determining what need to be done in particular aspect.<br />It will be done only once per message, not for each aspect oriented call.</p><h4>Idea 2 – Compress context by hashing</h4><p>Actually, we could think about context as a function which answers if some aspect should be taken into attention.<br />After system analyzed context initially it is defined as set of hashed ids.<br />For example, for SOHO customers we will have a 75896 in context array, and for customers which are our partner we could define key number 84512. (In real system – Guids)<br />In each aspect oriented call, instead of looking to customer record and detailed information, we just checked for ID in context which is relatively simple operation.</p><h4>Idea 3 – Match a overloads to context</h4><p>Each Context Bounded method has information, in which contexts it should be called, and in which not.<br />By hashing it with same id, which was used to describe context, we simplify task in each call to compare an ordered lists of two ids:<br />List of IDs which are describing context (Nc)<br />List of ID describing possible context overloads for particular methods (No)<br />Complexity of determining which methods should be called equal to complexity of merging 2 ordered lists, and is O (Nc + No)<br />For testing Nc was 5, No was 10, and total numbers of aspect dependent places was 1000.</p><h4>Implementation</h4><p>I have tested such call structure structure, in terms of Events:<br /><span style="font-family:courier new;">Try<br />{<br /> OnBeforeCall();<br /> If (OnInstead != null)<br /> OnInstead();<br /> else<br /> Call();<br /> OnAfterCall();<br />}<br />Catch (exception)<br />{<br /> OnException(exception)<br />}</span> </P><p>I can see such ways for implementation: <p><ul><li>Reflection</li><li>Events</li><li>Run time code generation</li></ul><p>I have made tests, and I have that Events are slower 9.85 times than a virtual call (213K op/s), Reflection - 9.55 (220K op/s), and code generation - 4.46 (470K op/s).</p><p>However, Code generation need time for first run - it is at least 100 ms, so I think it could be used only in very specific systems, where you need to execute more than 400000 calls with same context during application life.</p><h4>Summary</h4><p>Hashed Aspect Oriented Programming could help to add another dimension of flexibility in application which need to be ready for future requirements changes with a reasonable performance and implementation cost.</p><p>To be continued...</p><hr /><br /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J# </span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112315842774020615?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0tag:blogger.com,1999:blog-13817452.post-1121347318232880322005-07-14T06:05:00.000-07:002005-08-25T12:49:49.253-07:00Passing SortedList via WebServices [Q&A]Classes which implements IDictionary are very useful for developers. Concept of key - value addressing could be applied in many areas, including web services.<br />however, when you try to return a SortedList, ListDictionary or Hashtable from webservice you get run-time error when accessing web service:<br /><blockquote><p>System.NotSupportedException: The type System.Collections.SortedList is not<br />supported because it implements IDictionary.</p></blockquote>Cheapest server side solution is to return array of DictionaryEntry filled by SortedList.CopyTo method. Sample code is :<br /><span style="font-family:Verdana;font-size:85%;">[WebMethod]<br />public DictionaryEntry[] HelloWorld()<br />{<br />SortedList sl = new SortedList();<br />sl.Add("Key","Value");<br />DictionaryEntry[] deArray = new DictionaryEntry[sl.Count];<br />sl.CopyTo(deArray, 0);<br />return deArray;<br />}<br /></span><span style="font-family:Verdana;font-size:85%;"></span>And on client side you need to create SortedList and fill it manually.<br />Please note, that you can export entries from one list and add it to another. For example, server can use HashTable for better performance and client SortedList in order to display items ordered for end user.<br /><hr /><span style="font-family:verdana;font-size:85%;">Applies to all dotnet languages: C#, VB.NET, C++.NET, J#</span><br /><span style="font-family:verdana;font-size:85%;">Idea of this topic was suggested by <a href="http://www.google.com">google</a> search engine.</span><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112134731823288032?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com1tag:blogger.com,1999:blog-13817452.post-1121247855601369902005-07-13T02:36:00.000-07:002005-07-13T02:46:51.093-07:00Oracle Developer Tools for Visual Studio .NET [News]<h3>Oracle corporation informs about Oracle(R) Developer Tools for Visual Studio .NET 2003.</h3><p>This is free plug-in that enables developers to use Microsoft Visual Studio .NET 2003 to develop and deploy Oracle Database 10g applications on Microsoft Windows. This plug-in integrates Oracle Database 10g and Visual Studio .NET 2003 and reinforces Oracle's commitment to meet the needs of the Windows development community.</p><p>Oracle Developer Tools for Visual Studio .NET 2003 is available today for download from the Oracle Technology Network at: <a href="http://www.oracle.com/technology/tech/dotnet/tools/index.html">http://www.oracle.com/technology/tech/dotnet/tools/index.html</a> . (<strong>187MB</strong>)</p><p>Oracle's support for the Windows development community extends beyond Oracle Developer Tools for Visual Studio .NET 2003. Oracle Database 10g Release 2 incorporates new features that further Oracle's commitment to Windows application developers. Release 2 includes Oracle Database Extensions for the .NET Framework, offering improved Microsoft .NET Framework support via <strong>stored procedures implemented using Common Language Runtime (CLR)</strong>. The new feature enables developers to write .NET Framework-based stored procedures and deploy them into Oracle Database, helping to reduce the time it takes to build and deploy .NET Framework-based applications. Oracle Database 10g Release 2 for Windows is scheduled for availability in the next 90 days. </p><p>Other Oracle products for the .NET Framework, visit the .NET Developer Center on the Oracle Technology Network at <a href="http://www.oracle.com/technology/tech/dotnet/">http://www.oracle.com/technology/tech/dotnet/</a> .<br /></p><div class="blogger-post-footer"><img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/13817452-112124785560136990?l=dotnet.osypchuk.com%2Findex.html'/></div>Sergey Osypchukhttp://www.blogger.com/profile/03848405633632935621noreply@blogger.com0