Skip to content

Ramblings

Musings of Matt Williams
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 
Less
More
Trim
Untrim
« Older
Home
Loading
Newer »
Archive for the 'gotchas' Category
22Jun12 cygwin and torquebox and rvm, oh my!
cygwin gotchas jruby tips torquebox
0 Comments

rvm, despite being wonderful, doesn’t play very well with torquebox under cygwin. In particular, the gem paths are not working. So, in order to fix this, simply do:

rvm use system

And then it will work right. Once you’re done with the torquebox work, you can go back to using rvm.

04Aug10 rsh hates nohup
gotchas UNIX
0 Comments

rsh does not like nohup — rather than returning, as one would expect, it just hangs.

This has to do with stdin, stdout and stderr.

The short of it is….

By preference use ssh.

If you must use rsh, make sure that stdin, stdout, and stderr are all redirected properly.

09Jun10 Torquebox and Cygwin: Take I
gotchas jboss jruby rails torquebox
0 Comments

Torquebox and Cygwin don’t work as nicely together as one might hope.

That said, here are a couple of findings:

  1. In order to deploy, you need to set the $JBOSS_HOME with the Windows path.  You can do this via export JBOSS_PATH=`cygpath -w PATH_TO_JBOSS`.
  2. Additionally, the JRUBY_HOME needs to be a windows path as well.   Otherwise you will see:

    org.jruby.exceptions.RaiseException: no such file to load — date

That’s it so far, more to follow as discovered….

02Mar10 Rails & JRuby in a Jar
gotchas jruby rails tips
7 Comments

For political reasons, I needed to ship a single jar file.  I didn’t want to have the overhead of a war & an appserver, so I set out to embed my rails app within a single jar file.  I needed to make some changes in order to get it to work.

This assumes Rails 2.3.5 and JRuby 1.4.0.

First, you need to create your rails app.   Freeze rails and any gems required.

Next download jruby-complete.  Once you’ve done so, unzip it.  I’m assuming you’ve unzipped it to complete.

Note: When you repackage the jar file, DO NOT use jar.  Use zip.  This is very important.  If you don’t, you’ll trash your jruby instance.

Copy your rails instance to complete/META-INF/jruby.home. I assume it will be complete/META-INF/jruby.home/rails.

Next create complete/META-INF/jruby.home/bin/server with the following content:


#!/usr/bin/env ruby

RAILS_ROOT = File.join(File.dirname(File.dirname(__FILE__)),'rails')

require File.join(RAILS_ROOT,'config/boot')
require 'commands/server'

The RAILS_ROOT needs to be set in order to have the proper paths within the jar file.

Next, edit complete/META-INF/jruby.home/rails/vendor/rails/railties/lib/initializer.rb In the set_root_path method, edit it so it looks like this:


    def set_root_path!
      raise 'RAILS_ROOT is not set' unless defined?(::RAILS_ROOT)
      raise 'RAILS_ROOT is not a directory' unless File.directory?(::RAILS_ROOT)
      # I changed this... mkw21 20100301
      @root_path = RAILS_ROOT
        # Pathname is incompatible with Windows, but Windows doesn't have
        # real symlinks so File.expand_path is safe.
#        if RUBY_PLATFORM =~ /(:?mswin|mingw)/
#          File.expand_path(::RAILS_ROOT)#

        # Otherwise use Pathname#realpath which respects symlinks.
#        else
#          Pathname.new(::RAILS_ROOT).realpath.to_s
#        end

      Object.const_set(:RELATIVE_RAILS_ROOT, ::RAILS_ROOT.dup) unless defined?(::RELATIVE_RAILS_ROOT)
      ::RAILS_ROOT.replace @root_path
    end

This is related to paths within the jar file.

Additionally, you need to change the initialize_logger method. (this might not be needed, see below). Change


          logger = ActiveSupport::BufferedLogger.new(configuration.log_path)

