This guy hits the nail on the head in 4 lines:
http://groups.google.com/group/authlogic/browse_thread/thread/9af639591293b0d1/a362802ca4cccecf
Woot!
This guy hits the nail on the head in 4 lines:
http://groups.google.com/group/authlogic/browse_thread/thread/9af639591293b0d1/a362802ca4cccecf
Woot!
Note to self:
Next time you get this:
ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -L not found
ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Pinch Analytics"' following -L not found
ld: warning: directory '"/Users/rob/Projects/drync/iphonegit/Resources/Pinch Analytics"' following -L not found
ld: warning: directory '"/Users/rob/Projects/drync/iphonegit"' following -F not found
Remember that ‘Duplicate target’ added bonus quotes to the library search path. (Look real close above and notice the bonus \”. Helps if it’s the first thing you do in the morning after a good nights sleep and fresh coffee). Remove them.
Meat is great, but the chives are growing like gangbusters and actually flowering. The flowers are tasty – similar to the chives, but colorful (purple!) and lacking the bit, a little juicy and sweet even.
I find that if you BBQ portobello mushrooms, and then garnish with chive blossoms and toasted pine nuts, you have a really great appetizer.
Smoked Portobello mushroom
The result goes really well with this BBQ artichoke recipe: http://www.foodnetwork.com/recipes/artichoke-bbq-recipe-recipe/reviews/index.html
I roasted/smoked mine over a desultory wood fire (it never quite burned hot) for about 30-45 minutes before it was done.
Good result though.
You’d think that the pom.xml provided in the Hibernate tutorial would like, work. But no, it lacks the version tag, and so you have to googling.
And eventually you find someone else with the same problem: http://www.jumpingbean.co.za/blogs/hibernate-maven-dependencies-pom-setup
Score 1 for google, 0 for jboss (http://docs.jboss.org/hibernate/stable/core/reference/en/html/tutorial.html#tutorial-firstapp-mvn)
This is a fascinating article. Couldn’t agree more.
So, you want to produce a XML api for your RoR server, and you need to got beyond the defaults?
In the controller, change the action from this:
format.xml { render
ml => @server_assignment }
to this:
format.xml
(otherwise, your .rxml template never gets called, which is according to spec, but puzzling to the beginner)
The, in the view, create a file called show.xml.rxml (assuming that the action was ‘show’) like this:
xml.instruct!
xml.tag!('resource-assignment') do
xml.tag!('server-assignment-uri', test_run_server_assignment_path(@server_assignment.test_run,@server_assignment))
xml.created_at @server_assignment.created_at
xml.test_resource_uri server_path(@server_assignment.test_resource)
xml.test_resource_name server_path(@server_assignment.test_resource.name)
xml.test_run_uri test_run_path(@server_assignment.test_run)
end
A few things here:
Here: http://argonrain.wordpress.com/2009/10/27/000/
Simple XML parser in Java. One class. No framework. No JAXB. Just parse the damn answer easily.
Thank you!
Apparently, RESTfull means different things to different folks.
In particular, the Rails folks seem to have decided that the correct way to handle object creation is to do a POST to the resource. On successful creation, the server should indicate that by issuing a 302 to the location of the resulting new resource.
Actually, I pretty sure that this is not the canonical RESTfull api pattern – reading examples from the wikipedia article, I can see that the canonical way to create a resource RESTfully is via a POST, returning a ’201 Created’, along with a body containing the XML result and a Location header pointing to the resource’s URL – but it was the problem I was trying to solve here.
I’m fine with that, but the folks that wrote the jersey.api.client package don’t see it that way, and their package doesn’t follow that paradigm. You can tell it to follow redirects using setFollowRedirects(true)- sure, but it’ll lose the authentication headers and thus you’ll get a 401 Unauthorized instead of display the resulting resource.
Anyway, I ended out writing a ClientFilter that detected the redirector, and followed the redirect after copying the headers. Here it is:
package com.dell.tg;
import com.sun.jersey.api.client.ClientRequest;
import com.sun.jersey.api.client.ClientResponse;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.ClientFilter;
class RedirectFilter extends ClientFilter {
/* (non-Javadoc)
* Handle a redirect by doing a get to the new location, using the same headers (this avoids auth headers being dropped). This handles the common RESTful API case for creation on a POST correctly,
* where the POST creates the resource and then 301 redirects to the show page.
* @see com.sun.jersey.api.client.filter.ClientFilter#handle(com.sun.jersey.api.client.ClientRequest)
*/
public ClientResponse handle(ClientRequest cr) {
ClientResponse clientResponse= this.getNext().handle(cr);
if(isRedirect(clientResponse))
{
cr.setMethod("GET");
cr.setEntity(null);
cr.setURI(clientResponse.getLocation());
return this.getNext().handle(cr);
}
else
return clientResponse;
}
// Some sort of 3XX response.
private boolean isRedirect(ClientResponse clientResponse)
{
return clientResponse.getStatus()/100 == 3;
}
}
and here is an example of how to use it:
package com.dell.tg;
import java.net.URISyntaxException;
import javax.ws.rs.core.MultivaluedMap;
import sun.misc.BASE64Encoder;
import com.sun.jersey.api.client.Client;
import com.sun.jersey.api.client.WebResource;
import com.sun.jersey.api.client.filter.LoggingFilter;
import com.sun.jersey.impl.MultivaluedMapImpl;
class TGClient {
private static final String AUTHENTICATION_HEADER = "Authorization";
static TGClient instance;
Client client = Client.create();
String authentication;
String server;
public TGClient(String iServer, String iUser, String iPassword)
throws URISyntaxException {
server = iServer;
authentication = "Basic " + encodeCredentialsBasic(iUser, iPassword);
instance = this;
client.setFollowRedirects(false);
client.addFilter(new LoggingFilter()); // just for debugging happiness
client.addFilter(new RedirectFilter());
}
public void createTestrun(String iName) {
WebResource webResource = client.resource(String.format(
"http://%s/test_runs.xml", server));
MultivaluedMap<String, String> formData = new MultivaluedMapImpl();
formData.add("test_run[name]", iName);
String response = webResource.type("application/x-www-form-urlencoded")
.header(AUTHENTICATION_HEADER, authentication).post(
String.class, formData);
String fred = response.toString(); // Pretty lame - should tidy this up and get it into an XML document.
}
/**
* <p>
* Encode the specified credentials into a String as required by HTTP Basic
* Authentication (<a href="http://www.ietf.org/rfc/rfc2617.txt">RFC
* 2617</a>).
* </p>
*
* @param username
* Username to be encoded
* @param password
* Password to be encoded
*/
@SuppressWarnings("deprecation")
private String encodeCredentialsBasic(String username, String password) {
String auth = username + ":" + password;
BASE64Encoder encoder = new BASE64Encoder();
return encoder.encode(auth.getBytes());
}
}
See here: http://www.themomorohoax.com/2009/02/21/rails-2-3-authentication-comparison
Then use http://rdoc.info/projects/binarylogic/authlogic
It’s the only rational solution.
recipe for setting focus:
:javascript
/* This will get executed whenever the create panel comes to view, picking which form field gets focus first */
window.create_panel_focus_flag=0;
$('#reg_create').focus(function() { if(window.create_panel_focus_flag==0) { window.create_panel_focus_flag=1; }}
where
Powered by WordPress