@Kevin you could solve the problem?! I thin that we have the same issue, because when i update the picture, i got a blank screen, it doesnt take me to crop.html.erb. When i refresh that blank screen i got the new updated picture. Could you help me please?
I was wondering the same thing. Both look like they are done well but GeoKit seems like its been around a lot longer than Geocoder, but I could be wrong.
Keep in mind that doing geocode server side is not a best practice.
Google API limit is 2500 req/day (and decrease every year :))
Should be done client side with plugin like this: https://github.com/sgruhier/jquery-addresspicker
Not sure why, but I can't get this to work unless I accept an argument in the mass_assignment_authorizer method located in the initializer. If I do it like the below everything works.
FAYE_TOKEN isn't in the source javascript. It's a token used on two backend servers which communicate between each other. The end user never sees, sends or intercepts that communication.
Kaminari is also SEO-friendly! Add a route like this:
resources :products do
get 'page/:page', :action => :index, :on => :collection
end
And Rails will automatically rewrite your URLs to be SEO-friendly! Instead of /products?page=32, you'll have a nicer URL - /products/page/32. Because of this, you can also leverage on some page-caching techniques if your index isn't updated frequently.
Awesome as usual! Thx. Have you tried deploying your app in production mode under RC4 ? Everything worked exactly the same for me under development but when I switched to production I got this error with web brick:
Fantastic intro, we just started using resque and I was going to have to learn it the hard way. But then you show up with a great screencast and now I get to take a long lunch. :)
I too can verify this problem exists with the code Ryan. The outputted code looks like the following for me.
html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"><html><body><p>This is a <strong>markdown</strong> enabled text</p><divclass="highlight"><pre><spanclass="nb">puts</span><spanclass="s2">"Hello World"</span></pre></div></body></html>
Please who can i specify the path for scss files and the related css path for the compiled file ? in rails 3.0.7
How can use sass manualy to generate css files when i was in for exemple in Appcontroller ? which steps should i have to follow to do this with sass (Rails 3.0.7)
Wow! This rocks! I was getting tired of will_paginate, especially not knowing if at any point the rails3 branch was going to screw up on me. I definitely recommend Kaminari over will_paginate any day! And it's not any harder to implement either......
You can run your selenium tests on a server without a GUI in background by using a virtual frame buffer called Xvfb. There you will find usage information.
Hopefully I helped you. :)
Last night I've done some testing on an Ubuntu installation with the same results. I've modified the Nokogiri part so it will (hopefully) work on both installations. I've used the DocumentFragment class of Nokogiri.
ruby
defsyntax_highlighter(html)
doc = Nokogiri::HTML::DocumentFragment.parse(html)
doc.css("pre[@lang]").each do |pre|
pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])
end
doc.to_s
end
Another great cast. You have an uncanny ability to cover topics as I need them. I got RedCloth going this morning, but upon seeing this cast I will be switching ASAP. Thanks Ryan!
It works fine here, the only difference is I'm using libxml version 2.7.8. Perhaps try updating libxml, I know nokogiri has had issues with some past versions
If I use rails c with Nokogiri::HTML("<p>content</p>").to_s
it will output: "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>content</p></body></html>\n"
I'm using Nokogiri version 1.4.6, maybe it's something with the libraries Nokogiri uses?
When I give the /Library/Ruby/Gems/1.8/bin/nokogiri -v command I get:
That is very strange, it is not behaving this way for me. Maybe it's a different version of Nokogiri, what version are you using? I am using 1.4.6 in the screencast.
I prefer not to add these kinds of abstractions until I need them. Usually if I need to customize the options it will be to add or remove one option which will cause a lot of duplication. I think this kind of abstraction would be better, but too much to show in the episode.
Then you pass true/false options hash to modify the defaults. But the point is there are different ways to abstract this out, and we can't tell the best way without seeing how it needs to be customized.
Thanks for the screencast! When I use your example or the source code Nokogiri inserts HTML headers to the output of the syntax_highlighter method. I've fixed it by modifying the last line of that method.
ruby
defsyntax_highlighter(html)
doc = Nokogiri::HTML(html)
doc.search("//pre[@lang]").each do |pre|
pre.replace Albino.colorize(pre.text.rstrip, pre[:lang])
end
doc.at_css("body").inner_html.to_s
end
Why is it that the output in the screencast is different?
actually I needed to replace FolderRef.tiff, the old one is out of date, for those who use Snow Leopard... and @Ryan all your screencasts are great! :)
I think Ryan just wanted to demonstrate a basic helper so he didn't do it the way you described. Of course, yours is much more flexible than Ryan's version.
Hi Ryan, and thanks fpr the nice 'cast. As I used it everything went well..
But now, I am writing a server API call for the iPhone that will allow a user to log in via their email and password and return the auth_token, in the event that it gets "lost" (ie. new iPhone, app gets un-installed, etc) so that the app can store it in the device for authentication, where we normally pass
I need to "intercept" the Devise hidden controllers to be able to post the remote login call to my server and RETURN the authentication_token as the API response so that it can then be stored in the mobile device and used for subsequent
calls.
I get the layout, but intermittently. Some refreshes don't request the style.css file for some reason. Not sure what's going on--has that happened to you at all Ryan?
Someone know how can I set intersections?
@Kevin you could solve the problem?! I thin that we have the same issue, because when i update the picture, i got a blank screen, it doesnt take me to crop.html.erb. When i refresh that blank screen i got the new updated picture. Could you help me please?
Thanks in advance!
Here's another way to work with Google Maps: jquery-ui-map - a jQuery plugin.
http://code.google.com/p/jquery-ui-map/
I was wondering the same thing. Both look like they are done well but GeoKit seems like its been around a lot longer than Geocoder, but I could be wrong.
What's the difference between Geocoder and GeoKit? I've used GeoKit before and found it very good.
Keep in mind that doing geocode server side is not a best practice.
Google API limit is 2500 req/day (and decrease every year :))
Should be done client side with plugin like this: https://github.com/sgruhier/jquery-addresspicker
ah, ok, yes I see that now, thanks!
Same here, any luck solving the issue?
Not sure why, but I can't get this to work unless I accept an argument in the mass_assignment_authorizer method located in the initializer. If I do it like the below everything works.
def mass_assignment_authorizer(a=nil)
Perhaps this has changed in Rails 3.1.0.rc4..
irb(main):011:0> Rails.version
=> "3.1.0.rc4"
Thanks for this post Ryan.
Mark
FAYE_TOKEN isn't in the source javascript. It's a token used on two backend servers which communicate between each other. The end user never sees, sends or intercepts that communication.
Also this:
http://github.com/trevorturk/pygments
Killer preso, as always. Beyond the obvious stellar info on Resque, the pointer to the pygments syntaxer was a great take-away for me. Thanks, Ryan.
Anyone figure out what this problem is?
I'm running rails 3.0.9, ruby 1.8.7, with passenger.
Kaminari is also SEO-friendly! Add a route like this:
And Rails will automatically rewrite your URLs to be SEO-friendly! Instead of
/products?page=32
, you'll have a nicer URL -/products/page/32
. Because of this, you can also leverage on some page-caching techniques if your index isn't updated frequently.Awesome as usual! Thx. Have you tried deploying your app in production mode under RC4 ? Everything worked exactly the same for me under development but when I switched to production I got this error with web brick:
Processing by ProjectsController#index as HTML
Rendered projects/index.html.erb within layouts/application (24.4ms)
Compiled app/assets/stylesheets/application.css (1ms) (pid 45323)
...
Compiled app/assets/javascripts/projects.js.coffee (116ms) (pid 45323)
Completed 500 Internal Server Error in 377ms
and finally:
ActionView::Template::Error (uninitialized constant JSON::ParserError
(in /opt/nginx/apps/todo/app/assets/javascripts/application.js)):
3:
4: Todo
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8:
9:
app/views/layouts/application.html.erb:6:in
_app_views_layouts_application_html_erb__2079688217135001494_17202399760'
index'app/controllers/projects_controller.rb:7:in
Fantastic intro, we just started using resque and I was going to have to learn it the hard way. But then you show up with a great screencast and now I get to take a long lunch. :)
Thanks Ryan!
No need for lvh.me in development if you are using Pow. It handles subdomains automatically.
Ryan has an example of setting the subdomain to false in the show notes. You can use it like this.
It seems there are workarounds: http://pygments.heroku.com/
Is there a ruby alternative to pigments? Seems strange to use a python library.
I too can verify this problem exists with the code Ryan. The outputted code looks like the following for me.
Using Nokogiri 1.4.6
I'm getting the same error. I hope u still remember how did u overcome with this problem...
Please who can i specify the path for scss files and the related css path for the compiled file ? in rails 3.0.7
How can use sass manualy to generate css files when i was in for exemple in Appcontroller ? which steps should i have to follow to do this with sass (Rails 3.0.7)
Thanks a lot :)
Again, Just awesome, and Just in time.???
Wow! This rocks! I was getting tired of will_paginate, especially not knowing if at any point the rails3 branch was going to screw up on me. I definitely recommend Kaminari over will_paginate any day! And it's not any harder to implement either......
If you are on Windows, the solution for the 'identity' issue its to create a paperclip.rb in the initializers folder and type:
require "paperclip"
Paperclip.options[:command_path] = 'C:\ImageMagick-6.7.0-Q16'
Paperclip.options[:swallow_stderr] = false
Obviously check for the path where you installed the ImgMagick and the version, mine its 6.7.0 and worked fine in a x64 system...
Great screencast. Thanks Ryan.
@Paolo, Heroku can't use pygments.
Hi Jeroen,
You can run your selenium tests on a server without a GUI in background by using a virtual frame buffer called Xvfb. There you will find usage information.
Hopefully I helped you. :)
Botond
Thanks Ryan.
Is it possible to use pygments on Heroku?
Last night I've done some testing on an Ubuntu installation with the same results. I've modified the Nokogiri part so it will (hopefully) work on both installations. I've used the DocumentFragment class of Nokogiri.
I am getting the following error in my log when i try and use
ruby
block...ActionView::TemplateError (No such file or directory - posix_spawnp)
Any ideas why? or how to fix?
:D
Thanks for your screen.
A Markdown TextEditor with markitup and redcarpet ,support rails 3
https://github.com/ZhangHanDong/rails_markitup
Use BCrypt::Password.create() instead of BCrypt::Engine and the library takes care of the salt for you:
http://bcrypt-ruby.rubyforge.org/classes/BCrypt/Password.html#M000007
Another great cast. You have an uncanny ability to cover topics as I need them. I got RedCloth going this morning, but upon seeing this cast I will be switching ASAP. Thanks Ryan!
This last part starts redis in the foreground?
Maybe my Ubuntu config is disagreeable somewhere.
It works fine here, the only difference is I'm using libxml version 2.7.8. Perhaps try updating libxml, I know nokogiri has had issues with some past versions
If I use
rails c
withNokogiri::HTML("<p>content</p>").to_s
it will output:
"<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\" \"http://www.w3.org/TR/REC-html40/loose.dtd\">\n<html><body><p>content</p></body></html>\n"
I'm using Nokogiri version 1.4.6, maybe it's something with the libraries Nokogiri uses?
When I give the
/Library/Ruby/Gems/1.8/bin/nokogiri -v
command I get:Love the 'casts...Thanks, Ryan!
That is very strange, it is not behaving this way for me. Maybe it's a different version of Nokogiri, what version are you using? I am using 1.4.6 in the screencast.
I prefer not to add these kinds of abstractions until I need them. Usually if I need to customize the options it will be to add or remove one option which will cause a lot of duplication. I think this kind of abstraction would be better, but too much to show in the episode.
Then you pass true/false options hash to modify the defaults. But the point is there are different ways to abstract this out, and we can't tell the best way without seeing how it needs to be customized.
Hello Ryan,
Thanks for the screencast! When I use your example or the source code Nokogiri inserts HTML headers to the output of the syntax_highlighter method. I've fixed it by modifying the last line of that method.
Why is it that the output in the screencast is different?
actually I needed to replace FolderRef.tiff, the old one is out of date, for those who use Snow Leopard... and @Ryan all your screencasts are great! :)
@Ainars Same old icon? Not sure if you're referring to how Ryans drawer looks like, but he's using the TextMate MissingDrawer plugin.
Ryan, thanks for the plug. Create episode as always!
Hi Ryan and all,
how can I get in my textmate to show up new folder icon, I've tried everything I still get the same old icon, I'm using TM 1.5.9
I think Ryan just wanted to demonstrate a basic helper so he didn't do it the way you described. Of course, yours is much more flexible than Ryan's version.
How come you didn't do something like this? Was there any reason?
Hi, this was fantastic but when pasting the code to add a question, I get a missing partial error! Taking out the following gets rid of the error??
<%= link_to_add_fields "Add Item", f, :questions %>
Hi Ryan, and thanks fpr the nice 'cast. As I used it everything went well..
But now, I am writing a server API call for the iPhone that will allow a user to log in via their email and password and return the auth_token, in the event that it gets "lost" (ie. new iPhone, app gets un-installed, etc) so that the app can store it in the device for authentication, where we normally pass
www.mydomain.com?auth_token=blah-blah
for all of the authentications on the calls we make
In rails remote API call:
user = User.where(:email => data['email'], :password =>
data['password']).firstuser = User.where(:email =>
data['email'], :password => data['password']).first
I need to "intercept" the Devise hidden controllers to be able to post the remote login call to my server and RETURN the authentication_token as the API response so that it can then be stored in the mobile device and used for subsequent
calls.
Does anybody have any ideas how I might do this?
Thanks,
Bill
I get the layout, but intermittently. Some refreshes don't request the style.css file for some reason. Not sure what's going on--has that happened to you at all Ryan?