things.dave.io

Magical things from my head and the Web

    • 0
      27 Nov 2010
      • Edit
      • Delete
      • Tags
      • Autopost

      3aulfq

      • views
      • Tweet
    • 0
      6 Nov 2010
      • Edit
      • Delete
      • Tags
      • Autopost

      34l6tf

      • views
      • Tweet
    • 2
      6 Nov 2010

      Scripting attachment_fu in Rails 3: a bit broken

      • Edit
      • Delete
      • Tags
      • Autopost

      Turns out that ActionController::TestUploadedFile is deprecated in Rails 3.  This makes scripting attachment_fu, for example to import multiple images at once, difficult.

      However! All is not lost.  In this example, our attachment_fu-enabled Model is called Asset.

      In Rails 2, you could do this:

      require 'action_controller'
      require 'action_controller/test_process.rb'

      fpath = "/path/to/file"

      # this works on UNIX, find another way if you're stuck with Windows
      mtype = `file -ib #{fpath}`.gsub(/\n/,"")

      @attachable = AttachmentMetadataModel.new(
                    :uploaded_data =>ActionController::TestUploadedFile.new(path, mimetype)) @attachable.save

      However, with Rails 3, that doesn't work. You'll want something like this instead:

      require 'action_dispatch'
      require 'action_dispatch/testing/test_process'

      fpath = "/path/to/file"

      # this works on UNIX, find another way if you're stuck with Windows
      mtype = `file -ib #{fpath}`.gsub(/\n/,"")

      @attachable = Asset.new(
                    :uploaded_data => ActionDispatch::TestProcess.fixture_file_upload(fpath, mtype))
      @attachable.save

      Same job, different module.

      • views
      • Tweet
    • 0
      5 Nov 2010

      Enabling the large clock on Polycom IP phones (specifically the Polycom SoundPoint 501)

      • Edit
      • Delete
      • Tags
      • Autopost

      Polycom IP phones are, to use a technical term, a complete ballache to provision. The XML configuration file is rather opaque to say the least.

      One thing that I keep coming back to, and keep forgetting how to do, is enable the large clock with the date and time instead of a background image. It's simple once you know the directive to look for...if you can remember it. Google's unhelpful, so hopefully this will get indexed!

      Edit /tftpboot/sip.cfg and find a line containing ind.idleDisplay.enabled - change it to look like the following:

      <indicators ind.idleDisplay.enabled="0" ind.idleDisplay.mode="">

      This will disable the idle display, and the phone will show the date and time instead. Easy when you know how!

      • views
      • Tweet
    • Search

    • Tags

      • crypto
      • dailywtf
      • nsfw
      • security
      • someone else's photography
    • Archive

      • 2012 (2)
        • January (2)
      • 2011 (18)
        • December (6)
        • November (1)
        • September (6)
        • April (1)
        • March (1)
        • February (2)
        • January (1)
      • 2010 (48)
        • December (4)
        • November (2)
        • October (2)
        • August (6)
        • July (20)
        • June (1)
        • May (1)
        • April (1)
        • March (4)
        • February (2)
        • January (5)
      • 2009 (11)
        • December (1)
        • November (1)
        • September (9)
    • Obox Design
  • things.dave.io


    23660 Views
  • Get Updates

    Subscribe via RSS
    metaweblog