I’m beginning to use MooseX::Declare more and more, but this morning I realized I didn’t quite understand when the builder was getting called, and under what circumstances, so I wrote the following program to testing things out. Not so much a test of the code for some notion of correctness as a literal test of what is going on so I can be more informed.
(more…)
February 1, 2010
A simple “show me” program to understand what lazy_build, etc does
January 27, 2010
Better post on MooseX::Declare method signatures
So here is a better description of my problem, with simplified code examples.
First, the Holiday date checker that works (yes I know there is DateTime event classes and all that and I should use that framework, but I just wanted something that worked right away).
(more…)
Yikes!
Okay, two lessons. No, three. First iron man perl planet rocks. Second, from now on push up code examples with my code problems. Third, I need to turn off moderation on this blog, since the spam filter seems to work pretty well.
I’m working up an example of the problem I had with DateTime and my attempts to solve it, and I’ll fold in the suggestions I got on my previous post (especially if they solve the problem!)
January 26, 2010
I used perl today, and I can’t figure out how to get my paper man icon.
I used perl today. Moose. I ran into a problem. It was annoying. I am way too stressed and tired to blog more. But I will anyway, secure in the knowledge that no one reads this blog but google’s spiders.
Okay anyway I used MooseX::Declare, and couldn’t get the method signature stuff to work. I did something like
method weekend_or_vacation (DateTime $dt){
# check if weekend or vacation
# with vacation being the tricky bit
if($vacation || $weekend){
return 1;
}else{
return 0;
}
}
But MooseX::Declare kept complaining that it didn’t know what DateTime was. I scanned the tests in t and sure enough, they all test simple things like Str and ArrayRef and so on, but none of the more magical parts of type checking.
I eventually solved it the old fashioned way by puking if the argument wasn’t a DateTime, but I’d rather do it the method signature way.
December 22, 2009
PUT problem solved
I had a problem linking up dojo/xhrPut and Catalyst::Controller::REST. As always, the answer was in the documentation, but I didn’t see it.
Catalyst::Controller::REST docs say that:
The HTTP POST, PUT, and OPTIONS methods will all automatically deserialize the contents of $c->request->body based on the requests content-type header. A list of understood serialization formats is below.
And the docs for dojo/xhrPut point to those for dojo/xhrGet for parameters, which include:
headers
A JavaScript object of name/string value pairs. These are the headers to send as part of the request. For example, you can use the headers option to set the Content-Type, X-Method-Override, or Content-Encoding headers of the HTTP request.
This parameter is optional
So all I had to do in my javascript code is
var xhrArgs = {
url: ajaxurls.sort + '/' + editing.id,
putData: dojo.toJson(data),
handleAs: "json",
headers: {'Content-Type':'application/json'},
load: function(data){
// don't really need to do anything here
// uncomment for testing
// console.log("new sort order put to server");
},
error: function(error){
alert('warning, edits were not saved properly. Proceed with caution');
}
}
//Call the asynchronous xhrPost
var deferred = dojo.xhrPut(xhrArgs);
And the controller magically started to work as expected. Hooray, git commit and all that, but it is time to go to sleep and actually get things working some other day.
December 15, 2009
It’s a razor thin line, but obvious which side you’re on
So yesterday was the first day of Secret Santas at Grace’s school. Same dreadful drill as when we were kids…pick names out of a hat, get somebody you’re not friends with, and then try to think up gifts all week long. What with Nutcracker rehearsals and performances, I didn’t hear about it until Sunday night, but the girls and I had made cookies over the weekend so that seemed like an appropriate gift, fitting the “small, home made” type of requirements. So we got our act together, and Grace gave a decent gift. (more…)
December 10, 2009
Finally on the air
My mother-in-law just got notified that her interview with Tavis Smiley is finally going to get aired Dec 11, and will subsequently be posted forevermore on-line!
Hello Ms. Tomblin,
I just wanted to reach out to you and let you know that your interview
with Tavis will be running on our show this weekend. You can likely
hear it on your local public radio station, or hear it on demand at our
website at www.tavissmileyradio.com.
It should be available by 12 noon PT on Friday (tomorrow).
I’m remembering the old days when we would tape interviews and songs off the of the radio on warbly cassette tapes. Good times.
A Flash-related browser crash ate my bug report to MooseX::Declare
ggghhhhaaaa. I hate flash. I really like http://proquest.safaribooksonline.com/, or rather, I used to love it, but now they’ve switched to Flash and it is hateful hateful hateful. But I still can’t stop using it because the information is so awesome and handy and because UCI has an account and it is right there waiting for me whenever I have a question. But then *bang* one page too many and firefox just blinks off my desktop.
December 2, 2009
Tedious but necessary
I’ve found that I prefer making things to maintaining things. My wife will testify that tidying up is not my forte, but that I don’t mind the most laborious cooking task.
(more…)
November 11, 2009
RJSONIO to process CouchDB output
I have an idea. I am going to process the 5 minute aggregates of raw detector data I’ve stored in monthly CouchDB databases using R via Rcurl and RJSONIO. So, even though my data is split into months physically, I can use Rcurl to pull from each of the databases, and then use RJSONIO to parse the json, then use bootstrap methods to estimate the expected value and confidence bounds, and perhaps more importantly, try to estimate outliers and unusual events. (more…)