tag:blogger.com,1999:blog-52753768989985161282024-02-08T02:58:39.578-08:00StuffsAnandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-5275376898998516128.post-4361722838802949872009-02-28T00:57:00.000-08:002009-02-28T00:59:35.022-08:00Convert Generic List In To DataTableI saw the Converting the List to Data Table articles..that are really nice things<br /><br /><h3 style="font-weight: normal;" class="storytitle"><span style="font-size:85%;"><a href="http://amitpatriwala.wordpress.com/2008/12/03/convert-generic-list-in-to-datatable/" rel="bookmark">http://amitpatriwala.wordpress.com/2008/12/03/convert-generic-list-in-to-datatable/</a></span></h3><br />http://lekhok.com/pages/topic_view.aspx?id=39<br /><br /><br />Both are Good Stuffs<br /><br /><p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; color: blue; font-family: 'Courier New';">public</span><span style="font-size: 10pt; font-family: 'Courier New';"> <span style="color: blue;">static</span> <span style="color: rgb(43, 145, 175);">DataTable</span> convert2Table<t>(<span style="color: rgb(43, 145, 175);">List</span><t> list)<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';">{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: rgb(43, 145, 175);">DataTable</span> table = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">DataTable</span>();<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">if</span> (list.Count > 0)<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: rgb(43, 145, 175);">PropertyInfo</span>[] properties = list[0].GetType().GetProperties();<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>> columns = <span style="color: blue;">new</span> <span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>>();<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">foreach</span> (<span style="color: rgb(43, 145, 175);">PropertyInfo</span> pi <span style="color: blue;">in</span> properties)<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>table.Columns.Add(pi.Name);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>columns.Add(pi.Name);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">foreach</span> (T item <span style="color: blue;">in</span> list)<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">object</span>[] cells = getValues(columns, item);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>table.Rows.Add(cells);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">return</span> table;<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';">}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; color: blue; font-family: 'Courier New';">private</span><span style="font-size: 10pt; font-family: 'Courier New';"> <span style="color: blue;">static</span> <span style="color: blue;">object</span>[] getValues(<span style="color: rgb(43, 145, 175);">List</span><<span style="color: blue;">string</span>> columns, <span style="color: blue;">object</span> instance)<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';">{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">object</span>[] ret = <span style="color: blue;">new</span> <span style="color: blue;">object</span>[columns.Count];<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">for</span> (<span style="color: blue;">int</span> n = 0; n <></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>{<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: rgb(43, 145, 175);">PropertyInfo</span> pi = instance.GetType().GetProperty(columns[n]);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">object</span> value = pi.GetValue(instance, <span style="color: blue;">null</span>);<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>ret[n] = value;<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span>}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><span style=""> </span><span style="color: blue;">return</span> ret;<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';">}<o:p></o:p></span></p> <p class="MsoNormal" style="margin: 0in 0in 0pt; line-height: normal;"><span style="font-size: 10pt; font-family: 'Courier New';"><o:p> </o:p></span></p>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com3tag:blogger.com,1999:blog-5275376898998516128.post-64722080919113599902009-02-28T00:51:00.000-08:002009-02-28T00:52:30.090-08:00mchek great technology for AIRTEL mobile userswww.mchek.com<br /><br />You can pay your mobile bills, insurance premiums; buy air tickets and movie tickets from the convenience of your phone.<br /> <br /> <b>• Pay your Airtel Postpaid Bills or Top-up your Airtel Pre-paid<br /> Just SMS “PAY AIRTEL <amount>” to 543219 </amount></b><br /> <br /> <b>• Pay your insurance premium on your mobile</b> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody><tr> <td> <br /></td> <td>ICICI Pru</td> <td valign="top">SMS “MCHEK <policy>” TO 56767 </policy></td> </tr> </tbody></table> <br /> <b>• mCommerce Services</b> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tbody><tr> <td> <br /></td> <td><img src="http://www.mchek.com/images/movie.gif" /> </td> <td valign="top">Book your movie tickets SMS “MOVIE <language> <dd> <no>” to 543219 (only on Airtel) </no></dd></language></td> </tr> <tr> <td> <br /></td> <td><img src="http://www.mchek.com/images/bus.jpg" /> </td> <td valign="top">Book your Bus tickets on RedBus SMS “REDBUS <from> <to> <ddmm> <no>” to 543219 (only on Airtel) </no></ddmm></to></from></td> </tr> </tbody></table> <br /> <b>• You can also pay using mChek on </b><br /> <table border="0" cellpadding="4" cellspacing="0" width="100%"> <tbody><tr> <td align="center" valign="middle"><a href="http://www.yatra.com/" target="_blank"><img src="http://www.mchek.com/images/yatralogo.gif" border="0" /></a></td> <td align="center" valign="middle"><a href="http://www.futurebazaar.com/" target="_blank"><img src="http://www.mchek.com/images/futurebazaar.jpg" border="0" /></a></td> <td align="center" valign="middle"><a href="http://www.sifymall.com/" target="_blank"><img src="http://www.mchek.com/images/sifymall.jpg" border="0" /></a></td> </tr> <tr> <td align="center" valign="middle"><a href="http://shopping.indiatimes.com/" target="_blank"><img src="http://www.mchek.com/images/indiatimesshopping.gif" border="0" /></a></td> <td align="center" valign="middle"><a href="http://www.bookmyshow.com/" target="_blank"><img src="http://www.mchek.com/images/bookmyshow.jpg" border="0" /></a></td> <td align="center" valign="middle"><a href="http://www.homeshop18.com/" target="_blank"><img src="http://www.mchek.com/images/hs18.gif" alt="HS18" border="0" /></a></td> </tr> </tbody></table> <br /> <b>Why mChek?</b><br /> <img src="http://www.mchek.com/images/tick.gif" height="13" width="13" /> mChek is an easy, secure, mobile payment technology that has won the most stringent industry certifications like PCI DSS 1.2 and ISO 27001.<br /> <img src="http://www.mchek.com/images/tick.gif" height="13" width="13" /> The mChek product was voted the “Most Innovative Mobile Customer Care Solution” by the GSMA (The Global Mobile(GSM) Phone Association)Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-8462731604064246722009-01-29T01:10:00.001-08:002009-01-29T01:12:43.790-08:00Repository Factory VS 2008I tried to integrate the repository factory in VS 2008...But it takes 3 days...Finally i got the Guidance Package manager Toolkit and then opened the Repository Source in VS 2008 and modified the repoistory XML in the source to 9.0 and then i build and registered the component it comes in the menu and solution explorer....got the ideas from msdn ...Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-72228962538773903952009-01-29T01:08:00.000-08:002009-01-29T01:09:30.719-08:00PdfSharp ASP.NETPdfSharp tool is great to generate the PDF document from ASP.NET...I did some samples..this makes some tough job easier...Really great opensource to use,...Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-67530009960746002882009-01-29T01:06:00.000-08:002009-01-29T01:08:07.954-08:00Paypal Pay Flow Recurring ASP.NETI have done the paypal pay flow recurring service using the Payflow-dotnet dll..It is easy to create the payment...There is no need to navigate to the paypal..site...The purchases are made in our site..Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-18227214948874473252009-01-21T20:42:00.000-08:002009-01-29T01:06:22.676-08:00Data Matrix 2D Bar Code C# ASP.NET SampleI have created the Data matrix ASCII.Like below<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_jAPB90fBN3M/SXf5py3VcdI/AAAAAAAAAXw/aOTM5kY-3LM/s1600-h/EV-34.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 226px; height: 161px;" src="http://2.bp.blogspot.com/_jAPB90fBN3M/SXf5py3VcdI/AAAAAAAAAXw/aOTM5kY-3LM/s320/EV-34.gif" alt="" id="BLOGGER_PHOTO_ID_5293974383421125074" border="0" /></a><br />This is sample and compared to the Standard this is same as in other site too.We can implement the Data Matrix in ASP.NET and Windows application.i have used the open source C# library from sourceforge ...but it supports rectangle and square automatically..I modified the source to generate the rectangle matrixAnandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com3tag:blogger.com,1999:blog-5275376898998516128.post-13765136788385821972008-12-23T03:12:00.000-08:002008-12-23T03:17:43.127-08:00ASP.NET Design Patterns<span style="font-size:85%;"><br /><span style="font-family: verdana; font-weight: bold; color: rgb(255, 0, 0);">Creational Patterns</span><br /><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Abstract Factory</span> Creates an instance of several families of classes</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Builder </span>Separates object construction from its representation</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Factory Method </span> Creates an instance of several derived classes</span><br /><span style="font-family: verdana;"><span style="font-weight: bold;"> Prototype </span> A fully initialized instance to be copied or cloned</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Singleton </span>A class of which only a single instance can exist</span><br /><br /><span style="font-family: verdana; font-weight: bold;"><span style="color: rgb(255, 0, 0);">Structural Patterns</span><br /><br /></span><span style="font-family: verdana;"> <span style="font-weight: bold;">Adapter </span>Match interfaces of different classes</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Bridge </span>Separates an object’s interface from its implementation</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Composite </span>A tree structure of simple and composite objects</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Decorator </span>Add responsibilities to objects dynamically</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Facade </span>A single class that represents an entire subsystem</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Flyweight </span>A fine-grained instance used for efficient sharing</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Proxy </span>An object representing another object</span><br /><br /><span style="font-family: verdana; font-weight: bold;"><span style="color: rgb(255, 0, 0);">Behavioral Patterns</span><br /><br /></span><span style="font-family: verdana;"><span style="font-weight: bold;"> Chain of Resp</span> A way of passing a request between a chain of objects</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;"> Command </span> Encapsulate a command request as an object</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;"> Interpreter</span> A way to include language elements in a program</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Iterator</span> Sequentially access the elements of a collection</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Mediator </span> Defines simplified communication between classes</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;"> Memento </span> Capture and restore an object's internal state</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Observer</span> A way of notifying change to a number of classes</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">State</span> Alter an object's behavior when its state changes</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Strategy </span>Encapsulates an algorithm inside a class</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Template Method</span> Defer the exact steps of an algorithm to a subclass</span><br /><span style="font-family: verdana;"> <span style="font-weight: bold;">Visitor </span> Defines a new operation to a class without change</span><br /><br />Reference:<br /><br />http://www.dofactory.com/Patterns/Patterns.aspx<br /><br /><br /><br /><br /><br /></span>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-35483808877976241592008-12-23T03:04:00.000-08:002008-12-23T03:11:31.988-08:00Create Dynamic ASP.NET Website in 30 minutes<span style="font-size:100%;"><span style="font-size:130%;"><span style="font-weight: bold;">ASP.NET Patterns & Practices</span></span><br /><br /><span style="font-family: verdana;" id="ctl00_ContentPlaceHolder1_ThePostDescription"></span></span><h3 style="font-family: verdana; font-weight: bold;"><span style="font-size:85%;">Create Data Access Layer Using Data Access Guidance Package</span></h3><span style="font-size:100%;"><span style="font-size:85%;"><span style="font-family: verdana;" id="ctl00_ContentPlaceHolder1_ThePostDescription">Data Access Guidance Package in the Web Service Software Factory to generate a data access layer for a Web Client Software Factory application<br /><br />The factory pattern is easy to implement,it has the code generation capabilities........<br /><br />Download and install<br /><br /><a style="font-weight: bold;" href="http://www.microsoft.com/downloads/details.aspx?FamilyID=C0A394C0-5EEB-47C4-9F7B-71E51866A7ED&displaylang=en">1.GuidanceAutomationExtensions.msi</a><br /><a style="font-weight: bold;" href="http://www.codeplex.com/RepositoryFactory/Release/ProjectReleases.aspx?ReleaseId=7429">2.DataAccessGuidancePackageSetup.msi</a><br /><br /><br /><br />Resources:<br /><br />http://www.codeplex.com/RepositoryFactory<br /><br />http://www.pnpguidance.net/Category/RepositoryFactory.aspx<br /><br /><br /></span></span><br /><br /><br /></span>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-46236545955680800632008-01-25T03:13:00.001-08:002008-01-25T03:13:59.277-08:00Convolution C#.NETConvolution matrix<br /><br /> public static bool Conv3x3(Bitmap b, ConvMatrix m)<br /> {<br /> // Avoid divide by zero errors<br /> if (0 == m.Factor) return false;<br /><br /> Bitmap bSrc = (Bitmap)b.Clone();<br /><br /> // GDI+ still lies to us - the return format is BGR, NOT RGB.<br /> BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br /> BitmapData bmSrc = bSrc.LockBits(new Rectangle(0, 0, bSrc.Width, bSrc.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);<br /><br /> int stride = bmData.Stride;<br /> int stride2 = stride * 2;<br /> System.IntPtr Scan0 = bmData.Scan0;<br /> System.IntPtr SrcScan0 = bmSrc.Scan0;<br /><br /> unsafe<br /> {<br /> byte* p = (byte*)(void*)Scan0;<br /> byte* pSrc = (byte*)(void*)SrcScan0;<br /><br /> int nOffset = stride - b.Width * 3;<br /> int nWidth = b.Width - 2;<br /> int nHeight = b.Height - 2;<br /><br /> int nPixel;<br /><br /> for (int y = 0; y < nHeight; ++y)<br /> {<br /> for (int x = 0; x < nWidth; ++x)<br /> {<br /> nPixel = ((((pSrc[2] * m.TopLeft) + (pSrc[5] * m.TopMid) + (pSrc[8] * m.TopRight) +<br /> (pSrc[2 + stride] * m.MidLeft) + (pSrc[5 + stride] * m.Pixel) + (pSrc[8 + stride] * m.MidRight) +<br /> (pSrc[2 + stride2] * m.BottomLeft) + (pSrc[5 + stride2] * m.BottomMid) + (pSrc[8 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);<br /><br /> if (nPixel < 0) nPixel = 0;<br /> if (nPixel > 255) nPixel = 255;<br /><br /> p[5 + stride] = (byte)nPixel;<br /><br /> nPixel = ((((pSrc[1] * m.TopLeft) + (pSrc[4] * m.TopMid) + (pSrc[7] * m.TopRight) +<br /> (pSrc[1 + stride] * m.MidLeft) + (pSrc[4 + stride] * m.Pixel) + (pSrc[7 + stride] * m.MidRight) +<br /> (pSrc[1 + stride2] * m.BottomLeft) + (pSrc[4 + stride2] * m.BottomMid) + (pSrc[7 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);<br /><br /> if (nPixel < 0) nPixel = 0;<br /> if (nPixel > 255) nPixel = 255;<br /><br /> p[4 + stride] = (byte)nPixel;<br /><br /> nPixel = ((((pSrc[0] * m.TopLeft) + (pSrc[3] * m.TopMid) + (pSrc[6] * m.TopRight) +<br /> (pSrc[0 + stride] * m.MidLeft) + (pSrc[3 + stride] * m.Pixel) + (pSrc[6 + stride] * m.MidRight) +<br /> (pSrc[0 + stride2] * m.BottomLeft) + (pSrc[3 + stride2] * m.BottomMid) + (pSrc[6 + stride2] * m.BottomRight)) / m.Factor) + m.Offset);<br /><br /> if (nPixel < 0) nPixel = 0;<br /> if (nPixel > 255) nPixel = 255;<br /><br /> p[3 + stride] = (byte)nPixel;<br /><br /> p += 3;<br /> pSrc += 3;<br /> }<br /> p += nOffset;<br /> pSrc += nOffset;<br /> }<br /> }<br /><br /> b.UnlockBits(bmData);<br /> bSrc.UnlockBits(bmSrc);<br /><br /> return true;<br /> }Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-73857911201313004822008-01-25T03:06:00.000-08:002008-01-25T03:07:29.791-08:00Ruler in C#.NETHere i have posted Ruler user control<br /><br />using System;<br />using System.Collections.Generic;<br />using System.ComponentModel;<br />using System.Drawing;<br />using System.Data;<br />using System.Text;<br />using System.Windows.Forms;<br /><br />namespace RulerTest<br />{<br /> public partial class Ruler : UserControl<br /> {<br /> private int _width;<br /> private int _height;<br /><br /> public int RulerWidth<br /> {<br /> get { return _width; }<br /> set { _width = value; }<br /> }<br /> public int RulerHeight<br /> {<br /> get { return _height; }<br /> set { _height = value; }<br /> }<br /><br /> public Ruler()<br /> {<br /> InitializeComponent();<br /> }<br /><br /> <br /> private void DrawRuler(Graphics g, int formWidth, int formHeight)<br /> {<br /> // Border<br /> //g.DrawRectangle(Pens.Black, 0, 0, formWidth - 1, formHeight - 1);<br /> <br /><br /> // Width<br /> //g.DrawString(formWidth + " pixels", Font, Brushes.Black, 10, (formHeight / 2) - (Font.Height / 2));<br /><br /> // Ticks<br /> for (int i = 0; i < formWidth; i++)<br /> {<br /> if (i % 2 == 0)<br /> {<br /> int tickHeight;<br /> if (i % 100 == 0)<br /> {<br /> tickHeight = 15;<br /> DrawTickLabel(g, i.ToString(), i, formHeight, tickHeight);<br /> DrawTick(g, i, formHeight, tickHeight);<br /> }<br /> else if (i % 10 == 0)<br /> {<br /> tickHeight = 10;<br /> DrawTick(g, i, formHeight, tickHeight);<br /> }<br /> else<br /> {<br /> tickHeight = 5;<br /> }<br /><br /> <br /> }<br /> }<br /> }<br /><br /> private static void DrawTick(Graphics g, int xPos, int formHeight, int tickHeight)<br /> {<br /><br /> // Top<br /> g.DrawLine(Pens.White, xPos + 50, 40, xPos + 50, -tickHeight + 40);<br /><br /> // Left<br /> g.DrawLine(Pens.White, 40, xPos + 50, -tickHeight + 40, xPos + 50);<br /><br /> }<br /><br /> <br /> private void DrawTickLabel(Graphics g, string text, int xPos, int formHeight, int height)<br /> {<br /> // Top<br /> g.DrawString(text, Font, Brushes.White, xPos + 45, -height + 20);<br /><br /> // Left<br /> g.DrawString(text, Font, Brushes.White, -height+20, xPos+45);<br /> }<br /><br /> private void Ruler_Paint(object sender, PaintEventArgs e)<br /> {<br /> Graphics graphics = e.Graphics;<br /> int height = Width;<br /> int width = Height;<br /> <br /> DrawRuler(graphics, width, height);<br /> <br /> <br /> <br /> }<br /><br /> <br /> }<br />}Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-1023252973385230612008-01-25T03:02:00.000-08:002008-12-09T19:08:50.733-08:00Unsharp Mask in C#.NET<b>UnSharp Mask filter (called USM)</b><br /><br />Resolution might add detail, but it can't add sharpness, they're different things. Resolution adds the detail that lets us recognize features. Sharpness makes edges clear and distinct. The standard tool of choice for sharpening is the <b>UnSharp Mask filter (called USM)</b>. It's magic! Most good programs have a USM. Scanners often include a USM tool, but normally the USM sharpening is done after the scan, as the final operation in an image program that saves the image file.<br /><br />Example:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jAPB90fBN3M/R5nHYP3HqcI/AAAAAAAAALQ/uPctlyFFkDs/s1600-h/DSC003701.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 217px; height: 229px;" src="http://3.bp.blogspot.com/_jAPB90fBN3M/R5nHYP3HqcI/AAAAAAAAALQ/uPctlyFFkDs/s320/DSC003701.jpg" alt="" id="BLOGGER_PHOTO_ID_5159374067518122434" border="0" /></a><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_jAPB90fBN3M/R5nHYP3HqbI/AAAAAAAAALI/nNRedfDxSNE/s1600-h/anand.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 200px; height: 198px;" src="http://3.bp.blogspot.com/_jAPB90fBN3M/R5nHYP3HqbI/AAAAAAAAALI/nNRedfDxSNE/s320/anand.jpg" alt="" id="BLOGGER_PHOTO_ID_5159374067518122418" border="0" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_jAPB90fBN3M/R5nHYf3HqdI/AAAAAAAAALY/e8RmG84JL1Y/s1600-h/A.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_jAPB90fBN3M/R5nHYf3HqdI/AAAAAAAAALY/e8RmG84JL1Y/s320/A.jpg" alt="" id="BLOGGER_PHOTO_ID_5159374071813089746" border="0" /></a><br /><br />I feel this one will do unsharp mask but its not doing accurate...(<br /><br />private unsafe Bitmap UnsharpMask(Bitmap img, double amount, int radius, int threshold)<br />{<br /><br /> if (amount > 500) amount = 500;<br /> amount = amount * 2;<br /> if (radius > 50) radius = 50;<br /> radius = radius * 2;<br /> if (threshold > 255) threshold = 255;<br /><br /> if (radius == 0)<br /> {<br /> img.Dispose();<br /> return img;<br /> }<br /> int w = img.Width; int h = img.Height;<br /> Bitmap imgCanvas = new Bitmap(w, h);<br /> Bitmap imgBlur = new Bitmap(w, h);<br /><br /> for (int i = 0; i < con =" new" imgblur =" (Bitmap)img.Clone();" imgdata1 =" img.LockBits(new" imgdata2 =" imgBlur.LockBits(new" p1 =" (byte*)(void*)imgdata1.Scan0;" p2 =" (byte*)(void*)imgdata2.Scan0;"> 0)<br /> {<br /><br /><br /> for (int x = 0; x < y =" 0;" imgrvalue =" p1[2];" imggvalue =" p1[1];" imgbvalue =" p1[0];" imgblurrvalue =" p2[2];" imgblurgvalue =" p2[1];" imgblurbvalue =" p2[0];" rnew =" (Math.Abs(imgRValue">= (int)threshold)<br /> ? Math.Max(0, Math.Min(255, ((int)amount * (imgRValue - imgBlurRValue)) + imgRValue)) : imgRValue;<br /> int gNew = (Math.Abs(imgGValue - imgBlurGValue) >= (int)threshold)<br /> ? Math.Max(0, Math.Min(255, ((int)amount * (imgGValue - imgBlurGValue)) + imgGValue)) : imgGValue;<br /> int bNew = (Math.Abs(imgBValue - imgBlurBValue) >= (int)threshold)<br /> ? Math.Max(0, Math.Min(255, ((int)amount * (imgBValue - imgBlurBValue)) + imgBValue)) : imgBValue;<br /><br /> if ((imgRValue != rNew) || (imgGValue != gNew) || (imgBValue != bNew))<br /> {<br /> p1[0] = (byte)bNew;<br /> p1[1] = (byte)gNew;<br /> p1[2] = (byte)rNew;<br /><br /> }<br /> p1 = p1 + 3;<br /> p2 = p2 + 3;<br /><br /><br /> }<br /> <br /> }<br /><br /> }<br /> else<br /> {<br /> for (int x = 0; x < y =" 0;" rgb =" img.GetPixel(x," imgrvalue =" Convert.ToInt32(rgb.R);" imggvalue =" Convert.ToInt32(rgb.G);" imgbvalue =" Convert.ToInt32(rgb.B);" imgblurrgb =" imgBlur.GetPixel(x," imgblurrvalue =" Convert.ToInt32(imgBlurRGB.R);" imgblurgvalue =" Convert.ToInt32(imgBlurRGB.G);" imgblurbvalue =" Convert.ToInt32(imgBlurRGB.B);" rnew =" ((int)amount"> 255)<br /> rNew = 255;<br /> else if (rNew < rnew =" 0;" gnew =" ((int)amount"> 255)<br /> gNew = 255;<br /> else if (gNew < gnew =" 0;" bnew =" ((int)amount"> 255)<br /> bNew = 255;<br /> else if (bNew < 0)<br /> bNew = 0;<br /><br /> img.SetPixel(x, y, System.Drawing.Color.FromArgb(rNew, gNew, bNew));<br /><br /> }<br /> }<br /><br /> }<br /><br /> img.UnlockBits(imgdata1);<br /> imgBlur.UnlockBits(imgdata2);<br /><br /> return img;<br />}Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com3tag:blogger.com,1999:blog-5275376898998516128.post-32718678725079047812007-12-25T20:59:00.000-08:002007-12-25T21:02:35.102-08:00SQLite in ASP.NETSystem.Data.SQLite is used to connect the SQLite ..but it is not a built in namespace....it is downloaded from third party...here i am not able to attach the dllAnandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-62300320927969299422007-12-23T22:17:00.000-08:002007-12-23T22:20:17.304-08:00ImageMagick C#.NET<span style="font-size:85%;"><span style="font-family:verdana;">I have posted the <a href="http://www.discussweb.com/c-programming/3926-imagemagick-magicknet-c-webapplication.html">ImageMagick</a> using C#.NET....Pls read this<br /><br />Here Release build for ImageMagick DLL and useful discussions....<br /></span></span>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-4832984590448933842007-12-23T22:12:00.000-08:002007-12-23T22:15:53.335-08:00Google Gear in ASP.NET<span style="font-family: verdana;font-size:85%;" >Google introduced the offline support for web apps..<br /><br />http://code.google.com/apis/gears/<br /><br /><br /></span><span style="font-size:85%;"><span style="font-family: verdana;">There are many ways to approach offline web applications. The Gears team believes in the open web and the simple technologies it is built on, and we didn't want to change that. So Gears is an incremental improvement to the web as it is today. It adds just enough to AJAX to make current web applications work offline.</span><br /></span><span style="font-family: verdana;font-size:85%;" ><br /><br /></span>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0tag:blogger.com,1999:blog-5275376898998516128.post-62179116975137697972007-12-23T21:56:00.000-08:002007-12-23T21:58:32.329-08:00ASP.NET<span style="font-size:85%;"><span style="font-family: verdana;">Record Sound in ASP.NET<br /><br />Steps:<br /><br /></span></span><span style="font-size:85%;color:#000000;">Add the below API<br />[DllImport(”winmm.dll”, EntryPoint = “mciSendStringA”, CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]<br />private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);</span> <p><span style="font-size:85%;color:#000000;"> Create three Buttons and given the below name and text for the buttons.</span></p> <p><span style="font-size:85%;color:#000000;">1. Record<br />2. SaveStop<br />3. Read</span></p> <p><span style="font-size:85%;color:#000000;">1. Under Record Button Click paste the below Code:</span></p> <p><span style="font-size:85%;color:#000000;">// record from microphone<br />mciSendString(”open new Type waveaudio Alias recsound”, “”, 0, 0);<br />mciSendString(”record recsound”, “”, 0, 0);</span></p> <p><span style="font-size:85%;color:#000000;">2. Under Save / Stop button Click,</span></p> <p><span style="font-size:85%;color:#000000;">// stop and save<br />mciSendString(”save recsound c:\\record.wav”, “”, 0, 0);<br />mciSendString(”close recsound “, “”, 0, 0);<br />Computer c = new Computer();<br />c.Audio.Stop();</span></p> <p><span style="font-size:85%;color:#000000;">3. Under Read Button Click</span></p> <p><span style="font-size:85%;color:#000000;">Computer computer = new Computer();<br />computer.Audio.Play(”c:\\record.wav”, AudioPlayMode.Background);</span></p><span style="font-size:85%;">Save option is only access the Root Folder<br /><span style="font-family: verdana;"><br /></span></span>Anandhttp://www.blogger.com/profile/10418832476179581915noreply@blogger.com0