Get value of CollectionOfElements annotation Map
Here is the HQL query to retrieve the value of CollectionOfElements annotation field Map attributes within object ObjectUnderConsideration.
SELECT elements(t.attributes) FROM ObjectUnderConsideration as OurObject INNER JOIN t.attributes as attributeField WHERE CONDITION=’your-condition’
Releasing Web Applications
MS DOS script to close batch file upon execution
MS DOS batch script to restart Internet explorer followed by closing the parent batch file even though the child process has not been closed.
start “” taskkill /im iexplore.exe
start “” “C:\Program Files\Internet Explorer\iexplore.exe” google.com
CLS
EXIT
Jquery ajax call manipulating DHTML
Code snippet to change Check-box state based on Server side call upon dropdown selection change
HTML
<select name=”dropDown” id=”dropDownId”>
<option>Value1</option>
<option>Value2</option>
<option>Value3</option>
<select> <!– Intentional typo to preserve HTML code –><span id=”changingCheckboxes”>
<label for=”group1″>One</label>
<input type=”radio” name=”group1″ id=”1″ value=”option1″/>
<label for=”group1″>Two</label>
<input type=”radio” name=”group1″ id=”2″ value=”option2″/>
<label for=”group1″>Three</label>
<input type=”radio” name=”group1″ id=”3″ value=”option3″/>
<label for=”group1″>Four</label>
<input type=”radio” name=”group1″ id=”4″ value=”option4″/>
</span>
Jquery
function UpdateCheckBoxStatus () {
var CurrentChoice = $(“#dropDownId”).val();
$.ajax({
url: “/serverSideUrl”,
data: { “selectedDropDownId”: CurrentChoice },
type: “post”,
dataType: “json”,
success: function (data) {
SetCheckbox($(“#changingCheckboxes”).children(“input:[type='radio']“), true);
$.each(data.disabled, function () {
SetCheckbox($(“#changingCheckboxes #” + this), false); });
}
});
}function SetCheckbox (th, state) {
if (state) th.removeAttr(“disabled”);
else if (!state) th.attr(“disabled”, true);
}$(‘#dropDownId’).change(UpdateCheckBoxStatus);
Java
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String selectedValue = request.getParameter(“dropDownId”);
YourDao yourDao = new YourDao();
Map<String, List<String>> disabledOptions = cycleDao.determineStateDropDown(selectedTool);
String json = new Gson().toJson(disabledOptions);
response.setContentType(“application/json”);
response.setCharacterEncoding(“UTF-8″);
response.getWriter().write(json);
}
Factorial without recursion Java
Here is the non-recursive way of calculating Factorial in Java:
public class FactorialUtility
{
public static BigInteger factorial(int n)
{
BigInteger ret = BigInteger.ONE;
for (int i = 1; i <= n; ++i) ret = ret.multiply(BigInteger.valueOf(i));
return ret;
}
}
Agile Practices Reference Space
Martin Fowler@ThoughtWorks
Reference Space
Some of the useful spaces for reference:
-
CSS/Web Design
Alistapart TutsPlus Css Tricks WebMonkey Smashing Magazine
Doctype Noupe Design Cubicle Problog Design
Java
InfoQ
Software Development
Unicode and Character Sets
HTML5
Offline Web Applications
