|
You'd probably be a lot happier using d3 rather than anything else.
|
# ? Aug 24, 2013 03:55 |
|
|
# ? May 15, 2024 22:15 |
|
Pardot posted:You'd probably be a lot happier using d3 rather than anything else. Yeah, I was mostly just curious if anything not-terrible existed.
|
# ? Aug 24, 2013 03:56 |
|
prom candy posted:Is it common to write a test for all your relationships and validations? It seems like overkill to me. I like to see them because they are low hanging fruit that ensure the foundation of your app is in place. It only takes a few minutes to add the tests with shoulda matchers. If it was a lot of effort to implement I would agree that it is overkill.
|
# ? Aug 24, 2013 04:07 |
|
I actually test if my classes inherit from ActiveRecord::Base sometimes. You can't have too many tests.
|
# ? Aug 24, 2013 05:54 |
|
xtal posted:You can't have too many tests. Is the amount of time that it takes to run your test suite not a concern?
|
# ? Aug 24, 2013 17:50 |
|
Not as much of a concern as code correctness, that's for sure! Plus use Guard.
|
# ? Aug 24, 2013 19:40 |
|
Like everything else in software engineering, every test has a cost, and you can very well go overboard with tests. With ruby and other dynamically typed languages, I find more useful to focus more on integration tests. In myexperience, they tend to catch bugs earlier than large number of extremely specific unit tests.
|
# ? Aug 24, 2013 20:07 |
|
EAT THE EGGS RICOLA posted:Are there any decent ruby gems for doing decent visualizations, in the form of graphs/charts/maps/anything? I have a bunch of varied datasets that I've been asked to make interesting with, and all of my code that works with the api is ruby-based so I'd like to just carry on with that. There isn't really one. I was working on making one, but haven't fully gemified it yet. Ran out of time. e: this is awful code and you should by no means copy it because it breaks about 20 standard rails conventions, but this makes a pretty nice line chart: https://github.com/talho/epi_full/blob/master/app/views/svg/line.svg.erb
|
# ? Aug 24, 2013 21:48 |
|
What's the ideal way to test Rails 4 concerns? Trying to switch my code base to use them more and they're being really irritating. edit: http://www.dotnetguy.co.uk/post/2012/08/26/rails-rspec-testing-your-modules/ xtal fucked around with this message at 17:40 on Aug 25, 2013 |
# ? Aug 25, 2013 01:59 |
|
kayakyakr posted:For XML use Builder: What am I missing here? This looks like a God-awful way to construct anything. I've seen it recommended in a couple of places, but the API seems horrible, and constructing nested XML is nigh on impossible. Is there a better set of instructions than the minimal examples on the github and rubyforge sites? I guess I assumed that using this would be easier than building up XML as strings in my code, but I'm not seeing that at all.
|
# ? Aug 26, 2013 16:56 |
|
The good thing about libraries like Builder and Nokogiri::XML::Builder is that the structure of the code mirrors the structure of the resulting xml. For example,Ruby code:
XML code:
Smol fucked around with this message at 17:18 on Aug 26, 2013 |
# ? Aug 26, 2013 17:14 |
|
It makes me sad that XML is still so prevalent. Everything about it is so terrible.
|
# ? Aug 26, 2013 17:21 |
|
XML as a whole is too complex. But using a sane subset of it is just fine. Also, at least they managed to standardize validation. Validating JSON in a standardized manner is horrible. Smol fucked around with this message at 17:34 on Aug 26, 2013 |
# ? Aug 26, 2013 17:30 |
|
Smol posted:The good thing about libraries like Builder and Nokogiri::XML::Builder is that the structure of the code mirrors the structure of the resulting xml. For example, Wait, do I have to use Nokogiri with Builder? I'm confused now - I thought they were alternate ways of doing the same things.
|
# ? Aug 26, 2013 17:35 |
|
They're different libraries. Nokogiri is a general purpose XML processing library which offers a Builder-like API for constructing XML documents as well. The big difference between Builder and Nokogiri::XML::Builder is that Nokogiri uses either libxml2 or a similar Java library under the hood, so it should be quite a bit faster.
Smol fucked around with this message at 17:42 on Aug 26, 2013 |
# ? Aug 26, 2013 17:37 |
|
Smol posted:They're different libraries. Nokogiri is a general purpose XML processing library which offers a Builder-like API for constructing XML documents as well. The big difference between Builder and Nokogiri::XML::Builder is that Nokogiri uses either libxml2 or a similar Java library under the hood, so it should be quite a bit faster. Okay, sorry if I'm being dense, but let me back up. I'd like nice libraries to more easily parse and construct XML strings (and if the same gem could do both, that's even better). Someone suggested the Builder gem, but I found it difficult to understand, and nearly impossible to use. I'd like to get a better explanation of how it works, or (if it does just suck) other alternatives. Are you suggesting that Nokogiri is better? Peristalsis fucked around with this message at 17:57 on Aug 26, 2013 |
# ? Aug 26, 2013 17:54 |
|
If I had to choose between the two, I'd use Nokogiri for XML generation. As for it being difficult to understand... I wouldn't call it that. I think they're both very easy to use. But maybe it's a bit more basic thing. Have you used Ruby (or some other language where anonymous functions are considered to be idiomatic) a lot in the past? Perhaps you're familiar with JavaScript? Knowing your background might make it easier to explain how they work. Smol fucked around with this message at 18:21 on Aug 26, 2013 |
# ? Aug 26, 2013 18:15 |
|
Smol posted:If I had to choose between the two, I'd use Nokogiri for XML generation. I've been using Ruby for over 6 months, intermittently with Rails. I like Ruby well enough, but I've always found the documentation to be lacking, at least in organization. For the current problem, I'll see if I can make Nokogiri do what I want, and forget about Builder for now. The main problems I was having with Builder were: 1) When trying things out in irb/Rails console, it appends an extraneous <inspect/> element - not the end of the world, but very distracting when I was trying to play with the tool to figure out what I was doing wrong. 2) I don't see a way to build up an XML string as I go along. I'm trying to model objects with a class hierarchy, and I had hoped to add elements and sub-elements to a single string/builder model as I looped over each collection. I really didn't want to have to make one huge instantiation call with every piece of information in it - keeping track of that would be far worse than building my own, simple xml generation routines in each class. 3) Getting nested elements and attributes to work without escape characters corrupting the end result was much, much harder than it needed to be. Edit: For my background, I've been programming professionally since 1997, but mostly with more traditional tools. I've used VB and Java the most, with some work in Matlab, Perl, C/C++, AREV, and some Pascal and Mumps. There's probably one or two others that I'm not thinking of. I've hacked at some javascript to debug issues at a previous job, but never approached it systematically or anything. Peristalsis fucked around with this message at 18:41 on Aug 26, 2013 |
# ? Aug 26, 2013 18:31 |
|
For building XML responses, you could always use erb. create a view named action.xml.erb and write XML as if you were writing an HTML view. This doesn't work as well if you're trying to send XML to a different webservice
|
# ? Aug 26, 2013 19:07 |
|
kayakyakr posted:This doesn't work as well if you're trying to send XML to a different webservice Why not? I use erb to render to string all the time, including scenarios like that one.
|
# ? Aug 26, 2013 19:09 |
|
xtal posted:I actually test if my classes inherit from ActiveRecord::Base sometimes. You can't have too many tests. This is dumb; you might as well be writing tests to make sure your models respond to Object methods.
|
# ? Aug 26, 2013 19:19 |
|
Novo posted:This is dumb; you might as well be writing tests to make sure your models respond to Object methods. TDD is writing tests first and having them tell you what code to write. Testing your class's inheritance is a perfectly logical starting point and there's literally no downside aside from an extra few milliseconds when you first start your tests.
|
# ? Aug 26, 2013 19:32 |
|
Of course there is a downside. It's another test you have to maintain.
Smol fucked around with this message at 19:54 on Aug 26, 2013 |
# ? Aug 26, 2013 19:50 |
|
Smol posted:Like everything else in software engineering, every test has a cost, and you can very well go overboard with tests. With ruby and other dynamically typed languages, I find more useful to focus more on integration tests. In myexperience, they tend to catch bugs earlier than large number of extremely specific unit tests. I like specific unit tests when I need to know that a method I'm changing still returns the same values for the same inputs. I mean, integration tests are great for finding real bugs, but unit tests are basically what tell me that a method's behavior includes the particular things I need it to. It's really nice when I change something and my left-over unit tests let me know I screwed up, but it seems like the biggest thing they do (for my small, ~4-5k LOC projects) is tell me when I've implemented some component in a way that satisfies my specifications for it. My most recent project was all hosed up when I finally built all the components and ran it as an application, even though each component passed its unit tests and satisfied the specific requirements I laid out. Safe and Secure! fucked around with this message at 20:02 on Aug 26, 2013 |
# ? Aug 26, 2013 19:57 |
|
xtal posted:TDD is writing tests first and having them tell you what code to write. Testing your class's inheritance is a perfectly logical starting point and there's literally no downside aside from an extra few milliseconds when you first start your tests. TDD is driving your development with tests, not writing your code once in test form and once in implementation form. Testing inheritance actively hurts you, because you'll have to fix that test if you change the class's implementation (say, from ActiveRecord to DataMapper or Ripple or a plain old Object that calls methods on other classes). I justify testing associations by using it as a design phase: I mash out association tests, pending tests for features that haven't been implemented, and validations I'll know I want. Then I use the test output as a gauge to know when I'm done.
|
# ? Aug 26, 2013 21:02 |
|
Are there any robust CMS/blogging services currently available that are similar in functionality to Wordpress? I'm really sick of Wordpress becoming more and more clogged up with each release and would love a more open and fluid coding process when I'm building features. Googling turns up some results, but nothing that seems to have a solid userbase/community. Am I stuck with PHP?
|
# ? Aug 28, 2013 18:19 |
|
I have been toying around with locomotiveCMS and it seems OK. Would love some input on it if anyone has used it in production.
|
# ? Aug 28, 2013 18:23 |
|
Cocoa Crispies posted:TDD is driving your development with tests, not writing your code once in test form and once in implementation form. Exactly. If you are defining classes at runtime then testing a parent class is defensible, but testing that "class Foo < Bar" has the desired effect is way outside the scope of what you should be testing, TDD or no.
|
# ? Aug 29, 2013 00:25 |
|
scotty posted:Are there any robust CMS/blogging services currently available that are similar in functionality to Wordpress? I'm really sick of Wordpress becoming more and more clogged up with each release and would love a more open and fluid coding process when I'm building features. Googling turns up some results, but nothing that seems to have a solid userbase/community. Am I stuck with PHP? My company has a semi-open source CMS that we use for our client sites. We'd like to build widespread adoption but at this point the docs aren't there and the code needs some (a lot of) cleanup. It's still functionally complete and pretty nice to work with. PM me if you're interested and I'll set you up, I'd definitely love to get feedback from someone outside our team.
|
# ? Aug 29, 2013 01:43 |
What could cause a 422 error on an AWS deploy but work perfectly fine on my local machine? Submitting an POST through AJAX to update a record. It works fine on my local machine but returns a 422 on the staging server.
|
|
# ? Aug 29, 2013 17:51 |
|
Is there any easy way to do a one time dump from an access DB into my postgres DB?
|
# ? Aug 29, 2013 19:41 |
|
scotty posted:Are there any robust CMS/blogging services currently available that are similar in functionality to Wordpress? I'm really sick of Wordpress becoming more and more clogged up with each release and would love a more open and fluid coding process when I'm building features. Googling turns up some results, but nothing that seems to have a solid userbase/community. Am I stuck with PHP? The only CMSes worth using are Wordpress you don't host and one you've written to match your own particular needs. Every CMS is terrible, but Wordpress is well-supported.
|
# ? Aug 29, 2013 23:08 |
|
Cocoa Crispies posted:The only CMSes worth using are Wordpress you don't host and one you've written to match your own particular needs. Every CMS is terrible, but Wordpress is well-supported. It's not quite a CMS, but I've really enjoyed using Octopress lately.
|
# ? Aug 29, 2013 23:12 |
|
raej posted:Is there any easy way to do a one time dump from an access DB into my postgres DB? It looks like Sequel can maybe connect to Access, but I have no idea. Can you dump your access tables to CSV? If so you could use copy
|
# ? Aug 29, 2013 23:21 |
|
Novo posted:Exactly. If you are defining classes at runtime then testing a parent class is defensible, but testing that "class Foo < Bar" has the desired effect is way outside the scope of what you should be testing, TDD or no. How do you determine what's in scope?
|
# ? Aug 29, 2013 23:35 |
|
Fillerbunny posted:How do you determine what's in scope? I test the methods I've implemented, not the ones Ruby implements. I also don't test things that are implemented by frameworks or libraries I'm using. I set up the preconditions (if necessary), feed my code inputs, and check that the outputs conform to my expectations. I don't test that the implementation was expressed in a particular way, because that's not what tests are for. OOP is supposed to help you separate the "what" from the "how", the interface from the implementation, etc. When I am refactoring part of my implementation, I want my failed tests to tell me "hey, these things stopped working the way they're supposed to!" not "hey, you forgot to subclass FooBarBaz!" Basically, even a clean well-designed OO codebase is full of assumptions, conventions, and other implicit behaviors. Testing should be about making these things explicit so that if you decide to change a class hierarchy or whatever, you have a way of knowing that you still conform. If your test just fails because you did some refactoring (but didn't change the behavior in any way) then it's not useful. Novo fucked around with this message at 00:10 on Aug 30, 2013 |
# ? Aug 30, 2013 00:01 |
|
Fillerbunny posted:How do you determine what's in scope? Isn't this why "behavior driven development" took off? Because test-driven development was a thing, and everyone started letting their tests drive their development, and then people started wondering how much to test, and then some people went "just test behavior!"?
|
# ? Aug 30, 2013 01:30 |
|
Fillerbunny posted:How do you determine what's in scope? Safe and Secure! posted:Isn't this why "behavior driven development" took off? Because test-driven development was a thing, and everyone started letting their tests drive their development, and then people started wondering how much to test, and then some people went "just test behavior!"? Good TDD isn't testing what your poo poo inherits from, it's testing what your poo poo does.
|
# ? Aug 30, 2013 04:08 |
|
Pardot posted:Can you dump your access tables to CSV? If so you could use copy Access can absolutely dump to CSV.
|
# ? Aug 30, 2013 04:08 |
|
|
# ? May 15, 2024 22:15 |
|
Cocoa Crispies posted:TDD and BDD are the same, except saying "BDD" probably means you're using rspec and being very self-congratulatory about it. Hahaha, this is so true and I love it. I use rspec
|
# ? Aug 30, 2013 04:56 |