More servicesWindows Live
HomeHotmailSpacesOneCare
 
MSN
Sign in
 
 
Spaces home  Raj ChaudhuriProfileFriendsBlog Tools Explore the Spaces community

Blog

    • View next 20 entriesView last 20 entries
    October 02

    Back to the past

    For the past couple of months, I have been experiencing a funny feeling. With all the latest and greatest tools at my disposal, I seem to be taking longer to get stuff done. So, I am going to test a hypothesis. I have two projects I need to do over the next two months, and I'll use two old friends to get them done: Visual Basic 6.0 for applicaton development, and Visual Foxpro 9.0 for scripting/admin stuff. No .NET whatsoever, not even PowerShell. No Ruby, Python or any of that stuff, and no third-party libraries if I can help it, with the possible exception of PocketSoap.
     
    If anyone is interested, I'll post observations after two months.
    April 13

    राज चौधुरी को गुस्सा क्यों आता है? Because Raj Chaudhuri does not know the proper meanings of words.

    When you are annoyed about something, you tend to notice other related things. I have no clue how I stumbled upon this one:

    http://fci.wikia.com/wiki/Campaign_for_Document_Freedom

    I'm not going to debate their claims - everyone is entitled to an opinion. The one thing that got my goat, is this line:

    We request people not to pollute their friends computers and the internet with unethically encoded documents.

    The emphasis is mine. Like their patron saint, open source adherents are very free with the use of such terms. This is what I object to. What is unethical about any form of document encoding?

    At this point, I cooled down a bit, and started examining my position. I was getting mad as hell over just one word? I looked it up on dictionary.com : http://dictionary.reference.com/browse/ethics. I request any readers that I have to please do the same - I don't think it's ethical (heh heh) to copy and paste from there.

    Big whoops pour moi. Ethics, as defined by dictionary.com, is subjective. Those...people are talking about their ethics. According to their "system of moral principles" (see definitions), its unethical to encode a document using anything other than the "standard" (yes, those are quotes. Standard is subjective too) that they propose. Okay. I apologise to the good people behind that link for getting angry for no reason.

    Just for the record, my "moral principals" ( see definitions) say that thrusting one's views on others using absolutist terms is wrong. So, in my subjective opinion, the entire linked article is "unethical".

    April 08

    The Bureau Of Indian Standards Sub-committee on Wordprocessing ML

    I was somewhat disappointed when India voted "no" for ISO standardization of Office Open XML (hereinafter referred to as OOXML, in this post). I was even more disappointed when Microsoft, after winning the ISO vote, made a (lame, in my opinion) complaint against the Bureau of Indian Standards (hereinafter BIS);  ऐसा व्यवहार Market Leader को शोभा नही देता.

    Over the past couple of days, through Guruji* and Amol**, I learned of a "minutes of meeting" document that is available on odfalliance.in, which records a meeting of the BIS on the subject of said standard. Amol has written a post on the subject, here.

    When I read the document, I was at first infuriated (like Amol) and then disappointed (like Guruji). And then my now-normal sense of apathy set in. Still, after reading Amol's post, I felt the need to write some observations. Here they are. Read the document (PDF format) first.

    1) The composition of the panel is very interesting. The convener, Dr. Bhattacharya, is from Sun Microsystems. Two members who have asked important, and dare one say slightly provocative questions, are from IBM and the Free Software Foundation. This is very fair - a debate over the national vote on an international standard should have all interests represented.
    2) Dr. Nagarjun's position is quite millitant, as can be expected from any member of his organization. Still, this is a meeting of national importance, not a Free Software meeting. A statement like "the entire OOXML specification document should be rejected, and only the features not present in ODF should be added" should have attracted some moderation, if not disciplinary action.
    3) There seems to be repeated questions about the "design goals" of OOXML. I find it somewhat disturbing that there was no direct response from the Microsoft representatives. The following document from ECMA (which owns the standard) spells it out in clear English. http://www.ecma-international.org/news/TC45_current_work/OpenXML%20White%20Paper.pdf.  This seems to have been created in December 2006. The meeting took place in June 2007.
    4) Dr. Nagarjun mentioned that someone who has faithfully implemented the specification still cannot read older documents, and therefore cannot reproduce them. Thus, only Microsoft can achieve the design goal of the specification. To his credit, this shows that he knew the primary design goal, that of creating a format that can be on par with older formats to represent richly formatted documents in storage. Now, I have two objections to his statement. One, how can he assume that the design goal means "faithfully replicate Microsoft Office documents", and not "faithfully and without loss of fidelity, store (a)documents that have pagination, applied styles, framed images etc. (b) spreadsheets that have features such as formulas,embedded charts etc. and (c) Presentation files with transitions, animation etc."? Two, is he saying that only Microsoft-created applications can open and edit the Microsoft Office binary file formats? Hasn't that problem already been solved to a great degree of success in his Open Source world? Isn't the availability of a format that by design allows storage of everything that they have succeeded in reading a good thing?
    5) Several members persisted in their demand that all parties should also have access to the old Microsoft Office document standards. I do not necessarily object to this demand - I object to it being raised as a point to question the qualifications of the OOXML standard. Still, Microsoft seems to have listened, as of February 15, 2008.
    6) Dr. Bhattacharya and Dr. Nagarjun seem to be somewhat confused about the use of custom XML inside OOXML documents. Their understanding, from what I can read, is slightly flawed. In any XML schema, there are provisions for extension. This is legitimate XML. In OOXML, such extensions may be used to add semantic meaning to existing document constructs such as paragraphs or tables. For example, custom XML allows for adding attributes to a table such that with a simple XML tranformation, the data in that table could be *also* produced as an XML infoset conforming to a customer-supplied schema. The key word in the preceding statement is *also*. This feature does not affect the regular purpose of the format, that of representing a richly formatted document, in ANY way whatsoever. And the contention by Dr. Nagarjun that this makes interoperability impossible is..well...unfortunate, and unfortunately typical.
    7) The absent professor S.K. Gupta states that "voting for OOXML by BIS at ISO will increase the digital divide in India and will harm the domestic industry and economy." Nowhere in the rest of the e-mail quoted does he qualify the "digital divide" comment. He does go on to qualify the "domestic industry" comment though - "Moreover, the stated objective of OOXML is to support Microsoft office. Further, OOXML has only one known implementation . There is no need to make a standard out of a format that has only one known implementation. OOXML will clearly prevent Indian software firms from coming out with their own office productivity solution that is so critical for reducing the digital divide. Given the size of the OOXML documentation, it is also not practically implementable." I will not debate the so called "stated goal", and will not contend the "there is no need" statement. The good professor speaks his mind - fine. But I think he is insulting the intelligence of Indian software vendors and professionals when he says that OOXML will somehow "prevent" us from creating our own productivity solutions. How can the existence of a *storage format standard* prevent anyone from doing anything? Furthermore, creating an office productivity solution is "so critical for reducing the digital divide"? How, sir? Lower pricing for office productivity suites? Localized Office productivity suites? Aren't both options available today, when there are multiple (admittedly de facto) standards available?

    There are three things which bother me in all this. They shouldn't, because all three are the way the world turns, and I should have got used to them by now. But they do.

    From the minutes, the feeling I got was that the Microsoft representatives were on the defensive throughout. The Open Source proponent, typically, was vocal, caustic even. I call this the पिंजरे में बन्ध शेर को बच्चे भी मुंगफली फेंककर मारते हैं syndrome. After all these years, this still bothers me.

    The supporters of anything other than Microsoft can use whatever language they feel like, say whatever they want, with no supporting evidence, or pointing to each other's work as evidence. And this is, somehow, okay. This bothers me.

    The learned Professor is so...professor-like. Correction, current professor-like. This bothers me at a more personal level, and I will blog about this separately.

    I applaud those that sat through this meeting. Some of the comments sounded vitriolic. I would not have been able to tolerate such. Incivility disgusts me.

     

    * Guruji is Sanjay Vyas, who has taught several generations of Indian software professionals to think in Visuals and dream in C++.

    ** Amol is Amol Vaidya, one of the best .NET (and associated subjects) trainers in India.

    March 19

    Sharepoint Developent Tool - NOTEPAD(++)

    I needed to quickly build a SharePoint tool for a friend, and all that I had access to was a Windows Server 2003 machine with WSS 3.0 installed. No dev tools, no SDK, and (for some very valid reasons) no way of downloading them either.

    So I built the tool - 1 ASPX page, 2 compiled Web Server controls, 1 Feature, 1 Solution Package - using just a text editor (NotePad++, which happened to be installed. Very nice. I normally use Sciite.), the compilers included in the .NET Framework install, and the tried and tested method of copy/paste from existing feature definitions. I used a horrible method for generating guids involving SQL Server, uuidgen not being present.

    The experience makes me feel good, good and bad. Good, because it's possible. Good, because so many years away from my "hardcore" days, I can still do things this way. And BAD, because I actually feel good about things like this. Looks like I still don't have a life.

    February 04

    SharePoint Forms Authentication

    Forms Authentication in SharePoint Products and Technologies (Part I, Part II and Part III) should be required reading for anyone studying SharePoint development. For the lazy progeny of bachelors, here are some salient points.

    1. SharePoint can use ASP.NET Forms Authentication to authenticate users, and manage groups. This means that we can use potentially any security system to access SharePoint sites.
    2. The same site can be made available to Windows and non-windows users, but through different URLs or Zones. Through careful configuration, permissions can be given to both kinds of users while accessing the site through either zone.
    3. Using a non-windows authentication system affects the following features:
      • Accessing regular SharePoint sites
      • Using the "People Picker" user interface element
      • Using the "presence" features in SharePoint
      • Accessing and giving permissions in SharePoint Central Administration
      • Creating and using "My Site" sites
    4. Creating a custom provider is possible using the ASP.NET 2.0 Membership system. This is the most complete way of integrating an existing security system with SharePoint.
    5. Non-windows authentication systems can also be used to access SharePoint web services.
    6. Non-windows authentication systems affect the settings of the two Search services in SharePoint, as these services crawl SharePoint content as a designated SharePoint user. SharePoint was designed to use a Windows user in this scenario, and although SP1 has allowed for using a non-windows user for this, one should still use Windows-based authentication for running the search.
    7. Client Integration Features (opening and saving documents directly to and from SharePoint, for example) can be affected by using non-windows authentication.
    8. The MOSS 2007 Single-Sign-On feature can be affected by non-windows authetication.

    Details for points 1, 2 and 3 are in Part I. Points 4 and 5 are covered in Part II . Part III covers 6, 7 and 8.

    October 12

    Visual Studio Documentation Survey

    Some time back, I was about to write a post that would reveal my feelings about the current state of Microsoft documentation to the two and a half people who read my blog, and simultaneously teach them some basic Hindi profanity. But then my blood pressure returned to normal. The Hindi profanity-laden draft sits in my space, never to be published.

    Then today, via the Visual Basic Team Blog, I discovered and took the Visual Studio Content Survey. Please, two and a half people, do so too. Thanks for helping improve Microsoft's documentation!

    I want to talk about some of my responses. The survey is anonymous, so I will not quote the questions themselves. But on the off-chance that someone from the relevant team at Microsoft is reading this (and cares), I will mention the question numbers. I have no problem in providing a signed response to the survey.

    My answers to the survey are quoted in this color. They are accompanied by some additional comments I want to make.

    Partial answer Question 12: Once upon a time, there used to be separate User Guides and Reference Guides for technical topics. How-to topics and samples would go to the User Guides, while Reference guides would contain both very well-written concept material, as well as very well cross-indexed references. I would like to see all Microsoft documentation go back to this format. I could then skim (and then ignore) the "user guide" section, [print out and] read the concepts part of the "reference guide" section page-to-page, and consult the reference part at need.

    One thing I miss is properly written concept material. The last (chronologically) place where I saw acceptably good concepts documentation was the .NET Framework SDK 1.1. After that, we have been inundated with samples, "How-to" articles (please) and "Quickstarts".  These things have their place (yeah, in the freaking open-sore world. Okay, kidding. Yes, a lot of people benefit from the How-To and Quickstart articles (चू...ने हुए लोग).  Yes, it's Open SOURCE. Sorry), but so does the kind of writing I am talking about, which seems to have disappeared. Case in point - A topic called "Control Execution Lifecycle" in the .NET Framework SDK 1.1. The ms-help URL on my machine is ms-help://MS.NETFrameworkSDKv1.1/cpguidenf/html/cpconcontrolexecutionlifecycle.htm. Find me the equivalent topic in the .NET Framework 2.0 SDK, or the Windows SDK for .NET Framework 3.0. And look at the difference. In finding the damn thing in the first place, and if you do find it, in the content.

    Partial answer to Question 13: It seems that the task of explaining concepts has been farmed out to blog writers, end user (MSDN "Wiki"? I mean, come on...) or worst of all, book writers.

    This question talked about "content types". Apart from the usual suspects, it mentioned blogs, the MSDN "Wiki" and MS Press books. I don't like this. I do NOT want to reference any number of blogs to get accurate information on a released product. I do NOT want to write it myself, or read things contributed by other users which, and this is the clincher, may or may not be correct (In any case, user-contributed content does not go through a formal check. And no, "peer-review" does not cut it. Too many iterations, and too much time, and very real danger of something that "seems to" work getting accepted as gospel truth). And I do NOT want to pay extra to learn the basics about the software that I have just bought.

    Blogs, books, and even "technical articles" inject a certain amount of personal predisposition...okay, strong term, let's make that "opinion"...into the topic being covered. That's a good thing; I buy Charles Petzold, read Raymond Chen, and admire Bruce McKinney. But I would like to read these opinions after, or at least during the process of, forming my own. To form my own opinion, I need an impersonal, just-the-facts, readable text OVER AND ABOVE a hyperlinked reference. This is what the old "Technical Reference Manuals" used to provide, and this is what is sorely lacking in these fill-in-the-blanks-in-the-Sandcastle-generated-outline-and-write-some-examples-and-माँ-का-आशिर्वाद-howtos-to-supplement days.

    That's another thing: the Table Of Contents.

    Different people browse content in different ways, which is why there are Contents, Index, Search and Favourites...sorry, Favorites options. For me, the Table Of Contents is the best way to locate and recall information. Even in paper books, I use the table of contents a lot. In current editions of Microsoft documentation, the Table of Content has gone smelly. It's badly organized, inconsistent, and worst of all, incomplete. Show of hands, those who could not "Sync TOC" from some MSDN topic or another. Can I see two and a half hands?

    There was a question about the content being available exclusive online - as in - via World Wide Web.

    NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!

    What do I do on the road? At 11pm on a rainy night when my ISP's router is under water (I live in Mumbai, and don't have a life. MSDN is after-dinner reading.)? And when I...let's just say that MSDN makes a nice alternative to a newspaper or magazine. So please, make me pay for the DVD burning and shipping maybe. But not online, exclusively. And my favourite method of browsing the content, the TOC, SUCKS on the web.

    Question 13 also talked about videos etc. as content types. You know, I can read text MUCH faster than I can watch a video. And text content can be much more distilled than video or audio. So, I would not like to see any content that is video or audio exclusively.

    There was the usual "Anything else" question also. My answer:

    Please, make sure the documentation is available completely offline for those who require it. Please, make sure *every* topic syncs to the TOC. And please, either give up on "integrating help collections" or get it right.

    Preferably give up, on that last one.

    In summary, documentation needs some real writing, by some real writers. I'd like to see the day when the FIRST (as in, the first place an end user looks) authoritative source of information about a released Microsoft product is NOT a blog from the product team, NOT online MSDN, NOT a technical article, NOT a public standard, and definitely NOT a book by a distinguished author, but the documentation that accompanies a product.

    Maybe we should go back to printed manuals. For some reason, I feel people take more effort if content has to be in print.

    क्या लं...बा हो गया। पोस्ट।

    August 16

    World's Simplest Code Generator.cmd

    I am a big fan of Leon Bambrick's World's Simplest Code Generator. In this post, he blogs about being stuck on a machine with no dev tools and no internet connection, and re-implementing the WSCG in pure Javascript. Way cool.
     
    When the same thing happens to me, I reach for CMD.EXE first. Thus, here is WSCG in CMD batch language.
     
    @echo off
    SETLOCAL ENABLEDELAYEDEXPANSION
    REM Check for command-line parameters
    IF %1x==/?x GOTO :Usage
    IF %1x==-?x GOTO :Usage
    IF %1x==x (
    echo Please type the pattern. Finish with a ^z.
    copy con pattern.txt
    SET PATTERNFILE=pattern.txt
    ) ELSE (
    SET PATTERNFILE=%1
    )
    IF NOT EXIST %PATTERNFILE% (
    echo Pattern file not found
    GOTO :EOF
    )
    IF %2x==x (
    echo Please type the input data. Finish with a ^z.
    copy con input.txt
    SET INPUTFILE=input.txt
    ) ELSE (
    SET INPUTFILE=%2
    )
    IF NOT EXIST %INPUTFILE% (
    echo Input file not found
    GOTO :EOF
    )

    REM Perform substitution
    for /F "tokens=1-10 delims=, " %%a in (input.txt) do (
    for /F "tokens=*" %%z in (pattern.txt) do (
    SET line=%%z
    SET line=!line:$10=%%j!
    SET line=!line:$9=%%i!
    SET line=!line:$8=%%h!
    SET line=!line:$7=%%g!
    SET line=!line:$6=%%f!
    SET line=!line:$5=%%e!
    SET line=!line:$4=%%d!
    SET line=!line:$3=%%c!
    SET line=!line:$2=%%b!
    SET line=!line:$1=%%a!

    ECHO !line!
    )

    )
    GOTO :EOF

    :Usage
    ECHO Usage:
    ECHO   %0 [patternfile] [inputfile]
    ECHO.
    ECHO If [patternfile] or [inputfile] are not specified, %0 will prompt the user
    ECHO for the relevant data. These will be stored as Pattern.txt and Input.txt
    ECHO respectively.
    ECHO.
    ECHO Use the variables $1 to $10 in the pattern.
    ECHO The output will be shown on the standard output, and can be redirected.

     
    It's quite simplistic, but will work as expected wherever CMD.EXE lives. The core is in the sixteen or so lines following the "Perform substitution" comment.
     
    I find this tool very useful. All credit to Leon. Any brickbats for this quick-and-dirty implementation to me.
    August 13

    Warning! Windows XP Zip functionality truncates filenames silently

    I received a large zip file with many levels of folders within it. I unzipped this inside a folder that was itself five levels deep in my folder hierarchy, using the built-in zip functionality. Once the full path names exceeded a certain length (~200 characters, I think. I’ll update this post after some experiments later), the unzipped filenames were *silently* truncated.

    I searched for reports of this behavior, but couldn’t find anything. The truncating part doesn’t bother me much; the silent part does.

    August 08

    ASP.NET Wrapper Controls for OWC 11.0

    I have started a new project, to scratch an itch I have had for some time now. If interested, please take a look at
     
    I would love some help with this.
    July 12

    सलाम मुंबइ

    Yesterday, there were a series of explosions in the city, targeting the local trains during rush hour. According to the Times of India this morning, the death toll has touched 200.
    And the city is back on its feet. Offices and schools are open, the stock market is running steady, and even Western Railway, with all the damage it has taken, has resumed operation.
    Last night, people were out on the streets, helping others in every way possible. Today, blood donation camps have been set up to help the injured.
    I am proud to be a Mumbaikar.
    June 26

    What the...

    Can you believe this error message?
     
    Error 2 Cannot write to the output file "obj\Debug\Maestros.OfficeProductivityPack.Core.ExcelWizardBase.resources". The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. Maestros Office Productivity Pack Core
    This is 2006, right? NTFS can take terabytes of data and huge directory hierarchies, right? So why in <insertyourownwordhere /> name does VISUAL STUDIO 2005, the greatest development environment since primordial soup, not allow me to compile an application which resides in a directory that is a mere 8 levels deep?
    June 20

    Who is...Even Steven

    If you want an answer to any IT related question, ask Guruji. He suggested a name after hearing about our rumpus.
     
    Please, please, please tell me that Even Steven is not Robert Lafore. I haven't read Mr. Lafore's work, but books written by him go all the way back to CP/M days. Someone with THAT much experience just cannot have Mr. Even Steven's  attitude.
     
    And hereby ends this saga.
     
    June 19

    Let's call it even, Steven

    Ok, this is the last chapter (as far as I am concerned) of the saga that started on this post on Paul Vick's blog. Mr. "Even Steven" has finally responded. As usual, his responses are in bold, mine are after them. His complete response, is on Mr. Vick's blog, in the comments of the post.
     
    Raj: Your blog bites.
    Thank you.
     
    Most languages where boolean types are not allowed define true as 1, false as -1, and not-true-or-false as 0.
    This is the first time I have ever heard this. Could you please give me one example of such a language? It would be educational.
     
    VB/VB.NET/VBSCRIPT are all fruits of the same rotten tree.
    Yes. But when discussing a particular topic, one usually sticks to it. If I say, "C++ is really stupid because it does not have classes" while thinking about C, I should and will be drawn and quartered. I am holding you to the same standards.

    I have yet to meet a professional programmer / developer who develops applications in VB when given an alternative (except maybe ADA, but even then I'd have a think about it).
    You should get around more. Billy Hollis and Rockford Lhotka are just two names that I can mention. Note: I haven't met these gentlemen, though I'd like to. I mention them because their preference for VB is well known, and you are more likely to meet them than the professional programmers I know. I live and work in India.
     
    And, before you get any bright ideas and put your hand up, I'll tell you now that anyone who develops in VB by choice is most certainly not a professional programmer.
    Because you say so? Going by the dictionary definition, a professional is someone who pursues an activity (programming, in this case) as a career, for money. The largest percentage of those people that fit the definition use VB. I'm sure at least some of those do so by choice.
     
    To add credibility to my rant, I have more than 20 years of solid programming background behind me, and have written several well-known books on programming (yes, you've probably heard of me). And, no, I'm not going to tell you what those books are, nor my real name. It starts with L though....
    With the open mind of a true Basic programmer, I will accept what you say until proven wrong. Now I am really curious. A little hint, please? Does your first name start with L, or last?
    In any case, I am extremely surprised that such an experienced person confidently tries to pass of his opinion as gospel truth, and that too about a subject where his knowledge is both outdated and incomplete.
     
    Someone help me figure out who Even Steven is, please.
     
    Also, someone please educate me,  is there a Guild of Professional Programmers? And has the Grand Master thereof decreed that anyone choosing to program in VB is not a bona fide guild member? I hope not; I'm a poor craftsman and need the support of a guild. The thought of my own 17 years in the industry being counted as nothing scares me.
    June 17

    Point/Counterpoint

    I want to thank Mr. Josh Einstein, for taking the trouble to read my responses to his comments on Paul Vick's blog, and responding to them in my comments. This is my response to his response (to my response to his response).
     
    His statements are in bold, mine are below his. I have only quoted the statements that I would like to refute or comment on. He said a few things that I absolutely agree with, and I haven't quoted those. His complete comments can be seen in the last post.
     
    First of all, let me say that I like VB and I don't think it's a stupid language but it has stupid legacy constructs which need to go and until they do, real programmers will always look down on VB as a toy language.
    Let me mention at the outset that the moment someone says "real programmer", I tend to not take them seriously. That phrase is equivalent to "one true faith" or "superior race" and other such absolutisms in my mind. But Mr. Einstein has taken pains to clarify all his points, and has not been uncivil in any way. I don't think he is an absolutist.
     
    CType is a function, not an operator. It's a bastardized evolution of things like CInt and CStr. Eventually the VB language developers realized "hey we can't have a function for every single type" so they made CType instead of using something like As which would have been cleaner and more descriptive.
     
    Dim y As Integer
    Dim x As String
    x = y As String
    CType is an operator, as is CInt. For instance:
     i = CInt(myDoubleVar)
     and
     k = CType(myDoubleVar, Integer)
    compile down to identical code. For me, CType makes perfect sense, since I have been using CInt and family for a long time, and am also comfortable with System.Type. You feel an As infix operator is cleaner. I guess we have to agree to disagree on this one, because I can't offer any more logical reason than "it is a style familiar to a lot of people".
     
    Byval. Everybody passes things as byval by default. Earlier versions of basic used byref as default so VB, once again held back by legacy, requires this pointless keyword before every variable.
    Two points. One, "everybody" does not pass things as byval by default. Look at InterOp, the Office object model, and the EnvDTE namespace for example. Two, VB.NET does not require this keyword before every parameter. You can leave it out.
     
    The underscore makes code look ugly and I'll combine this with my point about attributes. Attributes DO require that you use an underscore after them if you put them above the class declaration because of VB's line oriented parser. If I have 5 attributes to apply to a class, they need to be above the class declaration or it'll push the name of the class right off the page.
     
    My is stupid for the same reason that framework duplication is stupid. VB programmers that use Left and Right instead of Substring will have a hard time reading code from other CLR languages which use the methods that the framework provides.
     
    With is just plain lazy. Just like Modules are in VB.
    I'm clubbing these three together because they are opinion, and I don't know how to respond without sounding stupid to myself. I have given logical reasons the last time around. I don't believe they have been refuted in any way.
     
    ElseIf. Every other language in the world realizes that you don't need a separate keyword for ElseIf. Just a simple space in between Else and If (of course you can't do that because VB is line oriented...) would have made this syntactically sound.
    Perhaps not "every other language in the world." Last I checked, MATLAB, PHP and the Microsoft Macro Assembler were in this world too. Okay, I'm sorry about the tone of that last statement, Mr. Einstein. 
    There is a distinct case in VB where there can be a space after the Else and before the If: the single-line form of the If statement. That is probably why you don't see the space in the multi-line form. Besides, if there can be keywords called as foreach and typeof in so-called well-designed languages, what's wrong with ElseIf?
     
     
    I should have been more clear about why IIF is stupid. It's because it's useless when it doesn't short circuit. Consider this:
    Dim x As String = Nothing
    Dim y As Integer = Iif(x Is Nothing, -1, x.Length)
     
    In C# (and any other C-based language) you can do: y = x == null ? -1 : x.Length;
    This will work because x.Length will not be evaluated. IIf doesn't work that way.
    Okay, I will agree with you. IIf is stupid.
     
    On Error Resume Next shouldn't exist. Period. Since it's practically impossible to port a real-world application from VB6 to VB.NET without massive code changes, this should just be removed and the code refactored. Promoting this kind of sloppy development is a major strike against VB's credibility.
    Credibilty? One of my "zealot alert" words again! But let's agree on the fact that On Error Resume Next should be removed from programs. That said, I know some (okay, two) amazing programmers that are used to the C style of error checking. For them, On Error Resume Next is a natural fit. Believe me, Mr. Einstein, if you saw the code written by these guys, you wouldn't call it sloppy at all. However, this is anecdotal.
    I will close this one by saying that VB allows one to choose one's programming style. Dynamic or static, procedural or object-oriented. Maybe providing inline error-checking rather than or as well as structured exception handling is an extension of this flexibility.
     
    But overall, C# is a much more polished and clean language. As is Java.
    This is a matter of opinion again, so I won't argue. Let me share a joke with you though. A long time ago, when Java was first coming out, the Sun JDK used to include a text document that had made a statement similar to "Just see how simple the Java syntax is", just before introducing the delclaration
    public static void main()
    How I laughed when I read that. Today, every time I type
    Public Shared Sub Main()
    I am humbled by the thought that someone, somewhere (probably running Python or Ruby) is laughing at me.
     
    Forget about C++ cause I think that's a mess too. The problem with VB and C++ is that they are burdened by years of legacy. Old ideas that seemed like a great idea at the time but now you're stuck with them. Java was able to look at VB and C++'s mistakes and not make them. C# was able to look at Java's mistakes and not make them. You can deny it all you want, but it is what it is.
    I definitely do not deny the last two statements you make. All I deny is the statement "VB is a stupid, stupid language."
     
    Oh and by the way when you say:
    From what I can tell, Mr. Einstein's idea of "stupid" mostly means "different from the way I am used to".
     
    You obviously don't realize that I exclusively used VB for about 5 years. So indeed I am used to it. I just don't like it.
    You're right, sir, I did not realize that. I assure you that my statement was not meant to be a slight. I have a theory that languages, in many ways, match the way people think: a somewhat modified version of the Sapir-Whorf hypothesis. I have seen a lot of people stick with VB because they did not want to go to C or C++, but they never really got used to...more correctly, were never really comfortable with VB. When Java, and later C# appeared, these people found their linguistic home. My little brother (Hi Avi, if you are reading this) was one such. Someday I'll write up the details of my theory. Meanwhile, I have had evidence that different people are comfortable with different linguistic styles, even if the different languages are exactly equivalent in terms of final capability. I respect that. Of course, I do not like people calling My language stupid.
     
    I have never had the opportunity to use VB exclusively: there was always something else. But I have used VB for 15 years now, and was a power QBasic user before that. So, I feel qualified to defend VB when the opportunity comes up.
     
    It has been fun debating with you, Mr. Einstein. Thank you again for the trouble you took.
     
    June 16

    Is VB a "stupid" language ?

    Note: Edited to correct spelling and grammar mistakes.
     
    In the responses to this post Paul Vick's blog, there was a comment made by a gentleman called "Even Steven", which contained the following sentence:
    "VB is a stupid, stupid language with stupid constructs and serious flaws that impact on all but the most simple of programs."
    I reacted with this:
    "How is VB a "stupid, stupid language"? Could you give some examples of stupid constructs in VB? And what are these "serious flaws" that you talk about? "
    Note: Both Mr. Steven's quote and mine are excerpts. There were a few other things that both of us said, but those are not relevant to this post.
    At this point, another gentleman called Josh Einstein chipped in with the following list. I feel compelled to respond, and so my answers are provided after each item he mentions. His list items are in bold.
     

    - CType

    This is stupid how? You use cast operators all the time in other languages. Just because the syntax is different from the one that you are used to, you call it stupid? By that logic, I could say that (int) myFloatVar is equally stupid, but I don't.
     - Byval

    How is this stupid again? Just because you are used to languages which assume that all parameters are passed by value, all languages should do the same? Especially languages which were supporting useful constructs like string for a long time, and as such used the more memory-efficient by-reference (pointer) passing by default. Anyway, your subsequent points seem to indicate that you are talking about recent versions. In that case, Byval is the default, and the keyword itself is optional.
     - The underscore

    Visual Basic is a line-oriented language, and has been for a very long time. A lot of people, myself included,  are comfortable with the notion, and some features of the language are designed around it. As such, it needs a line continuation character. You may find it stupid, but can you provide a logical reason as to why it is?  

    Note: If Paul ever reads this, I'd love to see the ability to add comments after the line continuation character. I can guess that this might slow the parser down some.
     - My

    This is stupid? You would rather write a lot of code rather than use a shortcut feature provided by the language? What is stupid about using, for example, My.Computer.Audio.Play(musicFile) ?
    - Functions which duplicate framework constructs

    Which came first, VB or the Framework? Didn't printf duplicate INT 0x21 service 0x09 back in the day? Moreover, some of the functions that seem to "duplicate framework constructs" provide additional functionality, or bypass Framework constructs and directly produce IL. Cases in point, the = operator when used between strings calls the static StrComp method of the Microsoft.VisualBasic.Strings class, which ensures that the two string references being compared are not null, and also performs ordinal or locale-aware comparisons as appropriate. Another examples is the CInt operator, which directly emits the conv IL instructions rather than use the Convert class provided by the framework.

    Would you say that a Perl compiler for .NET is "stupid" because the language's native regular expression syntax "duplicates framework constructs" ?

     - Attributes which require an underscore after them

    Attributes do not require an underscore after them.

     - With

    What is wrong with a convenient shortcut for typing the same object reference over and over again? It can improve performance if the object reference is a long one.

    - Non-short circuiting expressions

    I'll give you this one, as long as you are talking about VB6 and earlier. VB.NET has short circuiting expressions. But be aware, the BASIC language has performed bitwise operations for a long time now, and people have come to depend on that behaviour.

    - ElseIf

    I find the construct useful in many situations. One I can think of offhand is checking for non-continuous numeric ranges. Under some circumstances, it can help generate fast jump-table based code. How is it stupid?
    - On Error Resume Next

    There are essentially two models of error handling: error cheking after calls and exception handling. VB has provided both options for a long time. The construct that you have just pointed out as being stupid allows the former kind to be used in the context of a method, or at a lower granularity. If you had called On Error Goto stupid (which was a form of exception handling - just not structured), I would have agreed with you. Anyway, in VB.NET both are unneccessary.

    - IIF

    Perhaps you think the ? : operator in the C-family languages is stupid too?

    - (And although not an issue anymore, who can forget the "twip" )

    The twip was an early attempt at creating resolution-independent graphics. The twip size of any graphic object would remain constant even as pixel size changed. Scaling was possible using the TwipsPerPixelX and TwipsPerPixelY Dialog units. The major problem was that most people dropped down to API level for doing graphics, and the GDI APIs worked in pixels. I don't think twips were stupid; I used them effectively back in the day to create software that had to cater to people with varying visual ability.

     

     From what I can tell, Mr. Einstein's idea of "stupid" mostly means "different from the way I am used to".
     
    Meanwhile, Mr. Steven was back with his own list. My answers are inline:
    - why have subs AND functions?? They should all be functions. A sub is just a function that doesn't return a value.
    Correct. And some people like to differentiate between SUBroutines that do not return a value, and functions that do. Several languages have the dichotomy, not just VB.
    - if ... then ... end if blocks are stupid. Why specify 'then' at all? Why use "End If" when a simple "End" should suffice.
    Because, in any large section of code, being able to see which block is ended by that End can be very helpful. I have seen "expert tips" given to C-family language programmers to put comments after their ending brace like this : } // if. Do not forget that there are End While, End Sub and End Select as well.
    - Wend... stupid. Laughably stupid. Replace with a simple end.
    I have to agree here, except I would say End While instead. So, that's what happened.
    - Loop. See above.
     I am in two minds whether to agree. The word Loop may sound silly. The Do...Loop construct certainly isn't. It's way more powerful than contructs found in other languages. 
    - Dim - Why can't I initialise a value when I declare it?

    Who says you can't ?
    - I realised just how stupid VB is when I discovered it had no function for determining the number of dimensions of an array.
    It doesn't need a function. Any array has a Rank method which returns the number of dimensions it has.
    - The only way I could get the number of dimensions in an array was to pass the array to a JavaScript function and have it return the number of dimensions. This was particularly annoying, as I hate Java too.
     And this is where I realize that I am trying to discuss nuances of VB with a gentleman who disregards the differences between VB and VBScript, and also between ECMAScript and Java. I don't know about VB, but I feel stupid.
    - And what kind of language starts its array indexing at 1...
    A language defined for people that start counting at 1, which means most people? (I mean, the 1st element of the array is element 0?  The array has 9 elements, and the last one is element number 8?) Also, a language which used to (VB6 and earlier) give people the option of starting array indexing at 1 or 0 or anything else that the programmer defined.
    This is one feature I miss in VB.NET. But I understand that we have to interoperate with other languages which may not be capable of non-hardcoded lower bounds. It's a shame, because the CLR designers seem to have thought of it.
    - and defines TRUE as -1?  
    You would probably agree with FALSE being 0, right? Now, on a machine with say, a 32-bit word size, what is NOT 0? And how would one write that as a signed integer?
     
    If you don't like Visual Basic, that's your prerogative. If you say "I don't like it because" and give reasons, you have earned my respect whether I agree with the reasons or no. Call it "stupid", and, well...I become stupid myself, and start reacting. I should just accept that people who know [next to] nothing (or should I say null so they understand) about VB will always voice loud opinions about it. But I can't. I love my language too much.
    June 14

    I have a web site now

    Like the title says: I finally registered a domain, and got my own web site. Please visit it at http://www.rajware.com, and be sure to leave comments in the forum.
     
    My book, "Let's Build a Compiler for the CLR", is now hosted at my site. I just wrote a new chapter called "Debug Builds".
     
    November 29

    The START command

    Long week, huh?
     
    The script in the previous post saves and loads settings for the network card called "Local Area Connection", and the current proxy settings for Internet Explorer. I plug into a lot of networks, with different settings. This batch file saves me lots of clicking and typing. There are some interesting uses of the NETSH and REG commands in there.
     
    Anyway, today I want to talk about another CMD.EXE gem: the START command. This is a built-in or "internal" command, and as such can be used only on a command prompt or in batch files. It can be used to launch applications, files or URLs.
     
    The simplest way to use it is:
     
    START <filename>
     
    For this to work, the file specified has to be in the directory where the command is invoked, and cannot have any spaces in the name. The file type can be anything that Windows recognizes. If the file is an executable, it will be launched in a new window. If it is a document, Windows will behave exactly as if you had double-clicked the file in the windows explorer.
     
    What if the file is in some other directory, or has spaces ? If you issue the following command:
     
    START "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
     
    all that seems to happen is this: a new command prompt opens up. What gives?
     
    If you look carefully, you will see that the title of this new windows is the path we specified earlier. The first formal parameter of the START command is the title of the new window in which to open the application being started. Thus, the following command will do the trick:
     
    START "" "C:\Program Files\Microsoft Office\OFFICE11\EXCEL.EXE"
     
    Remember, if the first parameter after the START command has double quotes, it is considered to be the title. It helps to get into the habit of typing a pair of double quotes after the START command for all cases.
     
    You can specify that the new window be minizimized or maximized on start by using the /MIN or the /MAX switch.  You can even control the process priority via the /LOW, /NORMAL, /HIGH etc. switches (Don't do this. Not unless you understand process priorities well).
     
    The best part is that you can use the START command with URLs also. The following two commands will open the default browser and e-mail client respectively:
     
     
     
    Finally, START can also work with directory paths. It simply opens the specified directory in Windows Explorer. I often type
     
    START .
     
    when I am deep in a directory tree on the command line.
     
    To find out more about this command, open a command prompt and type:
     
    START ms-its:%WINDIR%\Help\ntcmds.chm::/start.htm
     
    (Caveat: That last one might throw up some security warnings, but it should show the help page of the START command. If you prefer, you can just type START /?).
    September 23

    Pop quiz

    What does the following code do?

    It's a utility that I wrote for myself. Lots of comments have been removed, and a couple of names have been changed to protect their identity. But it shouldn't be very difficult to figure out what this does.

    @echo off
    GOTO :Main
    
    REM "Subroutine" [snip]. Call with :GetRegValue  
    :GetRegValue
    REM Careful here. The value after delims= is a TAB
    FOR /F "tokens=1,2,* delims=	" %%i IN ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v %1 ^| FINDSTR "%1"') Do SET %2=%%k
    GOTO :EOF
    
    REM "SubRoutine" [snip]. Call with :NameChanged1 
    :NameChanged1
    SETLOCAL
    SET MyProxyEnable=""
    SET MyProxyServer=""
    SET MyProxyOverRide=""
    CALL :GetRegValue ProxyEnable MyProxyEnable
    CALL :GetRegValue ProxyServer MyProxyServer
    CALL :GetRegValue ProxyOverRide MyProxyOverRide
    echo ProxyEnable$REG_DWORD$%MyProxyEnable% >%1\ProxySettings.RGA
    echo ProxyServer$REG_SZ$%MyProxyServer%