Re: Sqlite3 on ubuntu
ActiveRecord has a built in pure ruby sqlite adapter (which is the *only* reason I sometimes use ActiveRecord over Sequel). Perhaps you're having include issues. Could you give the following a try? Shoes.setup do gem 'activerecord' end Shoes.app do begin require 'active_record' require 'active_record/connection_adapters/sqlite3_adapter' require 'user' ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile ='test.db') para User.find(1).id rescue Exception alert $! end end On Mar 11, 2009, at 3:51 AM, niedh wrote: thanks to Paul my test code is : Shoes.setup do gem 'activerecord' require 'active_record' ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile = 'test.db') require 'user' end Shoes.app do begin para User.find(1).id rescue StandardError = e alert(e) end end ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile = 'test.db') seems work find,but when User.find(1) it says no driver for sqlite3 found thanks to Marc Galbraith I 'git' the sources,and 'rake' it,but the problem still there maybe i should try another machin :( thanks anyway :) Marc Galbraith 写道: Hi, Noticed you are using 64-bit version of Ubuntu, did you build shoes from source on your system? Once I did that lots of ruby library problems went away. Regards, Marc. 2009/3/10 niedh dianhui@gmail.com mailto:dianhui@gmail.com I've use Shoes.setup do gem 'activerecord' end to install the activerecord gem ,and got succes. when i use active record the connect the sqlite3, it says no driver for sqlite3 found, and I tried to Shoes.setup do gem 'sqlite3-ruby' end It does not work,I guess it's because shoes has install it already,since i can found it in /tmp/selfxx/ I googled and not found a result. In windows ,it works fine. what happened to my ubuntu??? Ubuntu Version : 64bit 8.04 ruby verserion : 1.87 use ruby 1.86 use apt-get intall , is ruby1.8 some lib : i've already instal the libsqlite3 any help ?? 3ks
help with http post in shoes
Hi, I have a strange problem with using ruby http post in shoes block. I get a connection refused - connect(2) error on trying to run the shoes app. I am running the program on macOS and the problem seems to be resolve-replace.rb: line 19. Here's the code require 'rubygems' require 'erb' require 'net/http' Shoes.app{ @http = Net::HTTP.new('localhost', 8080) path = /remoting/ruby/Auth/logIn args = {:userName = 'user', :password = '1'} body = args.map {|k,v| #{k}=#{ERB::Util.url_encode(v)}}.join() resp, data = @http.post(path, body, @headers) para resp.response para data } I can run the program without Shoes block and it runs fine. What am I doing wrong ? Thanks for all the help. Regards, Vijay PS - I understand that shoes recommends openuri over the ruby http class but I would really appreciate comments on this issue
Re: Sqlite3 on ubuntu
Thanks all I fix my problem after compile shoes from the shoes, thanks to **Marc.** again. yesterday i compile from source after Marc's advice,and try ,it's not work. I found the reason today ,because I was still use the old version shoes bin(which i download from shoes site ,may not work find on my 64bit ubuntu) ,not the newer compile one :) Thanks all again ActiveRecord has a built in pure ruby sqlite adapter (which is the *only* reason I sometimes use ActiveRecord over Sequel). Perhaps you're having include issues. Could you give the following a try? Shoes.setup do gem 'activerecord' end Shoes.app do begin require 'active_record' require 'active_record/connection_adapters/sqlite3_adapter' require 'user' ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile ='test.db') para User.find(1).id rescue Exception alert $! end end On Mar 11, 2009, at 3:51 AM, niedh wrote: thanks to Paul my test code is : Shoes.setup do gem 'activerecord' require 'active_record' ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile = 'test.db') require 'user' end Shoes.app do begin para User.find(1).id rescue StandardError = e alert(e) end end ActiveRecord::Base.establish_connection(:adapter = 'sqlite3',:dbfile = 'test.db') seems work find,but when User.find(1) it says no driver for sqlite3 found thanks to Marc Galbraith I 'git' the sources,and 'rake' it,but the problem still there maybe i should try another machin :( thanks anyway :) Marc Galbraith 写道: Hi, Noticed you are using 64-bit version of Ubuntu, did you build shoes from source on your system? Once I did that lots of ruby library problems went away. Regards, Marc. 2009/3/10 niedh dianhui@gmail.com mailto:dianhui@gmail.com I've use Shoes.setup do gem 'activerecord' end to install the activerecord gem ,and got succes. when i use active record the connect the sqlite3, it says no driver for sqlite3 found, and I tried to Shoes.setup do gem 'sqlite3-ruby' end It does not work,I guess it's because shoes has install it already,since i can found it in /tmp/selfxx/ I googled and not found a result. In windows ,it works fine. what happened to my ubuntu??? Ubuntu Version : 64bit 8.04 ruby verserion : 1.87 use ruby 1.86 use apt-get intall , is ruby1.8 some lib : i've already instal the libsqlite3 any help ?? 3ks
instance variable voodoo
this seems weird to me. Am I wrong to be able to expect to use a method inside a shoes-derived class to assign a value to an instance variable? Check this out: == class BugTest Shoes url '/', :main def assign_variable info assigning variable. @foo = bar info self is #{self}. @foo is #...@foo} end def main title main info in main. self is #{self}. @foo is #...@foo} button assign variable do assign_variable visit '/' end end end Shoes.app = You run this, click the button, and get the following on the console: in main. self is (#Class:0x12493b0::BugTest). @foo is assigning variable. self is (#Class:0x12493b0::BugTest @foo=bar). @foo is bar in main. self is (#Class:0x12493b0::BugTest). @foo is Where'd the value 'bar' in @foo go after the assign_variable method returned?
Re: + on our way to shoes 3
I would have thought the rubygems support and native extensions support already included in shoes would have been sufficient. What else is needed? Will the next shoes ship with bloopsaphone? It would be very nifty if it did. :) Good luck with the bug fixings and the Hackety Hacking. I'm sure we're all looking forward to having a go with the new shoesian hackety hack. :) On 12/03/2009, at 3:27 PM, _why wrote: Okay, thanks for sitting tight everybody. I'm back from ART CODE and, while I'm still working on Hackety Hack, I hope to return to working on Shoes 3 in a week or so. The idea is to put it out in a few weeks. The biggest part is that we'll be moving to Ruby 1.9, VLC 1.9, and newer versions of Cairo and Pango. Also, all of Tim Elliott's great work on Windows will be merged. I've got some Vista fixes to work out as well. The release after this one will focus on speed. Basically making the retained graphics operate on an immediate surface. (A surface living in its own thread.) In Pittsburgh, I also had a chat with Seth Rasmussen about Shoes and we kicked around an idea for having an extension library that would make it a bit easier for people to bring in native controls (grids, trees, systray, etc.) into Shoes without needing my approval. I really like that idea and, yeah, could use some help with it. _why
Re: help with http post in shoes
Those very docs say And if you need to go beyond these, you can always break out Ruby's OpenURI class Does shoes hack open-uri to go via download, or is this some strange cyclical thing where the docs are advising that if download doesn't work we should be using Net::HTTP in a round about way? On 12/03/2009, at 2:56 PM, _why wrote: On Wed, Mar 11, 2009 at 05:31:36PM -0700, Vijay wrote: I have a strange problem with using ruby http post in shoes block. I get a connection refused - connect(2) error on trying to run the shoes app. I am running the program on macOS and the problem seems to be resolve-replace.rb: line 19. I would stay away from Net::HTTP when using Shoes. It's a blocking operation. Your whole app will stop until the request is done. Use the `download` method, which can do HTTP in the background and uses platform-specific code to work much, much faster. Shoes.app do download http://localhost:8080;, :method = POST, :body = userName=userpassword=1 do |dl| para dl.response.body end end You can read more in the Shoes manual. http://help.shoooes.net/App.html#download _why
Re: instance variable voodoo
On Mar 12, 2009, at 12:06 AM, _why wrote: Sure you could use a class var. Those are guaranteed to persist throughout the life of the app. Or a constant. Also, Shoes comes with SQLite3, data can be passed there. Thank you!
Re: help with http post in shoes
On Thu, Mar 12, 2009 at 03:38:06PM +1100, Jenna Fox wrote: Those very docs say And if you need to go beyond these, you can always break out Ruby's OpenURI class Does shoes hack open-uri to go via download, or is this some strange cyclical thing where the docs are advising that if download doesn't work we should be using Net::HTTP in a round about way? No, I'll nix that recommendation, the HTTP stuff is fleshed -- I use POST and PUT throughout Hackety Hack. _why