Saturday, January 14, 2012

Sweet Breaded Chicken

Necessity is the mother of invention and this recipe came about when I realized I didn't have an egg to stick the breading to my chicken.  I actually prefer this method now.  I use this chicken either in stir fry or as chicken fingers with some fries.  I'm considering incorporating parmesan into the breading and garlic into the soy sauce next time I do this, and may update the recipe if that works out.

Ingredients
1 lb Chicken Cutlets
3 Tablespoons Flour
1 Cup Soy Sauce
3/4 Cup Plain Breadcrumbs
1/2 Cup Canola (or other vegetable) Oil
Pepper to taste

  1. First set up your station so you're ready when you're hands are covered with chicken and goo- one bowl with flour, another bowl with the soy sauce and a plate covered in a layer of bread crumbs.
  2. Cut the chicken up into either nugget size or finger size pieces.
  3. Coat the chicken pieces with flour.
  4. Dunk the chicken into the soy sauce but don't leave it too long so you don't lose all of the flour on it, this helps make it sticky for the next step.
  5. Press the chicken into bread crumbs so they're completely coated. 
  6. Heat up a pan over medium heat with the oil.  I don't deep fry, I just use enough oil to coat the pan and fry one side of the chicken at a time.
  7. Don't add the chicken to the pan until the oil is nice and hot or the breading will just end up mush.  The chicken should sizzle a bit when you add it.
  8. Pepper the exposed side of the chicken.
  9. Leave the chicken alone while one side of it browns- the time will vary based on the size and thickness of the pieces, but the finger-sized pieces I did took about 4-5 minutes per side.
  10. The chicken is ready to flip when the side that's frying is verging on dark brown - the sides should look lightly browned. Tongs are the easiest way to flip them.
  11. Pepper the newly exposed side.
  12. Brown the other side. 
  13. Remove the chicken from the pan and let it drain on a plate with a paper towel beneath it.

Wednesday, January 11, 2012

Random Book and Movie Reviews


Movies
Contagion- I told you if you left Gwyneth Paltrow to her own devices long enough that something like this would happen.  I liked this movie, though it just re-focused me on my fear of the impending plague.  The characters were well written and performed and it kept me engaged, unlike...

Tinker Tailor Soldier Spy- This is a movie of old white men looking at each other awkwardly and staring across rooms and out windows.  Every once in awhile a woman will look across a room with an expectant dismay on her face.  The men never seem to expect anything until it's too late and unfortunately it's on them who we focus.  The time jumps were confusing and each scene I had to check for grey hairs to get an idea of when it was.  There was a slew of scenes with a character who had been shot earlier that I assumed were flashbacks but it turned out he just hadn't died. I guess Gary Oldman delivered the 10 or so lines he had really well, but mostly he just stared.  If you couldn't tell already, I was not as enamored with this movie as the critics.

Rise of the Planet of the Apes- The writers spent time endearing the apes to me, but there was no need; I was with them from the beginning.  Get 'em, gorilla!  Along those same lines, we were flipping through the channels the other day and happened upon a scene at a bull fight of a bull jumping into the stands of people who had come to watch him be tortured.  Havoc was wreaked. Fair play to the bull. 

Book
Pym, A Novel by Mat Johnson- It's hard for a book that goes into the realm of complete implausibility to fully engage me the way this one did.  The main character, formerly a professor of African American studies, becomes convinced that the novel The Narrative of Arthur Gordon Pym of Nantucket, by Edgar Allen Poe is actually based on a true story and sets off to prove it, an adventure that eventually lands him in Antartica.  It's a very entertaining read, I recommend it.

Sunday, January 8, 2012

Visualforce to Word


I've been having lots of fights with Microsoft applications lately.  Perhaps as a web developer, this goes without saying.  I just won a fight getting a Visualforce page to display correctly when converted to a Word file.  I was generating a file of certificates with each certificate on a separate page and a very specific layout that had to be followed. Thought I'd share a few tips on what I learned.

Basics
First off, how to get a Visualforce page to generate as a Word file.  In the "page" tag, include the following:

<apex:page contentType="application/msword#FileName.doc" showHeader="false" standardStylesheets="false">

Page Formatting
  • Save a Word doc as HTML
    Not sure how to get the font, border, layout, etc specified in Visualforce to display correctly in Word?  Do it in Word and then save it as an HTML file.  The file it generates is a bit of a beast, but if you scroll down, you'll find <style> tags with Word-specific attributes you can use in <style> tags in Visualforce. You can also copy and paste paragraphs from the html into your Visualforce, though I wouldn't recommend trying to paste the whole file, there's just too much crap (very technical term) in there and Salesforce won't even let you save it the way Word writes the html tags.

    For my document, I grabbed these styles to create the following in Visualforce; note the orientation style to set the page as landscape:
    <style>
            @page Section1{
                size:11.0in 8.5in;
                mso-page-orientation:landscape;
                margin:.25in .25in .25in .25in ;
                mso-header-margin:.5in;
                mso-footer-margin:.6in;
            }
            div.Section1
            {
                 page:Section1;
            }
            body {
                font-family:"Gotham-Book";
            }
    </style>
    For the style above to work, you'll need to surround your content in Visualforce with: 
