Automapper: passing parameter to Map method

You can’t do exactly what you want, but you can get pretty close by specifying mapping options when you call Map. Ignore the property in your config: cfg.CreateMap<Message, MessageDto>() .ForMember(dest => dest.Timestamp, opt => opt.Ignore()); Then pass in options when you call your map: int someValue = 5; var dto = Mapper.Map<Message, MessageDto>(message, opt => … Read more

Nested and multiple troubles

Oh, dear Lord! Well. They don’t cross because they’re positioned statically one above the other. The second marquee cannot go above the first. You can solve* this problem by ungluing the marquees from each other using absolute positioning. Then doubly-nest each one with different horizontal and vertical motion: <div style=”border:2px solid blue; position: relative;”> <marquee … Read more

How to install wkhtmltopdf on a linux based (shared hosting) web server

I’ve managed to successfully install wkhtmltopdf-amd64 on my shared hosting account without root access. Here’s what i did: Downloaded the relevant static binary v0.10.0 from here: http://code.google.com/p/wkhtmltopdf/downloads/list EDIT: The above has moved to here via ssh on my shared host typed the following: $ wget {relavant url to binary from link above} $ tar -xvf … Read more

How do I access an element of a control template from within code-behind

You need to get the template and locate the control by name on the templated control, something like: var template = MyList.Template; var myControl = (MyControl)template.FindName(“MyControlName”, MyList); Templates are just that: Abstract descriptions of what is to be created, the controls in templates only exist in the context of something that is being templated. Note … Read more

Python configuration file: Any file format recommendation? INI format still appropriate? Seems quite old school

Consider using plain Python files as configuration files. An example (config.py): # use normal python comments value1 = 32 value2 = “A string value” value3 = [“lists”, “are”, “handy”] value4 = {“and”: “so”, “are”: “dictionaries”} In your program, load the config file using exec (docs): from pathlib import Path if __name__ == “__main__”: config = … Read more

Python Requests requests.exceptions.SSLError: [Errno 8] _ssl.c:504: EOF occurred in violation of protocol

Reposting this here for others from the requests issue page: Requests’ does not support doing this before version 1. Subsequent to version 1, you are expected to subclass the HTTPAdapter, like so: from requests.adapters import HTTPAdapter from requests.packages.urllib3.poolmanager import PoolManager import ssl class MyAdapter(HTTPAdapter): def init_poolmanager(self, connections, maxsize, block=False): self.poolmanager = PoolManager(num_pools=connections, maxsize=maxsize, block=block, ssl_version=ssl.PROTOCOL_TLSv1) … Read more

Resolving an ambiguous reference

If the types with the same name exist in both namespaces, you have a couple of options: 1) If the number of types is small, create an alias for that type: using BorderStyle3d = tool.3dChartLib.BorderStyle; 2) If the number of types is large, you can create an alias for the namespace: using t3d = tool.3dChartLib; … Read more