Search Results

Search found 34 results on 2 pages for 'macek'.

Page 2/2 | < Previous Page | 1 2 

  • Arbitrary precision arithmetic with Ruby

    - by macek
    How the heck does Ruby do this? Does Jörg or anyone else know what's happening behind the scenes? irb(main):001:0> 999**999 368063488259223267894700840060521865838338232037353204655959621437025609300472231530103873614505175218691345257589896391130393189447969771645832382192366076536631132001776175977932178658703660778465765811830827876982014124022948671975678131724958064427949902810498973271030787716781467419524180040734398996952930832508934116945966120176735120823151959779536852290090377452502236990839453416790640456116471139751546750048602189291028640970574762600185950226138244530187489211615864021135312077912018844630780307462205252807737757672094320692373101032517459518497524015120165166724189816766397247824175394802028228160027100623998873667435799073054618906855460488351426611310634023489044291860510352301912426608488807462312126590206830413782664554260411266378866626653755763627796569082931785645600816236891168141774993267488171702172191072731069216881668294625679492696148976999868715671440874206427212056717373099639711168901197440416590226524192782842896415414611688187391232048327738965820265934093108172054875188246591760877131657895633586576611857277011782497943522945011248430439201297015119468730712364007639373910811953430309476832453230123996750235710787086641070310288725389595138936784715274150426495416196669832679980253436807864187160054589045664027158817958549374490512399055448819148487049363674611664609890030088549591992466360050042566270348330911795487647045949301286614658650071299695652245266080672989921799342509291635330827874264789587306974472327718704306352445925996155619153783913237212716010410294999877569745287353422903443387562746452522860420416689019732913798073773281533570910205207767157128174184873357050830752777900041943256738499067821488421053870869022738698816059810579221002560882999884763252161747566893835178558961142349304466506402373556318707175710866983035313122068321102457824112014969387225476259342872866363550383840720010832906695360553556647545295849966279980830561242960013654529514995113584909050813015198928283202189194615501403435553060147713139766323195743324848047347575473228198492343231496580885057330510949058490527738662697480293583612233134502078182014347192522391449087738579081585795613547198599661273567662441490401862839817822686573112998663038868314974259766039340894024308383451039874674061160538242392803580758232755749310843694194787991556647907091849600704712003371103926967137408125713631396699343733288014254084819379380555174777020843568689927348949484201042595271932630685747613835385434424807024615161848223715989797178155169951121052285149157137697718850449708843330475301440373094611119631361702936342263219382793996895988331701890693689862459020775599439506870005130750427949747071390095256759203426671803377068109744629909769176319526837824364926844730545524646494321826241925107158040561607706364484910978348669388142016838792902926158979355432483611517588605967745393958061959024834251565197963477521095821435651996730128376734574843289089682710350244222290017891280419782767803785277960834729869249991658417000499998999

    Read the article

  • Problem with url_for in ActionMailer template

    - by macek
    I'm attempting to provide a confirmation link in my user welcome email and I'm getting the following Rails error: Need controller and action! It makes a fuss about this line: <p>Please take a moment to activate your account by going to: <%= link_to confirm_user_url(:id => @user.confirmation_code) %>.</p> In my development.rb environment, I have the following line: config.action_mailer.default_url_options = { :host => "localhost", :port => 3000 } There's no problem with the @user variable. I've tested the email with things like @user.username and @user.confirmation_code. I'm only getting trouble with url_for and named routes like confirm_user_url. When I check my routes with rake routes, confirm_user shows up, so it's not an issue with the named route not existing. I can't seem to figure it out. What gives?

    Read the article

  • Test Driven Development (TDD) with Rails

    - by macek
    I am looking for TDD resources that are specific to Rails. I've seen the Rails Guide: The Basics of Creating a Rails Plugin which really spurred my interest in the topic. I have the Agile Development with Rails book and I see there's some testing-related information there. However, it seems like the author takes you through the steps of building the app, then adds testing afterward. This isn't really Test Driven Development. Ideally, I'd like a book on this, but a collection of other tutorials or articles would be great if such a book doesn't exist. Things I'd like to learn: Primary goal: Best Practices Unit testing How to utilize Fixtures Possibly using existing development data in place of fixtures What's the community standard here? Writing tests for plugins Testing with session data User is logged in User can access URL /foo/bar Testing success of sending email Thanks for any help!

    Read the article

  • Calculate sum of objects for each unique object property in Ruby

    - by macek
    I was helping with an answer in this question and it sparked a question of my own. Pie is an object that has a pieces array made of of PiePiece objects. Each PiePiece has a flavor attribute How do I create a hash that looks like this: # flavor => number of pieces { :cherry => 3 :apple => 1 :strawberry => 2 } This works, but I think it could be improved def inventory hash = {} pieces.each do |p| hash[p.flavor] ||= 0 hash[p.flavor] += 1 end hash end Any ideas?

    Read the article

< Previous Page | 1 2