About the author.

Welcome to datsoc.com

My own brand of technical mumbo jumbo Read more...

For the record, this blog is not intended to be a source of technical support, political rants, or personal ramblings. I need a place to store my technical thoughts where my family and friends don't have to wade through the jargon, and this is my answer. Think of it as my public personal organization center for all things technical. I hope you find it somewhat useful too, however that is in no way my guarantee.

March
29
2007
3:51 pm
Tags:
Post Meta :

So I’ve been wrestling through another technical problem the last couple hours. I have databased email formats that are structured as rhtml so that they are both dynamic and easy to modify. Nothing new here. I want to be able to pre-render them using render_to_string(:inline=>code) so that I can capture the output and store that to database as a log of which messages are sent to whom.

The problem lies in my desire to do this at both the model and controller level. The function render_to_string is available strictly within the scope of the controller. There is probably a simple reference or something that can be used to drop the functionality to the model level, but after scraping around the internet for half an hour the best I could come up with is some obscure reference to using blocks…

I’ve spent almost a full year avoiding learning more about blocks. I’ve written thousands of lines of ruby code and have failed to really come to understand one of the most fundamental advantages this language has to offer. In this case using blocks allows me to yield from the model to the controller, execute render_to_string in the controller scope and pass the result back into the model. On a pragmatic level this is really cool because while it is very common to have a parent object have access to all aspects of its member objects it is not common to be able to allow those members access to their parent, but the magic of blocks goes much deeper.

I need to spend a little more time looking at ruby from an academic perspective so I can work more effectively.

code sample:
Controller level

def refer_to_provider
    @order = Order.find(params[:id])
    @shipment = @order.order_shipments.find(params[:shipment_id]) if @order
    if @shipment

      @shipment.refer{|opts| render_to_string(opts)}

      flash[:notice]="Shipment has been referred"
      redirect_to :action=>:show,:id=>@order.id
    end
  end

Model level

  def refer
    mark_referred
    variables = {:order=>self.order, :shipment=>self}
    format = CommunicationFormat.find_by_token("submit_to_provider")
    subject = yield(:inline=>format.subject, :locals => variables)
    body = yield(:inline=>format.subject, :locals => variables)
    Sender.deliver_send("orders@yourdomain.com", self.provider.fullfillment_center_email.address, format.token, subject, body, self.order)
  end

Inspiration
Info on blocks

March
29
2007
3:50 pm
Tags:
Post Meta :

This morning I had the pleasure of waking up with a phone call from my SSL provider trying to upsell me on EV certificates. You know someone is trying too hard when you can barely squeeze in short affirmations while they go on and on about how great their product is and how much money they’re going to save you.

The pitch began by rebuking me for not having put their security badge on the EV Certs (Extended Validation) are.

I have a technical background, and I know that once data is encrypted that creates a barrier against attackers. Once the encryption is in place the biggest whole in the system is human, and there’s no way to encrypt the security risks that individuals pose. Data encryption also reassures customers of a sites validity (not that they understand much about what is actually going on). So this new EV format is basically a marketing gimmick. They’ll give surfers an even greater sense of security by changing the browsers url bar green and charge an arm and a leg for something that doesn’t really add significantly to the actual security of the system itself.

The old feel good marketing tactic. I only wish there weren’t any merit in the customer assurance angle, then I could justify disregarding the whole matter out of hand. While born of good ideas and good intentions, I can’t help but feel like this is a high profile scam being perpetrated by a handful of high profile businesses to make money in a field that has become overly competitive.

March
8
2007
11:22 am
Tags:
Post Meta :

My life Web2.0 (if only Web2.0 was something more than a marketing gimmick). So… I suppose this is simply “My life” with a more technical connotation than it has had in past (or other present) manifestations.

I consider myself to be a connoisseur of all things technical. I have a deep appreciation for well written / structured code as well as an unseemly fascination with well obfuscated / unreadable code. I have open source tendencies, but I have no problem admitting when a closed source solution happens to be particularly amazing. As I like to preface anything I work with, if this blog doesn’t strike your fancy, then don’t read it. This is another place for me to collect things.

Topics you can expect to find covered here:

  • Code - mostly ruby
  • Design - whatever I scavange
  • Marketing and Analytics - I don’t know much about these two yet, but things they are a changin’
  • Ajax - to use another well marketed term (this one actually has a technical definition people love to ignore
  • Useful apps - If I life it I’ll probably pass it on
  • Whatever else strikes my fancy… In other words I reserve the right to expand the scope of this blog at will.

If you enjoy what I’m doing here, drop me a comment. If you hate what I’m dong here, drop me a comment and I’ll do my best not to ignore you. Good criticism is worth infinitly more than the best compliment in the world.