What happens if I don’t retain IBOutlet?

It is recommended you declare properties for all of your IBOutlets for clarity and consistency. The details are spelled out in the Memory Management Programming Guide. The basic gist is, when your NIB objects are unarchived, the nib loading code will go through and set all of the IBOutlets using setValue:forKey:. When you declare the … Read more

Selected value for JSP drop down using JSTL

In HTML, the selected option is represented by the presence of the selected attribute on the <option> element like so: <option … selected>…</option> Or if you’re HTML/XHTML strict: <option … selected=”selected”>…</option> Thus, you just have to let JSP/EL print it conditionally. Provided that you’ve prepared the selected department as follows: request.setAttribute(“selectedDept”, selectedDept); then this should … Read more

capturing self strongly in this block is likely to lead to a retain cycle

The capture of self here is coming in with your implicit property access of self.timerDisp – you can’t refer to self or properties on self from within a block that will be strongly retained by self. You can get around this by creating a weak reference to self before accessing timerDisp inside your block: __weak … Read more

Fix warning “Capturing [an object] strongly in this block is likely to lead to a retain cycle” in ARC-enabled code

Replying to myself: My understanding of the documentation says that using keyword block and setting the variable to nil after using it inside the block should be ok, but it still shows the warning. __block ASIHTTPRequest *request = [[ASIHTTPRequest alloc] initWithURL:… [request setCompletionBlock:^{ NSDictionary *jsonDictionary = [[CJSONDeserializer deserializer] deserialize:request.responseData error:nil]; request = nil; // …. … Read more

How can I retain HTML form field values in JSP after submitting form to Servlet?

You could access single-value request parameters by ${param}. <%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn” %> … <input name=”foo” value=”${fn:escapeXml(param.foo)}”> <textarea name=”bar”>${fn:escapeXml(param.bar)}</textarea> … <input type=”radio” name=”faz” value=”a” ${param.faz == ‘a’ ? ‘checked’ : ”} /> <input type=”radio” name=”faz” value=”b” ${param.faz == ‘b’ ? ‘checked’ : ”} /> <input type=”radio” name=”faz” value=”c” ${param.faz == ‘c’ ? ‘checked’ : ”} … Read more