Use of `inline` in F#

The inline keyword indicates that a function definition should be inserted inline into any code which uses it. Most of the time, this will not have any effect on the type of the function. However, in rare cases, it can lead to a function which has a more general type, since there are constraints which … Read more

Function declaration inside or outside the class

C++ is object oriented, in the sense that it supports the object oriented paradigm for software development. However, differently from Java, C++ doesn’t force you to group function definitions in classes: the standard C++ way for declaring a function is to just declare a function, without any class. If instead you are talking about method … Read more

c++ inline function?

The former (using inline) allows you to put that function in a header file, where it can be included in multiple source files. Using inline makes the identifier in file scope, much like declaring it static. Without using inline, you would get a multiple symbol definition error from the linker. Of course, this is in … Read more

Limit foreign key choices in select in an inline form in admin

Used request instance as temporary container for obj. Overrided Inline method formfield_for_foreignkey to modify queryset. This works at least on django 1.2.3. class RoomInline(admin.TabularInline): model = Room def formfield_for_foreignkey(self, db_field, request=None, **kwargs): field = super(RoomInline, self).formfield_for_foreignkey(db_field, request, **kwargs) if db_field.name == ‘inside_room’: if request._obj_ is not None: field.queryset = field.queryset.filter(building__exact = request._obj_) else: field.queryset = … Read more

HTML: Changing colors of specific words in a string of text

<p style=”font-size:14px; color:#538b01; font-weight:bold; font-style:italic;”> Enter the competition by <span style=”color: #ff0000″>January 30, 2011</span> and you could win up to $$$$ — including amazing <span style=”color: #0000a0″>summer</span> trips! </p> Or you may want to use CSS classes instead: <html> <head> <style type=”text/css”> p { font-size:14px; color:#538b01; font-weight:bold; font-style:italic; } .date { color: #ff0000; } .season … Read more