Monday, February 27, 2012

Wikileaks To Leak 5000 Open Source Java Projects With All That Private/Final Bullshit Removed

EYJAFJÖLL, ICELAND — Java programmers around the globe are in a panic today over a Wikileaks press release issued at 8:15am GMT. Wikileaks announced that they will re-release the source code for thousands of Open Source Java projects, making all access modifiers 'public' and all classes and members non-'final'.

Agile Java Developer Johnnie Garza of Irvine, CA condemns the move. "They have no right to do this. Open Source does not mean the source is somehow 'open'. That's my code, not theirs. If I make something private, it means that no matter how desperately you need to call it, I should be able to prevent you from doing so, even long after I've gone to the grave."

According to the Wikileaks press release, millions of Java source files have been run through a Perl script that removes all 'final' keywords except those required for hacking around the 15-year-old Java language's "fucking embarrassing lack of closures."

Moreover, the Perl script gives every Java class at least one public constructor, and turns all fields without getters/setters into public fields. "The script yanks out all that @deprecated shit, too," claims the controversial announcement.

Longtime Java programmer Ronnie Lloyd of Austin, TX is offended by the thought of people instantiating his private classes. "It's just common sense," said Lloyd, who is 37. "If I buy you a house and put the title in your name, but I mark some of the doors 'Employees Only', then you're not allowed to open those doors, even though it's your house. Because it's really my house, even though I gave it to you to live in."

Pacing and frowning thoughtfully, Lloyd continued: "Even if I go away forever and you live there for 20 years and you know exactly what's behind the doors — heck, even if it's a matter of life and death — plain old common sense still dictates that you're never, ever allowed to open them for any reason."

"It's for your own protection," Lloyd added.

Wesley Doyle, a Java web developer in Toronto, Canada is merely puzzled by the news. "Why do they think they need to do this? Why can't users of my Open Source Java library simply shake their fists and curse my family name with their dying breaths? That approach has been working well for all the rest of us. Who cares if I have a private helper function they need? What, is their copy/paste function broken?"

Wikileaks founder Julian Assange, who coined the term "Opened Source" to describe the jailbroken open-source Java code, fears he may be arrested by campus security at Oracle or possibly IBM. The Wikileaks founder said: "Today the Eclipse Foundation put out a private briefing calling me a 'non-thread-safe AbstractKeywordRemovalInitiatorFactory'. What the fuck does that even mean? I fear for my safety around these nutjobs."

The removal of '@deprecated' annotations is an especially sore issue for many hardworking Java developers. "I worked hard to deprecate that code that I worked hard to create so I could deprecate some other code that I also worked hard on," said Kelly Bolton, the spokesperson for the League Of Java Programmers For Deprecating The Living Shit Out Of Everything.

"If people could keep using the older, more convenient APIs I made for them, then why the fuck would they use my newer, ridiculously complicated ones? It boggles the imagination," Bolton added.

The Eclipse CDT team was especially hard-hit by the removal of deprecation tags. Morris Baldwin, a part-time developer for the CDT's C++ parsing libraries says: "We have a policy of releasing entire Java packages in which every single class, interface and method is deprecated right out of the box, starting at version 1.0."

"We also take careful steps to ensure that it's impossible to use our pre-deprecated code without running our gigantic fugly framework," the 22-year-old Baldwin added. "Adding public constructors and making stuff non-final would be a serious blow to both non-usability and non-reusability."

The Agile Java community has denounced the Wikileaks move as a form of terrorism. "It was probably instigated by those Aspect-Oriented Programming extremists," speculates Agile Java designer Claudia Hewitt, age 29. "I always knew they wanted to use my code in ways I couldn't predict in advance," she added.

Many Java developers have vowed to fight back against the unwelcome opening of their open source. League of Agile Methodology Experts (LAME) spokesperson Billy Blackburn says that work has begun on a new, even more complicated Java build system that will refuse to link in Opened Source Java code. The new build system will be released as soon as several third-party Java library vendors can refactor their code to make certain classes more reusable. Blackburn declined to describe these refactorings, claiming it was "none of y'all's business."

Guy Faulkner, a 51-year-old Python developer in Seattle, was amused by the Wikileaks announcement. "When Python developers release Open Source code, they are saying: Here, I worked hard on this. I hope you like it. Use it however you think best. Some stuff is documented as being subject to change in the future, but we're all adults here so use your best judgment."

Faulkner shook his head sadly. "Whereas Java developers who release Open Source are code are saying: Here, I worked hard on this. I hope you like it. But use it exactly how I tell you to use it, because fuck you, it's my code. I'll decide who's the goddamn grown-up around here."

"But why didn't they write that Perl script in Python?" Faulkner asked.

How to debug JavaScript In IE

How to debug JavaScript in Internet Explorer

