Friday, December 23, 2016

weezy taco


Recipe - Beef Tacos

//===================================================================
//  INGREDIENTS
//===================================================================
1lb ground round
1 package of taco seasoning (preferrably lawrys)
1 small yellow onion
1 hot or mild pepper such as jalepeno, seranno or pueblano
3 cloves of garlic
fresh cilantro
1/2 lime
1/2 cup chicken broth and water for the rest.
a few squirts of red vinegar
cayenne to taste


optional: instead chicken broth (just for half)

Wednesday, November 30, 2016

bulk zap 
 funk from grs content html on the command line


find . -name '*.html' -exec sed -i "" 's/
//g' {} \;

grs mobile quiz - qids per chapter

as part of moving to a qids-for-quiz approach (as opposed to embedding falcon, prepware quiz info, etc) with the grs mobile apps:

/Users/smr/current_projects/pws2016/app/controllers/sandbox_controller.rb

  # qids per chapter
  def qidsperc
    quiz_definition = QuizDefinition.find_by_name("Private Pilot, Airplane")
    qids_per_chapter = quiz_definition.qids_per_chapter()
    # qids_per_chapter = JSON.pretty_generate(qids_per_chapter)
    render json: qids_per_chapter
  end


/Users/smr/current_projects/pws2016/app/models/quiz_definition.rb

  def qids_per_chapter
    chapters = self.book.chapters
    dict = {}
    qapc = {}
    chapters.each { |chapter| 
      chapnum = chapter.chapnum
      qids = question_ids_for_chapnum(chapnum)  # N.B. these are shuffled
      dict[chapnum] = qids
      qapc[chapnum] = qids.count
    }
    dict[:qapc] = qapc
    return dict
  end

this script generates the json:
http://localhost:3000/sandbox/qidsperc

which you can then save in a file, e.g. qids_per_chapter.json
and embed into the app bundle.



  1. based on Private Pilot, Airplane
  2. this is based on a quiz definition so categories are taken into account
  3. a qapc data structure is baked in


Sunday, November 20, 2016

xcode8 - xcodebuild wank with signing ipa


https://pewpewthespells.com/blog/migrating_code_signing.html#signing-in-xcode-8

error looks like:
None of the valid provisioning profiles allowed the specified entitlements: application-identifier, beta-reports-active, keychain-access-groups

voodoo fix:
after using xcode (instead of the command line) to archive then export an ad-hoc ipa, the command line build issue seemed to resolve itself.

Friday, September 30, 2016

ASA notes - add randomize flag to instructor quiz


##################################################
# add randomize flag to instructor quiz
##################################################

very similar to the active flag.
same UI, table column in the instructor quizzes table (instructor tools)



rails g migration add_randomize_flag_to_instructor_quiz randomize:boolean

add default: true

class AddRandomizeFlagToInstructorQuiz < ActiveRecord::Migration
  def change
    add_column :instructor_quizzes, :randomize, :boolean, default: true
  end
end


we want default to be randomized, but don't want to convert all existing instructor quizzes to be randomized, so after the migration (which sets the randomize flag to 1 for existing quizzes) manually set the randomize flag to 0 for all existing instructor_quizzes:

update `instructor_quizzes` set randomize=0


Wednesday, September 28, 2016

ASA Notes - add pvt/ins to grs corses

add quizzes and study material

tweaks to:
books_products
products_quiz_definitions

  # products for which the user has active subscriptions
  def activated_quiz_products
    seen = {}
    self.subscriptions.each do |s| 
      if s.active_expiry_subscription?
        # don't include groundschool products here
        # removed this restriction for GRS-58
        # if s.product.name !~ /Ground School/
          seen[s.product] = true        
        # end
      elsif s.active_token_subscription?
        seen[Product.find_by_name("Practice Tests")] = true
      end
    end
    return seen.keys.sort_by {|product| product.name}
  end




Thursday, September 1, 2016

pwo/grs - cloudfront invalidation for S3 video; mysql REPLACE



cloudfront invalidation is sort of a pain in the ass.
easier to just use a new name.
even though that means doing a replace in mysql for the video content id

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Invalidation.html#Invalidation_Requests

UPDATE grs_requirements
SET content_id = REPLACE(content_id, 'vtpp/', 'vtpp4/')
WHERE req_type = 'video'