Re: Do you recommend the book: Web Development with Clojure
On 19/02/14, Erlis Vidal wrote: Hi all, Have any of you read the book *Web Development with Clojure*? http://www.amazon.com/Web-Development-Clojure-Build-Bulletproof/dp/1937785645 There's only one review on amazon, and it's a fantastic review but I'm wondering if this is the book I should read if I wanted to start using Clojure for web programming. Any advice will be greatly appreciated. I'll share my 2c. Before picking the book, I already knew some Clojure, but I hadn't used it for web. The book was a nice overview of some of the popular tools for web development in Clojure. I enjoyed reading it. In a few cases I felt that I needed to write the example code and play with it in order to truly grok what it is about. If you know some Clojure (O'Reilly's Clojure Programming is a great book for that, in my opinion), then it is a perfect follow-up if you're interested in web apps (IMHO). -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: clojure key destructuring motivation
On 18/01/14, Alex Miller wrote: I have some sympathy for this view of things as it was a question I had while learning Clojure as well. The general justification for the current behavior is that the thing being bound is always on the left and the expression defining it is always on the right. That's not really true. For example: (let [{:keys (foo bar)} map] ...) Here it is actually on the right (noting that left and right are very relative in this case). If I were to guess, I would say that the example above is the reason for the design – :keys seem useful more often than naming individual keys. Of course, I'm just guessing. -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to handle configuration in Clojure?
On 14/01/14, James Trunk wrote: I am curious about what you mean by 'thread safety'. Perhaps thread safety is the wrong term, but what I meant was the limitations dynamic binding introduces around thread dispatching, which Stuart Sierra explains in this blog posthttp://stuartsierra.com/2013/03/29/perils-of-dynamic-scope Fair enough. Thanks for the elaboration. -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ Bringing computers into the home won't change either one, but may revitalize the corner saloon. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How to handle configuration in Clojure?
On 13/01/14, James Trunk wrote: The downsides to dynamic vars seem to be: hiddenness, thread safety, and more complex tests (binding before each test). I am curious about what you mean by 'thread safety'. As far as I know, dynamic variables are thread-local, which means that they are thread-safe, at least to some extend. I assume you mean something specific? -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ If a program manipulates a large amount of data, it does so in a small number of ways. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: Good learning resources for Clojure novice but with a long background i programming, both OO and some Fp?
On 10/01/14, christian jacobsen wrote: I have +10 years experience of OO programming (C++, C# and a little Java) and a couple of years of FP programming (mainly F#, some Scala and a little Haskell). Are there any resources for learning Clojure that are particular good for someone with the above background? I strongly suggest you get a copy of the O'Reilly book (Clojure Programming). I have a somewhat similar background and it worked great for me. On one hand, it goes deep enough in the language (at least for me) and on the other it is very well written. I also like The Joy of Clojure. The first edition covered an oldered version and I have no idea about the second. -- Stefan Kanev Ś @skanev Ś http://skanev.com/ Often it is the means that justify the ends: Goals advance technique and technique survives even when goal structures crumble. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How can I improve this?
On 10/01/14, Colin Yates wrote: I have a sequence of file names and I want to make them unique. (uniquify [a b c a]) = [a b c a_1]) This is what I have come up with, but surely there is a better way? What would you all do? Feedback welcome (including the word 'muppet' as I am sure I have missed something simple) :) (defn uniquify Return a sequence, in the same order as s containing every element of s. If s (which is presumed to be a string) occurs more than once then every subsequent occurrence will be made unique. Items will be updated to include an incrementing numeric count using the specified formatter function. The formatter function will be given the name and the number and should return a combination of the two. The set of unique s's in the returned sequence will be the count of s's in s. ([s] (uniquify s (fn [item duplicates] (str item _ duplicates ([s formatter] (let [occurrences (atom {}) register-occurrence (fn [item] (if (get @occurrences item) (swap! (get @occurrences item) inc) (swap! occurrences assoc item (atom 1))) @(get @occurrences item)) process (fn [item] (let [duplicates (dec (register-occurrence item))] (if ( duplicates 0) (formatter item duplicates) item))) unique-s (map process s)] unique-s))) I came up with the following version: (defn uniquify [words] (loop [encountered {} result [] remaining words] (if (seq remaining) (let [word (first remaining) occurences (get encountered word) modified (if occurences (str word _ occurences) word)] (recur (update-in encountered [word] (fnil inc 0)) (conj result modified) (rest remaining))) result))) It is a bit Scheme-ish. It builds a map of number of occurences as it builds a vector, containing the result. It uses the map to figure out whether to add a suffix or not. It preserves the original order of the names. The variable names could use some love, but I don't have the time for it now. If you want a lazy version, some modification is needed. -- Stefan Kanev Ś @skanev Ś http://skanev.com/ Giving up on assembly language was the apple in our Garden of Eden: Languages whose use squanders machine cycles are sinful. The LISP machine now permits LISP programmers to abandon bra and fig-leaf. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How can I improve this?
Somehow I totally forgot I could use destructuring. Here's a slightly shorter version: (defn uniquify [words] (loop [encountered {} result [] [word remaining] words] (if (seq remaining) (let [occurences (get encountered word) modified (if occurences (str word _ occurences) word)] (recur (update-in encountered [word] (fnil inc 0)) (conj result modified) remaining)) result))) -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ You can measure a programmer's perspective by noting his attitude on the continuing vitality of FORTRAN. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: How can I improve this?
On 10/01/14, Laurent PETIT wrote: What about this one? Inspired by Stefan's, with more destructuring in loop, format-fn as a function, initial call to (seq) then (next) instead of (rest), placing the exit argument first so that it's not lost at the end of the function, renamed word as item since this function does not depend on the type of items. (defn uniquify [in format-fn] (loop [[item :as in] (seq in) {n item :as item-nbrs} {} out []] (if-not in out (let [format-fn (if n format-fn (constantly item))] (recur (next in) (update-in item-nbrs [item] (fnil inc 0)) (conj out (format-fn item n))) Yeah, that's better. I like using `if-not` instead of `if` - it puts the base case first, which I find preferable. An adequate format function can be given by defining a single-parameter version of `uniquify`. -- Stefan Kanev ¦ @skanev ¦ http://skanev.com/ Think of all the psychic energy expended in seeking a fundamental distinction between algorithm and program. -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups Clojure group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Lug-bg] OpenFest 2013 - Call For Papers
Здравейте, Тази година отново ще правим OpenFest (11 години от първия). Ще бъде на 2-3 ноември, отново в Интерпред, София. Тази година ще бъдем в три зали и както обикновено, входът е свободен. От името на екипа, каня всички ви да заповядате :) Също така, време е и да поканим желаещите да говорят. Ако искате да представите нещо, може да пуснете заявка на http://openfest.org/call-for-papers/. Очакваме предложенията ви с нетърпение :) Засега сигурен международен гост е Karanbir Singh, project leader на CentOS. Миналата година направихме парти с безплатна бира в RockIt и се получи страхотно! Тази година отново ще има такова, макар мястото все още да не е сигурно. Повече детайли ще има скоро на сайта ни (http://openfest.org/) Заповядайте! Поздрави, Стефан Кънев ___ Lug-bg mailing list Lug-bg@linux-bulgaria.org http://linux-bulgaria.org/mailman/listinfo/lug-bg
Re: [rspec-users] Test execution time filtering
RSpec is built around the premise that each example is run in its own environment, and that one should not depend on the outcome of another. This is not unique to RSpec, btw. It's how all of the unit testing frameworks of which I am aware work. I know I'm going off-topic, but TestNG supports that. You can say that one tests depends on another and use the second one to both set up the fixture and assert behavior. But I don't like it either, since it smells of Fragile Test. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Test execution time filtering
On Wed, Aug 10, 2011 at 2:23 AM, Mike Jr n00s...@comcast.net wrote: But a sophisticated test will make decisions in mid test. If a certain test condition occurs, set a singleton hash and then have later tests condition their processing on that hash. In my tests, these if statements are within the it blocks so that they execute during the second pass. It sure would be less clutter if the describe and it statements supported a filter that is evaluated in the second pass. I am not sure if I understand you, but if I do, conventional wisdom suggests that having if statements in your tests is a very bad idea. You might want to check out this article: http://xunitpatterns.com/Conditional%20Test%20Logic.html ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] ControllerExampleGroup.bypass_rescue
I agree with Lenny. I can give an example. Lets say that parts of the application are restricted. Whenever they are accessed by an unauthorized user, they trigger UnauthorizedAccessError. Depending on the role the user has in the system, different actions should be performed, e.g. unauthenticated users get redirected to the hope page, admins see a special message with more details. The example is a bit synthetic, but I'm sure you can see a similar, real one. In the design I have in mind, the logic that handles the UnauthorizedAccessError is handled in ApplicationController, while the error is raised in some specific controller. If you, in this error-raising path, assert that a non-authenticated user gets redirected to the homepage, you're encoding that behavior in the test. But this behavior is only accidental to the controller under test. This makes the test harder to understand. Worse, if you have multiple actions that raise this exception, you're encoding the knowledge in multiple tests. Now you have duplication too. I think it makes much more sense to assert that UnauthorizedAccessError is raised and specify what happens elsewhere. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Overriding Kernel#inspect just for tests
Hi all. Occasionally, I write specs that verify the order in which some ActiveRecord objects are returned. For example, in a toy project I do: Reply.stub :per_page = 2 topic.replies_on_page(1).should == [second, first] The spec out quickly get unwieldy when it fails: 1) Topic paginates its replies in chronological order Failure/Error: topic.replies_on_page(1).should == [second, first] expected: [#Reply id: 20, topic_id: 21, user_id: 98, body: Body, created_at: 2011-04-07 06:38:34, updated_at: 2011-04-08 06:38:34, #Reply id: 19, topic_id: 21, user_id: 97, body: Body, created_at: 2011-04-06 06:38:34, updated_at: 2011-04-08 06:38:34] got: [#Reply id: 19, topic_id: 21, user_id: 97, body: Body, created_at: 2011-04-06 06:38:34, updated_at: 2011-04-08 06:38:34, #Reply id: 20, topic_id: 21, user_id: 98, body: Body, created_at: 2011-04-07 06:38:34, updated_at: 2011-04-08 06:38:34] (using ==) This is a rather simple example with a simple model. If Topic would have more columns or the list contains more items, it quickly gets very hard to understand the failure. I tried overriding #inpsect in my models, but I'm not sure I like that. Results are a lot better, but now using rails console gets trickier. Is there a way to do this just for RSpec? I found an old thread in rspec-devel [1], but I don't think it ever resulted to something that got merged. [1]: http://old.nabble.com/Better-inspect-method-for-active-record-objects-in-rspec-rails-td20297318.html ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Overriding Kernel#inspect just for tests
Ah, that's clever. Thanks. On Fri, Apr 8, 2011 at 3:43 PM, David Chelimsky dchelim...@gmail.comwrote: On Fri, Apr 8, 2011 at 1:52 AM, Stefan Kanev stefan.ka...@gmail.com wrote: Hi all. Occasionally, I write specs that verify the order in which some ActiveRecord objects are returned. For example, in a toy project I do: Reply.stub :per_page = 2 topic.replies_on_page(1).should == [second, first] The spec out quickly get unwieldy when it fails: 1) Topic paginates its replies in chronological order Failure/Error: topic.replies_on_page(1).should == [second, first] expected: [#Reply id: 20, topic_id: 21, user_id: 98, body: Body, created_at: 2011-04-07 06:38:34, updated_at: 2011-04-08 06:38:34, #Reply id: 19, topic_id: 21, user_id: 97, body: Body, created_at: 2011-04-06 06:38:34, updated_at: 2011-04-08 06:38:34] got: [#Reply id: 19, topic_id: 21, user_id: 97, body: Body, created_at: 2011-04-06 06:38:34, updated_at: 2011-04-08 06:38:34, #Reply id: 20, topic_id: 21, user_id: 98, body: Body, created_at: 2011-04-07 06:38:34, updated_at: 2011-04-08 06:38:34] (using ==) This is a rather simple example with a simple model. If Topic would have more columns or the list contains more items, it quickly gets very hard to understand the failure. I tried overriding #inpsect in my models, but I'm not sure I like that. Results are a lot better, but now using rails console gets trickier. Is there a way to do this just for RSpec? Of course! Remember, this is just Ruby. Put something like this in spec/spec_helper.rb: module InspectModelForRSpec def inspect ... end end ActiveRecord::Base.send(:include, InspectModelForRSpec) Now, as long as the code is not inadvertently loading up spec/spec_helper.rb when running the app or console, you'll only see the result of this when you run specs. HTH, David I found an old thread in rspec-devel [1], but I don't think it ever resulted to something that got merged. [1]: http://old.nabble.com/Better-inspect-method-for-active-record-objects-in-rspec-rails-td20297318.html ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Good practices on spec'ing views?
Thank you for your answers! In The Rspec Book, section 24.6 (chapter 24), When I write view specs offers some tips for determining when to write view specs. Have you read this section? I though I did, but I revisited it and I learned some new things. Thanks! I did some thinking on my own and I reached some conclusions. I would like to share them -- it will help me structure my reasoning. I would be happy to hear what you think. This is going to be long. I'm assuming that I want to use test doubles in view specs. I don't see much value in testing model, view and helper code at once. Also, I'm only checking for the presence of text and occasionally for the presence of a link. I'm not asserting DOM structure or rendering order. There is a big difference between using doubles in controller specs and in view specs. Controllers depend only on the models. Using test doubles in their specs leads you to a nice, clean public interface of the models and only a handful of simple messages in the actions. The code is just a simple moderator. This is what a clean controller should be, in my opinion. Views, on the other hand, know a lot of tiny details about the models. After all, they should if they are to present that information in a humane way. Thus, they are more coupled to the models than controllers. This requires more intricate test doubles. Furthermore, they also invoke helpers to do some of the work. Not only you have to mock them too, but most of the time helpers just take a model and return a result dependent on it. This is tricky to mock (simplest case you make a mock of the model and set an expectation on a helper). That's two problems with test doubles in view specs -- (1) view and model is more tightly coupled and (2) you have helpers as a depend-on component. At this point, getting the test doubles right is too much work. The usual problem that I have, is that as soon as I complete a refactoring in the model, I have to spend an equal (or even greater) effort to fix the doubles in spec failures, that are false negatives. I think I've seen this named 'fragile test'. Thus, my approach would be to avoid writing view specs most of the time and make sure I've provided the safety net with Cucumber. That is my case against view specs. I can see two reasons to write them, though. First, I can consider it as purchasing technical debt. I write a view spec instead of a Cucumber scenario for a small behavior modification. This gives me the safety net for a lower price (view specs take considerably less time), but the cost is that it hinders refactoring. Second, if I have something complex to display and no idea now to organize it, I can use a view spec to drive the design. This let's me base it on feedback, but when I've implemented the functionality back-to-back, the view spec has turned into an expensive artifact that hinders further refactoring. I've done that a few times -- it really helps me with the design, but I find myself removing the spec after a while since it takes just too much time to maintain. I also see two things that might invalidate this reasoning. First, presenters. They group the model and helpers logic that the view depends on, so now I would have to mock only one object. More importantly, that object is specifically designed to be used by the view, which means that the test double will be simple and that I can use the view spec to drive the design of the presenter. Second, moving all logic from the view to helpers that take the model as a parameter. This should simplify the test doubles, although you still will have to set expectations on helper invocations. This moves the intricate knowledge of the models in the helpers, which are easier to test. The view mediates models and helpers. I'm not sure if I like the resulting design. While the views look slick, you have to understand the helpers first in order to understand the view. Logic that belongs together is scattered around in multiple files, intermingled with other logic. Also, at this point I don't see much reason to write a view spec either, since the code that could possibly break is either in models or helpers, which are tested in isolation. If you insist on doing it, setting up test doubles is still a bit weird (you have to set expectations and define results on helpers and you have to use mocks for models). It gets particularly tricky when the view iterates over a collection and calls a few helpers with each item. On the more general note, while controllers are pretty OO in they nature and thus can tolerate test doubles, views are, well, just procedural Ruby embedded in HTML. Applying mocks to them doesn't seem a good fit to me. So, what do you think? Does this make sense? Did I miss anything? ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Good practices on spec'ing views?
Hey guys. I've been doing RSpec for more than a year by now, yet I cannot help but feel that I've never got a single view spec right. I can see that I have very few view specs and that my views tend be a lot messier than everything else. I've read the chapter in the RSpec book about spec'ing views, but I still think I'm not getting it right. Assuming that I'm a view spec noob, would you guys care to share your experience with writing them? What works and what doesn't? What should I avoid at all cost? And most importantly, how does the process of writing view specs feel? Thanks, Stefan ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] Disabling database access in controller specs
It took a while, but now I an totally convinced that controller specs should not access the database and stub as much as possible. I'm committed to that style of writing, yet from time to time I incidentally allow it to happen. Is there a way to err on the safe side and have RSpec throw an error every time a controller spec attempts to access the database? And does it sound like a good idea? Thanks, Stefan ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
[rspec-users] spec'ing controllers
Hey guys. I switched completely to RSpec and Cucumber this spring and I am really happy with. While I think I've gotten quite good with it, I'm not sure I understand the value of spec'ing controllers (in Rails). I would appreciate if you can give me some suggestions. Let me elaborate: The RSpec book suggests mocking models and not integrating vies controller specs. Following that, I usually end up with something like this: http://gist.github.com/257946 I see a few benefits: - It helps keeping the controllers simple. For example, while writing that spec I discovered that Topic should have #update_topic_hits (as opposed to inlining it there). That improved the design. - When mocking gets tricky, I treat this as a code smell and start refactoring. Usually it works out well. - Specs are faster. Remembering how much time it took to run the functional tests on an old project, I can really appreciate that. - Small changes in models (or views) don't result in broken controller specs. It took some time, but I can see it now. However, I still don't feel too confident about the way I'm doing it. Some of my worries: - It feels like lots and lots of code. I'm normally at 2:1 test:code, but it feels I'm overdoing it. *feels* is the key word here -- I might be worrying too much. - I have a similar spec for each RESTful controller. Looks like duplication, but I'm not sure what to do about it - Often the specs are passing when the code is broken (due to the mocks). While Cucumber catches those errors for me, I'm not sure if they shouldn't be in the specs in some way. - It's a lot of effort. Eventually ones gets used to it, but I can't decide whether it pays of or not. Can you validate (or invalidate) my reasoning? It will be very nice to hear a comment from more experienced rspec users. Comments on the the spec I posted would be appreciated too, of course. Thanks very much, Stefan ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Re: [rspec-users] Where to put macros
On Mon, Jun 22, 2009 at 7:37 PM, David Chelimsky dchelim...@gmail.comwrote: On Mon, Jun 22, 2009 at 11:28 AM, Andrew Premdasaprem...@gmail.com wrote:What would folks think if that was included in the generated spec_helper in spec-rails? I, while not a regular patron in this mailing list, +1 this too. It would be very nice if the autogenerated Rails files specify a conventional place to put macros/matchers. I would have a lot lower psychological barrier to adding few of those in my Rails applications. ___ rspec-users mailing list rspec-users@rubyforge.org http://rubyforge.org/mailman/listinfo/rspec-users
Profiling the memory usage
Hi. I'm doubting that my wicket application is using to much memory because of serializing too much unnecessary stuff in the session (programmers' mistakes). Can you help me find a way to see what objects get serialized, so I can see what I'm doing wrong and correct my mistakes? Thanks in advance. /Stefan
[jira] Commented: (WICKET-695) Border.resolve() should not attempt to render contents if bodyVisible is false
[ https://issues.apache.org/jira/browse/WICKET-695?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12510137 ] Stefan Kanev commented on WICKET-695: - Where does the following method come from: Border border = findBorder(); I cannot find it... Border.resolve() should not attempt to render contents if bodyVisible is false -- Key: WICKET-695 URL: https://issues.apache.org/jira/browse/WICKET-695 Project: Wicket Issue Type: Bug Components: wicket Affects Versions: 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3 Reporter: Stefan Kanev Assignee: Juergen Donnerstag Priority: Minor Border.resolve() should not attempt to render its nested components if setBorderBodyVisible(false) has been called. This way the behavior would be similar to Component.setVisible() - when the contents are not visible, wicket would not raise an exception if there are no corresponding components for the border's markup. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[jira] Created: (WICKET-695) Border.resolve() should not attempt to render contents if bodyVisible is false
Border.resolve() should not attempt to render contents if bodyVisible is false -- Key: WICKET-695 URL: https://issues.apache.org/jira/browse/WICKET-695 Project: Wicket Issue Type: Bug Components: wicket Affects Versions: 1.3.0-beta1, 1.3.0-beta2, 1.3.0-beta3 Reporter: Stefan Kanev Priority: Minor Border.resolve() should not attempt to render its nested components if setBorderBodyVisible(false) has been called. This way the behavior would be similar to Component.setVisible() - when the contents are not visible, wicket would not raise an exception if there are no corresponding components for the border's markup. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
[Wicket-user] Foldable border
Hello. I'm trying to create a foldable box component - not unlike the quick contacts and labels boxes in gmail. I want to render some markup around a border's contents - particulary, an open/close link. So far, I've made it toggle the value of Border.setBorderBodyVisible() and it works fine. But. I also want to skip the loading of the contents of borders, that are initially rendered closed. I though the deal would be to just borderBodyVisible to false and not to put any components in it at all, but unfortunatelly wicket raises an exception that components with coresponding names cannot be found in the hierarchy. This was not the behavior I was expecting, since after Component.setVisible(false) it doesn't check the markup for matching components. Can anyone help me resolve this issue? I'm using wicket 1.3, if it matters. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Foldable panels
Hello. I'm trying to achieve the following effect using Wicket 1.3. I want to have a component (let's dub it widget), that draws a thin border around its contents and makes it possible to fold and unfold it (pretty much like the Quick Contacts and Labels in GMail. In the perfect scenario, I would like each Widget subsclass to have it's own markup (like a Panel) and add them in the parent container as div wicket:id=widget/div. I'm failing to come up with a clean concept how to do it, though. I tried to Make it a panel that adds a border in itself, and then add everything within that border with Widget.addComponent() instead of Component.add(), but I fail to see how to show/hide the components - I guess I should add a MarkupContainer within the border and add the stuff there, but then I should reference that container withing the Widget markup too, so it should start with div wicket:id=borderdiv wicket:id=container.../div/div. Has anyone experienced the need to do that and do you have any suggestions how to make it? I would appreciate some help a lot. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[jira] Updated: (WICKET-338) DateTextField
[ https://issues.apache.org/jira/browse/WICKET-338?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stefan Kanev updated WICKET-338: Attachment: DateTextField.java The DateTextField itself. DateTextField - Key: WICKET-338 URL: https://issues.apache.org/jira/browse/WICKET-338 Project: Wicket Issue Type: New Feature Components: wicket-extensions Reporter: Stefan Kanev Priority: Minor Attachments: DateTextField.java This issue was created to allow the DateTextField into the ASF license. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.
Re: [Wicket-user] new initiative for a user guide
I'm not really sure why you're giving me that JPA hype, as I already said I'm a big fond of using it and my motivations for evading it are different. But since Justin Lee gave me that repository, I think I can pull it out greatly. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] new initiative for a user guide
I'm a big fan of JPA myself, but a JPA application is not easy to distribute since the akward policy Sun has for their enterprise jars. Thus I cannot create an application that is as easily runned localy as mvn jetty:run - I'm having the same problem with the commercial projects I'm doing and with a small JPA test fixtures API I've been trying to put up and I'm pretty much sick of it. I think it is a better idea to use hibernate (if use any persistence at all) than to sacrifice the easiness of the sample application portability. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] new initiative for a user guide
Does the same go for Hibernate? Maybe create an in-memory domain model, that doesn't persist in any kind and use it instead? This would simplify the sample application and put the focus to Wicket instead. It might be especially useful to people, who are not familiar with Spring and Hibernate. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] AjaxSubmitButton don't working with button
I found out that AjaxSubmitButton is not working with button html tags. I didn't see a reason why not to allow that, so I tried to create a patch, but I failed miserably. Can anyone please look into it, or at least give me a hint what I'm doing wrong with my patch. I'm trying to put this chunk of code: protected void onComponentTag(ComponentTag tag) { final String tagName = tag.getName().toLowerCase(); if (!(tagName.equals(input) || tagName.equals(button))) { findMarkupStream().throwMarkupException( Component + getId() + must be applied to a tag of type + 'input' or 'button', not + tag.toUserDebugString()); } final String type = tag.getAttributes().getString(type); if (!button.equals(type) !image.equals(type) !submit.equals(type)) { findMarkupStream().throwMarkupException( Component + getId() + must be applied to a tag with 'type' + attribute matching 'submit', 'button' or 'image', not ' + type + '); } super.onComponentTag(tag); } It fails when I try to use the following markup: button wicket:id=contactButtonSave type=submitwicket:message key=manageContacts.save[Save]/wicket:message/button And the exception: 14:59:29.243 ERROR! [SocketListener0-1] wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:379) 24 Error while responding to an AJAX request: [EMAIL PROTECTED] markupIdToComponent [{createFormContainer=[MarkupContainer [Component id = createFormContainer, page = com.agent25.rebirth.web.pages.ManageContacts, path = 2:createFormContainer.WebMarkupContainer, isVisible = true, isVersioned = false]]}], prependJavascript [[]], appendJavascript [[]] wicket.markup.MarkupException: Expected close tag for button type=submit wicket:id=contactButtonSave onclick=var wcall=wicketSubmitFormById('createFormContainer_saveContact', '/web/app?wicket:interface=wicket-2:2:createFormContainer:saveContact:contactButtonSave:-1:IUnversionedBehaviorListenerwicket:behaviorId=0wicket:ignoreIfNotActive=true', null, function() { }, function() { });;; return false; id=createFormContainer_saveContact_contactButtonSave [markup = file:/home/aquarius/dev/workspace/web/target/classes/com/agent25/rebirth/web/pages/ManageContacts.html, index = 107, current = 'wicket:message key=manageContacts.save' (line 68, column 62)] at wicket.markup.MarkupStream.throwMarkupException(MarkupStream.java:290) at wicket.Component.renderClosingComponentTag(Component.java:2965) at wicket.Component.renderComponent(Component.java:1705) at wicket.markup.html.WebComponent.onRender(WebComponent.java:61) at wicket.Component.render(Component.java:1533) at wicket.MarkupContainer.renderNext(MarkupContainer.java:1334) at wicket.MarkupContainer.renderComponentTagBody(MarkupContainer.java:982) at wicket.MarkupContainer.onComponentTagBody(MarkupContainer.java:917) at wicket.markup.html.form.Form.onComponentTagBody(Form.java:773) at wicket.Component.renderComponent(Component.java:1697) at wicket.MarkupContainer.onRender(MarkupContainer.java:927) I would be grateful if someone can hint me on it. I understand what the exception means, but I don't get why it is thrown, since button has a close tag. Thanks in advance. - Stefan - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] new initiative for a user guide
I'm thinking with starting from a user guide to a sample app and then continuing with a reference guide. I would like to start simple, and if I see I can handle it, I'll start writing a reference manual - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] AjaxSubmitButton don't working with button
Sorry, was very sleepy - a stupid mistake. I will send my bugfix within few hours. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] new initiative for a user guide
Maybe I didn't express myself cleary, sorry. JPA is very cool and all, but it requires jars that you have to download from Sun, because they aren't distributed freely (thus ibiblio.org). This is a major problem with Maven, since this is what Maven does - gets the publicly available jars for you, so the only thing you have to do to build and run a project is mvn package or mvn jetty:run. Now, I don't say JPA is evil because of that. I'm currently working on a project that is heavy-JPA and I too feel that it is one of the coolest three-letter acronyms in Java. But it would hinder the redistributabily and availability of the demo application - you'll have to download the jars yourself and manually install it in Maven's repository (and that sucks bit time). So for this reason, I prefer to avoid it - it is hadly central for the project itself, and that is why I even prefer to use a mocked-up model and not a big framework that does some persisting. On the other hand, it is important to show how Wicket works with domain models, not just how it handles web page rendering and request processing. I've went through three pases on how domain interaction should be split around my components and models in the aforemented project and each of them could have been avoided if I had a good seperation between the two concepts before that. So for this reason, it would be cool to have Spring and Hibernate, since they influence building a web app a lot. So I'm not really sure which way to go. And let me add something for my previous email, since it's too vague - it would be a How to build a pet store with wicket guide. I think it is good to start with something small and that will produce something useful even if left unfinished (at least a demo application and maybe a guide how to do it). But I also want to write a reference manual and I actually started with this idea. One thing I'm lack is a Table of Contents, though, since I have no idea of how to categorize everything in Wicket. If anyone has an idea and feels that it is worth it, please do send your thoughs - I will eventually start writing a reference manual too. - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] new initiative for a user guide
Oh, cool. So I might use JPA after all. Is it freely available and is there a change that you might suddenly stop supporting it (I have another projects that would be good to dedirect here). - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] AjaxSubmitButton don't working with button
I'm not sure it is a good solution, but I've made AjaxSubmitButton inherit from WebMarkupComoponent to allow buttonFoo/button. I've also expanded the tag name check to allow button. Works for me now. Submitting the change as a patch. Index: . === --- . (revision 7574) +++ . (working copy) @@ -22,7 +22,7 @@ import wicket.ajax.IAjaxCallDecorator; import wicket.ajax.form.AjaxFormSubmitBehavior; import wicket.markup.ComponentTag; -import wicket.markup.html.WebComponent; +import wicket.markup.html.WebMarkupContainer; import wicket.markup.html.form.Button; import wicket.markup.html.form.Form; import wicket.util.string.AppendingStringBuffer; @@ -36,7 +36,7 @@ * * @author Igor Vaynberg (ivaynberg) */ -public abstract class AjaxSubmitButton extends WebComponent +public abstract class AjaxSubmitButton extends WebMarkupContainer { private static final long serialVersionUID = 1L; @@ -94,7 +94,14 @@ protected void onComponentTag(ComponentTag tag) { - checkComponentTag(tag, input); + String tagName = tag.getName(); + + if (!(input.equalsIgnoreCase(tagName) || (button.equalsIgnoreCase(tagName + { + findMarkupStream().throwMarkupException( + Component + getId() + must be applied to a tag of type 'button' + + or 'input', not + tag.toUserDebugString()); + } final String type = tag.getAttributes().getString(type); if (!button.equals(type) !image.equals(type) !submit.equals(type)) - Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] A Reorderer component
No, I don't depend on any external libs, but some polishing is definatelly needed. The .js is well done (not tested in Safari yet, would be grateful if someone can try it), but I think the wicket code can be done better (although I don't have an idea how). I was hoping that any of you guys can take a look and give me some hints, before contributing. - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] A Reorderer component
Hey to all.I just finished a draft version of a small ajax component that allows the user to change the order of elements in a list. I'm doing an application that requires such functionality in a number of places and so I decided to pack it out as a seperate component and send it to the mailing list. You can see a schreenshot on the following address: http://spider.bg/~aquarius/dl/reorderer.jpgIt's just a picture, so if you want to see everything in action, you can download get a sample from here: http://spider.bg/~aquarius/dl/reorderer-demo.tar.gzA simple mvn jetty:run should be able to run it directly.Is anyone interested in this in any way? - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Sortable DataTable with AJAX
Hi. Is there a quick way to implement the sorting of the DataTable with AJAX, or should I go rewriting everything from the OrderByLink to the HeadersToolbar? ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Sortable DataTable with AJAX
I don't see an AJAX sortable example with the DataTable component (Wicket extensions). Can you point me to it, if I have missed it, please? ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[m2.0.4] Javadoc aggregate problems with multiple modules projects
Hi all. Setting aggregate to true for the javadoc plugin doesn't seem to work for me, in a multiple-module build. I won't paste error message, because they are just too large, but it tells me that it can't find some classes (from external dependencies) that it succesfully finds when I'm building the project. After that, I get a lot of java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl exceptions and duh. The problem disappears when I move those dependencies from the dependencyManagement to the dependencies tag in the code. It leads me to think, that the javadoc plugin ignores the dependencies in dependencyManagement. I read somewhere (I don't remember where) that this is currently fixed in the CVS for maven-javadoc-plugin, but a fresh checkout produces the same error. Ideas, anyone?
[Wicket-user] A ListView with no items
Hi. I want to be able to display easily a ListView with no items. There are two things that bother me, thought. First, I would like to dipslay a message You have no foo's in the place of the list. And second, how do I drop the ul, given that my code is like this: ul li wicket:id=foos span wicket:id=name[Name]/span span wicket:id=stuff[OtherStuff/span /li /ul --- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnkkid0709bid3057dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Re: UML diagram?
I sketched a small diagram of the components hierarchy of Wicket. Grayed classes are final. It is compact enough to be printable (and readable) on A4. Here it is: http://spider.bg/~aquarius/dl/Wicket%20Components%200.1.png
Re: [Wicket-user] UML diagram?
Actually, I meant which classes should I put there? I cannot put everything, since (1) it is too much and (2) won't be that helpful if it has a lot of stuff. :DStefan
[Wicket-user] UML diagram?
HiDon't you think that an UML diagram for the basic objects in wicket would be useful for newbies to the frameworks (shows the complete) picture and for all users, where it can serve as a quick reference. Since such a diagram is not present, I'm willing to put up one. What do you think should be included in it? Stefan
Re: [Wicket-user] call for i18n contributions
This is a translation in Bulgarian, I hope that GMail sends as UTF-8. And I do hope it will be useful to somebody.Application_bg.propertiesRequiredValidator=Полето '${label}' е задължително.TypeValidator='${input}' не е валиден ${type}. NumberValidator.range=${input} трябва да бъде между ${minimum} и ${maximum}.NumberValidator.minimum='${input}' трябва да бъде повече от ${minimum}.NumberValidator.maximum='${input}' трябва да бъде по-малко от ${maximum}. StringValidator.range='${input}' трябва да бъде между ${minimum} и ${maximum} символа.StringValidator.minimum='${input}' трябва да бъде поне ${mimimum} символа.StringValidator.maximum='${input}' трябва да бъде най-много ${maximum} символа. DateValidator.range='${input}' трябва да бъде между ${minimum} и ${maximum}.DateValidator.minimum='${input}' трябва да бъде след ${minimum}.DateValidator.maximum='${input}' трябва да бъде преди ${maximum}. PatternValidator='${input}' не съвпада с шаблона '${pattern}'EmailAddressPatternValidator='${input}' не е валиден email адрес.EqualInputValidator='${input0}' от ${label0} и '${input1}' от ${label1} трябва да бъдат еднакви. EqualPasswordInputValidator=${label0} и ${label1} трябва да съвпадат.null=Изберете едно.nullValid=