<div class="Section1">your content</div>
  • Use "in" (inches) for widths to layout the page
    Word is designed to render documents for printing, so widths should be specified in inches (and I'm guessing centimeters for everyone that's abandoned our archaic measuring system).  Just a note that "px" does work in Word (in specific contexts) but if you're trying to fit something to a page like a border that goes around everything, save yourself the trouble and just do it in inches.
  • Use "pt" for font sizes
    Setting the font size using style="font-size:12pt;" in VF is the equivalent of selecting 12 for the font size in Word.
  • Margin instead of Padding Padding wasn't doing the trick to space out lines of text but margin works.  Here's a sample:

  • <p style="font-size:22.0pt;font-family:Gotham-Medium;margin-top:12pt;margin-bottom:.0001pt;">
                    Some text here
    </p>
  • Page breaks
    Wherever you want a page break, insert this:

    <br clear="all" style="mso-special-character:line-break;page-break-before:always;"/>

    Note that I tried using "page-break-before:always;" as the style for a div and that was a no go, Word wants it in a break or paragraph tag.
Including Images
  • Don't use a secure URL (https) as the image URL
    I came across forum posts where people were able to successfully use the secure Salesforce URL (i.e. https://na2.salesforce.com/...) to link to images in Word, so my guess is that this varies based on the version of Word you have.  I have Word 2007 and the images would not display until I switched to a non-secure URL, which I did using Salesforce Sites.  It's probably a good idea to do this even if the secure URL works for you because it may not work for others.  
  • Use the full URL
    If your image is stored in Salesforce Documents, you can generate that URL like this:
    http://yourdomain.force.com/servlet/servlet.ImageServer?id=015D0000000Dpwc&oid=00DD0000000FJbGyourdomain = 
    Your Salesforce Sites domain
    id= The Id of the Document
    oid= Your Organization Id, which you can find in Setup in Company Information

    You can also store the image as a Static Resource and link to it that way.
Exclude "Visualforce" from your web searches
Still need help formatting your Visualforce page for Word? When it comes to figuring out formatting in Word, Google (as is often the case) is your friend and no doubt how you arrived here, but don't limit your searches by including "Visualforce" in the search terms. People use html to generate Word files in other languages, and some of the best tips I found were on PHP and ASP forums.

Tuesday, January 3, 2012

African Groundnut Stew

I somewhat randomly selected this as our New Year's Eve dinner, and was happy I did.  This is based on a recipe from a slow cooker pamphlet I no longer have, so I can't properly attribute it.  Nor do I know for sure if it's actually based on an African recipe as was claimed.  Whatever, it's yummy.

Ingredients
1/2 to 3/4 lbs Chicken Cutlet

1 Medium Potato
1 Medium Sweet Potato
1/4 Medium Onion
1 Tablespoon Peanut Butter
1 Tablespoon Tomato Paste
1 teaspoon Ground Ginger (or dice up some fresh ginger)
Salt and pepper to taste

  1. Cut up the chicken, potatoes and onion into stew sized pieces.  Make the sweet potato pieces bigger than the regular potato pieces as they cook through faster.
  2. Mix all ingredients into the slow cooker.
  3. Turn on the slow cooker (I have a rather simple unit that's either on or off, but if you need a temperature setting, I'm guessing it will be about median of your options).
  4. Let it cook at least 2 1/2 hours, stirring occasionally.

Salesforce general sentiments


Right now my business is based almost exclusively on developing on the Salesforce.com platform, but I'm not one of those Marc Benioff idolizing, Salesforce can do no wrong type of people (those people are annoying).  I think Salesforce has done a good job of creating an extensible CRM that allows for non-technical people to customize it up to a point, and developers to customize it beyond that point.

For awhile, the supposed plan for Salesforce was to become a true platform- they handle the storage and maintenance and provide the framework on which everyone could build or install pre-built applications.  Included in that pitch was the statement that they wouldn't build enhancements specific to industry verticals or job functions, that would be left to the customers and third-party developers.  Good bye Salesforce.com, hello Force.com.  I liked this plan. 

This is clearly no longer the plan.  Salesforce continues to build functionality for sales and other verticals, and has gone the Microsofty route of acquiring companies who have built Salesforce solutions and incorporating those solutions into the platform.  This plan I don't like for the same reason I never cared for Microsoft doing it.  Trying to incorporate software into a platform that was not specifically engineered to be incorporated creates complexities (i.e. opportunities for bugs) and inefficiencies that could have been avoided by engineering something from the ground up to actually be a part of the platform.  It's a big part (though not the only reason) of why Windows is the giant bloated piece of crap that is today.  Microsoft has managed to prosper despite this by having a strong foothold in the market, particularly corporate sector of the market, and because computers have progressed to be able to handle the bloatiness of Windows and still function. 

As of late, we've seen some instability in the Salesforce sandbox environment. There was that week this past fall where one of the sandboxes was dead to the world, and just last night the entire sandbox environment, in North America anyway, was hiccuping.  Do I know for sure that these glitches were the result of the way they've expanded the platform?  Absolutely not.  But they were no real surprise to me when they hit and I suspect we'll see more; it's as hard for Salesforce to avoid as a painfully long boot-up time is for MS Windows.  Be careful there Icarus, your wings are looking a little gooey.