Tarik
java function that changes negative number to 0
You should use : Math.max(0, yourVar) You don’t need a built-in function for that.
Remove element by tag name [duplicate]
var element = document.getElementsByTagName(“label”), index; for (index = element.length – 1; index >= 0; index–) { element[index].parentNode.removeChild(element[index]); }
Don’t return property when it’s an empty list with jackson
You can use @JsonInclude(JsonInclude.Include.NON_EMPTY) annotation on your class or filed. import com.fasterxml.jackson.annotation.JsonInclude; @JsonInclude(JsonInclude.Include.NON_EMPTY) class Person { String name; List<Event> events; //….getter, setter }
Understanding logic in CaseInsensitiveComparator
From Unicode Technical Standard: In addition, because of the vagaries of natural language, there are situations where two different Unicode characters have the same uppercase or lowercase So, it’s not enough to compare only uppercase of two characters, because they may have different uppercase and same lowercase Simple brute force check gives some results. Check … Read more
Parent Height doesn’t follow their float children [duplicate]
Add overflow:hidden; to the container: #mainContainer{ width: 1000px; /*height: 1000px;*/ height:auto; margin-left:auto; margin-right:auto; background-color: #ff6600; padding-bottom: 20px; overflow: hidden; /* <— here */ } Because its content is floated, the container div collapses. Using a ‘clearfix’ class or, as I mentioned, adding overflow:hidden will cause the container to contain the floated elements. UPDATE Explanation of … Read more
How do I implement Toastr JS?
Toastr is a very nice component, and you can show messages with theses commands: // for success – green box toastr.success(‘Success messages’); // for errors – red box toastr.error(‘errors messages’); // for warning – orange box toastr.warning(‘warning messages’); // for info – blue box toastr.info(‘info messages’); If you want to provide a title on the … Read more
Export data from H2 database into CSV
Try CSVWRITE This is perhaps all that you need: call CSVWRITE ( ‘C:/MyFolder/MyCSV.txt’, ‘SELECT * FROM MYTABLE’ ) You need to just run the call (mentioned above) in the browser based client of H2 that you are most likely using. Further reading: http://www.h2database.com/html/functions.html#csvwrite.