to


          logger = ActiveSupport::BufferedLogger.new("/tmp/transfer.log")

The idea is to change it to something definitely outside the jar. The reason I did this, and didn’t change the config in environment.rb was that the changes in environment.rb were not getting picked up. I’ve since come to the belief that this is due to an issue with the Rack LogTailer detailed at https://rails.lighthouseapp.com/projects/8994/tickets/2350-logtailer-ignores-configlog_path. So complete/META-INF/jruby.home/rails/vendor/rails/railties/lib/rails/rack/log_tailer.rb needs to be edited. Edit the EnvironmentLog assignment to match the file we’d specified. (You may be able to substitute RAILS_DEFAULT_LOGGER but I have not tested that)


      EnvironmentLog = "/tmp/transfer.log"      

That’s pretty much it. Zip up your exploded jar from the complete directory: zip -r ../complete.zip *. Then you can run it via java -jar complete.jar -S server.

Enjoy!

29Jul09 JBoss port confusion
gotchas jboss
0 Comments

We ran into a case where JBoss was unable to come up; it gave the following (partial) exception:

java.rmi.server.ExportException: Port already in use: 1098; nested exception is:
java.net.BindException: Cannot assign requested address

After poking around with netstat and lsof, we couldn’t find anything that was binding to the port.  I’d made the assumption that it was bound, totally missing the next line.  As it turns out, we were attempting to bind to a vip which, although it existed in DNS, was not defined on the host on which the error occurred.  The “cannot assign requested address” was the clue.

Enhanced by Zemanta
14May09 SSL Joys
gotchas howto tips
0 Comments

The nice thing about standards is that there are so many of them to choose from. Andrew S. Tanenbaum

I’ve been working with a Apache proxy to force SSL and https.  Well, I haven’t had any control over the certificates.  And they can come in so many versions, especially given that Microsoft wants to do things its own way and the Apache web server instance is sitting on a windows virtual instance.

I’ve gotten the private key in two different formats, .pfx and .pvk.

.pfx can be converted to the pem file format which Apache is expecting via the following:

openssl pkcs12 -nodes -in infile.pfx -out out.pem

You then need to edit it, stripping out everything but the private key.  Once that’s accomplished you’re good to go.

.pvk, however, isn’t supported in openssl until version 1.0.  Joy!

Enhanced by Zemanta
14Jan09 SSL and Java Keystores
gotchas tips
0 Comments

If you happen to change a machine’s name, be sure to delete the previous definition from the keystore.  Otherwise it will complain mightily and, indeed, fail when you attempt to add in the pem file.

14Nov08 Concatenation Note to Self
gotchas
0 Comments

To concatenate in PHP you use a ‘.’, not a ‘+’.  Likewise, you don’t use ‘.’ to reference an object’s members, you use ‘->’. 

Move along, nothing to see.

12Nov08 DIY Maps and Linux Firefox/Flash Quirks
gotchas javascript
1 Comment

First off, let me say that I really like DIY Map. It’s quick, and responsive, with an easy to use interface, as well as allowing you to make changes on the fly easily.

That said, I discovered lastnight / this morning that there are some quirks with its updating through the Flash JavaScript Integration Kit.

First of all, the only way I’ve been able to get paths to resources to work is via relative paths.  More on why I think that is the case in a moment.  I was finding that resources were not being found until I used relative paths.  Once I did so, that part worked just fine.

Second, in order to be able to update the map, it needs to be fed an XML data file, which is fine.  Wherein lies the trouble is when you are attempting to feed a dynamic file (like a cgi script or php) — I’ve not been able to get it to work, despite having the right data in the output and the proper content type — the data works just fine when loaded from a file, however…  So, my workaround is to write to a temporary file and use that file to make the changes.

Third, and this was a kicker….  The Javascript integration kit isn’t talking to Flash 9 on Firefox 3.0.3 under linux.  The messages get lost out on the bit bucket.  Just to make sure it wasn’t me, I also tried the examples which came with the app.  They, however, work on Firefox under windows.  So, I don’t know if it is something having to do with my box or what…  But it ain’t working.

