Samples of Scala and Java code where Scala code looks simpler/has fewer lines?

Let’s improve stacker’s example and use Scala’s case classes: case class Person(firstName: String, lastName: String) The above Scala class contains all features of the below Java class, and some more – for example it supports pattern matching (which Java doesn’t have). Scala 2.8 adds named and default arguments, which are used to generate a copy … Read more

What unique features does Firebug have that are not built-in to Firefox?

Firefox’s native developer tools have come a long way since this question was written. The differences have mainly reduced to the following points: Can’t stop the script execution on DOM mutations, XHRs, or cookie changes. XPaths can’t be copied. Missing an events side panel in the Inspector (though events are displayed within the DOM structure). … Read more

Hidden features of HTML

Using a protocol-independent absolute path: <img src=”//domain.example/img/logo.png”/> If the browser is viewing an page in SSL through HTTPS, then it’ll request that asset with the HTTPS protocol, otherwise it’ll request it with HTTP. This prevents that awful “This Page Contains Both Secure and Non-Secure Items” error message in IE, keeping all your asset requests within … Read more

What is the purpose of python’s inner classes?

Quoted from http://www.geekinterview.com/question_details/64739: Advantages of inner class: Logical grouping of classes: If a class is useful to only one other class then it is logical to embed it in that class and keep the two together. Nesting such “helper classes” makes their package more streamlined. Increased encapsulation: Consider two top-level classes A and B where … Read more

VB.NET equivalent of C# property shorthand?

There is no shorthand for Visual Studio 2008 or prior for VB.NET. In Visual Studio 2010 and beyond, you can use the following shorthand: Public Property FirstName as String This will be handled as your short version in C# is – I think they call it “Auto Property” See also: Auto-Implemented Properties (Visual Basic)