EzDevInfo.com

gruff

Gruff graphing library for Ruby gruff-0.3.6 Documentation

Visualize an OWL file with Gruff [closed]

How can I load an OWL file in Gruff? It's not clear in the tutorials. I have a file, camera.owl. I need to display this in Gruff and view a graph of it.


Source: (StackOverflow)

how to send a graph via email in Ruby without saving to disk?

I'm using Ruby script and the "mail" gem to send emails.

Question - How could how to send a graph via email in Ruby without saving to disk? Is this possible? Which graphing tool would you recommend and would the "mail" gem support somehow streaming this out? (or it it a given you have to save to disk first) If it's possible/easy sample code lines should how to would be great....


Source: (StackOverflow)

Advertisements

rmagick installation [closed]

I am facing some issues while installing Rmagick. There are 2 ways to install this: 1] using Ruby-Gem 2] bld the source

I am facing issues in both, but I will like to be able to get the gem and install.

I have updated the PKG_CONFIG_PATH as many have suggested but I still face issues:

 PKG_CONFIG_PATH=/home/<user>/Downloads/ImageMagick-6.7.5-7/magick gem install rmagick  

    Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
    ERROR: Failed to build gem native extension.

        /home/<user>/apps/jruby-1.6.4/bin/jruby extconf.rb