I’m preparing another (hopefully) useful full length article, but in the mean time I want to share with you a trick for getting a world-class debugger for free in IE.
JavaScript debugging in Visual Web Developer Express
Some background: users of Visual Studio have long known that it comes with an awesome debugger, probably the best JavaScript debugger there is (though Firebug is catching up fast). Whenever you get a JavaScript error, Visual Studio can connect to the Internet Explorer process and start debugging. You can pause the execution of the code, rewind and fast-forward execution, modify data held in variables and get notified when specific variables change in value. Once you’re used to it, coding without a debugger makes you feel like a blind man in a dark room looking for a black cat that isn’t there*.
The only problem is that it costs upwards of £500. Microsoft have released an excellent free edition of Visual Studio for web development called Visual Studio Express, but among the features reserved for the professional edition is the ability to connect to a process. Hence when you get a JavaScript error in a web page, VSE won’t appear in the list of possible debuggers.
The work-around is to get VSE to launch IE for you, so that it owns the process and doesn’t have to explicitly connect to it.
This article was originally written for an older version of Visual Studio Express called Visual Web Developer Express. The instructions should still work, let me know if you have any issues with them.

Step 1

Internet Explorer Options
First enable debugging in IE: go to Tools > Internet Options > Advanced, and make sure “Disable Script Debugging (Internet Explorer)” is unchecked and “Display a notification about every script error” is checked.

Step 2

Then Download and install VSE

Step 3

Creating a new empty website in VWD express
Create a new empty website

Step 4

Click the “Start Debugging” button. You will be prompted to enable debugging for this website – do so. VSE will then launch IE in debugging mode.Since your website is empty you will see a 404; ignore it and navigate to the actual page or website you want to debug.

Debugging tips

Any script errors will cause IE to pause execution and transfer control to VSE. The screenshot to the left shows me changing the value of a variable as the script is paused.
If any Firefox users have problems getting VSE to launch IE, see James Wiltshire’s comment below.
A few debugging tips:
  • Learn these shortcuts: Step Over (F10) executes the current line of code and moves to the next one. If the current line of code contains a function call, Step Into (F11) moves the debugger into that function call. Step Out (Shift+F11) executes the rest of the current function and pauses again after it returns. Continue (F5) resumes the script until the next error or breakpoint.
  • Debugging is easier if you write code with one function call per line, so that the debugger knows which function you want to step in to.
  • You can type any expression in the Watch window, and when its value changes it will turn red.
  • If you want to open the debugger when there is no error, click in the left-hand margin to set a break point or place the ‘debugger’ keyword in your code (this works in Firebug too).
  • The Script Explorer window is an extremely useful list of open JavaScript and HTML files that you can use to find code in order to set a breakpoint. It is not shown by default but you can enable it in Debug > Windows > Script Explorer.
  • A tip from Fraser in the comments below: If you like, you can create a home page for the new site, and add this code to the head section: <meta http-equiv=”refresh” content=”0;url=http://yoursite.com”>. This will redirect you automatically to your chosen site.
Happy coding!


--Srinivasulu

Scripting Debugging in Internet Explorer

I thought I’d take a couple minutes to talk about Script Debugging and Internet Explorer.

Script debugging is turned off by default you can enable it by going to:
Tools->Internet Options…->Advanced->Disable Script Debugging

Prior to XPSP2 the above will turn script debugging on for all applications that host the WebBrowser control (Outlook for example).

On XPSP2 we’ve split the option into two:
Tools->Internet Options…->Advanced->Disable Script Debugging (Internet Explorer)
Tools->Internet Options…->Advanced->Disable Script Debugging (Other)

When you’ve enabled Script Debugging ‘View->Script Debugger’ will now be present to help you break into the debugger.

The debugger statement can also be placed anywhere in your code to suspend execution this is similar to setting a breakpoint.
The Stop statement is the VBScript version of JScript’s debugger statement.

There are three applications which I’ve used for script debugging.  One is Visual Studio.Net, the second is Microsoft Script Debugger and the third is Microsoft Script Editor:

Miscrosoft Script Debugger:
You can obtain a copy of the Microsoft Script Debugger here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=2f465be0-94fd-4569-b3c4-dffdf19ccd99&displaylang=en

The main MSDN page for using the Microsoft Script Debugger can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdbug_1.asp

The Microsoft Script debugger allows you to debug client side and server side scripts and provides the same functionality as most debuggers do.

Directions on using the Microsoft Script debugger can be found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sdbug/Html/sdbug_2.asp

Microsoft Script Editor:
The Microsoft Script Editor comes free with Microsoft Office XP/2003 with FrontPage.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnfp2k2/html/odc_fpdebugscripts.asp

Visual Studio.net:
For Visual Studio.net debugging Monica Rosculet has written an excellent article on: Debugging Script Code Using Visual Studio.

Other:
Gregg Miskelly a developer on the Visual Studio team has posted some excellent information about: How Script Debugging Works.

-Srinivasulu