.NET Evangelist - Abi Bellamkonda

Monday, February 13, 2006

System.Data.SqlClient.SqlClientPermission

You get the follwoing error when cconnecting to a SQL Server database from a Win App in .net 2.0 sometimes.
Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

A quick search on google showed http://www.vbcity.com/forums/topic.asp?tid=105907&#RID380236. All you need to do is just

  1. open solution explorer-->Click Project Properties--> Click Security tab-->Tick 'Enable ClickOne Security settings'.
  2. Ensure you have selected 'This is a full trust application', or appropriate security settings.
  3. Recompile and run.

Gmail For Your Domain

Google is looking for organizations to beta test its new hosted email service. From the information page: 'This special beta test lets you give Gmail, Google's webmail service, to every user at your domain. Gmail for your domain is hosted by Google, so there's no hardware or software for you to install or maintain.' The beta test is limited, but Google is accepting open applications. I am excited about Google buy and this hosted mail service.

Thursday, February 09, 2006

Invalid Cast Exception XMLElement

You wrote a class say StoredItemElement, that inherited from XmlElement class. When you open the document and try to cast the Element to StoredItemElement, you get an exception "Cannot cast 'this.SelectSingleNode("/WorkFlow/Messages")' (which has an actual type of 'System.Xml.XmlElement') to 'Roadhouse.WorkFlow.Engine.Messages'". In other words its "Specified cast is not valid" exception. Then do the following... 1. Don't use XmlDocument, write a class, say StoredElementDocument : XmlDocument 2. Override the CreateElement method in StoredElementDocument as below.. public override XmlElement CreateElement( string prefix, string localname, string namespaceuri ) { switch(localname) { case "StoredItemElement": return new StoredItemElement(prefix, localname, namespaceuri, this); // ..... Any other XmlElements default: return base.CreateElement(prefix, localname, namespaceuri); } } 3. Use StoredElementDocument instead of XmlDocument StoredElementDocument doc = new StoredElementDocument(); doc.Load("File.xml"); StoredItemElement element = (StoredItemElement)doc.SelectSingleNode("//StoredItem");

Monday, February 06, 2006

404 NET framework IIS6

I received 404 when i tried to open a ASP.NET app, after installing 1.1 & 2.0 frameworks on a virtual machine. To my suprise the following solution worked.

  1. Open IIS
  2. Expand [COMPUTER NAME]--> Web Service Extenstions
  3. Select ASP.NET frameworks and click 'Allow'

Thursday, February 02, 2006

Imagine Cup 2006

There is a new competition going on now, called Imagine Cup 2006. Ohhh, i still haven't started working on TopCoder Intel competition yet. The following is an extract of what is available in the competition.

We are working with Universities to integrate the Imagine Cup Software Design Invitational into course work for Semester 1 2006. The theme for Imagine Cup 2006 is "imagine a world where technology helps us to live healthier lives". We could integrate this as an assignment or project for next year. The winning team and lecturer from Australia will be flown to the worldwide finals in Delhi, India next year to win up to USD$25,000 in the software design category.

If you are interested in integrating and promoting Imagine Cup 2006 please email netoz@microsoft.com

Software Design Invitational

The Software Design Invitational challenges students around the globe to explore their own creativity by using technology to solve what they consider to be challenging problems. Imagine Cup provides a theme but the competitors provide the genius behind innovative, dynamic, and powerful software applications. Using Microsoft tools and technology, competitors can unleash their ideas, their curiosities, and their talents towards creating usable software applications. Competitors are asked to demonstrate innovation on the .NET Framework and Windows platform but the possibilities only begin with these requirements. Globally, students in this invitational conceive, test, and build their ideas into applications that can change the world. Many former winners go on to start their own companies, work at major corporations, and even integrate their projects into how their schools approach teaching.

  • Teams of up to 4 individuals
  • Theme: Imagine a world where “technology helps us to live healthier lives”
  • Presentations and documentation at the WW finals must be in English, first and second rounds are subject to language requirement set by the Microsoft subsidiary you compete within.
  • Self created Web service
  • Designed on .NET Framework 2.0
  • Use of Visual Studio family (Express, Standard, or Team System) for development
  • Mobile device
  • .NET Compact Framework
  • ASP .NET
  • SQL Server
  • Application executables and readme files
  • Project specification, no more than 5 pages
  • One page executive summary
  • Oral presentation – length TBD based on number of qualifying teams
  • Visual representation of system architecture

  • 15% Problem Definition
    • How difficult is the problem being addressed? How well is it being defined?
  • 60% Design

    • Equal consideration will be given to:
      • Innovation – applications that approach a new problem, or look at an old problem in a new way.
      • Impact - applications that either impact a large number of people very broadly, or impact a smaller number of people very deeply.
      • Effectivenessto what degree the application actually solves the problem in question.

  • 15% Development
    • The judges will be looking for elegant system architectures that break the problem down into logical chunks and modules.

  • 10% Presentation
    • The judges will be looking for oral presentations that provide background and context to the project, explain why the problem is an interesting one, highlight how the system works, and include an insightful demonstration. Teams will also be evaluated on their ability to take questions from the judging panel.
  • A simple numerical scoring system will be used. Each Judging element will be given a score of 1-10 and weighted according to guidance seen in the percentages associated with each.
  • Participants must have built and presented a running software application that won a national or regional level competition in a country or region that is sponsoring a winning team for the worldwide Imagine Cup finals.
  • First Place $25,000
  • Second Place $15,000
  • Third Place $10,000
  • Additional prizes: Competitors that achieve advancement to the worldwide finals will also receive travel and accommodations to attend the final competition in Delhi, India.

Tuesday, January 24, 2006

Intel Code Competition

Intel® Software Network Multi-threading Competition Series
Intel are holding a competition at http://www.topcoder.com/intel. This is aimed at developing multi threaded applications on multi processor computers. This will occur during a 12 month period. Each competion will last for 2 weeks. You could win Monthly Cash Prizes: Champion - $2,500 2nd Place - $1,000 3rd Place - $750 4th Place - $500 5th Place - $250 First match starts 26th Jan 2006. Testing will be on the following machines
  1. 4 (Paxville) Dual-Core Intel® Xeon® 3GHz processors with 8 MB L2 Cache
  2. Intel® E8500 chipset (Twin Castle)
Let the Games Begin !!

Monday, January 23, 2006

Difference in File uploads in .NET 2.0

Uploading multiples file was not too easy in .NET 1.1 framework. In .NET 2.0 they have introduced something called "Request.Files".

Request.Files
This is what you have to do if you want to upload multiple file in .NET 2.0 framework HttpFileCollection uploadedFiles = Request.Files; for (int i = 0; i < uploadedFiles.Count; i++) { HttpPostedFile userPostedFile = uploadedFiles[i]; userPostedFile.SaveAs(Server.MapPath("~/Downloads/") + System.IO.Path.GetFileName(userPostedFile.FileName))); }

Friday, January 20, 2006

LDAP Attributes list

This link http://www.computerperformance.co.uk/Logon/LDAP_attributes_active_directory.htm has a good list of Active Directory attributes. The good thing about this is that it shows us the corresponding screens in Active Directory while showing the attribute names.

Friday, January 13, 2006

Difference between OVER(), RANK() and DENSE_RANK()

I came across this article at 4GuysFromRolla. They spoke about OVER, RANK, DENSE_RANK in SQL Server 2005. SQL brought in these functions (oh yeah oracle had it since i was wearing nappies). Though i used RANK's in Oracle, i didn't really understand the difference before.

  1. OVER - gives sequential numbers
  2. RANK - gives ranks to records, so more than a record may have same rank
  3. DENSE_RANK - same as ranks, but will continue the ranking number, but rank will skip ranks when more than a record gets same rank.

Paging in SQL Server 2005

Oracle has ROWNUM column which will let us select paged records(gets you 21-30 records) by using the following query. SELECT * FROM (SELECT RowNum, P.* FROM Products P) As T WHERE T.RowNum BETWEEN 21 and 30 SQL Server 2000 didn't have this feature. Paging in SQL Server 2000, was a pain, we had to build dynamic SQL to do the paging or use temp tables.

SQL Server 2005 has "RowNum" now
Its better to be late than never. This following query will give us the records from 21-30. Both 21 and 30 can be replaced by @Start and @End variables. SELECT * FROM (SELECT ROW_NUMBER() OVER (ORDER BY Title DESC) AS RowNum, * FROM Product) As P WHERE RowNum BETWEEN 21 AND 30 Also SQL Server 2005's TOP keyword takes variables now. I was used to a solution similar to a comment at http://weblogs.sqlteam.com/jeffs/archive/2003/12/22/672.aspx#1524. Now we can do this instead of dynamic SQL. SELECT * FROM (SELECT TOP @PageSize ROW_NUMBER() OVER (ORDER BY Title DESC) AS RowNum, * FROM Product) P WHERE P.RowNum> @PageSize * (@PageNumber-1) You still need ROW_NUMBER, unless you sort other way round.