WARNING: JRuby does not support native extensions or the `mkmf' library very well.
Check http://kenai.com/projects/jruby/pages/Home for alternatives.
checking for Ruby version >= 1.8.5... yes
checking for cc... yes
checking for Magick-config... yes

Warning: Found more than one ImageMagick installation. This could cause problems at runtime.
         /usr/local/bin/Magick-config reports version 6.7.5 Q8 is installed in /usr/local
         /usr/bin/Magick-config reports version 6.5.7 Q16 is installed in /usr
Using 6.7.5 Q8 from /usr/local.

checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... no
checking for sys/types.h... no
checking for wand/MagickWand.h... no

Can't install RMagick 2.13.1. Can't find MagickWand.h.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/home/<user>/apps/jruby-1.6.4/bin/jruby

ImageMagick is configured as follows. Please verify that this configuration matches your expectations.

Host system type: x86_64-unknown-linux-gnu
Build system type: x86_64-unknown-linux-gnu

                  Option                        Value
-------------------------------------------------------------------------------
Shared libraries  --enable-shared=yes           yes
Static libraries  --enable-static=yes           yes
Module support    --with-modules=no             no
GNU ld            --with-gnu-ld=yes             yes
Quantum depth     --with-quantum-depth=16       16
High Dynamic Range Imagery
                  --enable-hdri=no              no

Delegate Configuration:
BZLIB             --with-bzlib=yes              no
Autotrace         --with-autotrace=no           no
Dejavu fonts      --with-dejavu-font-dir=default        none
DJVU              --with-djvu=yes               no
DPS               --with-dps=yes                no
FFTW              --with-fftw=yes               no
FlashPIX          --with-fpx=yes                no
FontConfig        --with-fontconfig=yes         no
FreeType          --with-freetype=yes           yes
GhostPCL          None                          pcl6 (unknown)
GhostXPS          None                          gxps (unknown)
Ghostscript       None                          gs (8.71)
Ghostscript fonts --with-gs-font-dir=default    /usr/share/fonts/type1/gsfonts/
Ghostscript lib   --with-gslib=no               no
Graphviz          --with-gvc=yes                no
JBIG              --with-jbig=yes               no
JPEG v1           --with-jpeg=yes               yes
JPEG-2000         --with-jp2=yes                no
LCMS v1           --with-lcms=yes               yes
LCMS v2           --with-lcms2=yes              no
LQR               --with-lqr=yes                no
LZMA              --with-lzma=yes               no
Magick++          --with-magick-plus-plus=yes   yes
OpenEXR           --with-openexr=yes            no
PERL              --with-perl=no                no
PANGO             --with-pango=yes              no
PNG               --with-png=yes                no
RSVG              --with-rsvg=yes               no
TIFF              --with-tiff=yes               no
WEBP              --with-webp=yes               no
Windows fonts     --with-windows-font-dir=      none
WMF               --with-wmf=no         no
X11               --with-x=                     no
XML               --with-xml=yes                no
ZLIB              --with-zlib=yes               yes

X11 Configuration:
      X_CFLAGS        =
      X_PRE_LIBS      =
      X_LIBS          =
      X_EXTRA_LIBS    =

Options used to compile and link:
  PREFIX          = /usr/local
  EXEC-PREFIX     = /usr/local
  VERSION         = 6.7.5
  CC              = gcc -std=gnu99 -std=gnu99
  CFLAGS          = -fopenmp -g -O2 -Wall -pthread
  CPPFLAGS        = -I/usr/local/include/ImageMagick
  PCFLAGS         = -fopenmp
  DEFS            = -DHAVE_CONFIG_H
  LDFLAGS         = -L/usr/lib
  MAGICK_LDFLAGS  = -L/usr/local/lib -L/usr/lib
  LIBS            = -lMagickCore -llcms -lfreetype -ljpeg -lz -lm -lgomp -lpthread
  CXX             = g++
  CXXFLAGS        = -g -O2 -pthread
  FEATURES        = OpenMP

Any suggestions ?

Update: I have libmagickwand-dev and libmagickwand2 installed

P.S:I am trying to use Gruff and I am wondering if using it would also be as painful as the installation . I might also try rcharts while this gets resolved...


Source: (StackOverflow)

Gruff in RoR works in the console, crashes the server

when I attempt to do this apparently common and simple graph generation in Ruby on Rails (Ruby 1.9.2, RoR 3.2.1):

@g = Gruff::Line.new
@g.title = "My Graph"
@g.data("Apples", [1, 2, 3, 4, 4, 3])
@g.data("Oranges", [4, 8, 7, 9, 8, 9])
@g.data("Watermelon", [2, 3, 1, 5, 6, 8])
@g.data("Peaches", [9, 9, 10, 8, 7, 9])
@g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}
@g.write("fruitgraph.png")

it works in rails console, but when I put the same exact code in a function, say the show function for a page, and then navigate to that page, I get this error printout:

/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:915: [BUG] Segmentation fault
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.2.0]

-- control frame ----------
c:0081 p:---- s:0441 b:0441 l:000440 d:000440 CFUNC  :initialize
c:0080 p:---- s:0439 b:0439 l:000438 d:000438 CFUNC  :new
c:0079 p:0048 s:0433 b:0433 l:000432 d:000432 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:915
c:0078 p:0085 s:0428 b:0428 l:000427 d:000427 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:898
c:0077 p:0123 s:0425 b:0425 l:000424 d:000424 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:318
c:0076 p:0114 s:0420 b:0419 l:000418 d:000418 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:333
c:0075 p:0138 s:0416 b:0416 l:000415 d:000415 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:195
c:0074 p:0105 s:0410 b:0410 l:000409 d:000409 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/line.rb:42
c:0073 p:---- s:0406 b:0406 l:000405 d:000405 FINISH
c:0072 p:---- s:0404 b:0404 l:000403 d:000403 CFUNC  :new
c:0071 p:0088 s:0401 b:0401 l:000400 d:000400 METHOD /Users/Tim/Dropbox/EmotionManager/manager/app/controllers/entries_controller.rb:26
c:0070 p:0014 s:0398 b:0398 l:000397 d:000397 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/implicit_render.rb:4
c:0069 p:0015 s:0392 b:0392 l:000391 d:000391 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/base.rb:167
c:0068 p:0041 s:0387 b:0387 l:000386 d:000386 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rendering.rb:10
c:0067 p:0010 s:0383 b:0383 l:0025e0 d:000382 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/callbacks.rb:18
c:0066 p:0086 s:0381 b:0381 l:000380 d:000380 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:414
c:0065 p:0113 s:0375 b:0375 l:000374 d:000374 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405
c:0064 p:0027 s:0366 b:0366 l:000365 d:000365 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385
c:0063 p:0024 s:0361 b:0361 l:000360 d:000360 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81
c:0062 p:0020 s:0355 b:0355 l:0025e0 d:0025e0 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/callbacks.rb:17
c:0061 p:0012 s:0351 b:0351 l:000350 d:000350 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rescue.rb:29
c:0060 p:0010 s:0346 b:0346 l:000327 d:000345 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/instrumentation.rb:30
c:0059 p:0017 s:0342 b:0342 l:000332 d:000341 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123
c:0058 p:0032 s:0340 b:0340 l:000339 d:000339 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb:20
c:0057 p:0036 s:0333 b:0333 l:000332 d:000332 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123
c:0056 p:0152 s:0328 b:0328 l:000327 d:000327 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/instrumentation.rb:29
c:0055 p:0143 s:0323 b:0323 l:000322 d:000322 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/params_wrapper.rb:205
c:0054 p:0032 s:0317 b:0317 l:000316 d:000316 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/railties/controller_runtime.rb:18
c:0053 p:0093 s:0312 b:0312 l:000311 d:000311 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/base.rb:121
c:0052 p:0084 s:0306 b:0306 l:000305 d:000305 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/rendering.rb:45
c:0051 p:0048 s:0301 b:0301 l:000300 d:000300 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal.rb:203
c:0050 p:0086 s:0296 b:0296 l:000295 d:000295 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rack_delegation.rb:14
c:0049 p:0030 s:0290 b:0290 l:000d18 d:000289 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal.rb:246
c:0048 p:---- s:0287 b:0287 l:000286 d:000286 FINISH
c:0047 p:---- s:0285 b:0285 l:000284 d:000284 CFUNC  :call
c:0046 p:0022 s:0281 b:0281 l:000280 d:000280 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:66
c:0045 p:0094 s:0275 b:0275 l:000274 d:000274 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:30
c:0044 p:0161 s:0269 b:0269 l:000252 d:000268 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/journey-1.0.3/lib/journey/router.rb:68
c:0043 p:---- s:0258 b:0258 l:000257 d:000257 FINISH
c:0042 p:---- s:0256 b:0256 l:000255 d:000255 CFUNC  :each
c:0041 p:0051 s:0253 b:0253 l:000252 d:000252 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/journey-1.0.3/lib/journey/router.rb:56
c:0040 p:0025 s:0249 b:0249 l:000248 d:000248 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:589
c:0039 p:0015 s:0245 b:0245 l:000244 d:000244 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/best_standards_support.rb:1
c:0038 p:0015 s:0238 b:0238 l:000237 d:000237 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/etag.rb:23
c:0037 p:0068 s:0230 b:0230 l:000229 d:000229 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/conditionalget.rb:25
c:0036 p:0093 s:0223 b:0223 l:000222 d:000222 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/head.rb:14
c:0035 p:0046 s:0216 b:0216 l:000215 d:000215 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/params_parser.rb:21
c:0034 p:0054 s:0211 b:0211 l:000210 d:000210 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/flash.rb:242
c:0033 p:0031 s:0203 b:0203 l:000202 d:000202 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205
c:0032 p:0013 s:0195 b:0195 l:000194 d:000194 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200
c:0031 p:0020 s:0191 b:0191 l:000190 d:000190 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/cookies.rb:338
c:0030 p:0064 s:0183 b:0183 l:000182 d:000182 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/query_cache.rb:64
c:0029 p:0029 s:0174 b:0174 l:000173 d:000173 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connectio
c:0028 p:0014 s:0166 b:0166 l:002670 d:000165 BLOCK  /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:28
c:0027 p:0040 s:0164 b:0164 l:000163 d:000163 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405
c:0026 p:0113 s:0157 b:0157 l:000156 d:000156 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405
c:0025 p:0027 s:0148 b:0148 l:000147 d:000147 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385
c:0024 p:0024 s:0143 b:0143 l:000142 d:000142 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81
c:0023 p:0013 s:0137 b:0137 l:002670 d:002670 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:27
c:0022 p:0039 s:0133 b:0133 l:000132 d:000132 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:65
c:0021 p:0044 s:0128 b:0128 l:000127 d:000127 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/remote_ip.rb:31
c:0020 p:0017 s:0124 b:0124 l:000123 d:000123 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:16
c:0019 p:0017 s:0117 b:0117 l:000116 d:000116 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/show_exceptions.rb:56
c:0018 p:0121 s:0111 b:0111 l:000110 d:000110 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/logger.rb:26
c:0017 p:0052 s:0105 b:0105 l:000104 d:000104 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/logger.rb:16
c:0016 p:0048 s:0101 b:0101 l:000100 d:000100 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/request_id.rb:22
c:0015 p:0095 s:0094 b:0094 l:000093 d:000093 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/methodoverride.rb:21
c:0014 p:0032 s:0089 b:0089 l:000088 d:000088 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/runtime.rb:17
c:0013 p:0057 s:0080 b:0080 l:000079 d:000079 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/cache/strategy/local_cache.rb:72
c:0012 p:0068 s:0076 b:0076 l:000075 d:000075 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/lock.rb:15
c:0011 p:0124 s:0070 b:0070 l:000069 d:000069 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/static.rb:53
c:0010 p:0032 s:0064 b:0064 l:000063 d:000063 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/engine.rb:479
c:0009 p:0034 s:0060 b:0060 l:000059 d:000059 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/application.rb:220
c:0008 p:0015 s:0056 b:0056 l:000055 d:000055 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/content_length.rb:14
c:0007 p:0015 s:0047 b:0047 l:000046 d:000046 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/log_tailer.rb:14
c:0006 p:0356 s:0042 b:0042 l:000041 d:000041 METHOD /Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59
c:0005 p:0257 s:0030 b:0030 l:000029 d:000029 METHOD /Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111
c:0004 p:0393 s:0020 b:0020 l:000019 d:000019 METHOD /Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70
c:0003 p:0126 s:0009 b:0009 l:001f28 d:000008 BLOCK  /Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183
c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:---- s:0002 b:0002 l:000001 d:000001 TOP   
---------------------------
-- Ruby level backtrace information ----------------------------------------
/Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
/Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/Users/Tim/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/handler/webrick.rb:59:in `service'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/log_tailer.rb:14:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/content_length.rb:14:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/application.rb:220:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/engine.rb:479:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/static.rb:53:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/request_id.rb:22:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/logger.rb:16:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/railties-3.2.1/lib/rails/rack/logger.rb:26:in `call_app'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/reloader.rb:65:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `_run__3357496781086114657__call__4342850330723582611__callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/query_cache.rb:64:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/cookies.rb:338:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/flash.rb:242:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/head.rb:14:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:589:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/journey-1.0.3/lib/journey/router.rb:56:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/journey-1.0.3/lib/journey/router.rb:56:in `each'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:30:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_dispatch/routing/route_set.rb:66:in `call'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal.rb:246:in `block in action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal.rb:203:in `dispatch'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/rendering.rb:45:in `process'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/base.rb:121:in `process'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activerecord-3.2.1/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123:in `instrument'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/notifications.rb:123:in `block in instrument'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rescue.rb:29:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/callbacks.rb:17:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:405:in `__run_callback'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/activesupport-3.2.1/lib/active_support/callbacks.rb:414:in `_run__3934952041362041186__process_action__2052907014529777029__callbacks'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/rendering.rb:10:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/abstract_controller/base.rb:167:in `process_action'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/actionpack-3.2.1/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
/Users/Tim/Dropbox/EmotionManager/manager/app/controllers/entries_controller.rb:26:in `show'
/Users/Tim/Dropbox/EmotionManager/manager/app/controllers/entries_controller.rb:26:in `new'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/line.rb:42:in `initialize'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:195:in `initialize'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:333:in `theme_keynote'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:318:in `theme='
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:898:in `render_background'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:915:in `render_gradiated_background'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:915:in `new'
/Users/Tim/.rvm/gems/ruby-1.9.2-p290@rails3tut/gems/gruff-0.3.6/lib/gruff/base.rb:915:in `initialize'

-- C level backtrace information -------------------------------------------

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort trap: 6

Any ideas or help would be great, thanks!


Source: (StackOverflow)

How can I generate images in real-time using Ruby on Rails and Gruff?

I draw bar graphs in my app using gruff. In one view, 'compare', I want to show one graph for every 'step' my 'project' has. I imagine it something like this:

image_tag graph_step_path(step)

I've created a 'graph' action in the step controller and included a route. But now I'm kind of lost. How can my controller action return the correct image path to the image_tag function? Doing 'return' doesn't feel right. Or could I somehow directly include the image blob generated by gruff?

edit:

I've created a helper function that creates the graph and returns the file path.


Source: (StackOverflow)

SPARQL Parse Error: unexpected terminal

I've been using gruff to create and execute some simple SPARQL queries, but have run into some trouble. The following query works (prefixes have been left out):

SELECT ?k
WHERE
{ ?k  rdf:type  uw:pcservice . }

However, when I introduce the COUNT function, as seen below, I get the following error in gruff:

Error: Parse error: unexpected terminal ( (value: :|(|). Expected terminals: (* varname reduced distinct). [condition type: sparql-parse-error-unexpected-terminal]

SELECT (COUNT(?k) AS ?count)
WHERE
{ ?k  rdf:type  uw:pcservice . }

Not sure what is causing this. Any clues would be appreciated. Thanks.


Source: (StackOverflow)

Gruff is not working well. What to do?

I`m facing a problem with Gruff and Rails. Examples on the site fail with:

