It is pretty common to come across a scenario where we have to deal with special characters in XML. Like &, (, ), $, etc. With this fix the < be the only illeagal character.
Input images used :
Pillow (PIL) and NumPy libraries can do wonders in Python! I had once he requirement to overlap two images – not watermarking.
I found several alternatives, but curious to see which would work best.
- (x+y)/2 … Mathematically, x/2+y/2 seems equivalent to above, but it is not. We’d be loosing a ton of info by doing so!
- final = (x+y/2) and then addition = addition[addition>256]=256
- Pillow’s Image.blend(x,y,0.5)
- Pillow’s Image.composite(x,y,y)
I took a swing at answering a question on StackOverflow, albeit I liked the accepted answer better than mine. But Continue reading Python: find most common element from list of lists
This post discusses how to custom sort one list in python based on the order of elements of another list.
Objective: I have a dictionary, and a float value. I would like to sort the dictionary in such a way that, first key-value pair’s value is nearest (min absolute difference) to a given float value, and last would be the farthest (max absolute difference)
I enjoyed spending some time after creating some very useful (at least to me 😛 ) C# helper functions for string operation. So here is the gist of it Continue reading C# String Extension & Helper Methods