How to write a comment in a Razor view?

Note that in general, IDE’s like Visual Studio will markup a comment in the context of the current language, by selecting the text you wish to turn into a comment, and then using the Ctrl+K Ctrl+C shortcut, or if you are using Resharper / Intelli-J style shortcuts, then Ctrl+/. Server side Comments: Razor .cshtml Like so: .aspxFor those looking … Read more

Html encode in PHP

By encode, do you mean: Convert all applicable characters to HTML entities? htmlspecialchars or htmlentities You can also use strip_tags if you want to remove all HTML tags : strip_tags Note: this will NOT stop all XSS attacks

Arithmetic Overflow in mips

According to the MIPS instruction reference, the only addition operations which can produce overflow exceptions are the signed addition instructions: MIPS integers are 32-bit, and since you’ll be using signed integers, the maximum value is 231-1 (aka 2147483647 or hex 7FFFFFFF). Thus any addition which results in a number larger than this should throw an exception, … Read more

understanding private setters

Logically. The presence of a private setter is because you can use auto property: What would you do if you want to make it readonly? Oh crap!! I can’t access it from my own class; I should create it like a normal property: Hmm… but I lost the “Auto Property” feature… AHHH.. that is better!!

Categories c# Tags

What’s a good IDE for Erlang programming?

The best IDE for Erlang is Emacs. However, the mode which ships with Erlang isn’t the best. Erlware-mode extends it and Distel allows you to use Emacs itself as an Erlang node, enabling some very nice features. See this blog post. Between plugins for NetBeans (ErlyBird) and Eclipse (ErlIDE), I prefer the Eclipse one. NetBeans at least used to require nightly … Read more

How do I test a class that has private methods, fields or inner classes?

Update: Some 10 years later perhaps the best way to test a private method, or any inaccessible member, is via @Jailbreak from the Manifold framework. This way your code remains type-safe and readable. No design compromises, no overexposing methods and fields for the sake of tests. If you have somewhat of a legacy Java application, and you’re not allowed to change … Read more

AngularJS ng-disabled directive with expression is not working

The ng-disabled expression is evaluated in the present scope. Hence, you should only need the following without any extra interpolation with {{..}}: Note that I added a ! since you probably want the button disabled if the user has not accepted the TnC. Working demo: http://plnkr.co/edit/95UiO4Rd2IMh8T1KjSQK?p=preview A comment was posted below asking how to reason about when to use {{…}} and when to use bare … Read more