ZeroDivisionError: divided by 0
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:1066:in `label'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:590:in `setup_graph_measurements'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:532:in `setup_drawing'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:508:in `draw'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/line.rb:53:in `draw'
from /home/prikha/.rvm/gems/ruby-1.9.3-p194@rubymine/gems/gruff-0.3.6/lib/gruff/base.rb:487:in `write'
from (irb):8
from /home/prikha/.rvm/rubies/ruby-1.9.3-p194/bin/irb:16:in `<main>'

Source: (StackOverflow)

Image rendering on browser or temporary images?

I'm trying to make a statistics page where it will show several data and charts.
The charts need to be pictures so that the user can save it/drag-and-drop to his/her personal reports.

I'm using Gruff Graphs for Ruby to produce the charts but I don't know the best way to display the results safe and protected.

Some of my ideas/tries are:

  1. save the chart to a file (jpg, png)? problem: data is available to anyone (don't have access to cron, to delete data from time to time)

  2. render in the browser (has to work on IE)?

  3. Use javascript (Raphaël—JavaScript Library) or Google API and output a PDF report (need plugin or gem, right)?

  4. use send_data? i've tried to output other way than inline, because I needs to show other data, is it possible?

Thanks for any help.


Source: (StackOverflow)

how to combine two columns in sparql?

Hi I have the output of results like this :

?name ?o ?x
------------
ABCD  xyz ghh
PQR   xyz hij

how do I combine the columns ?o and ?x into one column called papers? I need the output to be like this :

?name ?papers
--------------
ABCD  (xyz, ghh, hij)

Note that PQR and ABCD are replaced only by ABCD. ABCD and PQR have the same property called mbox_sha1sum

The above two were examples. I need them to be like so:

This is the current sparql query :

PREFIX xmlns: <http://xmlns.com/foaf/0.1/> 
PREFIX ontoware: <http://swrc.ontoware.org/ontology#>
SELECT DISTINCT ?name ?x ?o
WHERE { 
 ?s xmlns:mbox_sha1sum ?hash.
 ?s xmlns:made ?o.
 ?s xmlns:name ?name.
 ?o ontoware:year "2009".
 ?r xmlns:mbox_sha1sum ?hash.
 ?r xmlns:made ?x.
 ?x ontoware:year "2008".
}

I need to basically combine ?o and ?x into one column called ?papers If it helps, ?s and ?r have different IRI


Source: (StackOverflow)

Data in Gruff diagram from database

I was looking for some example how to extract data from database and use it in diagram created in Gruff, but failed. So I want to show in this diagram two things from data base:

Course.application.size - which would count all applications to this course

Student.size - which would show me how many students are in school

So, how should I put this data into following diagram?

g = Gruff::Pie.new

g.title = "Applications"
g.data("Applied", ???)
g.data("Students", ???)

send_data(g.to_blob, :disposition => 'inline', :type => 'image/png', :filename => "gruff.png")

Source: (StackOverflow)

Vertical lines (markers) on ruby gruff x,y chart?

Is it possible in gruff to draw vertical marker lines, or does it only do horizontal lines?

If the latter, is there another ruby graph gem that can draw proper x,y graphs?


Source: (StackOverflow)

Dynamic image creation using gruff in ruby on rails

I am new to Ruby on Rails and working on Graph creation using 'Gruff'. In controller I am writing below code to create image in assets/images.

g.write("#{Rails.root}/app/assets/images/chart/chart.png")   

and in view : <%= image_tag("chart/chart.png", :alt => "Image missing") %>

By using this way I can perfectly see image in the view, but storing images in assets/images will consume a lot of memory.

Is there an alternative to create image dynamically without storing it in assets/images?


Source: (StackOverflow)

Possible to display marker value in Gruff chart?

Currently i am using Gruff gem to generate line chart. Its working great for me. But as the values increase in x-axis it is difficult to read the value from the chart(difficult in the sense, if the marker lies between y-axis values 0 - 500 user can't figure out what is the exact value).

i am thinking to display marker with values (anyhow we are drawing graph based on some value).

Is that possible.?

if not what is the preferred gem?

Thanking you all


Source: (StackOverflow)

Ruby 1.9 compatible plotting / graphic library?

I feel like I have a simple desire that no one can satisfy: I want to be able to graph a set of points, and I am using Ruby 1.9.2.

I would like to use Gruff or Scruffy, since these seem to be the easiest to use. However, they both rely on rmagick, and it seems that many other libraries do to. Rmagick isn't compatible with Ruby 1.9 though. (not to mention, I've read that you should just stay away from it anyways...I would enjoy hearing reasons)

I am using wxRuby for a project, but in the future I will be needing simple graphs in other places, such as online and just command line scripts. Therefore, if someone has a solution for wxRuby, that is great, but an all-encompassing solution would be even better.

Thank you!

P.S. I've seen gnuplot, but it would be a bit overkill. If that's my best option, I can live with that. I've also seen RGL, but I didn't look too long at it.

EDIT: Just to add, neither Gruff or Scruffy have been updated since August 2009, and I would like to find something that is at least semi-maintained. SVG::Graph looks very powerful, but hasn't been updated since Sept. '09. There is a fork of it on rubygems though which says it is 1.9 compatible, maybe I will try that if I can't get Scruffy or Gruff to play nice.


Source: (StackOverflow)

Gruff Non-conforming drawing primitive

I have a Ruby script I've written using Gruff to produce graphs. These are simple bar charts, and they've worked fine many times. Now, for one particular set of points I'm getting

c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.6/lib/gruff/line.rb:109:in draw': Non-conforming drawing primitive definitionInf' @ draw.c/DrawImage/3140 (Magick::ImageMagickError) from c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.6/lib/gruff/line.rb:109:in draw' from c:/ruby/lib/ruby/gems/1.8/gems/gruff-0.3.6/lib/gruff/base.rb:487:inwrite'

(then stack trace into my code)

I certainly don't have "Inf" in my code. I've taken a look into Gruff, but it's going to be the devil to get my head wrapped around Gruff source enough to track this one down.

I'll work on narrowing things down, but thought I'd post to see if this is familiar to anyone, or anyone has pointers on how to track down what has thrown Gruff for a loop.


Source: (StackOverflow)