Canvas Tutorial

Canvas
Canvas is a HTML element that is planned to be introduced in HTML 5. Canvas is like a blackboard where we can draw (paint) any kind of Art we want. This is currently available in FireFox, you can do the following stuff (Its similar to GDI in .NET). Canvas tutorial is available here http://developer.mozilla.org/en/docs/Canvas_tutorial:Applying_styles_and_colors#Transparency
  1. Different types of line caps
  2. Arcs and sectors
  3. Callout symbols using quadraticCurveTo() method, we can draw lines and other shapes too
  4. Drawing up nice shapes using arcs & circles.
  5. Drawing symetric shapes
  6. Coloring them
  7. Radial Gradient filling
  8. Filling regions and lines with Linear Gradients
  9. Drawing Arcs with diiferent colors & Alpha values
  10. Animate them all
  11. Using images to show like Art Gallery

Thursday, January 05, 2006

Top Coder Open 2006 Begins !

The Games have begun !
Oh yes, prize money is USD $150,000 this time. As usual, they have algorithm, design and development competitions this time. Algorithms can be written in C#, VB.NET, Java or C++. But mind you, its NOT easy. We have to get the things right, within the given time frame. You can parctice algorithms question in Top coder. The competition is held at http://www.topcoder.com/tc?module=Static&d1=tournaments&d2=tco06&d3=about

Tuesday, January 03, 2006

Ajax Ian

I found this useful blog. They are giving tons of useful User Interface information. Targetting usability/cross browser stuff. Their URL is

http://ajaxian.com/

Wednesday, December 28, 2005

XUL Challenge

There was a recent XUL challenge at http://www.sourceforge.net , they show cased many extensible User interfaces. They all had to develop a little application using different extensible User interfaces.

The Unnoticed .NET 2.0 Standard controls

We have noticed many new controls in .NET framework 2.0, like DataSources and GridView, DetailsView, Tree, ObjectDataSource, SiteMap, Web parts and so on. I found some controls have gone unnoticed.

MultiView and View
MultiView control composites multiple views, developer can set the ActiveViewIndex when required. This has got it purpose, as there are several instances where we have multiple views, but we have to show a view to a user based on User's access and views are very different to each other. We typically used to achive this using Panel controls and setting their visibility property to true/false. A typical multiView control can look like... <asp:multiview id="MultiView1" runat="server" activeviewindex="0">     <asp:view id="View1" runat="server">         Now showing View #1<br />         <asp:textbox id="TextBox1" runat="server"></asp:TextBox><strong> </strong>         <asp:button id="Button1" runat="server" text="Button"></asp:View>     <asp:view id="View2" runat="server">         Now showing View #2<br />         <asp:hyperlink id="HyperLink1" runat="server" navigateurl="http://www.asp.net">HyperLink</asp:HyperLink>         <asp:hyperlink id="HyperLink2" runat="server" navigateurl="http://www.asp.net">HyperLink</asp:HyperLink></asp:View>     <asp:view id="View3" runat="server">         Now showing View #3<br />         <asp:calendar id="Calendar1" runat="server"></asp:Calendar>     </asp:View> </asp:MultiView> We can set the active view by the following MultiView1.ActiveViewIndex = DropDownList1.SelectedValue
Substitution
Substitution is useful when you have a Page/UserControl that is cached, but you want somethings to be dynamic. Substitution enables us to do this. In past we choose not to cache as one of the option. or to split the Page/UserControl intto multiple UserControls. In the below example the cached time will change every 60 seconds, but Substitution time changes for every request. <%@ Page Language="C#" %> <%@ OutputCache Duration="60" VaryByParam="none" %> <script runat="server"> static string GetCurrentDate(HttpContext context) { return DateTime.Now.ToString(); } </script> <form id="form1" runat="server"> Cached Time:<%= DateTime.Now.ToString() %> Substitution time: <asp:Substitution ID="Substitution1" runat="server" MethodName="GetCurrentDate" /> </form> Its is intesting to note that these methods take HttpContext as argument, which is reasonable, as that's required in most cases. We can also use Response.WriteSubstitution (new HttpResponseSubstitutionCallback(GetCurrentDate)) method to do the same too. It looks like we can get most of the string stuff. I have to explore if we can use Substitution for DataGrid or so on.
Wizard
Wizard is an other Standard control, it delivers forms in Wizard style. I will try not to use this, as when you say Wizard, it means you have a big form, which implies that users are not going to visit the site, as you might expect. Forms should be as simple as possible (KIS = keep it simple). There is lot said about Wizard at http://beta.asp.net/QUICKSTART/aspnet/doc/ctrlref/standard/wizard.aspx

Friday, December 02, 2005

The request failed with HTTP status 407: Proxy authentication required

My wife developed a ConsoleApp that communicates to a Web Service which was deployed at client site later. The ConsoleApp gave a problem

The request failed with HTTP status 407: Proxy authentication required
When we googled for this problem, we found the link http://support.microsoft.com/default.aspx?scid=kb;en-us;330221 which instructs us to set the proxy settings as below... WebProxy myProxy = new WebProxy("http://proxyserver:port",true); myProxy.Credentials = new NetworkCredential("username", "password", "domain"); FindServiceSoap myFindService = new FindServiceSoap(); myFindService.Proxy = myProxy;

Monday, November 28, 2005

I won XBox 360 & Xbox 360 Game !!!

I won XBox 360 & Xbox 360 Game !! It says Abishek Bellamkonda from Melbourne, Australia, using Grasshopper Abishek used Grasshopper for the port and said "I had a few hiccups, but for the most part, Grasshopper did the work for me." Abishek ported both the Time Tracker and Reports kit and said the first port took a couple of hours and the second one took about 30 minutes or so, including through testing.

Abishek won an Xbox 360 and a game of his choice.

Roadhouse made an offer

Adam gave me a call for a chat and asked if i am intrested to come back to Roadhouse and made a good offer. I accepted it gladly. Its all good, the bad thing is that my wife works at same company.

Monday, November 21, 2005

Finished the DAMN part-time Masters degree exams

Ok today was my last exam for my part-time Masters degree course. Now i will get some time for code competitions and other stuff. Went partying around today.

Saturday, November 12, 2005

DotLucene

A colleague pointed me to an software that searches stuff. Obviously I explored the files available and found DotLucene, which is currently "The Fastest Open Source Fulltext Search Engine for .NET". It basically will index documents and retrieve them on request. The results are pretty good. Its worth using it. It can be used, customised in many projects.

Monday, October 31, 2005

My own Find

My own custom client side find functionality for IE. <input type="text" id="SearchText" value="the"> <input type="button" onclick="doFind(SearchText.value, searchableText);" value="Find"> <INPUT onclick="clearFind(SearchText.value, searchableText);" type="button" value="Clear" name="ClearSearchButton"> var HIGHLIGHT_START = ""; var HIGHLIGHT_END = ""; function doFind(text, elementToSearch) { var re = new RegExp(text, "ig"); elementToSearch.innerHTML = elementToSearch.innerHTML.replace(re, HIGHLIGHT_START + text + HIGHLIGHT_END); } function clearFind(text, elementToSearch) { var re = new RegExp(HIGHLIGHT_START + text + HIGHLIGHT_END, "ig"); elementToSearch.innerHTML = elementToSearch.innerHTML.replace(re, text); } This is a working version

Authorities have detected signs of bird flu at a farm in northern Japan and plan to kill 82,000 chickens, local officials say. The farm in Ibaraki prefecture, just north east of Tokyo, was already inside a quarantined area because of past outbreaks, Kyodo News agency reported. Kyodo said 1.5 million birds had already been culled in the area because of bird flu fears. Authorities found signs of the disease in seven farms in the area at the end of August. In today's case, antibody tests showed the chickens may be infected with a virus from the H5 family, Ibaraki prefectural officials said in a statement. Signs of the antibodies means the chickens were infected in the past but had survived. Japanese officials said the strain involved in the recent outbreaks is less virulent that the H5N1 variety that has ravaged poultry in South-East Asia since 2003 and killed more than 60 people in Vietnam, Thailand and Cambodia. Bird flu hit Japan last year for the first time in decades, killing or prompting the extermintion of hundreds of thousands of chickens. Japan also confirmed a human case of bird flu in December 2004, but no deaths have been reported. An outbreak in June forced the culling of about 94,000 birds at another farm outside Tokyo. It was caused by the H5N2 bird flu strain, a variety not known to infect humans.

