thin

Oracle ResultSetMetaData getPrecision/getScale

人走茶凉 提交于 2019-12-04 12:49:47
I'm using Oracle's JDBC thin driver (10.2.0.3) for connecting to an Oracle 10g database. I'd like to get information about the database columns, so I use ResultSetMetaData . The most important information I need is the type of the column and the length, so I use getColumnType , getPrecision , and getScale methods. It works for a simple query ( select * from tablename ) if the column type is "simple" like VARCHAR2(50), NUMBER(5), NUMBER(6,2) . If I have a more complex query ( select count(*) from tablename ) or a query based on a view which contains some complex calculation, the methods give

How do I log asynchronous thin+sinatra+rack requests?

天大地大妈咪最大 提交于 2019-12-04 10:20:11
I'm writing my first Sinatra-based web app as a frontend to another TCP-based service, using EventMachine and async_sinatra to process incoming HTTP requests asynchronously. When I'm testing my app, all requests to synchronous routes are logged to stdout in common log format, but asynchronous requests are not. I've read through bits of the source code to async_sinatra, Sinatra, Thin, and Rack, and it looks like logging of synchronous requests is done through CommonLogger#call. However, I can't find anywhere in the asynchronous code in async_sinatra or Thin that seems to pass asynchronous

How to view debug code in Thin console window?

南楼画角 提交于 2019-12-04 09:41:37
In Mongrel, we are able to see any ruby debug code. After installing thin and doing thin start . I don't see any debug code on the console window. Is this nromal? Are we supposed to use tail -f log/development.log in a new console window to view the debug code? Yes. The solution with tail is normal, and you should use it. You could also try to start your server this way : rails server thin It shows your log, in Rails 3 at least. You can use a Procfile with foreman : Procfile web: thin start -p $PORT logger: tail -f log/development.log Example $ foreman start -p 3000 Benj The solution is to add

Rack Sessions getting lost in Chrome

╄→гoц情女王★ 提交于 2019-12-04 07:26:09
I have an pretty simple app hosted on EC2 built with Sinatra, served with thin behind nginx. The problem is that with Chrome, the session variables get 'lost' in Sinatra. It does not happen in Firefox. This is using Rack::Session::Cookie. This is similar to this issue: Sinatra not persisting session with redirect on Chrome Any insights in how to solve this issues in Chrome would be appreciated. Make sure you are setting the following: configure :development do set(:session_secret, 'a random string that wont change') end configure :production do set(:session_secret, '*&(${)UIJH$(&*(&*(@(*)(!))

Rails development server, PDFKit and multithread

╄→гoц情女王★ 提交于 2019-12-04 07:18:58
I have a rails app that uses PDFKit to render pdf versions of webpages. I use Thin as a development server. The problem is that when i'm in development mode. When I start my server with "bundle exec rails s" and I try to render any PDF the whole process gets deadlocked because when you render a PDF some extra resources like images and css are requested to the server and looks like there is a single thread. How can I configure rails development server to run multiple worker threads? Thanks a lot. The simplest solution I have found is unicorn . gem install unicorn Create a unicorn.conf : worker

Running Rails apps with thin as a service

帅比萌擦擦* 提交于 2019-12-03 16:35:32
I am trying to run thin as a service on my web server. After running "sudo thin install", thin created the following file in /etc/init.d/thin #!/bin/sh DAEMON=/usr/local/lib/ruby/gems/1.9.1/bin/thin SCRIPT_NAME=/etc/init.d/thin CONFIG_PATH=/etc/thin # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 case "$1" in start) $DAEMON start --all $CONFIG_PATH ;; stop) $DAEMON stop --all $CONFIG_PATH ;; restart) $DAEMON restart --all $CONFIG_PATH ;; *) echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2 exit 3 ;; esac When the thin service is started, the following is ran thin start -

Asynchronously iterating over the response of a request using Thin and Sinatra

不打扰是莪最后的温柔 提交于 2019-12-03 16:15:28
If your response in Sinatra returns an 'eachable' object, Sinatra's event loop will 'each' your result and yield the results in a streaming fashion as the HTTP response. However, if there are concurrent requests to Sinatra, it will iterate through all the elements of one response before handling another request. If we have a cursor to the results of some DB query, that means we have to wait for all the data to be available before handling a concurrent query. I've looked at the async-sinatra gem and http://macournoyer.com/blog/2009/06/04/pusher-and-async-with-thin/ , thinking these would solve

Can't start thin server as service, RubyGems: Could not find thin

*爱你&永不变心* 提交于 2019-12-03 08:17:37
I used the following instructions to install and configure the Thin server as a service on Ubuntu 10.04.4 with Rails 3.2.3: http://articles.slicehost.com/2008/5/6/ubuntu-hardy-thin-web-server-for-ruby Thin server works fine running it from the application root, using 'thin start' However, when I try to run the service using any of these commands: service thin start sudo service thin start /etc/init.d/thin start sudo /etc/init.d/thin start I get the following error: /home/myuser/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find thin (>

Why would I want to use unicorn or thin instead of WEBrick for development purposes?

孤人 提交于 2019-12-03 03:33:09
问题 I've recently found that some people prefer using unicorn_rails instead of the default WEBrick as a web server for developing Rails applications. I understand that if I wanted to use unicorn in production, it could make kind of sense to try it out in development, but since the configuration is different in production, is it even relevant? Is there any real, tangible advantage that I would get from using thin or unicorn instead of WEBrick for developing a Rails application, such as speed or

Why would I want to use unicorn or thin instead of WEBrick for development purposes?

◇◆丶佛笑我妖孽 提交于 2019-12-02 17:01:16
I've recently found that some people prefer using unicorn_rails instead of the default WEBrick as a web server for developing Rails applications. I understand that if I wanted to use unicorn in production, it could make kind of sense to try it out in development, but since the configuration is different in production, is it even relevant? Is there any real, tangible advantage that I would get from using thin or unicorn instead of WEBrick for developing a Rails application, such as speed or some additional features? Or is this just a matter of personal preference? It is important to develop as