02:08
bradgonesurfing joined
03:17
bradgonesurfing joined
03:53
hipertracker joined
07:31
Swimming_Bird joined
09:59
flegelleicht joined
10:03
<neonski>
good morning/afternoon/evening
10:03
<neonski>
anyone can help with post file uploads?
10:04
<neonski>
i'm trying to find a good example of this but all i find seems to be outdated
10:08
<ecin>
With reading the file or making the html form?
10:12
<neonski>
with receiving the file in a POST handler
10:12
<ecin>
tbuehlmann: so what's the error you're getting?
10:12
<neonski>
thanks tbuehlmann
10:16
<neonski>
works perfectly. yay
11:15
irclogger_com joined
11:19
<baxter->
what's the best way to generate an etag?
11:20
<baxter->
i'm currently generating one based on String#hash
11:38
<malte_>
when using sinatra, if you want to load a css (sass) file in the < head > tag, what exactly are you meant to do? are you meant to first manually compile the sass file into css and call the css file, or is there some way of letting sinatra / haml / sass take care of that itself so i don't have to manually recompile the css file for each change?
11:40
<baxter->
malte_, do you mean embedding css within <style> tags? or something like <link href='/style.css' rel='stylesheet' type='text/css'>?
11:40
<baxter->
if you mean the latter, i would create a route like get '/style.css' do ...
11:41
<malte_>
baxter-, the latter .. im not talking about inline css, but referencing a css file (pure html wise)
11:41
<baxter->
i would create a new get statement for your css file, and then use something like 'sass :style'
11:42
<malte_>
baxter-, but does that mean then that for every request to load the css, the entire sinatra app is called? that must get pretty clunky in the long run .. is there no way to make it just recompile the sass file itself when needed, but always just serve the static css to the consumer for speed and efficiency reasons?
11:43
<baxter->
there might be a way to do that :) i'm not sure
11:44
<baxter->
i'm hosting my stuff on heroku and relying on caching, but that might not be any good for you
11:44
<malte_>
oh :) .. ok, some sites indicate that its possible .. they just don't say how the F its done :p
11:45
<malte_>
hmms, just started using ruby / sinatra / haml / sass etc the other day, so learning the ropes right now .. will take a look at heroku a little later when i feel like i have the basics under control
11:50
<malte_>
baxter-, i found a way!
11:50
<baxter->
what did you do?
11:52
<malte_>
baxter-, if you use 'thin' to run the app, and you place the sass files in /public/stylesheets/sass, and add some stuff to config.ru, then thin recompiles the sass into css whenever needed
11:52
<baxter->
oh, interesting
11:53
<malte_>
could you tell me what 'thin' is in a nutshell though? you are not meant to use it in a production environment are you?
11:53
<baxter->
thin is a web server
11:53
<baxter->
i think you can use it in production. i'm sure heroku runs on a version of thin
11:54
<malte_>
hm... but can it handle even nearly as much requests as nginx for example?
11:54
<malte_>
i come from a python background, and using these native webservers in production is never recommended there at least
11:54
<malte_>
they are just for development there really
11:55
<baxter->
i think thin can run on nginx... i'm not really sure actually, let me read up
11:56
<malte_>
yes it can
11:56
<malte_>
just reading about it now
11:56
<malte_>
so thin is kind of like wsgi in python then i take it .. like a protocol that also has a native web server implemented, but you can opt to use a 'real' webserver too, like nginx with it
11:58
<baxter->
i'm not familiar with wsgl, so i can't say for certain
11:59
<malte_>
WSGI is the Web Server Gateway Interface. It is a specification for web servers and application servers to communicate with web applications (though it can also be used for more than that). It is a Python standard, described in detail in PEP 333.
11:59
<baxter->
i think with thin nginx works as a proxy
12:00
<baxter->
hmm, well i would say rack is the equivalent to wsgi
12:00
<baxter->
based on that definition
12:00
<malte_>
yep, that's what i'm going to assume for now as well
12:01
<baxter->
where did you find that info about thin processing sass files? i would quite like to have a read
12:03
<bresc>
HI I'm having sinatra running with Thin and I want to POST gziped json. So everything works fine if I don't send gzip. But with gzip there doesn't seem to be anything in "request.body.read"
12:04
<baxter->
i can't believe i've missed that, thanks malte_!
12:06
<bresc>
I should mention that I use nginx to proxy to Thin
12:30
charlenopires joined
13:21
xperiencezZz joined
13:26
Swimming_Bird joined
13:30
Swimming_Bird joined
13:33
<brainproxy>
using the builder gem in a sinatra app; I've got an xml tag that has colon in the name
13:33
<brainproxy>
xml.bar:foo
13:33
<brainproxy>
doesn't work
13:34
<brainproxy>
proper way to make that work?
13:45
<baxter->
brainproxy, just wondering, if you put a space between bar and :foo what happens
13:51
<bleything>
baxter-, brainproxy: that's exactly how you do namespaces. xml.foo :bar do ...
13:53
<baxter->
thanks bleything
13:57
<brainproxy>
i need my tag to look like this
13:57
<brainproxy>
<bar:foo arg1="yoz" arg2="baz">
13:57
<brainproxy>
well, ending with />
13:58
<brainproxy>
sorry, a bit new to this so I wasn't sure exactly how to apply your namespace suggestion, bleything
13:58
<brainproxy>
though I am looking at the builder docs on rubyforge
13:58
<brainproxy>
and saw that bulletpoint
13:58
<bleything>
yeah, the docs will show you the way.
13:58
<bleything>
if you don't give builder a block, it'll create a self-closing tag
13:58
<brainproxy>
well there's no example for tag!
13:58
<brainproxy>
which is how it suggests doing it at first
13:59
<brainproxy>
xml.tag!("bar:foo")
13:59
<brainproxy>
that works
13:59
<brainproxy>
but how to add the arguments
13:59
<brainproxy>
no examples in documentation
13:59
<brainproxy>
also, no examples for suggestion that namespace is a better way to go
13:59
<bleything>
I don't understand what you mean by "namespace is a better way to go"
14:01
<brainproxy>
from docs: "(But see the next bullet item for a better way to handle XML namespaces)."
14:01
<brainproxy>
so I didn't say it quite right
14:01
<bleything>
xml.bar :foo, :arg1 => "yoz", :arg2 => "baz"
14:01
<bleything>
does what you want
14:02
<bleything>
Just Try It™
14:02
<brainproxy>
sorry, it wasn't obvious to me
14:02
<brainproxy>
only been doing ruby for about 2 days :)
14:02
<bleything>
here's the thing to know about ruby: whatever you think might work, probably will :)
14:03
<bleything>
for instance, I haven't used builder for yeaaaaars. but I just slapped that together and it magically worked
14:03
<brainproxy>
thanks for the tips :)
14:03
<bleything>
np, good luck!
14:04
<brainproxy>
it worked, whadda ya know :)
14:37
<neonski>
good morning/afternoon/evening
14:38
<neonski>
so in my application, there is no database - the data comes from a REST based api on another server
14:39
<neonski>
so when a request comes in, I have to do a request (right now using RestClient) to the backend
14:39
<neonski>
and process it using the views, etc in the sinatra app
14:40
<neonski>
i'm wondering if there's a more efficient way of doing this - maybe using sinatra as a rack middleware? it becomes tricky because there will be cookies involved, etc
14:40
<neonski>
just wondering if someone has ideas, design wise, on how to implement this in an efficient way
14:40
<neonski>
(be back in 10)
14:48
xperiencezZz joined
15:04
xperiencezZz joined
15:29
aaroninfidel joined
17:02
Swimming_Bird joined
18:50
Swimming_Bird joined
20:17
<pjammer>
oh gosh, now where did rack/test go in 1.0.1
20:36
<pjammer>
did you know that rack 1.1.0 doesn't have rack/test?
20:37
<sr>
pjammer, it is not part of rack itself, you need to gem install rack-test
20:38
<pjammer>
yes, but somehow i was able to test without it before.... unless that was when i had my imac...hmmm
20:40
<johnny>
were you using sinatra test before?
20:40
<johnny>
that used to be part of sinatra until recently
20:40
<pjammer>
but either way, shouldn't that tibbit be in the docs?
20:40
<johnny>
it says so right in the sinatra docs
20:40
<pjammer>
i think my situation was i had a new imac, hated it, and went back to this laptop i'm on.
20:41
<johnny>
to use rack-test and that the sinatra test was being removed
20:41
<pjammer>
johnny: where does it say, install rack-test using sudo gem install rack-test
20:41
<pjammer>
as the examples show
20:41
<johnny>
it just says to use rack-test
20:42
<johnny>
not sure if it says how to install it
20:42
<johnny>
but it says you must
20:45
<pjammer>
the other thing is that rack comes with rack::mockwhatever... which one would assume had rack::test in it too, not that this is a rack room.
20:45
<pjammer>
so you can mock right out of rack, but you can't test.
20:46
<pjammer>
anyways, i'm sorry for whining. one of those days.
20:49
<sr>
pjammer, you could use Rack::MockRequest to test your app, actualy. check rack's test for an example
20:49
<sr>
rack/test is based on it. it just adds a bit of sugar on top of it
20:50
<pjammer>
yeah, i am using rack/test already, i wrote this in November ish...
20:50
<pjammer>
using last_response.ok? and stuff
20:50
<pjammer>
follow_redirect! etc
21:05
<pjammer>
hmm hmm hmm
21:05
<pjammer>
mocking xml, i wonder if that can be done in mockrequest
21:08
<tdmackey>
don't see why not
21:09
<pjammer>
fudge, i hate coming back to things 4 months later.
21:10
<pjammer>
so active resource sends a post request to my sinatra app /blah.xml
21:10
<pjammer>
so i then have to get said file, and parse it.
21:10
<pjammer>
it seems that rack test has an upload_file.rb file
21:10
<pjammer>
post "/photos", "file" => Rack::Test::UploadedFile.new("me.jpg", "image/jpeg")
21:11
<pjammer>
maybe that's how i do it.
21:15
<pjammer>
ok that part works.
21:15
<pjammer>
changed for xml of course
21:16
<tdmackey>
what are you doing with xml?
21:16
<pjammer>
isn't the following code a redirect? - return @shorty.to_xml
21:17
<pjammer>
tdmackey: i'm using the file from active Resource to create a record on my sinatra app based on the content inside.
21:19
<pjammer>
i guess it isn't although the return sends a request back to Active Resource
21:20
<pjammer>
so maybe redirect means like a true 301 or something
21:22
<pjammer>
yeah, stupid legacy code.
21:22
<pjammer>
night night, too late to keep thinking.
23:52
bradgonesurfing joined