There is a straight forward way to update an existing or empty directory from given a list of keys. In the first example below, we update dict only with keys, which were not already present. Notice that the key ‘a’ did get change and ‘z’ did not get deleted – they were left alone. The second example, basically initializes an empty dict object. Whereas, the third example creates a new dict object which did not exist before.
Today we are going to talk about adding front end user interface to our application, from scratch. We can add the front end to our application using something called view resolvers. Our options are Apache Tiles, JavaServer Pages (JSP), etc. there are many other options, as well. Spring Boot supports FreeMarker templates, Groovy Templates and Themyleaf via “AutoConfiguration”, as the first class citizens. As the name suggests, we should not need to do a whole lot to get going with one of these. In this video we would be looking at Thymeleaf. I find it easy to use and feature rich at the same time. Thymeleaf is mostly HTML. Finally, we will talk about Web JARs & How to add Branding to our web application, using responsive web design. Continue reading “[4/4] Docker: Front-end development w/ Java, SpringBoot MVC & RESTful Web API”
Tired of rebuilding your Spring Boot web application every time you change your HTML markup or Java class? Thanks to IntelliJ IDEA and SpringBoot DevTools, you can easily code and debug faster without wasting time rebuilding your application over and over again. The solution discussed here would run your project as soon as your code change, and it would refresh your Thymeleaf HTML templates for the front end without even having to rebuild the project.
The actual work required to configure your project is not much. All, in all, you need to Continue reading “SpringBoot: Debug faster”
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.