4+ hours spent  on this.  Meh.  It’d be a bit more amusing if I’d gotten more sleep.  I napped for about an hour around midnight, and another nap at 7:30am until I had to get up for work @ 9.

11Nov08 YUI Datasources
gotchas
0 Comments

Been a while since I’ve written.  I’ve been sick and working on a side project.  That said, I’ll be writing more……

Today’s note/reminder is a gotcha about YUI datasources.  If you have JSON feeding the datasource and you’re getting back more fields in the results than you’re expecting, the datasource will not behave properly.  For example, if you’ve declared that you’re getting back

  • name
  • id

But in reality you get

  • name
  • id
  • address
  • email

it will just sit there. Very frustrating. Very fun trying to debug, too!

 
Browse Archives »
  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • cygwin (1)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (19)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (8)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (10)
  • tools (2)
  • torquebox (2)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)
 

Latest

  • cygwin and torquebox and rvm, oh my!
  • JBoss Client Jars for Messaging
  • rsh hates nohup
  • Torquebox and Cygwin: Take I
  • Rails & JRuby in a Jar
  • Fractal Terrain Generation
  • Quick thought on programming and distractions
  • Using jnp as a JBoss heartbeat
  • z-index and events
  • JBoss port confusion

Flickr

layout_newm3headerTerrain Testa

Blogroll

  • Development Blog
  • Documentation
  • Plugins
  • Suggest Ideas
  • Support Forum
  • Themes
  • WordPress Planet

Search

Browse by Category

  • administrivia (6)
  • books (1)
  • Computers (2)
  • css (3)
  • cygwin (1)
  • eating crow (1)
  • games (1)
  • glassfish (1)
  • gotchas (19)
  • howto (2)
  • idiocy (3)
  • javascript (4)
  • jboss (6)
  • jruby (8)
  • Just Enough Programming (7)
  • life hacking (2)
  • mini sagas (1)
  • miscellany (1)
  • monitoring (1)
  • mysql (1)
  • philosophy (4)
  • php (1)
  • programming (17)
  • rails (7)
  • rants (2)
  • refactoring (1)
  • ruby (14)
  • tips (10)
  • tools (2)
  • torquebox (2)
  • Uncategorized (9)
  • UNIX (1)
  • utilities (3)
  • web (5)
  • web design (3)

Browse by Tag

  • 1.2.6
  • 2.1
  • administrivia
  • autotest
  • books
  • controller
  • css
  • feed-normalizer
  • feeds
  • gotchas
  • idiocy
  • irb
  • Java
  • javascript
  • jboss
  • jruby
  • just enough programming
  • mini sagas
  • open-uri
  • philosophy
  • php
  • pragmatism
  • programming
  • quotations
  • rails
  • rants
  • reading
  • restful_authentication
  • rspec
  • rss
  • ruby
  • rubygems
  • scriptaculous
  • setup
  • simplicity
  • sprites
  • statemachine
  • tips
  • treetop
  • utilities
  • web
  • web design
  • websense
  • yaml
  • zentest

Browse by Month

  • June 2012 (1)
  • November 2010 (1)
  • August 2010 (1)
  • June 2010 (1)
  • March 2010 (1)
  • September 2009 (1)
  • August 2009 (2)
  • July 2009 (2)
  • May 2009 (1)
  • April 2009 (1)
  • February 2009 (4)
  • January 2009 (2)
  • December 2008 (2)
  • November 2008 (5)
  • October 2008 (3)
  • September 2008 (12)
  • August 2008 (28)
 
 
  • Blog
  • About
  • Chibi
  • Ruby Blender
  • Archives
  • Log in
 


Theme Design by Jay Kwong | Powered by WordPress and K2

 

Home Top Archives Entries FeedComments Feed