ASP.NET “special” tags

The official name is “server-side scripting delimiters” or “ASP.NET inline expressions”. Visual Studio 2008 syntax highlighting settings dialog calls these “HTML Server-Side Script”. Microsoft guys call them “code nuggets” in their blogs. <%@ %> is a Directive for ASP.NET Web Pages. Used for pages and controls to configure page/control compiler settings (<%@ Control Inherits=”MyParentControl” %>). … Read more

Dynamic variable names in Bash

I’ve been looking for better way of doing it recently. Associative array sounded like overkill for me. Look what I found: suffix=bzz declare prefix_$suffix=mystr …and then… varname=prefix_$suffix echo ${!varname} From the docs: The ‘$’ character introduces parameter expansion, command substitution, or arithmetic expansion. … The basic form of parameter expansion is ${parameter}. The value of … Read more

What is the result of % in Python?

The % (modulo) operator yields the remainder from the division of the first argument by the second. The numeric arguments are first converted to a common type. A zero right argument raises the ZeroDivisionError exception. The arguments may be floating point numbers, e.g., 3.14%0.7 equals 0.34 (since 3.14 equals 4*0.7 + 0.34.) The modulo operator … Read more

How to query nested objects?

db.messages.find( { headers : { From: “reservations@marriott.com” } } ) This queries for documents where headers equals { From: … }, i.e. contains no other fields. db.messages.find( { ‘headers.From’: “reservations@marriott.com” } ) This only looks at the headers.From field, not affected by other fields contained in, or missing from, headers. Dot-notation docs