Sometext
isavailable
inthe
aTable

Friday, October 21, 2005

Xaml

I had my university assignments recently. One of the assignment in Advanced .NET subject was to develop a multi-threaded Application to simulate a car park. I wanted to score as much as i can, and the lecturer Andrew Cain has allocated bonus marks for the subject when someone does something intresting. I wanted the interface to look good, i knew that using vector graphics will make UI better. Doing a quick google i came accross a Xaml. Xaml is used to define User interfaces using markup. More information on Xaml can be found at http://www.xaml.net/ and http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnintlong/html/longhornch03.asp Marc Clifton has a website called http://www.vgdotnet.com/ that provided .NET libraries to produce User interfaces using Xaml. It provides a lite version and a full version. Lite was sufficent for me. The above image shows how we can develop buttons with gradients. The below image show a Clock and calculator Application that we developed as Controls using Xaml. This site has something called Translucent forms, which will make the UI even better as shown below...

I'm think not to develop normal classic Windows Applications anymore. I want to use Xaml as much as possible.

Saturday, September 24, 2005

Time Tracker

I took part in the "Race To Linux" and submitted a Grasshopper port of ASP.NET Starter Kit's 'Time Tracker' project. I had to write up an article on the approach, which is located at http://www.codeproject.com/useritems/TimeTracker_Porting.asp

Friday, September 02, 2005

w3wp high usage IIS on Windows 2003

Intresting... IIS on 2003 will show high usage (100%). And the fix is at http://support.microsoft.com/?id=894484. Looks like something to do with vunerability. It looks like it is to do with the asp.dll

Who fires events in WebForm?

This was a reply to a post from someone on dotnetjunkies. It says "There are events like Page_Load, OnPreRender, and so on events, who fires it, exactly. Don't say .NEt framework, it is like Universe. Be specific." Obviously this person wants exact answers and looks like got the passion for understanding unknown. Ok in simple terms it is Control. In .NET we have the concept of Controls. A control can have many child controls, they can have any number of child controls and so on. It is Composite Pattern (GOOGLE for it, if you are intrested). Now each control should be rendered to client, during this process we have several events. Firstly we need to Initilize, Load, CreateChildControls and finally render. So the same controls will fire all these events for themselves. Again child controls will do the same firing. For example if you take DataGrid, it will have many rows, which has many cells, which inturn might have controls (buttons, labels and so on). They implemented it nicely using Composite Pattern. Now intresting part is even the System.Web.UI.Page class is a Control too (it inherits from Control, if you look at the class heirarchy). There are many other events apart from the ones mentioned above like Loading of ViewState, saving ViewState bla bla.

how to ping some machine

Ok i was answering questions at http://www.dotnetjunkies.com forums. Someguy had this question. so here is the answer...

Ping in .NET using C# or VB.NET? In other words, how can you find is some host (may be web site) is alive?
#region PING Example private void button1_Click(object sender, System.EventArgs e) { CheckConnection("localhost"); CheckConnection("www.thiswebsitenamedoesnotexistsatontheplanet.com"); } public void CheckConnection(string server) { //Set up variables and String to write to the server. Encoding ASCII = Encoding.ASCII; string Get = string.Format("GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", server); Byte[] ByteGet = ASCII.GetBytes(Get); Byte[] RecvBytes = new Byte[256]; String strRetPage = null; // IPAddress and IPEndPoint represent the endpoint that will // receive the request. // Get first IPAddress in list return by DNS. try { // Define those variables to be evaluated in the next for loop and // then used to connect to the server. These variables are defined // outside the for loop to make them accessible there after. Socket s = null; IPEndPoint hostEndPoint; IPAddress hostAddress = null; int conPort = 80; // Get DNS host information. IPHostEntry hostInfo = Dns.Resolve(server); // Get the DNS IP addresses associated with the host. IPAddress[] IPaddresses = hostInfo.AddressList; // Evaluate the socket and receiving host IPAddress and IPEndPoint. for (int index=0; index< IPaddresses.Length; index++) { hostAddress = IPaddresses[index]; hostEndPoint = new IPEndPoint(hostAddress, conPort); s = null; // Creates the Socket to send data over a TCP connection. s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); // Connect to the host using its IPEndPoint. s.Connect(hostEndPoint); if (!s.Connected) { // Connection failed, try next IPaddress. Console.WriteLine("Unable to connect to host"); continue; } Console.WriteLine("Yeah it connected"); } } catch { Console.WriteLine("Unable to connect to host"); } } #endregion VB.NET will have similar code.

Monday, August 08, 2005

Miss. / Mrs. Stranger Email : Access Query

This email was about Access Query. hi.. Plz check this question in dotnet spider on sqlserver. http://www.dotnetspider.com/qa/Question19054.aspx I need the output in access.I dont have proper touch in access.Can u help this out by checking. Thnks in advance. keep smiling, XXXXX. The post talks about a database Table with CityName, PersonName and Sex (M/F). A person wants to get List of all cities and number of Males and Females in output. The person who sent me an email answered in the post with correct query. But she had troubles getting it in MS Access. This is how access we can write the query in Access. I checked it it works. SELECT CityName, SUM(IsMale) As NoOfMales, SUM(IsFemale) As NoOfFemales FROM ( SELECT CityName, IIF(Sex='M', 1,0)As IsMale, IIF(Sex='F', 1,0) as IsFemale FROM Citytable ) GROUP BY CityName;

Email of Today

abi, I have got a doubt. Can u pls clarify it asap. I would like to redirect the user to login page, when session is timed out. Can we use executionTimeout method of httpRuntime object in the web.config file. Please send me a reply asap with an example. Also is there any other method with which i could achieve this. Mr. XXXXX There are two things which we need to consider here. We will talk about Forms authentication, the commonly used one. When a user logs in, we set FormsAuthentication Cookie and set its expiration to say N minutes. So the cookie will die in N minutes. In your web.config you will have Session Timeout to be same M minutes (usually 30 minutes, can be found in web.config file). First thing we need to do it make sure N=M (Yes, both should be same. Say N=M=30 minutes). Now next thing to look at is Session. Whenever we as a user makes a request to application, the Session slides (in other words Web Server will extend the expiration time to another M minutes). But by Default Forms Authentication will not. So if you have user who logged into system at 10:00AM, so his FormsAuthenticationTicket has expiration of 30 minutes and session is 30 minutes as well. User does nothing, so both session and FormsAuthenticationTicket will expiry at 10:30. But user now makes a request to Server at 10:29AM. Sever will now extend Session till 10:59AM, but FormsAuthenticationTicket is still at 10:30, so user will now be logged out at 10:30AM (we still have all session variables). Now our step is to align these both. Web.Config has

tag which has a property called slidingExpiration. We need to set this to true. Doing so will extend the FormsAuthenticationTicket for another N (30)minutes. As both Session and FormsAuthenticationTicket wil behave in same we wont have any troubles with the expirations anymore. Having said that, there is a slight problem here. Whenever we redeploy the Application in Live, the whole Application restarts, killing all Sessions, but not the FormsAuthenticationTicket (as it is stored in client side). It is good idea to get clients off the application, when we are doing a deployment. But if we cant do that, we have to do a check in Global.asax file for PreRequestHandlerExecute or BeginRequest method to see if (Session.IsNew is true and User.IsAuthenticated = true) then we Signout the user and throw them to Login.aspx.

Tuesday, August 02, 2005

ASP.NET Multi Condition Validator

Ok i am thinking of writing a multi condition validator. ASP.NEt is not good at validating form when there are more than one field involved in validation logic. Only thing i can see is compare validator. But this is not sufficent always. We come across senarios where one field is mandatory out of two (or more). Sometimes, we say this field is mandatory if someother field has value. There are many things, we should be able to do validation for all these senarios. I am thinking of writing this since few months.... Just getting busy with life.

Friday, July 22, 2005

Stranger's Email of Today

Arief ZJ wrote: Dear Mr. Abishek Bellamkonda, I read your blog saying that u got an offer from EDS for .NET related job long time ago. May I know how well software development in this company. Bcos normally, most big company that I knew just bought a ready-made software and just use it instead of developing new one. Reason why I'm asking this is bcos... I am a .NET developer as well and I'm thinking of applying a position in EDS in my country... but I'm worry if there's no development activities in the company. If there aren't, there will be no 'exercise' for my .NET development :( Looking forward for your reply. Thanx ajak937



Hi, EDS does development, i would say it is purely based on development. It is a consulting house, like IBM. In australia it is a competitor to IBM, fujitsu and so on. Yes they are BIG. They do purchase software, but they also develop for clients. EDS is american company. As all bigger companies will be both good and bad things about it. Just apply it mate, then think of joining or not when you finally get it. People are reading my Blog.

Thursday, July 07, 2005

Today's Mr. Stranger Email

I received an email straight into my yahoo email today. This happens once a forthnight. I usually answer people and forget about it, i think i will blog the emails, as it might help others. "i like dotnet technology very much" while studying .net i am very much intrested in evey dot net topic now after completing the course i forgot every thing now even i am unable to recollect all the info regarding the past topics now what i want to do to recollect all the lost info.or i want to study for one more time why this happen i dont know exactly . i am afraid to tell all this info to you! give ur sugg. how to learn .net to master in that what are the steps to become the master in .net This person is a newbie to .NET world and he has learn't it, but lost touch with it. I think development is like Mathematics, if you don't practice it regularly, you will loose it. How do you keep in touch with it? I once gave a suggestion regarding this on server side .net, click here to see it. I think there are few methods to learn technical stuff...

  1. Subscribe to news letters. For .NET the below are usually good...
  2. Reading questions and answers in Forums will help lot. Go to sites like http://www.asp.net, http://www.theserverside.net, http://www.dotnetjunkies.com and http://www.dotnetspider.com
  3. Blog It !If you learn anything new on a day just write it down in your blog (create a blog in sites like http://www.blogger.com). Read popular peoples blog. Once you get your blog, it is like a big repository of source code for you. Whenever you want a code, you will just go to your blog and retrieve it. Say for example I got to http://www.abibaby.blogspot.com to get the code I want as I created it before. If i encounter a weird problem with my team, i will write the solution in the blog. If someone has the same problem, i can just send him the link and ask him to use it as a fix.

Saturday, July 02, 2005

Visual Studio .NET "Code Complete" Macro FREE

Ok i think the version 1.0 of the Macro i was thinking my my mind is ready for using/modifcation/stealing/sharing now. What new features does it include? It will replace a shortcut(say 'fi') with code block (a for i loop). User can configure his own list of code blocks and shortcuts assigning them with file types. Code blocks may contain multiple variables with default values, in such cases a window will pop up asking the user for value to be replaced in case of variables. Macro will take that user entered value and replace variable with text in the code block. This will be written into the files. Copyright? Ok this is it, anyone can use, share, copy, modify, steal and whatever you call it ! Cost?? Ok give $100 to charity, if you can, otherwise give $0 for charity. Yes, its absolutely FREE for all. I am not responsible for any miss use or failures. The below is the code...

CodeCompletion.vb
Imports EnvDTE Imports System.Diagnostics Imports System.Xml 'Imports System.Drawing 'Imports System.Drawing.Design Imports System.Data Imports Microsoft.Win32 'Used to read registry Imports System.Windows.Forms Imports System.Collections Imports System.ComponentModel Public Module CodeCompletion #Region "Config Settings" 'If you don't want caching, set it to false Private Const CacheXmlInMemory As Boolean = False Private Const CursorText As String = "~~" #End Region '''Completes the code by replacing your shortcut with the code block available in your configuration Public Sub Complete() 'DTE.Events.MiscFilesEvents() Dim selection As TextSelection = DTE.ActiveDocument.Selection Dim startPt As EditPoint = selection.TopPoint.CreateEditPoint() Dim endPt As TextPoint = selection.BottomPoint 'selection.MoveToDisplayColumn(endPt.Line, endPt.DisplayColumn - 2) Dim endCol As Integer = endPt.DisplayColumn 'MessageBox.Show(selection.Text.Length) If selection.Text.Length = 0 Then selection.WordLeft(True, 1) 'Replacement will occur here ApplyTemplate(selection) 'startPt.MoveToAbsoluteOffset(-1) 'selection.Text.IndexOf("~~")) End Sub Private configForm As CodeCompletionConfig '''Confiures your Code snippets Public Sub Configure() If Not configForm Is Nothing Then Exit Sub configForm = New CodeCompletionConfig configForm.CodeTemplateFileName = CodeTemplateFileName configForm.LoadDataSet() Application.Run(configForm) configForm = Nothing End Sub #Region "Helper functions" 'Get Xml document from Cache Private CodeTemplateXmlDocument As XmlDocument = Nothing #Region "Get Code Template Xml Document" #Region "Template File Name" Private _codeTemplateFileName As String = "" Private ReadOnly Property CodeTemplateFileName() As String Get If _codeTemplateFileName = String.Empty Then Dim pRegKey As RegistryKey = Registry.LocalMachine pRegKey = pRegKey.OpenSubKey("SOFTWARE\\Microsoft\\VisualStudio\\7.1") Dim folder As Object = pRegKey.GetValue("InstallDir") CodeTemplateXmlDocument = New XmlDocument _codeTemplateFileName = folder & "CodeTemplates.xml" End If Return _codeTemplateFileName End Get End Property #End Region Private Sub GetXmlDocument() If Not CodeTemplateXmlDocument Is Nothing Then If Not CodeTemplateXmlDocument.InnerXml = "" Then Exit Sub CodeTemplateXmlDocument = New XmlDocument CodeTemplateXmlDocument.Load(CodeTemplateFileName) 'I dont know why this does not load 1st time If CodeTemplateXmlDocument.InnerXml = "" Then CodeTemplateXmlDocument.Load(CodeTemplateFileName) End Sub #End Region Private Sub ApplyTemplate(ByVal selection As TextSelection) 'Get Xml Document GetXmlDocument() 'If template is NOT available then exit Dim codeTemplateNode As XmlNode = GetCodeTemplateNode(selection) If codeTemplateNode Is Nothing Then Exit Sub 'If template is available then replace Dim completeReplacementText As String = codeTemplateNode.SelectSingleNode("Code").InnerText() Dim variableNodes As XmlNodeList = codeTemplateNode.SelectNodes("Variable") If variableNodes.Count > 0 Then IsAborted = True completeReplacementText = GetReplacementText(completeReplacementText, variableNodes) If IsAborted Then Exit Sub End If End If Dim replacementText As String = completeReplacementText.Replace(CursorText, "") selection.Text = replacementText If Not CacheXmlInMemory Then CodeTemplateXmlDocument = Nothing Dim startPt As EditPoint = selection.TopPoint.CreateEditPoint() selection.MoveToDisplayColumn(startPt.Line, startPt.DisplayColumn - (replacementText.Length - completeReplacementText.IndexOf(CursorText))) End Sub Private Function GetCodeTemplateNode(ByVal selection As TextSelection) As XmlNode 'Get File Extension Dim fileName As String = DTE.ActiveDocument.Name Dim extension As String = fileName.Substring(fileName.LastIndexOf(".") + 1) 'Prepare xPath Dim xPath As String = String.Format("/CodeTemplates/CodeTemplateSet[FileType[@Extension='{0}']]/CodeTemplate[@ShortCut='{1}']", extension, selection.Text.Trim()) Return CodeTemplateXmlDocument.SelectSingleNode(xPath) End Function Private variableEntryForm As CodeCompletionVariableEntry Private IsAborted As Boolean = True Private Function GetReplacementText(ByVal replacementText As String, ByVal variableNodes As XmlNodeList) As String 'If Not variableEntryForm Is Nothing Then Return replacementText variableEntryForm = New CodeCompletionVariableEntry variableEntryForm.CodeTemplateVariablesNodes = variableNodes variableEntryForm.ReplacementText = replacementText variableEntryForm.AddVariableControls() Application.Run(variableEntryForm) replacementText = variableEntryForm.ReplacementText If variableEntryForm.DialogResult = DialogResult.OK Then IsAborted = False End If 'Kill The form variableEntryForm = Nothing Return replacementText End Function #End Region End Module
CodeCompletionConfig.vb
Imports System.Data Imports System.Windows.Forms Imports System.Xml Public Class CodeCompletionConfig Inherits System.Windows.Forms.Form #Region "Windows Form Designer generated code" Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents LoadBtn As System.Windows.Forms.Button Friend WithEvents SaveBtn As System.Windows.Forms.Button Friend WithEvents CancelBtn As System.Windows.Forms.Button Friend WithEvents ExitBtn As System.Windows.Forms.Button Friend WithEvents Grid As System.Windows.Forms.DataGrid Friend ds As DataSet Private Sub InitializeComponent() Me.ds = New System.Data.DataSet Me.Grid = New System.Windows.Forms.DataGrid Me.LoadBtn = New System.Windows.Forms.Button Me.SaveBtn = New System.Windows.Forms.Button Me.CancelBtn = New System.Windows.Forms.Button Me.ExitBtn = New System.Windows.Forms.Button CType(Me.ds, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.Grid, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'ds ' Me.ds.DataSetName = "NewDataSet" Me.ds.Locale = New System.Globalization.CultureInfo("en-AU") ' 'Grid ' Me.Grid.DataMember = "" Me.Grid.DataSource = Me.ds Me.Grid.Dock = System.Windows.Forms.DockStyle.Bottom Me.Grid.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.Grid.Location = New System.Drawing.Point(0, 46) Me.Grid.Name = "Grid" Me.Grid.Size = New System.Drawing.Size(736, 392) Me.Grid.TabIndex = 0 ' 'LoadBtn ' Me.LoadBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.LoadBtn.Location = New System.Drawing.Point(8, 8) Me.LoadBtn.Name = "LoadBtn" Me.LoadBtn.Size = New System.Drawing.Size(144, 32) Me.LoadBtn.TabIndex = 1 Me.LoadBtn.Text = "&Load" ' 'SaveBtn ' Me.SaveBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.SaveBtn.Location = New System.Drawing.Point(200, 8) Me.SaveBtn.Name = "SaveBtn" Me.SaveBtn.Size = New System.Drawing.Size(144, 32) Me.SaveBtn.TabIndex = 2 Me.SaveBtn.Text = "&Save" ' 'CancelBtn ' Me.CancelBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.CancelBtn.Location = New System.Drawing.Point(392, 8) Me.CancelBtn.Name = "CancelBtn" Me.CancelBtn.Size = New System.Drawing.Size(144, 32) Me.CancelBtn.TabIndex = 3 Me.CancelBtn.Text = "&Cancel" ' 'ExitBtn ' Me.ExitBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.ExitBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.ExitBtn.Location = New System.Drawing.Point(584, 8) Me.ExitBtn.Name = "ExitBtn" Me.ExitBtn.Size = New System.Drawing.Size(144, 32) Me.ExitBtn.TabIndex = 4 Me.ExitBtn.Text = "E&xit" ' 'ConfigForm ' Me.AutoScaleBaseSize = New System.Drawing.Size(7, 19) Me.CancelButton = Me.ExitBtn Me.ClientSize = New System.Drawing.Size(736, 438) Me.Controls.Add(Me.ExitBtn) Me.Controls.Add(Me.CancelBtn) Me.Controls.Add(Me.SaveBtn) Me.Controls.Add(Me.LoadBtn) Me.Controls.Add(Me.Grid) Me.Font = New System.Drawing.Font("Comic Sans MS", 10.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.Name = "ConfigForm" Me.Text = "Configuration" CType(Me.ds, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.Grid, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) End Sub #End Region #Region "Events" Public CodeTemplateFileName As String '= "C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\CodeTemplates.xml" Private Sub ExitBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ExitBtn.Click Close() End Sub Private Sub LoadBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LoadBtn.Click LoadDataSet() End Sub Public Sub LoadDataSet() ds = New DataSet ds.ReadXml(CodeTemplateFileName) Grid.DataSource = ds If ds.Tables.Count > 0 Then Grid.DataMember = ds.Tables(0).TableName End Sub Private Sub SaveBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveBtn.Click ds.WriteXml(CodeTemplateFileName, XmlWriteMode.WriteSchema) End Sub Private Sub CancelBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelBtn.Click ds.RejectChanges() LoadDataSet() End Sub #End Region End Class
CodeCompletionVariableEntry.vb
Imports System.Xml Imports System.Windows.Forms Public Class CodeCompletionVariableEntry Inherits System.Windows.Forms.Form #Region "Add variable Controls" Public CodeTemplateVariablesNodes As XmlNodeList Public ReplacementText As String = "for(int ~0~ = 0; ~0~ < ; ~0~++){ }" Public Sub AddVariableControls() Dim i As Integer Dim OffSet As Integer VariablesGroupBox.Controls.Clear() For i = 0 To CodeTemplateVariablesNodes.Count - 1 OffSet = i * 24 'Variable Label Dim variableLabel As New Label variableLabel.Location = New System.Drawing.Point(8, 16 + OffSet) variableLabel.Name = "VariableLabel" + i.ToString() variableLabel.Size = New System.Drawing.Size(128, 23) variableLabel.TabIndex = i + 3 variableLabel.Text = CodeTemplateVariablesNodes(i).Attributes("Name").Value 'Variable Value Dim variableValue As New TextBox variableValue.Location = New System.Drawing.Point(152, 16 + OffSet) variableValue.Name = "VariableValue" + i.ToString() variableValue.TabIndex = i + 2 variableValue.Text = CodeTemplateVariablesNodes(i).Attributes("Value").Value VariablesGroupBox.Controls.Add(variableLabel) VariablesGroupBox.Controls.Add(variableValue) Next If CodeTemplateVariablesNodes.Count > 0 Then Me.ActiveControl = VariablesGroupBox.Controls(1) End Sub #End Region #Region "Windows Form Designer generated code" Public Sub New() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call End Sub 'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose() End If End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. Friend WithEvents OkBtn As System.Windows.Forms.Button Friend WithEvents CancelBtn As System.Windows.Forms.Button Friend WithEvents VariablesGroupBox As System.Windows.Forms.GroupBox Private Sub InitializeComponent() Me.OkBtn = New System.Windows.Forms.Button Me.CancelBtn = New System.Windows.Forms.Button Me.VariablesGroupBox = New System.Windows.Forms.GroupBox Me.SuspendLayout() ' 'OkBtn ' Me.OkBtn.DialogResult = System.Windows.Forms.DialogResult.OK Me.OkBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold) Me.OkBtn.Location = New System.Drawing.Point(16, 8) Me.OkBtn.Name = "OkBtn" Me.OkBtn.Size = New System.Drawing.Size(128, 23) Me.OkBtn.TabIndex = 0 Me.OkBtn.Text = "&Ok" ' 'CancelBtn ' Me.CancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel Me.CancelBtn.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold) Me.CancelBtn.Location = New System.Drawing.Point(160, 8) Me.CancelBtn.Name = "CancelBtn" Me.CancelBtn.Size = New System.Drawing.Size(112, 23) Me.CancelBtn.TabIndex = 1 Me.CancelBtn.Text = "&Cancel" ' 'VariablesGroupBox ' Me.VariablesGroupBox.Font = New System.Drawing.Font("Lucida Sans", 9.75!, System.Drawing.FontStyle.Bold) Me.VariablesGroupBox.Location = New System.Drawing.Point(16, 40) Me.VariablesGroupBox.Name = "VariablesGroupBox" Me.VariablesGroupBox.Size = New System.Drawing.Size(264, 216) Me.VariablesGroupBox.TabIndex = 2 Me.VariablesGroupBox.TabStop = False Me.VariablesGroupBox.Text = "Variables" ' 'CodeCompletionVariableEntry ' Me.AcceptButton = Me.OkBtn Me.AccessibleDescription = "" Me.AccessibleName = "" Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13) Me.CancelButton = Me.CancelBtn Me.ClientSize = New System.Drawing.Size(292, 266) Me.Controls.Add(Me.VariablesGroupBox) Me.Controls.Add(Me.CancelBtn) Me.Controls.Add(Me.OkBtn) Me.Name = "CodeCompletionVariableEntry" Me.Text = "Variables Entry" Me.ResumeLayout(False) End Sub #End Region #Region "Event Handlers" Private Sub Cancel(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelBtn.Click Me.Close() End Sub Private Sub SetReplacementText(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OkBtn.Click Dim i As Integer For i = 0 To CodeTemplateVariablesNodes.Count - 1 ReplacementText = ReplacementText.Replace(String.Format("~{0}~", i), VariablesGroupBox.Controls(i * 2 + 1).Text) Next 'MessageBox.Show(ReplacementText) Me.Close() End Sub #End Region End Class
CodeTemplates.xml
I will post soon, XML doesn't seem to be displayed properly here.

Thursday, June 30, 2005

Enterprise Library June 2005

A new version of enterprise library has been released, check out msdn

Wednesday, June 29, 2005

Question by Mr. Stranger

Ok i received a question from a strager straight into my Yahoo email account. This was my response. Ahhh, just have a ASP.NET or any button with onclick calling a function. When user clicks the button just do the submit using javascript like below. function WillSubmitToExternalUrl() { document.forms[0].action = "http://gateway.upshotonline.com/UpShotDev/DynamicGenerator.dll"; document.forms[0].submit(); } You can also do a post using WebRequest/WebResponse classes. But thats unnecessary, unless you have some secured information. Where did you get my email from? Colin Fitzgerald wrote: Hello, I am stumped and in the process of trying to figure out how to get an ASP.NET form to post to an external URL ("http://gateway.upshotonline.com/UpShotDev/DynamicGenerator.dll"), however because a server-side form cannot have an action property, and because the Server.Transfer method does not work with external destinations, I am stuck. Do you have any suggestions as to what I should do or where I should start? The above URL is a 3rd party vendor that takes form information and handles the data on their dB. Thanks Much, Colin Colin FitzGerald IS Team Ellsworth Adhesives (262) 253-8600 x737 PS: My form must be server-side because it contains validation web controls and utilizes several other web controls...

Thursday, June 09, 2005

TheServerSide.NET says I am Top Poster of week !

Ahh http://www.TheServerSide.net says i am top poster of the week. Yeah i usually answer questions. I think TSS gets only few users who actually post questions, so i ended up being top 5 guy of the week. Hmmm... Its not like http://www.asp.net, http://www.dotnetjunkies.com, or http://www.dotnetspider.com where you get shit loads of users and questions placed everyday. Oh well, its always good to help someone out there struggling with technologies. See http://www.theserverside.net/discussions/index.tss for more details, it is the middle right section.

I thank my Dad, who gave me a PC in 1986 to play with.

Database Comparision Results between SQL Server 2000 and Oracle 9i

Ok here is my outcome of my tests. I ran these tests on my home PC. When Oracle services was running, SQL Server services were stopped and vice versa.

It took 13 minutes some odd seconds to create 10 million records, but Oracle took 1:21 seconds
I also observered that DB size has grown in SQL Server when i added records. but when i dropped the table or deleted the records, the database file size did not come down (as expected). However, Oracle took 8:51 minutes to delete all the records where as SQL Server took 6:06 minutes. But Dropping the Table in Oracle was instant. to Below are my SQL Scripts that i used on Oracle. Please let me know if you notice behaviours. --SqlCreateTable.sql --Creates Table and inserts 10 records CREATE TABLE SIZETEST ( COL NVARCHAR2(10) ); --Add 10 records INSERT INTO SizeTest(Col) SELECT 'AAAAAAAAAA' FROM DUAL UNION SELECT 'BBBBBBBBBB' FROM DUAL UNION SELECT 'CCCCCCCCCC' FROM DUAL UNION SELECT 'DDDDDDDDDD' FROM DUAL UNION SELECT 'DDDDDDDDDD' FROM DUAL UNION SELECT 'FFFFFFFFFF' FROM DUAL UNION SELECT 'GGGGGGGGGG' FROM DUAL UNION SELECT 'HHHHHHHHHH' FROM DUAL UNION SELECT 'IIIIIIIIII' FROM DUAL UNION SELECT 'JJJJJJJJJJ' FROM DUAL --InsertScript.sql --5 Times for each TRANS --2 times = 10k records --Each record has 10 characters DECLARE I NUMBER(10); N NUMBER(10); BEGIN N := 20; DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'dd-MM-yyyy hh:mi:ss')); FOR i IN 1..N LOOP INSERT INTO SizeTest(Col) SELECT Col FROM SizeTest; DBMS_OUTPUT.PUT_LINE(i); END LOOP; DBMS_OUTPUT.PUT_LINE(TO_CHAR(SYSDATE, 'dd-MM-yyyy hh:mi:ss')); END;

Which is beter DB?

Ok this is intresting topic. We started a discussion about databases. In just my past company we have develop & deployed 35+ SQL Server based applications and few Oracle ones. A colleague of mine gave me a run though IBM DB2. It sounds like very promising database. I just want to run a script on different databases and see how good their execution times are. Probably compare them as well. Concept of test:

Create a table with 1 10 character column with 10 records initially. Now do a SELECT INTO self 20 times to get 1 Million records. Record the times in various databases.
The code would be as follows, we have to mak udpates to script for each databases. --SqlCreateTable.sql --Creates Table and inserts 10 records CREATE TABLE [SizeTest] ( [Col] [nvarchar] (10) COLLATE Latin1_General_CI_AS NOT NULL ) GO --Add 10 records INSERT INTO SizeTest(Col) SELECT 'AAAAAAAAAA' UNION SELECT 'BBBBBBBBBB' UNION SELECT 'CCCCCCCCCC' UNION SELECT 'DDDDDDDDDD' UNION SELECT 'DDDDDDDDDD' UNION SELECT 'FFFFFFFFFF' UNION SELECT 'GGGGGGGGGG' UNION SELECT 'HHHHHHHHHH' UNION SELECT 'IIIIIIIIII' UNION SELECT 'JJJJJJJJJJ' --InsertScript.sql --5 Times for each TRANS --2 times = 10k records --Each record has 10 characters DECLARE @I INT DECLARE @N INT SET @I = 1 SET @N = 20 while @I<=@N BEGIN INSERT INTO SizeTest(Col) SELECT Col FROM SizeTest PRINT @I SET @I = @I + 1 END SELECT COUNT(*) FROM SizeTest

Thursday, June 02, 2005

Hmmm... took a while, but Add-in works well

Hmmm... took a while, but Add-in works well. It now reads the config and starts replacing the code. I also developed it so user can choose the HOTKEY. It is basically a Macro, which can be triggered using mouse Click or HOTKEY. Now i want more. Say, In case of for loop, i want it to write code and come back to a certain point, so i can type the code, i don't want to move the cursor manually.

Saturday, May 28, 2005

Crystal Reports .NET common Problems

Crystal Report .NET Rules and Tips

Rule 1:
Crystal in .NET doesn't work properly always, it gives proper functional.
Rule 2:
The error message you see has got nothing to do what you need to fix.
Rule 3:
The IDE does weird things; there are work arounds to get them working.

Common Problem 1: Crystal report when deployed to web server complains "keyCode" is invalid.Cause: Could be invalid keycode as it saysReal cause: The version you are using during compilation is not same as the one installed on server. Solution:

  1. Check if there Crystal reports 2.0 is install on server and development PC. If its installed then there should be a directory called "C:\Program Files\Common Files\Crystal Decisions\2.0"
  2. If it’s not installed use file://abi/CRWebSetup/Release folder and install it, it has got Crystal License KEY and all sorts in it. Ensure both development box and web server has the software
  3. When you open a crystal report project first time, delete all REFERENCES in VS.NET for the project and re add references from the following CrystalDecisions.Web.dll CrystalDecisions.ReportSource.dll CrystalDecisions.Shared.dll CrystalDecisions.CrystalReports.Engine.dllAll DLLs are should be under C:\Program Files\Common Files\Crystal Decisions\2.0\Managed directory. This is to be done as Visual Studio always adds reference to old version ALWAYS.


Common Problem 2:

"Query Engine error"

Real Cause:

The DataSet's Name, DataTable's Name, DataRelation's Name, DataColumn's Name or data types did not match the one given in XSD. This happens for the fact when we give the XSD; we usually tend to give good names for DataTable, DataSet, columns. But when we do dataAdapter.Fill(ds), it always gets filled as DataSet1, DataTable1, DataTable2, relations will not be added and Primary Key’s are not assigned.

Solution:

So if you match the names and relations it will work.


Common Problem 3: Visual Studio just disappears when you Undo check out

Cause:

It just does it!! Good thing is that it does it when file is opened in VS.NET already.

Solution:

Always close .RPT files before you do undo checkout.


I belive Crystal Reports is still the BEST reporting out there in market, SQL Server Reporting comes close, not complete.

Friday, May 20, 2005

Visual Studio.NET Add-in FREE

I decided to create Visual Studio.NET Add-in and give it away to public for FREE. I saw some add-ins that we need to pay for. Not all add-ins are affordable and in corporates, if you want to buy them, it will take ages. Ok concept of first add-in: It's all about aliases. We write similar code a million times. Say for example the <table>tag. 90% of the time i always have table tag with border="0" cellPadding="0" cellSpacing="0". I want to associate this with a alias, like say 'table', which will be replaced by the whole table tag. Eventually we might want to add million shortcuts, so i am using XML as config. Updating the XML config with file extension, alias and code should refelct in the code generation. I shall come back later to post more on it.

Wednesday, May 18, 2005

FireFox, the borwser that does most of things right

I just happened to download service pack 4, it was taking quite sometime to download all of them through my good old IE6. I though FireFox has better downloading capabilities than IE6, so opened up FireFor punched in the URL http://www.microsoft.com/sql/downloads/2000/sp4.asp. The font size and fone family for that page was very inconsistent. I guess we will have to wait until IE7, and see what it offers as competitor to IE.

Full text search

I recently encountered a problem using MS SQL Server FullText search. Error message was...

Full-Text Search is not enabled for the current database
I realised that i Full Text was not installed, i installed it. Then found that we have to enable it on every database we need FullTextsearch. Which i did ...
Use MyDatabase EXEC sp_fulltext_database 'enable'
Now, i got a different error message
Full-Text Search is not installed, or a full-text component cannot be loaded.
When i ran SELECT @@Version on database, i found that my new home PC had SQL Server SP2. After running service pack 3, the error has disappeared, i was able to use full text. I am still downloading SQL Server 2000 service pack 4.
Lesson of the Day: Always bloody install service packs. But at the sametime, some service packs break functionality like .NET patch. So install it only after 1 month of its release. SQL Server Service pack 4 can be found at http://www.microsoft.com/sql/downloads/2000/sp4.asp

Monday, May 16, 2005

ASPNET_REGIIS

Sometimes when you try to create a Web Project Visual Studio complains that it cant create ASP.NET project. This happens when you deploy ASP.NET application to a new web server it shows all code and not output. Usually its the fact that ASP.NET is not registered with IIS. If we register it it will work cool. Go to Start --> All Programs--> Visual Studio .NET 2003 --> Visual Studio Tools--> Visual Studio Command Prompt. Type the following command, it will fix most of the stuff. This should work even if you install .NET framework after IIS or other way round. If you dont have Visual Studio.NET installed on PC, then you just need to go to C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322 (replace with your Windows Directory and .NET version) through command prompt and type below command.

aspnet_regiis -i

Saturday, May 14, 2005

Intellisense for XSL/XSLT?

Every wondered that it would be better to have intellisense in Visual Studio.NET? I sometimes tend to forget the XSL syntax. I then look up http://www.w3schools.com, but it takes sometime. Fesersoft has something to download and explore. Whats good about it?

Its free.
What do you learn?
We can understand how Visual Studio.NET actually does intellisense and how to use it.
My intended future contribution?
I want to get this work web.config file as well. It will eliminate my key board mistakes.

Thursday, May 05, 2005

Mac's Tiger, is sooo Good!

I just had a look at Apple's Tiger, the new operating system. Mark, our interface designer was playing with it. Ahhhh....... The look, functionality, speed and graphics drives me crazy. Its so cute and well done. Its got UNIX kernel. I started to use it as UNIX box now, as i like the command line stuff. Mark was playing with open source C# web server. This looks so cool, thats the first impression http://www.apple.com/macosx/features/dashboard/. When you switch between users, the 3D animation was very nice. Its not just the graphics, the functionality looks great ! I am in .NET world and Windows world, i like them very much. But tiger, is really something. It tempts me to switch from Windows to Tiger.

Friday, April 29, 2005

Got a new Job Offer at EDS

I got a new job offer today at a company called EDS as .NET Architect. I very much like current company, Roadhouse. Though its small it has done good STUFF !! When i look at project list, they have crossed more than 40. Apart from normal client projects we have developed some products. Usually i think most of customisable stuff can be developed using XML, there are few examples below.

  1. FormBuilder - DHTML XML/XSL based
  2. WorkFlow Engine - XML based again with all rules embedded in XML
  3. WorkQueue - This product has got into IT News papers and had good publicity. It manages your companies tasks, with assigning jobs to staff, tracking progress and reporting. Assembly is using it for tracking Jobs.
  4. CMS - Ahhh yeah every company has one.

Wednesday, April 27, 2005

Do NOT deploy, if network admin is not at work

A client wanted to change database server and has arranged a suitable time to do so. Someone incharge at client end did the database migration. All applications now needed to point to new database server. We have updated the config settings for all 16+ sites. We then realised that web server cannot comminucate or ping new database server. We were able to connect from other machines. We called up client and asked to arrange for network admin to fix this issue. Client said "He is overseas today". Usually he is, but not today. So.... what happened? trans.Rollback();

Do not deploy, if network admin is NOT around. Always check with client that network admin would be available if required, just in case.blockquote>

Friday, April 22, 2005

SELECT's hover background color

I answer community forums whenever i can. Some one asked a question. In a dropdown ( SELECT tag ), when you click on the arrow on right side to expand the list and just before you select an option you will see background color of option being BLUE by default in IE. Can we change this color? I know we can change color of whole or indivudual ones. But what about highlighted option? Any thoughts? Solutions i found was to

  1. Use Custom DropDownList like WebCombo
  2. Write your own HTC
  3. Ask users to change highlight color to something else in Control Panel --> Display properties

Wednesday, April 20, 2005

WorkFlow Engine works great

Alright this is a small WorkFlow Engine that i have designed to manage WorkFlow in organisation. Its simple and works great, it is very highly flexible. It was developed for a major entertainment company in Melbourne at Roadhouse. The amount of development versus functionality it offers and flexibility is very pleasing. It routes messages through various corporate Hierarchy based on their responses.

Saturday, April 16, 2005

Wendy Pryor has resigned

Flash Flash news! Wendy Pryor, our Project Director has got a new job offer and is moving out of roadhouse soon. She has done good work at roadhouse. Her project qualifications and project management techniques are excellent.

Sunday, April 03, 2005

Ranked 5th in Australia in ASP.NET

Ahhh i was Australia's 2nd in ASP.NET for last 9 months. Someone over took me. I wrote again, but didn't climb the ladder, stayed same. There was BrainBench games and everybody had a chance to write the exam for free this week.

Now i am ranked 5th in Australia in ASP.NET Certification

Saturday, March 26, 2005

Grasshopper

Grasshopper, seems to be a nice way to get .NET working on Linux. And it runs smoothly too. We can convert .NET assemblies to JAVA byte code and then run it on Apache. Doesn't seem to be any different. http://dev.mainsoft.com/Default.aspx?tabid=130

Tuesday, March 08, 2005

Aussemble WorkQueue Live

The recent Aussemble solution went live. and Guess what, they got their investment back in just a weekend. It assigns jobs to techs, keeps track of status, syncs with PDA, receives jobs from front end system and eventually reports back. Graphs are awesome, i feel like eating them, so cute. The look of the web site made many other bigger clients intrested. Its doing what Million $ systems are not.

Wednesday, February 02, 2005

Enterprise Library 2005

Well, we have new .NET Enterprise Library 2005. When i first opened it took ages, i really dont like Visual Studio taking time. Then found the code very nice. All tested with NUnit tests. Application block supports DB2 and MySql by default (not sure how useful it would be for projects that dont need ByteFx). Exception management, configuration management and cahing are good

Sunday, January 16, 2005

J2EE and .NET Comparision

Ok many people always debate on the fact

Which is better technology J2EE or .NET?
Now, there was in independent study between IBM WebSphere and Visual Studio .NET. The comparisions revealed that you can develop a software to spec in half time with Visual Studio.NET.
For building some enterprise applications, it took developers 195 man-hours with WebSphere, whereas building the same applications using Visual Studio took only 94 man-hours, Somasegar said the study said. Application server installation and configuration took 22 man-hours in the WebSphere environment and only 4 man-hours in the Microsoft environment. Handheld device programming took 16 man-hours with WebSphere and 7 man-hours with Visual Studio. Web application and Web service client programming took 69 man-hours with WebSphere and 40 man-hours with Visual Studio. Web service and Web application host programming took 59 man-hours with IBM's environment and 44 with Microsoft's. And systemwide development took 29 man-hours with WebSphere and 2 man-hours with Visual Studio, according to the report, Somasegar said.
Meanwhile, in terms of overall application performance, applications developed in Visual Studio .Net 2003 showed better performance than applications built with IBM's tools, Somasegar said the study showed. Somasegar said applications built using Visual Studio .Net 2003 were able to deliver 635 transactions per second. Similar applications built using a hand-coded WebSphere implementation delivered 482 transactions per second, and applications built using WebSphere Studio Rational Rapid Developer Rational Rapid Developer delivered 365 transactions per second, Somasegar said.

Friday, January 07, 2005

World Vision Tsunami Appeal $20 Million

World Vision Australia has setup Tsunami Appeal and its having a major event at Fedration Square soon. Its getting massive number of hits from all over country, which is good, but servers are not able to handle the load. Roadhouse has developed some parts of World Vision Australia site, but not all. Internal developers have developed this Donations part. Now the task is...

Site is unable to cope with number of hits, its classic ASP application. No matter what you want to do, make the whole application collect donations. We need to get this update in 1 hour (WVA can't think of how to make it faster).

This is when things get intresting, looked at the code, found some slow stuff, fixed it and deployed back in 45 minutes

Two weeks later found that World Vision had collected $20 Million donations. I felt glad. Roadhouse didn't charge World Vision as it was for Tsunami.

Wednesday, December 08, 2004

ViewState again

Hmmm.. I used to think that storing ViewState on server side might be harmful. I think we can store it on server side without any harmful effects now. I am storing the ViewState in SQL Server and using GUID and assigning it to each page response. This is all done in BasePage. No change in code the app flying now! Works like Windows App, performance wise.

Saturday, September 18, 2004

.NET Framework patch: All ImageButtons don't work.

Ok .NET framework had a recent patch, and it broke many of our web sites. All imageButtons just don't do anything. Cause: The patch damaged the client scripts in aspnet_client folder. We need to update them properly. Solution: Run the following command lines

aspnet_regiis -ea aspnet_regiis -c

Option -ea will remove all scripts in all aspnet_client folder. -c will install the scripts again.

But, sometimes it complains about insufficent Administrator Privileges. This was really tough one to figure out. Some scripts in aspnet_client folder were somehow marked READONLY (might be because one of our developer added aspnet_client folder into sourcesafe and it marked them as readonly). Manually deleting those script folder did the trick in this case.

Monday, July 05, 2004

Won Prize: Member of Week

Yo! I was member of week for http://www.dotnetspider.com/ this, yeah they are going to send me a book on C# :( Take a look http://www.dotnetspider.com/technology/team/Winners.aspx I wish it was BizTalk, i am still learning it.

Monday, June 14, 2004

Ranked 2nd in ADO.NET in Australia

Yo!

I was ranked Australia's 2nd by BrainBench skills assesment. Sounds great

Sunday, May 02, 2004

Got Married

I Got Married. Now i know why most indians marry only once in lifetime. They have to go through the pain to 2-3 day marriage, they have to talk with 1000's of guests in wedding, whom they have no idea about. All of them say the same sentence "Do you remember me? You used to play with me lot when you were young". I must say, my wedding was not that crowded. Its just 1100 people.

Tuesday, February 17, 2004

How to open a Url or execute a command line in Windows .NET Applications

Ok a little senario, we wanted to open a URL when user clicks a button from a windows application. I know that .NET has a process class and it can start a process (in shorts acts like a command line). This is what the proposed solution was. 'A VB.NET Example Dim p As New Process p.Start("notepad.exe", "D:\Documents and Settings\abi\Desktop\TODO.txt") p.Start("iexplore.exe", "www.roadhouse.com.au") //A C# Example Process p = new Process(); p.Start("notepad.exe", @"C:\Documents and Settings\abi\Desktop\TODO.txt"); p.Start("iexplore.exe", "www.roadhouse.com.au");

Sunday, January 25, 2004

Victorian Govt. Panel

Roadhouse got into Victorian government panel.

Wednesday, September 03, 2003

Web.config and App.config Intellisense

Check this out http://www.radsoftware.com.au/articles/intellisensewebconfig.aspx. It describes how to get intellisense to web.config and App.config.

Saturday, August 16, 2003

WebRequest

If i want to access a web url through a .NET Application, how can i do that? Answer is WebRequest class. Say for example the url http://abibaby.blogspot.com or http://abibaby.blogspot.com/atom.xml WebRequest request = WebRequest.Create("http://abibaby.blogspot.com/atom.xml"); WebResponse response = request.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream()); string str = reader.ReadLine(); while(str != null) { Console.WriteLine(str); str = reader.ReadLine(); }

Friday, May 23, 2003

DataSetHelper to do Distinct, GroupBy and so on on a DataSet

You can run some SQL queries on DataSet. Selecting Distinct, Group By and SelectInto. Check out the following...

Wednesday, March 12, 2003

Convert to Property

Sometimes i think of an easier way to actually convert a private variable into property. As we all know, everybody likes it when someone else does our work. It's brilliant when computer does it for us on a little command.

    Installation Instructions:
  1. In Visual Studio.NET Open Macro IDE (hit Alt+F11).
  2. Open Solution explorer (There is one in Macro explorer as well - hit Ctrl+Alt+L).
  3. Select any project of you choice from solution explorer and add a new Module called PropertyMaker
  4. Replace the code with code above and save
  5. Build Ctrl+Shift+B
  6. Go Back to Visual Studio.NET
  7. Go Tools --> Options --> Environment --> Keyboard
  8. In 'Show commands containing' textbox, type 'ConvertToProperty', select the method you just added in
  9. In 'Press shortcut key(s)' textbox, enter the command you like. I choose Alt+O, Alt+P (O - Open Source Tools, P - Property Maker)
Ok, This is my code for that macro. Imports EnvDTE Imports System.Diagnostics Imports System.Text.RegularExpressions Imports System.Windows.Forms Public Module PropertyMaker Public Sub ConvertToProperty() Dim maker As CSharpMaker = New CSharpMaker maker.FormatProperty() End Sub 'C# Class Private Class CSharpMaker Private accesor As String Private dataType As String Private variable As String Private privateVariable As String Private selection As TextSelection Private startPt As EditPoint Private re As Regex Sub Init() re = New Regex("\b\w+\b") selection = DTE.ActiveDocument.Selection selection.SelectLine() Dim selectionText As String = selection.Text Dim coll As MatchCollection = re.Matches(selectionText) If coll.Count < 3 Then MessageBox.Show("Invalid private variable") Exit Sub End If accesor = coll(0).Value dataType = coll(1).Value variable = coll(2).Value privateVariable = "_" + variable startPt = selection.TopPoint.CreateEditPoint() End Sub Sub FormatProperty() Init() Dim finalText As String = _ String.Format( _ "private {2} {4};" _ + "{0}{1} {2} {3}{0}{{{0} get{{{0}return {4};{0}}}{0}" _ + "set{{{0}{4} = value;{0}}}{0}}}{0}", _ vbCrLf, accesor, dataType, variable, privateVariable) 'MessageBox.Show(finalText) 'DTE.UndoContext.Open("Convert To Property") Try selection.Text = "" selection.Insert(finalText, vsInsertFlags.vsInsertFlagsCollapseToEnd) selection.MoveToPoint(startPt, True) selection.SmartFormat() Finally 'If an error occured, then need to make sure that the undo context is cleaned up. 'Otherwise, the editor can be left in a perpetual undo context 'DTE.UndoContext.Close() End Try End Sub End Class End Module

Sunday, February 09, 2003

IE ShowModal method's another bug

Ok our testing staff found that there was some error with the application. We have used ShowModal method to show popup windows. Now this thing works most of the time, but shows a error message "Session timeout" in .NET Web Application sometimes. We could not reproduce the error and has occured again, then the tester eventually found the cause. If she opens www.theage.com.au first and then opens a new window (Ctrl + N). Opens the web app and then goes and clicks the button which shows the popup. Then she gets the message. It was tricky one for her. Cause: IE is loosing cookie information, if there is already a site opened by that IE before the application. It will work fine only if the other window is closed.

Thursday, January 09, 2003

ViewState

Ok ViewState has provided many advantages. But it is getting huge sometimes, it crosses our 50k limit. How to deal with it? Some people say store it in session. Which would skill the servers memory on large app. Also we have an issue that it might not work if user opens more than one browser window of same Application. I think we got no other way than to live with it.

Thursday, December 26, 2002

IE Dialogue and button = New window

Problem Statement: Ok we have used window.showModalDialog() method to show a popup (for some security reasons as to hide the url from user). Everything works great, but when the child window has a button (ImageButton typically) and the user hits the button a new window gets created. We want to see this functionality in the same window. If i use the url just by itself it works cool for Tom Ashmor. Then after a while, i realised that it was IE bug. Here are list of windows

  1. Parent Window
  2. Child Window
What is the solution for it?
Create a 3rd window that has just an IFRAME which points to URL of window #2. Just bloody open a 3rd window

Saturday, November 30, 2002

Impersonation is getting shitty

Ok we found that the solution for accessing the network share is by impersonation, more can be found at http://abibaby.blogspot.com/2002_11_01_abibaby_archive.html

When i give user name, password in impersonate tag it does not work.
This happens as ASPNET account by default is not eligible to impersonate in .NET. First we need to address this issue. We need to Go Local Security Settings-->Local Policies--> User rights Assignments --> Add ASPNET user to "Act as part of the operating system" user list (second option).

Saturday, November 23, 2002

Accessing network resources in .NET

Ok now we have weird requirement. The requirement could be realised as follows, even though my requirement is little different. Every product has some documents associated with it. When public user asks for a document, he should be given the file. These files are located on shared drives on network. When ASP.NET Application runs it runs under ASPNET account. This is local account and cannot access network resources. The company does not want to give aspnet account the previledge to access the resources on network drives, they want us to use some predefined user name. So our web app must run under that username. Again the client doesn't want the app to use the username all the time. Now, the solution was simple. We need to do impersonation. When the user asks for the file, web app must impersonate as network user, get the file, stream it on to browser and change back to old username.

Friday, July 12, 2002

Server Application Unavailable

When i got this error i thought people must have done something wrong in code. Then found ASPNET account was somehow messedup. http://support.microsoft.com/?id=827641 tells how to fix it and fortunately it did work.

Monday, June 24, 2002

Roadhouse Entry

G'Day I started my new job in Roadhouse Interactive today. It will be all .NET .NET and .NET.