header image

Archive for the 'Ruby' Category

Cheap prozac

Monday, April 27th, 2009

nice_ass.png

While I know the title is both asking for trouble (because of the now anecdotal original article with a similar title) and flamebaity, cheap prozac, please read on - my goal is not to get some great stats but rather to know your opinion about the situation and discuss the possible solutions of the problem.

How it all started…

I would not like to re-iterate what has been said on several blogs, cheap prozac, just to summarize: Matt Aimonetti, cheap prozac, member of the Rails Activists, cheap prozac, gave a presentation at GoGaRuCo which contained sexually explicit images (according to some - I am not here to judge whether that’s true, cheap prozac, and it doesn’t matter anyway, cheap prozac, as you’ll see in the rest of the post).

I am not really discussing whether it’s appropriate to have images of nude chicks in your presentation at a Ruby conference (I think it’s not, cheap prozac, it’s unprofessional etc. Cheap prozac, - but that would be a matter of a different post Update: Someone summed this up in the article’s reddit thread nicely: If you’re a Rails programmer, cheap prozac, or a Ruby programmer, cheap prozac, and you don’t decry this sort of thing, cheap prozac, you have no business calling yourself a professional. Cheap prozac, It doesn’t matter how large your website is, cheap prozac, how easy it was to write, cheap prozac, how much better it is over PHP or ASP.NET or J2EE; by definition, cheap prozac, you do not belong to a professional community. Cheap prozac, That’s all there is to it. It’s incumbent on every Ruby programmer to either reject this sort of misogynistic sewage, cheap prozac, or accept that you’re never going to advance the promotion of Rails in the public perception because members of the community still think it’s edgy or cool to put pictures of strippers in their public presentations. And here’s a hint: if your decided reaction is to talk about how unimportant this is, cheap prozac, how much it doesn’t matter, cheap prozac, or how much it doesn’t offend you personally, cheap prozac, you probably don’t understand professionalism at all.) because sadly, cheap prozac, I think there are far bigger problems here than that - shedding light on them is the real purpose of the article, cheap prozac, not talking about pr0n at GoGaRuCo again.

Would You Walk Into a Hindu Temple with Your Shoes on?

hindu_temple.pngI have been living in India for 2 months last summer, cheap prozac, working on a Rails startup. Cheap prozac, Maybe I am odd or something, cheap prozac, but I knew that I had to remove my shoes when entering a Hindu temple, cheap prozac, and no one had to convince me (what’s more, cheap prozac, I didn’t even think about it for a second) wether this is the right thing to do, cheap prozac, why is it so, cheap prozac, whether I should do otherwise etc. Cheap prozac, This is a similar situation - I just don’t do X when speaking at a conference, cheap prozac, if I suspect that X makes feel even one person in the room uncomfortable, cheap prozac, whether because of his gender, cheap prozac, race, cheap prozac, nationality, cheap prozac, Ruby/Rails skills, cheap prozac, penis size or what have you - regardless whether I think it’s fine for me, cheap prozac, my wife, cheap prozac, for other members of the community and/or the majority of the room. Cheap prozac,

The trick is, cheap prozac, how does a hindu feel when I enter a temple in footwear (even if that is perfectly acceptable in my country, cheap prozac, culture, cheap prozac, family, cheap prozac, friends) - it’s perfectly irrelevant how do I feel in the given situation. Cheap prozac, Using the previous paragraph, cheap prozac, try to apply this to a Ruby/Rails conference.

Shit happens…

Until this point in the story, cheap prozac, I see no problem at all, cheap prozac, and could even agree with the guys asking “what’s wrong with you, cheap prozac, don’t make a fuss out of nothing” - the pictures Matt used are non-problematic in my book, cheap prozac, and he had no idea they are problematic in anyone’s book - theoretically it could have worked, cheap prozac, but the point is, cheap prozac, it did not. Cheap prozac, Some members of the Ruby community got offended, cheap prozac, and here our story begins.

…and hits the fan

One of the real problems is that after this has been pointed out, cheap prozac, Matt still keeps answering “As mentioned many times earlier, cheap prozac, I don’t think my presentation is inappropriate.”. Cheap prozac, As I mentioned two paragraph above, cheap prozac, it doesn’t matter what do you think, cheap prozac, unless of course, cheap prozac, you don’t care about offending some members of the community. Cheap prozac, In that case you should not try to apologize at all. Cheap prozac, However, cheap prozac, if you are trying, cheap prozac, reciting “I don’t think my presentation is inappropriate” will not put and end to the discussion. Cheap prozac, It just doesn’t work. Cheap prozac, Why can’t you just simply apologize, cheap prozac, admitting that this was a bad move (because it offended some, cheap prozac, not because porn, cheap prozac, sexual images or whatever in presentations are bad, cheap prozac, per se) and finish the discussion?

Rails is Still a Ghetto

However, cheap prozac, in my opinion that’s still not the worst part of the story, cheap prozac, or to put it differently, cheap prozac, some members of the Rails community still found a way to make things worse, cheap prozac, by applauding to all this:

dhh_pr0n_is_great.png

OK, cheap prozac, you say, cheap prozac, we are all used to DHH’s style, cheap prozac, this is just how the guy is. Cheap prozac, That’s (kind of) cool, cheap prozac, but I heard that most of the Rails core team (and obviously Matt himself) has the same opinion - and that’s a much more serious problem, cheap prozac, because it means that a Rails activist, cheap prozac, backed by DHH and other Rails core members finds all this OK, cheap prozac, despite of the fact that numerous people in the community voiced their opinion otherwise.

This is not about being a closed-minded prude, cheap prozac, shouting for police and suing everyone using sexually explicit images in a presentation. Cheap prozac, This is not even about women, cheap prozac, as I have seen both males and females on either side of the fence. Cheap prozac, This is about mutual respect - I don’t agree with you, cheap prozac, but respect your feelings. Cheap prozac, Or not, cheap prozac, as demonstrated in this case.

So Rails continues to be the most socially unacceptable framework - associated with arrogance, cheap prozac, elitism and whatnot in the past - now add pr0n images in presentations. Cheap prozac, Thankfully RailsConf is held in Las Vegas, cheap prozac, and that should calm down all the people who associate Rails with all this crap :-). Cheap prozac, The real problem is that people associate you with the tools you are using - think Cobol, cheap prozac, PHP, cheap prozac, Java… Cheap prozac, or Rails. Cheap prozac, By being part of the Rails community people associate me with Railsy stereotypes automatically, cheap prozac, which aren’t nice at all right now.

I hear you, cheap prozac, dear creme-de-la-creme Rails (core) member, cheap prozac, I know you don’t give a shit, cheap prozac, and you think this is all prude babbling - because your hourly rate is more than some of us earn in a day, cheap prozac, and you’ll be sought after even if Rails will have a much worse image than it has now. Cheap prozac, But 99.9% of us are not in the ‘circle of trust’ and would be happier if Rails would not be constantly associated with a ghetto.

MINASWUBN

In case you are wondering what does the acronym stand for, cheap prozac, it’s “Matz is Nice And So We Used to Be Nice”. Cheap prozac, Unfortunately, cheap prozac, the stuff I don’t like about the Rails community is sneaking into Ruby too, cheap prozac, it seems, cheap prozac, as the above case demonstrates. Cheap prozac, Besides this, cheap prozac, the count of aggressive comments and reactions on various blog posts is really disturbing to me. Cheap prozac, Please (at least Rubyists) try to avoid being contaminated by all this shit and stop thinking you are cool because you can swear on a forum (always in anonymity). Cheap prozac, You don’t have to be a douchebag just because you are a Rubyist / Rails coder, cheap prozac, as surprising as this might sound to some.

Conclusion

I think “incidents” like this and getting more and more antisocial members are inevitable by-products of growth in a community. Cheap prozac, The questions is, cheap prozac, whether, cheap prozac, and if, cheap prozac, how, cheap prozac, do we stop them. Cheap prozac, The problem is that it seems to me the Rails “top management” doesn’t want to stop them (what’s more, cheap prozac, even encourages them) in the first place (please prove me otherwise - maybe I don’t see the full story - I’ll be the happiest to admit that I am talking bullshit).

I have to admit I have no clue what would be the right move - burying our heads in the sand and pretending everything is fine is not. Cheap prozac, Please leave a comment if you have an idea or anything to add.

Similar Posts:cheapest zoloft,cheap prozac,buy zoloft without prescription,ultram,generic alprazolam

Cheapest cialis

Thursday, November 13th, 2008

rails_rumble.png In part I I wrote about the hows and whys of gathering gem/plugin usage data based on Rails Rumble submitted user information, cheapest cialis, and in this part I would like to present my findings. Cheapest cialis, So without further ado, cheapest cialis, here we go:

Prototype/jQuery

I already covered this in part I, cheapest cialis, but for completeness’ sake, cheapest cialis, here is the chart again:

prototype_jquery.png
It seems that jQuery is (not so) slowly replacing Prototype as the javascript framework of Rails - which is still better (from the Prototype POV) than with Merb, cheapest cialis, where jQuery is the default framework (oh yeah, cheapest cialis, I know, cheapest cialis, Merb is everything-agnostic etc. Cheapest cialis, etc. Cheapest cialis, but I think vast majority of merbists are using Datamapper, cheapest cialis, jQuery etc. Cheapest cialis, (?)).

Skeleton Applications

Well… Cheapest cialis, this chart is rather dull:

bort.png

One in every three teams used a skeleton application (which in this context can be replaced with ‘Bort’). Cheapest cialis, The sovereignity of Bort is a bit surprising given that it’s not the only player in the field by far - there are definitely others, cheapest cialis, like ThoughtBot’s suspenders, cheapest cialis, Blank by James Golick, cheapest cialis, starter-app by Pat Maddox, cheapest cialis, appstarter by Lattice Purple just to name a few.

I am not sure about the others, cheapest cialis, but the absence of suspenders from the chart has more to do with the fact that it was not yet publicly released before Rails Rumble - I am basing this claim on the fact that a lot of people used the gems/plugins which, cheapest cialis, combined together, cheapest cialis, are basically suspenders.

However, cheapest cialis, this doesn’t alter the fact that Bort is immensely popular - great stuff, cheapest cialis, Jim.

Testing Frameworks

I think there are (at least) 2 things to note here:

  1. Testing in Ruby/Rails is not considered optional even facing a very tight deadline. Cheapest cialis, Even if we assume that the 49% didn’t test at all (which surely doesn’t sound too realistic - they probably just went with Test::Unit), cheapest cialis, more than half of the teams did!
  2. Though testing tools are a much debated topic nowadays, cheapest cialis, and the winner is not clear (yet) - I would guess, cheapest cialis, based on the above results there is roughly an 1:1:1 ration between Test::Unit, cheapest cialis, rspec and shoulda *currently* - there are definitely interesting alternatives to Test::Unit.

testins.png

Mocking

mocking.png
Not much to add here - though the above chart says nothing about how much people are using e.g. Cheapest cialis, Mocha with rSpec (vs. Cheapest cialis, using the rSpec built-in mocking tools), cheapest cialis, one thing is clear - as a stand-alone mocking framework, cheapest cialis, Mocha reigns supreme.

Exception Notification

ex_notification.png
Another point for ThoughtBot (not the last one in this list) - Hoptoad has no disadvantage compared to the more traditional Exception Notifier (if we don’t count getting an API-key, cheapest cialis, which takes about a minute) - on the upside, cheapest cialis, you get a beautiful and user friendly web GUI.

Full-text Search

full_text.png
I found the above chart interesting for two reasons:

  1. I thought that Ferret and/or acts_as_solr are still somewhat popular - it turns out they are not
  2. I also thought Thinking Sphinx is the de-facto fulltext search plugin, cheapest cialis, and didn’t know about Xapian - well, cheapest cialis, I learned something new again.

Uploading

uploading.png
ThoughtBot did it again - Paperclip is already more popular than the old-school attachment-fu. Cheapest cialis, I am always a bit cautious when someone challenges the status quo (like Nokogiri vs. Cheapest cialis, Hpricot, cheapest cialis, Authlogic vs. Cheapest cialis, Restful Authentication, cheapest cialis, attachment-fu vs. Cheapest cialis, Paperclip etc.) but it seems Paperclip is ripe to take over. Cheapest cialis, You can find some interesting tutorials here and here.

User Authentication

Another dull graph for you:

user_auth.png
I am wondering how homogenous this chart would be if Authlogic would have appeared earlier - it seems like a strong challenger (already watched by around 260 people on github) and I am sure it will take a nice slice of the pie in the future.

What’s more interesting is the openID support: more than one third of the apps offered openID authentication, cheapest cialis, and quite a few of them solely openID.

Misc

  • factory_girl was used to replace traditional fixtures in every 6th of the apps!
  • HAML/SASS is quite popular - used in about 20% of the applications
  • Hpricot was the only HTML/XML parser used (in 7 apps alltogerher)

What I am happy about the most is that there is still a lot of innovation going on in the Rails world - as you can see, cheapest cialis, newer and newer plugins/gems are appearing and in some (in fact, cheapest cialis, a lot of) cases are dethroning their good ol’ competitors. Cheapest cialis, There is a lot of competition going on in almost every major area of Rails web development, cheapest cialis, and this is always a good thing.

Similar Posts:soma sale,cheapest cialis,sibutramine pills,klonopin online stores,cheap viagra in usa

Cialis

Wednesday, November 12th, 2008

rails_rumble.png As a Rails Rumble judge, cialis, I spent quite some time reviewing the applications and I noticed several patterns regarding the gems/plugins used during the 48-hour contest. Cialis, The participants were asked to submit whatever tools they were using to build their app. Cialis, With a few exceptions they complied, cialis, creating an interesting data set to observe the current trends in the Rails world.

Collecting the Data

Unfortunately it was not possible to gather the information automatically using screen scraping or other mechanical methods, cialis, since the input was varying from free text (stating details like ‘we used Rails, cialis, macs, cialis, TextMate, cialis, cocaine (the drink!)’) etc. Cialis, to the output of gem list - and everything in-between, cialis, not following any guideline (perhaps because none was given). Cialis, So I hacked up a small app with a single form and harvested the info manually. Cialis, I only collected data for the first 100 entries, cialis, for two reasons: the stuff used in the rest of the apps was pretty much the same, cialis, and mainly: the task was rather daunting :-)

Why Does this Matter?

I believe that because of the rules (I mostly mean the 48-hour deadline) the findings are quite representative - I am sure that every team reached after the most productive/easy to use/effective tool they could grab since the deadline was tight. Cialis, Rails Rumble is not about experimentation or showing off some new shiny toys, cialis, but lightning fast hacking aided by state-of-the-art gems and plugins so I think it’s safe to assume that the tools used here are pretty much the crème de la crème of the Ruby/Rails world.

Prototype vs. Cialis, jQuery

In the first exhibit, cialis, I’d like to check out Prototype vs. Cialis, jQuery usage. Cialis, To prepare this chart, cialis, I took the extra mile and didn’t rely on the user-supplied data, cialis, but opened the pages by hand and checked the headers for Prototype/jQuery javascript includes. Cialis, Here is what I have found:

prototype_jquery.png

1 team was using mootools, cialis, the rest of the cake is divided between Prototype and jQuery. Most probably the real result is even more in favor of jQuery, cialis, I would guess well above 60% - all the teams that added jQuery to their application.html.erb were actually using it (why would they bother adding it otherwise), cialis, while this is not necessarily true for Prototype, cialis, which is included by default and maybe some teams didn’t even use it, cialis, just didn’t care to delete it (as you will learn in the next part, cialis, every 3rd team used bort, cialis, which includes the Prototype/script.aculo.us files by default).

This is not the first indicator of jQuery’s rising popularity in the Rails world - Hampton Catlin’s Ruby Survey found out the same (i.e. Cialis, jQuery is more popular right now than Prototype). Cialis, Merb is using jQuery by default.

Is Prototype Dead?

My favorite Austrian Ruby-hacker friend told me over lunch a few weeks ago: ‘Prototype is dead!’. Cialis, I think this statement is questionable at the moment to say the least, cialis, since Prototype is still the default javascript framework of Rails and this is not likely to change anytime soon due to the fact that Prototype is heavily used by 37singnals (and probably entrenched into other older Rails-apps as well). However, cialis, the trend seems to be that jQuery is spreading really fast, cialis, replacing Prototype in a lot of cases.

So be sure to check jQuery out (it’s dead easy to install and use it) - I immediately fell in love with it (maybe I was used to Hpricot-style CSS selectors too much?) and I am happily using it in my projects now.

The Next Episode

Which testing tools are used by the community? How about rails skeleton apps? OpenID support? exception-notifier or hoptoad? attachment_fu or paperclip? mocha or flexmock? factory-girl or traditional fixtures? Find out in the next installment!

Similar Posts:viagra generic,cialis,lipitor online,phentermine,cheap meridia

Xanax pills

Monday, May 5th, 2008

I recently applied this great plugin a few times to tackle different tasks and would like to share with you the joys of thinking in state machines!

Disclaimer: This installment is ‘just’ an intro to the topic (a teaser if you like), xanax pills, it doesn’t contain actual instructions or code on how to use actsasstate_machine - that comes in part II. Xanax pills, Though the original intent was to write up a small tutorial with some example code, xanax pills, I started with an intro and the article grew so long that I decided to split it up - so stay tuned for part deux!

State what…?!?

A finite state machine (FSM for short) a.k.a. Xanax pills, finite state automaton (FSA) is a 5-tuple (Σ, xanax pills,S, xanax pills,s0, xanax pills,δ, xanax pills,F)… Xanax pills, OK, xanax pills, just kidding. Xanax pills, I doubt too much people are interested in the rigorous definition of the FSM (for the rest, xanax pills, here it is), xanax pills, so let’s see a more down-to earth description.

According to wikipedia, xanax pills, Finite state machine is “a model of behavior composed of a finite number of states, xanax pills, transitions between those states, xanax pills, and actions“. Xanax pills, Somewhat better than those gammas and sigmas and stuff but if you are not the abstract thinker type, xanax pills, it might take some time to wrap your brain around it. Xanax pills, I believe a good example can help here!

Everybody knows and loves regular expressions - but probably it’s not that wide known fact that regular expression matching can be solved with an FSM (and in fact, xanax pills, a lot of implementations are using some kind of FSM on steroids). Xanax pills, So let’s see a simple example. Xanax pills, Suppose we would like to match a string against the following, xanax pills, simple regexp:

ab+(a|c)b*

First we have to construct the FSM, xanax pills, which will be fed with the string we would like to match. Xanax pills, An FSM for the above regular expression might look like this:

fsm_correct.png

String matching against this FSM is basically answering the question ’starting from the initial state, xanax pills, can we reach the finish after feeding the FSM the whole string?’. Xanax pills, Pretty easy - the only thing we have to define is ‘feeding’.

So let’s take the string ‘abbbcbbb’ as an example and feed the FSM! The process looks like this:

  1. we are in q0, xanax pills, the initial state (where the ’start’ label is). Xanax pills, Starting to consume the string
  2. we receive the first character, xanax pills, it’s an ‘a‘. Xanax pills, We have an ‘a‘ arrow to state q1, xanax pills, so we make a transition there
  3. we receive the next character, xanax pills, ‘b‘. Xanax pills, We have two b-arrows: to q1 and q2. Xanax pills, We choose to go to q1 (in fact, xanax pills, staying in q1) - remember, xanax pills, the question is whether we _can_ reach the finish, xanax pills, not whether all roads lead to the finish - so the choice is ours!
  4. identical to the above
  5. after the two above steps, xanax pills, we are still in q1. Xanax pills, We still get a ‘b‘ but this time we decide to move to q2.
  6. we are in q2 and the input is ‘c‘. Xanax pills, We have no analysis-paralysis here since the only thing we can do is to move to q4 - so let’s do that!
  7. Whoa! We reached the finish line! (q4 is one of the terminal states). Xanax pills, However, xanax pills, we didn’t consume the whole string yet, xanax pills, so we can’t yet tell whether the regexp matches or not. Xanax pills,
  8. So we eat the rest of the string (the ‘how’ is left as an exercise to the reader) and return ‘match!’

Let’s see a very simple non-matching example on the string ‘abac’

  1. in q0
  2. got an ‘a‘, xanax pills, move to q1
  3. in q1, xanax pills, got a ‘b‘, xanax pills, move to q2
  4. in q2, xanax pills, got an ‘a‘, xanax pills, move to q3 - we reached the finish, xanax pills, but still have a character to consume
  5. in q3, xanax pills, got a ‘c‘… Xanax pills, oops. Xanax pills, We have no ‘c’ arrow from q3 so we are stuck. Xanax pills, return ‘no match!’

Of course the real-life scenarios are much more complicated than the above one and sometimes FSMs are not enough (for example to my knowledge it’s not possible to tell about a number whether it is prime or not with a vanilla FSM - but a regexp doing just that has been floating around some time ago) but to illustrate the concept this example served fine.

This is cool and all but why should I care?!?

Well, xanax pills, yeah, xanax pills, you are obviously not going to model an FSM the next time you would like to match a regexp - that would be wheel-reinvention at it’s finest. Xanax pills, However there are some practical scenarios where an FSM can come handy:

  • sometimes the logic flow is just too complicated to model - an if-forrest is rarely a good solution (on the flip side, xanax pills, don’t model an if-else with an FSM :-))
  • encapsulate complex logic flow into a pattern and not clutter your code with it. Xanax pills,
  • you are in a stateless world - for example HTTP
  • asynchronous and/or distributed processing where you explicitly need to maintain your state and act upon it

Some real life examples of FSM usage in the Ruby/Rails world are why the lucky stiff’s Hpricot (using Ragel) or Rick Olson’s restful authentication plugin (using actsasstate_machine)

The Next Episode

In the next installment I’d like to focus on the practical usage of the actsasstate_machine plugin - I’ll attempt to create an asynchronous messaging system in a Rails app using it. Xanax pills,

Similar Posts:purchase viagra,xanax pills,accutane without prescription,kamagra no prescription,buy generic diflucan

Soma online

Thursday, April 24th, 2008

I have been always uncertain about the exact expression denoting today midnight (or any day midnight, soma online, for that matter). Soma online, Is 00:00 on e.g. Soma online, April 24th the midnight between 23rd and 24th or 24th and 25th? If I want something to happen at today midnight, soma online, is that today’s date at 00:00? (for the impatient: no, soma online, it isn’t :-)).

Chronic to the rescue! (If you don’t know chronic, soma online, be sure to check it out - it’s a great natural language date/time parser). Soma online, All I had to do is:

  1. >> Chronic.parse(‘today midnight’)
  2. => Fri Apr 25 00:00:00 +0200 2008

so actually it turns out it’s tomorrow’s date at 00:00.

I couldn’t find time zone support though (I am not saying it’s not there, soma online, just that I couldn’t find it by looking at the API) - so what if I want to meet someone in Madrid today midnight? Why, soma online, I install the tzinfo gem and ask Ruby!

  1. >> TzinfoTimezone["Madrid"].utc_to_local(Chronic.parse(‘today midnight’).getutc)
  2. => Fri Apr 25 00:00:00 UTC 2008

Similar Posts:order zoloft,soma online,cheapest lexapro,buy tramadol,prozac sale

Viagra prices

Tuesday, April 22nd, 2008

Similar Posts:phentermine sale,viagra prices,effexor online stores,synthroid online,buy cheap effexor

Cialis pharmacy

Monday, April 21st, 2008

Similar Posts:xanax online,cialis pharmacy,price of viagra,cipro for sale,purchase zithromax online

Cheapest zoloft

Sunday, June 10th, 2007

Cheapest zoloft, ubuntu In my quest to whip my feed reader’s Ruby/Rails related content into shape a bit, cheapest zoloft, I made a little research to find out which Ruby/Rails blogs are the most popular at the moment. Cheapest zoloft, I had given up on following most of the blogs systematically a long time ago - it is becoming increasingly hard to keep track of even the aggregators, cheapest zoloft, not to talk about the blogs themselves. Cheapest zoloft, There are hundreds of Ruby/Rails blogs out there right now (I am talking about the ones found on the few most popular aggregators - in reality there must be much more of them), cheapest zoloft, so it is clear that you need to pick carefully - unless you happen to be a well-paid, cheapest zoloft, full time Ruby/Rails blog reader (in which case you still would have to crank a lot to do your work properly).

Cheapest zoloft, OK, cheapest zoloft, enough nonsense for today - let’s see the results counting down from the 10th place! If you are interested in the method they were created with, cheapest zoloft, or a longer, cheapest zoloft, top 30 list from technorati and alexa, cheapest zoloft, check out this blog entry.

Cheapest zoloft, 10. Cheapest zoloft, http://weblog.jamisbuck.org/ by Jamis Buck.

jamisbuck

Cheapest zoloft, Jamis Buck “is a software developer who has the good fortune to be both employed by 37signals and counted among those who maintain the Ruby on Rails web framework”. Cheapest zoloft, He is mostly blogging about (surprise, cheapest zoloft, surprise!) Rails - of course on a very high level, cheapest zoloft, which could be expected from a Rails core developer. Cheapest zoloft, Very insightful posts on ActiveRecord, cheapest zoloft, Capistrano and other essential Rails topics delivered in a professional way.

Cheapest zoloft, 9. Cheapest zoloft, http://weblog.rubyonrails.org by the Rails core team

weblog_rubyonrails

Cheapest zoloft, This is the “default” Ruby on Rails blog, cheapest zoloft, used for announcements, cheapest zoloft, sightings, cheapest zoloft, manuals and whatever else the RoR team finds interesting :-).

Cheapest zoloft, 8. Cheapest zoloft, http://www.slash7.com by Amy Hoy.

slash7

Cheapest zoloft, This is a really cool little site - Amy is a very gifted writer and designer, cheapest zoloft, publishing very insightful articles as well as the nicest (hands down!) cheat sheets about different Web2.0, cheapest zoloft, Ajax, cheapest zoloft, Rails and that sort of stuff. Cheapest zoloft, Definitely worth checking out!

Cheapest zoloft, 7. Cheapest zoloft, http://errtheblog.com by PJ Hyett and Chris Wanstrath.

err_the_blog

Cheapest zoloft, A very serious blog of two Rails-geeks about advanced topics (but very well explained - so if you are not totally green (#00FF00) you should do fine). Cheapest zoloft, Among other things, cheapest zoloft, they have contributed Sexy Migrations to Rails recently.

Cheapest zoloft, 6. Cheapest zoloft, http://nubyonrails.com/ by Geoffrey Grosenbach

nubyonrails

Cheapest zoloft, Geoffrey is the author of more than twenty of Rails plugins, cheapest zoloft, (including gruff, cheapest zoloft, my favorite graph drawing gem), cheapest zoloft, a horde of professional-quality articles and the PeepCode screencast site. Cheapest zoloft, Do I need to say more?!

Cheapest zoloft, 5. Cheapest zoloft, http://redhanded.hobix.com/ by _why the lucky stiff.

redhanded

Cheapest zoloft, _why is probably the most interesting guy in the Ruby community. Cheapest zoloft, He is the author of (among tons of other things) Why’s Poignant Guide to Ruby, cheapest zoloft, HPricot, cheapest zoloft, the coolest Ruby HTML parser, cheapest zoloft, Try Ruby! (a must see!) and Hackety Hack, cheapest zoloft, for aspiring wannabe programmers who want to hack like in the movies! The list goes on and on… Cheapest zoloft, This guy never stops. Cheapest zoloft, If someone will ever invent the perpetuum mobile, cheapest zoloft, he will be it (in Ruby, cheapest zoloft, of course). Cheapest zoloft,

Cheapest zoloft, 4.http://hivelogic.com/ by Dan Benjamin.

hivelogic

Cheapest zoloft, Dan’s recent work include Cork’d, cheapest zoloft, a web2.0 wine community site or the A List Apart publishing system. Cheapest zoloft, He does great podcasts with various guys.

Cheapest zoloft, 3. Cheapest zoloft, http://mephistoblog.com/ by Rick Olson and Justin Palmer

mephisto

Cheapest zoloft, Personally I was quite surprised that a blog concentrating on such a narrow topic (in this case the mephisto blogging system) could grab the 3rd place - so I have checked both alexa and technorati by hand just to be sure, cheapest zoloft, and it seems that everything is OK - mephistoblog is ranked very high on both of them, cheapest zoloft, justifying this position. Cheapest zoloft, After all, cheapest zoloft, mephisto is the leading blog system of Rails!

Cheapest zoloft, 2. Cheapest zoloft, http://www.rubyinside.com/ by Peter Cooper.

rubyinside

Cheapest zoloft, This blog is my absolute favorite from this top 10 list (actually, cheapest zoloft, from all the Ruby blogs I have encountered so far). Cheapest zoloft, I am definitely with Amy Hoy, cheapest zoloft, who said If you had to subscribe to just one Ruby blog, cheapest zoloft, it should be this one. Cheapest zoloft, If you would like to know what’s happening in the Ruby/Rails community, cheapest zoloft, rubyinside is the place to check. Cheapest zoloft, If there is no new post here, cheapest zoloft, it’s because most probably nothing happened!

Cheapest zoloft, And the winner is: http://www.loudthinking.com/ by David Heinemeier Hansson.

loudthinking

Cheapest zoloft, Well, cheapest zoloft, what should I add? David is the author of Ruby on Rails, cheapest zoloft, so no wonder his blog topped the list!

Cheapest zoloft,
Conclusion
It’s interesting to note that nearly all the blogs listed here are mostly pure Rails ones - rubyinside (mixed Ruby/Rails) and redhanded (pure Ruby) being the two exceptions. Cheapest zoloft, It would be interesting to generate such a list for Ruby blogs - though I am not sure how. Cheapest zoloft, The sources I have used (most notably rubycorner) aggregate both Ruby and Rails blogs) - so it seems there are much more Rails bloggers out there (or they are much better (with the exception of _why) than the Ruby bloggers).

Cheapest zoloft, I would really like to hear your opinion on this little experiment - whether you think it makes sense or it is completely off, cheapest zoloft, how could it be improved in the future, cheapest zoloft, what features could be added etc. Cheapest zoloft, If I’ll receive some positive feedback, cheapest zoloft, I think I will work on the algorithm a bit more, cheapest zoloft, and run it once in say every 3 months to see what’s happening around the Ruby/Rails blogosphere. Cheapest zoloft, Let me know what do you think!


If one is thinking about creating a site for affiliate marketing to earn some extra cash they should thoroughly research a few things. Cheapest zoloft, To start with look for a cheap company that sell domains for your domain name registration. Cheapest zoloft, Next get a cheap, cheapest zoloft, yet reliable web hosting company to host your site on. Cheapest zoloft, These can be easily distinguished as they hire many cisco certified professionals. Cheapest zoloft, The generally carry 642-371 certifications. Cheapest zoloft, Then look into online backup for your files to avoid data loss. Cheapest zoloft, More over perform directory submission to get indexed in the search engines. Cheapest zoloft, Getting a+ certificate yourself is not a bad idea since it will help you get through the process with much ease.


Similar Posts:prozac online,cheapest zoloft,viagra pharmacy,plavix for sale,cialis sale

Phentermine prescription

Wednesday, May 23rd, 2007

Phentermine prescription,

Build Your Own Ruby on Rails Applications
Author: Patrik Lenz
Publisher: SitePoint
Pages: 447
Intended Audience: Beginners/Pre-intermediate
Rating: 5/5

I would like to begin with a few words about SitePoint. Phentermine prescription, According to their definition, phentermine prescription, ‘SitePoint specializes in publishing fun, phentermine prescription, practical, phentermine prescription, and easy-to-understand content for web professionals.’. Phentermine prescription, So far I had the pleasure to read three of their books: (obviously) Build Your Own Ruby on Rails Web Applications, phentermine prescription, The CSS Anthology: 101 Essential Tips, phentermine prescription, Tricks & Hacks and The Principles of Beautiful Web Design. Phentermine prescription, If I had to judge the publisher based on these three books, phentermine prescription, I could not agree more: I have found all their claims (fun, phentermine prescription, practical and easy-to-understand) to be unquestionably true.

After a brief overview of the book I would like to concentrate on the question that popped up in most of you I guess: Why should I prefer this book over Agile Web Development with Rails or other Rails books available? We’ll look into that in a minute, phentermine prescription, but first things first: let’s see what has Build Your Own Ruby on Rails Web Applications to offer!

The book starts off with installing Ruby, phentermine prescription, RubyGems, phentermine prescription, Rails and even MySQL on different operating systems, phentermine prescription, presented in painstaking detail - which is very good in my opinion, phentermine prescription, since advanced users will skip this section anyway, phentermine prescription, and it offers great step-by-step walkthrough for novices.

The second chapter is the compulsory ‘introduction to Ruby’. Phentermine prescription, I have to admit I did not read it - but judging from the contents and a quick skim-through, phentermine prescription, it offers at least the same knowledge as the other similar Rails-books, phentermine prescription, which is more than enough to get you started. Phentermine prescription, If you would like to go deeper into both Ruby and Rails, phentermine prescription, I suggest to check out David A. Phentermine prescription, Black’s excellent Ruby for Rails.

Chapter 4, phentermine prescription, ‘Rails Revealed’ is the only more-or-less theoretical chapter, phentermine prescription, discussing the architecture, phentermine prescription, components and conventions used in Ruby on Rails.

The real action starts from Chapter 5 in the form of building a digg-clone from scratch. Phentermine prescription, You will learn how to build a Rails application, phentermine prescription, beginning with generating the necessary files and ending up with a nicely working, phentermine prescription, (relatively) feature rich digg-like site, phentermine prescription, dealing with user management (even showing an user view with submitted stories), phentermine prescription, allowing you to submit and vote on stories (just as you would expect from an application like this), phentermine prescription, sprinkled with a lot of tasty tidbits like tagging (also introducing polymorphic associations in a very easy-to-understand way) or (of course) AJAX.

The book finishes with some advanced topics: Debugging, phentermine prescription, Testing and Benchmarking, phentermine prescription, followed by Deploying and Production use, phentermine prescription, providing instructions to deploy your application on Apache with Mongrel.

If the review would end right now, phentermine prescription, you could (rightfully) ask: ‘So what? These are exactly the things I would expect from a Rails book’ - and you would be perfectly right. Phentermine prescription, So let’s see why is this book different from all the other ones available on the market!

First of all, phentermine prescription, it is written in a very understandable and easy-to-digest way: it explains everything as simply as possible, phentermine prescription, making even the more complicated topics clear right away. Phentermine prescription, I don’t remember reading anything twice, phentermine prescription, no matter how advanced the topic was. Phentermine prescription, I think this alone makes Build Your Own Ruby on Rails Web Applications one of the best hands-on RoR books today (definitively the best one I have seen so far, phentermine prescription, but since I did not read all the competitors, phentermine prescription, I can not unambiguously claim this is the best one).

What I also like about this book is that it does not require nearly any preliminaries at all - the bare minimum that is needed is explained on the side during the application creation, phentermine prescription, or can be learned from the book. Phentermine prescription,

A big difference compared to Agile Web Development with Rails - which is the de facto Rails book today - is that testing of the created components is described in great detail. Phentermine prescription, The usual workflow is thus problem statement, phentermine prescription, solution and creating unit tests to verify the code - explaining the why’s and how’s as well. Phentermine prescription, I am not aware of any RoR book currently available that would explain and demonstrate testing your code to this extent.

One could argue that Build Your Own Ruby on Rails Web Applications is not deep enough, phentermine prescription, which is more-or-less true (compared to e.g. Phentermine prescription, Agile Web Development with Rails) - but I think this is perfectly fine, phentermine prescription, since going too deep is not the purpose of the book at all! If you need in-depth coverage of Rails internals, phentermine prescription, would like to go into advanced topics like caching, phentermine prescription, scaling or deployment in a great detail then this is not the book to get. Phentermine prescription, However, phentermine prescription, if you would like to try Ruby on Rails right away, phentermine prescription, without the need to google for blogs helping you to install the preliminaries or get this and that right, phentermine prescription, be sure to check it out!

Similar Posts:xanax,phentermine prescription,cheapest lasix,lipitor for sale,generic viagra

Viagra prescription

Thursday, May 17th, 2007

Viagra prescription, According to O’Reilly’s latest report on the state of the computer book market focusing on programming books, viagra prescription, Ruby has the definitive lead. Viagra prescription, Check out this treemap view - I believe it does not need too much additional explanation (The percentages reflect the relative book sale compared to 2006/Q1):

Viagra prescription, Now, viagra prescription, I would not like to start a language war here at all - there is neither a need to draw zealous consequences from the Ruby camp nor to come up with explanation from proponents of other languages. Viagra prescription, The diagram shows that compared to the same period of 2006, viagra prescription, there is the biggest demand for Ruby (and other Ruby-based/related) books currently - and nothing more. Viagra prescription, It does not tell anything about the number of people using the given language or related frameworks, viagra prescription, job opportunities or the absolute market share - this is just a relative indicator based on the programming book market. Viagra prescription,

Viagra prescription, However, viagra prescription, if you take a peek at the TIOBE index for May - entitled ‘Ruby’s growth comes to an end’ - you can see that Ruby is the fastest growing language at the moment (again, viagra prescription, compared to the same period of 2006). Viagra prescription, If this is the ‘end of the growth’, viagra prescription, then how does the growth look like?!

Viagra prescription, It is also interesting to check out this graph from TIOBE:

Viagra prescription, It tells me that starting from July 2006, viagra prescription, none of the programming languages shows so big (and steady) growth than Ruby.

Viagra prescription, I don’t know based on what did the TIOBE guys come to the conclusion that Ruby is losing steam… Viagra prescription, I have talked to a few Ruby on Rails freelancers recently, viagra prescription, and each of them confirmed independently that there is a bigger need for Ruby/Rails programmers than ever. Viagra prescription, Based on (not only) these data I would say quite the opposite is true: my personal feeling is that Ruby/Rails is just going to be a *lot* bigger than it is currently!

Similar Posts:soma online,viagra prescription,order zoloft,buy viagra,buy clonazepam without prescription

Discount tramadol

Thursday, April 26th, 2007

During hacking on various tasks, discount tramadol, I needed to partition a set of elements quite a few times. Discount tramadol, I have attacked the problem with different homegrown implementations, discount tramadol, mostly involving select-ing every element belonging into the same basket in turn. Discount tramadol, Fortunately I run across divide recently, discount tramadol, which does exactly this… Discount tramadol, No more wheel reinvention! Let’s see a concrete example.

I have an input file like this:

a 53 2 3
b 8 62 1 23
a 9 0 31
b 4 45 4 16 7
b 1 23
c 3 42 2 31 4 6
a 1 3 22
a 7 83 1 23 3
b 1 14 4 15 16 2
c 5 16 2 34

The goal is to sum up all the numbers in rows beginning with the same character (e.g. Discount tramadol, to sum up all the numbers that are in a row beginning with ‘a’). Discount tramadol, The result should look like:

[{"a"=>241}, discount tramadol, {"b"=>246}, discount tramadol, {"c"=>145}]

This is an ideal task for divide! Let’s see one possible solution for the problem:

  1. require ’set’
  2.  
  3. input = Set.new open(‘input.txt).readlines.map{|e| e.chomp}
  4. groups = input.divide {|x, discount tramadol,y| x.map[0][0] == y.map[0][0] }
  5. #build the array of hashes
  6. p groups.map.inject([]) {|a, discount tramadol,g|
  7.    #build the hashes for the number sequences with same letters
  8.     a << g.map.inject(Hash.new(0)) {|h, discount tramadol,v|
  9.     #for every sequence, discount tramadol, sum the numbers it contains
  10.     h[v[0..0]] += v[2..-1].split(‘ ‘).inject(0) {|c, discount tramadol,x|
  11.       c+=x.to_i; c}; h
  12.   }; a
  13. }

The output is:

  1. [{"a"=>241}, discount tramadol, {"b"=>246}, discount tramadol, {"c"=>145}]

Great - it works! Now let’s take a look into the code…

Discount tramadol, The 3rd line loads the lines into a set like this:

  1. <Set: {"b 1 23 ", discount tramadol, "c 5 16 2 34", discount tramadol, "a 9 0 31", discount tramadol, "a 7 83 1 23 3", discount tramadol, "b 1 14 4 15 16 2", discount tramadol, "a 53 2 3", discount tramadol, "c 3 42 2 31 4 6", discount tramadol, "b 4 45 4 16 7", discount tramadol, "b 8 62 1 23", discount tramadol, "a 1 3 22 "}>

The real thing happens on line 4. Discount tramadol, After it’s execution, discount tramadol, groups looks like:

  1. <Set: <Set: {"a 9 0 31", discount tramadol, "a 7 83 1 23 3", discount tramadol, "a 53 2 3", discount tramadol, "a 1 3 22 "}>, discount tramadol, <Set: {"b 1 23 ", discount tramadol, "b 1 14 4 15 16 2", discount tramadol, "b 8 62 1 23", discount tramadol, "b 4 45 4 16 7"}>, discount tramadol, <Set: {"c 5 16 2 34", discount tramadol, "c 3 42 2 31 4 6"}>}>

Discount tramadol, As you can see, discount tramadol, the set is correctly partitioned now - with almost no effort! We did not even need to require an external library… Discount tramadol,
The rest of the code is out of the scope of this article (everybody is always complaining about the long articles here, discount tramadol, so I am trying to keep them short) - and anyway, discount tramadol, the remaining snippet is just a bunch of calls to inject. Discount tramadol, If inject does not feel too natural to you, discount tramadol, don’t worry - it took me months until I got used to it, discount tramadol, and some people (despite of the fact that they fully understand and are able to use it) never reach after it - I guess it’s a matter of taste…’

Similar Posts:generic tramadol,discount tramadol,prozac online,buy cheap ultram,lexapro without prescription

Tramadol prescription

Thursday, March 22nd, 2007

Tramadol prescription, Though dreamhost offers phpBB as one of their one-click install goodies (ergo it is the easiest to install of all forums since you almost don’t have to do anything), tramadol prescription, I have been looking for something different. Tramadol prescription, To me, tramadol prescription, phpBB’s interface was always quite unintuitive and too heavy - I wanted something smaller, tramadol prescription, easier, tramadol prescription, more compact. Tramadol prescription, The problem was I did not know what should I search for - until I came across beast, tramadol prescription, a lightweight forum written in Ruby on Rails. Tramadol prescription, It was love at the first sight!

Tramadol prescription, When it comes to tools I am using, tramadol prescription, I am really language agnostic - this very blog uses WordPress (PHP), tramadol prescription, I am using Trac (Python) to track my projects, tramadol prescription, mediaWiki (PHP) is my preferred wiki etc - so even if it may seem so, tramadol prescription, I did not choose beast because it is written in Rails (although +1 for that :-)), tramadol prescription, but because of the design and ease of use. Tramadol prescription, My first thought after trying it was ‘wow, tramadol prescription, this is as easy to use as a 37signals app’ - it’s really that intuitive and well designed!

Tramadol prescription, Well, tramadol prescription, this sounds fine and all, tramadol prescription, but installation on dreamhost was a different story. Tramadol prescription, Thanks God I have found a superb, tramadol prescription, step by step HOWTO here. Tramadol prescription, However, tramadol prescription, even after following all the steps, tramadol prescription, I got ‘incomplete headers’ and other problems, tramadol prescription, which I have managed to fix - here are some additional comments to the HOWTO:

Tramadol prescription, 6. Tramadol prescription, You can forget about this point; as the HOWTO says, tramadol prescription, it is already installed on DH and it will work without any problems.
7. Tramadol prescription, Forget about ‘development’ and ‘test’, tramadol prescription, however be sure to get ‘production’ right, tramadol prescription, as the next step will not work otherwise. Tramadol prescription, It should look something like this:

production:
  adapter: mysql
  database: beast_prod
  host: mysql.myhost.com
  username: us3r
  password: p4ss
  port: 3306
8. Tramadol prescription, For me it worked only *with* the RAILS_ENV=production parameter specified.
9. Tramadol prescription, You can change the salt to anything - it just must not stay the same. Tramadol prescription, The easiest thing is to add or remove a random character from the string.
12. Tramadol prescription, The shebang should be updated to #!/usr/bin/ruby
13. Tramadol prescription, The || should be removed, tramadol prescription, i.e. Tramadol prescription, it should read:
ENV[‘RAILS_ENV’] = ‘production’
14. Tramadol prescription, Make sure you change the permission of those directories only - I have changed everything recursively, tramadol prescription, destroying the executable flag of dispatch.fcgi :-).

Tramadol prescription, Now you should apply the ‘GetText patch’ - it can be found later in the thread. Tramadol prescription, After you should be up and running!

Tramadol prescription, After playing around, tramadol prescription, I have found that the user listing is not working - fortunately I have found this as well in the forum. Tramadol prescription, The solution is:
app/views/users/index.rhtml line 3 should be modified to

%lt;% form_tag '', tramadol prescription, :method => 'get' do -%>
Enjoy this great forum!

Similar Posts:cheapest zoloft,tramadol prescription,kamagra online,diazepam for sale,cipro pills

Prozac online

Sunday, February 4th, 2007

This article is a follow-up to the quite popular first part on web scraping - well, prozac online, sort of. Prozac online, The relation is closer to that between Star Wars I and IV - i.e., prozac online, in chronological order, prozac online, the 4th comes first. Prozac online, To continue the analogy, prozac online, probably I am in the same shoes as George Lucas was after creating the original trilogy : the series became immensely popular and there was demand for more - in both quantity and depth.

After I have realized - not exclusively, prozac online, but also - through the success of the first artcile that there is need for this sort of stuff, prozac online, I begun to work on the second part. Prozac online, As stated at the end of the previous installment, prozac online, I wanted to create a demo web scraping application to show some advanced concepts. Prozac online, However, prozac online, I left out a major coefficient from my future-plan-equation: the power of Ruby.

Basically this web scraping code was my first serious Ruby program: I came to know Ruby just a few weeks earlier, prozac online, and I have decided to try it out on some real-life problem. Prozac online, After hacking on this app for a few weeks, prozac online, suddenly a reusable web scraping toolkit - scRUBYt! - begun to materialize which caused a total change of the plan: instead of writing a follow-up, prozac online, I decided to finish the toolkit and sketch a big picture of the topic as well as placing scRUBYt! inside this frame and illustrating the theoretical things with it described here.

The Big Picture: Web Information Acquisition

The whole art of systematically getting information from the Web is called ‘Web information acquisition’ in the literature. Prozac online, The process consists of 4 parts (see the illustration), prozac online, which are executed in this order: Information Retrieval (IR), prozac online, Information Extraction(IE), prozac online, Information Integration (II) and Information Delivery (ID).

Information Retrieval

Navigate to and download the input documents which are the subject of the next steps. This is probably the most intuitive step to make - clearly, prozac online, the information acquisition system has to be pointed to the document which contains the data first, prozac online, before it can perform the actual extraction.

The absolute majority of the information on the Web resides in the so-called deep web - backend databases and different legacy data stores which are not contained in static web documents. Prozac online, This data is accessible via interaction with web pages (which serve as a frontend to these databases) - by filling and submitting forms, prozac online, clicking links, prozac online, stepping through wizards etc. Prozac online, A typical example could be an airpot web page: an airport has all the schedules of the flights they offer in their databases, prozac online, yet you can access this information only on the fly by submitting a form containing your concrete request.

The opposite of the deep web is the surface web - static pages with a ‘constant’ URL, prozac online, like the very page you are reading. Prozac online, In such a case, prozac online, the information retrieval step consist of just downloading the URL. Prozac online, Not a really tough task.

However, prozac online, as I said two paragraphs earlier, prozac online, most of the information is stored in the deep web - different actions, prozac online, like filling input fields, prozac online, setting checkboxes and radio buttons, prozac online, clicking links etc. Prozac online, are needed to get to the actual page of interest which can be then downloaded as the result of navigation.

Besides that this is not trivial to do automatically from a programming language just because of the nature of the task, prozac online, there are a lot of pitfalls along the way, prozac online, stemming from the fact that the HTTP protocol is stateless: the information provided to a request is lost when making the next request. Prozac online, To remedy this problem, prozac online, sessions, prozac online, cookies, prozac online, authorizations, prozac online, navigation history and other mechanisms were introduced - so a decent information retrieval module has to take care about these as well.

Fortunately, prozac online, in Ruby there are packages which are offering exactly this functionality. Prozac online, Probably the most well-known is WWW::Mechanize which is able to automatically navigate through Web pages as a result of interaction (filling forms etc.) while keeping cookies, prozac online, automatically following redirects and simulating everything else what a real user (or the browser in response to that) would do. Prozac online, Mechanize is awesome - from my perspective it has one major flaw: you can not interact with JavaScript websites. Prozac online, Hopefully this feature will be added soon.

Until that happy day, prozac online, if someone wants to navigate through JS powered pages, prozac online, there is a solution: (Fire)Watir. Prozac online, Watir is capable to do similar things as Mechanize (I never did a head-to-head comparison, prozac online, though it would be interesting) with the added benefit of JavaScript handling. Prozac online,

scRUBYt! comes with a navigation module, prozac online, which is built upon Mechanize. Prozac online, In the future releases I am planning to add FireWatir, prozac online, too (just because of the JavaScript issue). Prozac online, scRUBYt! is basically a DSL for web scraping with lot of heavy lifting behind the scenes. Prozac online, Through the real power lies the extraction module, prozac online, there are some goodies here at the navigation module, prozac online, too. Prozac online, Let’s see an example!

Goal: Go to amazon.com. Prozac online, Type ‘Ruby’ into the search text field. Prozac online, To narrow down the results, prozac online, click ‘Books’, prozac online, then for further narrowing ‘Computers & Internet’ in the left sidebar.

Realization:

  fetch           'http://www.amazon.com/'
  fill_textfield  'field-keywords', prozac online, 'ruby'
  submit
  click_link      'Books'
  click_link      'Computers & Internet'

Result: This document.

As you can see, prozac online, scRUBYt’s DSL hides all the implementation details, prozac online, making the description of the navigation as easy as possible. Prozac online, The result of the above few lines is a document - which is automatically fed into the scraping module, prozac online, but this is already the topic of the next section.

Information Extraction

I think there is no need to write about why does one need to extract information from the Web today - the ‘how’ is a much more interesting question.

Why is Web extraction such a tedious task? Because the data of interest is stored in HTML documents (after navigating to them, prozac online, that is), prozac online, mixed with other stuff like formatting elements, prozac online, scripts or comments. Prozac online, Because the data is missing any semantic description, prozac online, a machine has no idea what a web shop record is or how a news article might look like - it just perceives the whole document as a soup of tags and text.

Querying objects in systems which are formally defined and thus understandable for a machine is easy: For instance, prozac online, if I want to get the first element of an array in Ruby, prozac online, One can do it easily like this:

  1. my_array.first

Another example for a machine-queryable structure could be an SQL table: to pull out the elements matching the given criteria, prozac online, all that needs to be done is to execute an SQL query like this:

  1. SELECT name FROM students WHERE age > 25

Now, prozac online, try to do similar queries for a Web page. Prozac online, For example, prozac online, suppose that you already navigated to an ebay page by searching for the term ‘Notebook’. Prozac online, Say you would like to execute the following query: ‘give me all the records with price lower than $400′ (and get the results into a data structure of course - not rendered inside your browser, prozac online, since that works naturally without any problems). Prozac online,

The query was definitely an easy one, prozac online, yet without implementing a custom script extracting the needed information and saving it to a data structure (or using stuff like scRUBYt! - which does exactly this instead of you) you have no chance to get this information from the source code.

There are ongoing efforts to change this situation - most notably the semantic Web, prozac online, common ontologies, prozac online, different Web2.0 technologies like taxonomies, prozac online, folksonomies, prozac online, microformats or tagging. Prozac online, The goal of these techniques is to make the documents understandable for machines to eliminate the problems stated above. Prozac online, While there are some promising results in this area already, prozac online, there is a long way to go until the whole Web will be such a friendly place - my guess is that this will happen around Web88.0 in the optimistic case.

However, prozac online, at the moment we are only at version 2.0 (at most), prozac online, so if we would like to scrape a web page for whatever reason today, prozac online, we need to cope with the difficulties we are facing. Prozac online, I wrote an overview on how to do this with the tools available in Ruby (update: there is a new kid on the block - HPricot - which is not mentioned there).

The rough idea of those packages is to parse the Web page source into some meaningful structure (usually a tree) then provide a querying mechanism (like XPaths, prozac online, CSS selectors or some other tree navigation model). Prozac online, You could think now: ‘A-ha! So actually a web page can be turned into something meaningful for machines, prozac online, and there is a formal model to query this structure - so where is the problem described in the previous paragraphs? You just write queries like you would in a case of a database, prozac online, evaluate them against the tree or whatever and you are done’.

The problem is that the machine’s understanding of the page and human thinking about querying this information are entirely different, prozac online, and there is no formal model (yet) to eliminate this discrepancy. Prozac online, Humans want to scrape ‘websop records with Canon cameras with maximal price $1000′, prozac online, while the machine sees this as ‘the third <td> tag inside the eight <tr> tag inside the fifth <table> … Prozac online, (lot of other tags) inside the <body>> tag inside the <html> tag, prozac online, where the text of the seventh <td> tag contains the string ‘Canon’ and the text of the ninth <td>, prozac online, is not bigger than 1000 (to even get the value 1000 you have to use a regular expression or something to get rid of the most probably present currency symbol and other possible additional information). Prozac online,

So why is this so easy with a database? Because the data stored in there has a formal model (specified by the CREATE TABLE keyword). Prozac online, Both you and the computer know exactly how a Student or a Camera looks like, prozac online, and both of you are speaking the same language (most probably an SQL dialect). Prozac online,

This is totally different in the case of a Web page. Prozac online, A web shop record, prozac online, a camera detail page or a news item can look just anyhow and your only chance to find out for the concrete Web page of interest is to exploit it’s structure. Prozac online, This is a very tedious task on it’s own (as I have said earlier, prozac online, a Web page is a mess of real data, prozac online, formatting, prozac online, scripts, prozac online, stylesheet information…). Prozac online, Moreover there are further problems: for example, prozac online, a web shop record must not be uniform even inside the same page - certain records can miss some cells which others have, prozac online, may containt the information on a detail page, prozac online, while others not and vice versa - so in some cases, prozac online, identifying a data model is impossible or very complicated - and I did not even talk about scraping the records yet!

So what could be the solution?

Intuitively, prozac online, there is a need for an interpreter which understands the human query and translates it to XPaths (or any querying mechanism a machine understands). Prozac online, This is more or less what scRUBYt! does. Prozac online, Let me explain how - it will be the easiest through a concrete example.

Suppose you would like to monitor stock information on finance.yahoo.com! This is how I would do it with scRUBYt!:

#Navigate to the page
fetch 'http://finance.yahoo.com/'

#Grab the data!
stockinfo do
  symbol  'Dow'
  value   '31.16'
end

output:

  <root>
    <stockinfo>
      <symbol>Dow</symbol>
      <value>31.16</value>
    </stockinfo>
    <stockinfo>
      <symbol>Nasdaq</symbol>
      <value>4.95</value>
    </stockinfo>
    <stockinfo>
      <symbol>S&P 500</symbol>
      <value>2.89</value>
    </stockinfo>
    <stockinfo>
      <symbol>10-Yr Bond</symbol>
      <value>0.0100</value>
    </stockinfo>
  </root>

Explanation: I think the navigation step does not require any further explanation - we fetched the page of interest and fed it into the scraping module.

The scraping part is more interesting at the moment. Prozac online, Two things happened here: we have defined a hierarchical structure of the output data (like we would define an object - we are scraping StockInfos which have Symbol and Value fields, prozac online, or children), prozac online, and showed scRUBYt! what to look for on the page in order to fill the defined structure with relevant data.

How did I know I had to specify ‘Dow’ and ‘31.16′ to get these nice results? Well, prozac online, by manually pointing my browser to ‘http://finance.yahoo.com/’, prozac online, and observing an example of the stuff I wanted to scrape - and leave the rest to scRUBYt!. Prozac online, What actually happens under the hood is that scRUBYt! finds the XPath of these examples, prozac online, figures out how to extract the similar ones and arranges the data nicely into a result XML (well, prozac online, there is much more going on, prozac online, but this is the rough idea). Prozac online, If anyone is interested, prozac online, I can explain this in a further post.

You could think now ‘O.K., prozac online, this is very nice and all, prozac online, but you have been talking about monitoring and I don’t really see how - the value 31.16 will change sooner or later and then you have to go to the page and re-specify the example again - I would not call this monitoring’.

Great observation. Prozac online, It’s true scRUBYt! would not be of much use if the situation of changing examples would not be handled (unless you would like to get the data only once, prozac online, that is) - fortunately, prozac online, the situation is dealt with in a powerful way!

Once you run the extractor and you think the data it scrapes is correct, prozac online, you can export it. Prozac online, Let’s see how the exported finances.yahoo.com extractor looks like:

#Navigate to the page
fetch 'http://finance.yahoo.com/'

#Construct the wrapper
 stockinfo "/html/body/div/div/div/div/div/div/table/tbody/tr" do
   symbol "/td[1]/a[1]"
   value "/td[3]/span[1]/b[1]"
end

As you can see, prozac online, there are no concrete examples any more - the system generalized the information and now you can use this extractor to scrape the information automatically whenever - until the moment the guys at yahoo change the structure of the page - which fortunately not happening every other day. Prozac online, In this case the extractor should be regenerated with up-to date examples (in the future I am planning to add automatic regeneration in such cases) and the fun can begin from the start once again.

This example just scratched the surface of what scRUBYt is capable of - there are tons of advanced stuff to fine-tune the scraping process and get the data you need. Prozac online, If you are interested, prozac online, check out http://scrubyt.org for more information!

Conclusion

The first two steps of information acquisition (retrieval and extraction) are dealing with the question ‘How to get the data I am interested in (querying)’. Prozac online, Up to the present version (0.2.0) scRUBYt! contains just these two steps - however, prozac online, to do even these properly, prozac online, I will need a lot of testing, prozac online, feedback, prozac online, bug fixing, prozac online, stabilization, prozac online, adding heaps of new features and enhancements - because as you have seen, prozac online, web scraping is not a straightforward thing to do at all.

The last two steps (integration and delivery) are addressing the question ‘what to do with the data once it is collected, prozac online, and how to do that (orchestration)’. Prozac online, These facets will be covered in a next installment - most probably when scRUBYt! will contain these features as well.

If you liked this article and you are interested in web scraping in practice, prozac online, be sure to install scRUBYt! and check out the community page for further instructions - the site is just taking off, prozac online, so there is not too much yet - but hopefully enough to get you started. Prozac online, I am counting on your feedback, prozac online, suggestions, prozac online, bug reports, prozac online, extractors you have created etc. Prozac online, to enhance both scrubyt.org and scRUBYt! user experience in general. Prozac online, Be sure to share your experience and opinion!

To launch a tutorial site is comparatively much easier today than it was a few years ago. Prozac online, You can easily buy domain name at a very low cost and do domain parking until your site is ready. Prozac online, Get a good business hosting package from one of the many providers listed on the internet, prozac online, go for a company which hires people with cisco certifications such as 642-143. Prozac online, Create a professional web design with the help of adobe. Prozac online, Get online training that can guide you through the site’s development. Prozac online, Use your laptop wireless internet connection to upload from anywhere conveniently.

Similar Posts:buy viagra,prozac online,buy doxycycline online,lexapro pills,clonazepam no prescription

Soma prescription

Thursday, December 21st, 2006

Since I am relatively new to Ruby, soma prescription, I have no idea how life could have been in the dark ages of the non-Japanese-speaking Ruby community (1995 - 2000), soma prescription, when there was no English Ruby book on the market. Soma prescription, The ice was broken by Andy Hunt and Dave Thomas with a pickaxe - err… Soma prescription, actually the Pickaxe (a.k.a. Soma prescription, “Programming Ruby”), soma prescription, which has undoubtedly become an all-famous Ruby-classic since then. Soma prescription,

In the foreword, soma prescription, Matz, soma prescription, the author of Ruby, soma prescription, explains that since he is much better in coding than in documentation writing, soma prescription, probably the authors did not have an easy job - what they could not find in the (rather scant) documentation, soma prescription, had to figure out directly from the Ruby source code. Soma prescription,

The Ruby book scene looks radically different today. Soma prescription, In fact we are facing the opposite problem: there are so much books on Ruby that sometimes it can be hard to choose which ones to read and in which order. Soma prescription, Probably it won’t be any easier to find the answers for these questions in the future: judging from the blogs and announcements, soma prescription, the bigger part of the books is yet to come. Soma prescription, If you are new to Ruby you will most probably have a hard time figure out how to spend your money wisely [1] - so what’s the solution?

Of course there is no definitive answer for this question - I can only tell you what worked for me.

First I would definitely recommend David A. Soma prescription, Black’s Ruby for Rails [2]. Soma prescription, It is absolutely suited for newcomers (and for advanced hackers, soma prescription, too), soma prescription, no matter if you are new to Ruby and/or coming from a different programming language [3]. Soma prescription, I was also a Python enthusiast (through doing most of my everyday work in Java) when I have discovered Ruby - and David’s book was a perfect choice to switch very fast.

Currently I am undecided between the 2nd and the 3rd place, soma prescription, so let’s say you should check them out in parallel - They are (of course) the pickaxe and Hal Fulton’s “The Ruby Way”. Soma prescription, They are both time-tested Ruby classics, soma prescription, hence a must read. Soma prescription, However, soma prescription, if you have time and/or money to read only one of the above books, soma prescription, in my opinion it should be “Ruby for Rails”.

Although these three masterpieces are - in my opinion - among the most well-written and informative tech books available today, soma prescription, you have to remember the good old rule: No matter how much books you read or how good they are - you will never become a true Ruby hacker until you actually begin to use the acquired knowledge and put it into practice. Soma prescription,

After reading these books I wanted to jump into writing some cool stuff - Ruby seemed to be so elegant, soma prescription, easy, soma prescription, succinct - and to my greatest surprise, soma prescription, I could not write too much sensible code :-) (at least not without referring to these books and/or google and/or ruby-talk more frequently that I considered o.k. Soma prescription, to call it programming on my own).

This is exactly the situation where the Ruby Cookbook should enter the scene. Soma prescription, The first three books give you a hint about what can be done with Ruby[4]. Soma prescription, The cookbook offers you well organized content in forms of recipes to show you how it can be done elegantly, soma prescription, quickly and effectively in a ruby-esque way.

Probably the most frequent answer to the question ‘How should I improve my Ruby skills’ on the ruby-talk mailing list sounds: By starting your own project. Soma prescription, Since I put this advice into practice myself and it worked for me, soma prescription, I have to agree: armed with the goodies from Learning Ruby, soma prescription, The Pickaxe and the Ruby way, soma prescription, the best thing to do is to grab a copy of the Cookbook and jump into your own project. Soma prescription, When I started my one, soma prescription, a web extraction framework, soma prescription, I had no idea about documenting Ruby code, soma prescription, packaging the whole program into a gem, soma prescription, logging, soma prescription, writing unit tests (in Ruby) and automatizing these tasks (and a lot of other things - this post would be considerably longer if I would like to state everything). Soma prescription, However, soma prescription, with the Ruby Cookbook by my side, soma prescription, learning and putting things into practice from writing the first line until packaging the whole framework into a gem was a piece of cake. Soma prescription,

If you are unfamiliar with the O’Reilly cookbook series format, soma prescription, it is a set of ‘recipes’ (problem statement, soma prescription, solution, soma prescription, discussion) divided into categories (like Strings, soma prescription, Arrays, soma prescription, Hashes… Soma prescription, in this case) for easy lookup of the problem at hand. Soma prescription, While it would be possible and certainly edifying to read the book cover to cover from the start (in this case you should also consider that it has 873 pages), soma prescription, I found that it really shines when you are stuck with a problem: you search for the relevant category and the relevant problem, soma prescription, apply the solution, soma prescription, read the discussion to understand what’s going on under the hood, soma prescription, rinse, soma prescription, repeat and after the 3rd or so cycle you will find out that you are not reaching for the book anymore (at least not because of this problem). Soma prescription,

OK, soma prescription, time to take a more detailed look at the content.

I would divide the book into five categories: Essentials, soma prescription, Ruby Specific Constructs, soma prescription, Advanced Techniques, soma prescription, Internet and networking and Software Management/Distribution. Soma prescription, I will review them one by one briefly.

  • Soma prescription, Essentials include Strings, soma prescription, Numbers, soma prescription, Arrays, soma prescription, Hashes, soma prescription, Date and Time, soma prescription, Files and Directories. Soma prescription, For a beginner Ruby journeyman, soma prescription, these chapters are a real gold mine. Soma prescription, Though the cookbook is not really intended for total beginners (it assumes a fair amount of Ruby knowledge), soma prescription, it certainly would not be impossible for a skilled (non-Ruby) programmer to understand most of the recipes since they are going from simple to complicated (e.g. Soma prescription, the String chapter begins with concatenating strings and closes with showing off text classification with a Bayesian classificator).

    Soma prescription, In this category I have probably learned the most Ruby best-practices from the chapters Arrays and Hashes [5]. Soma prescription, As a constant lurker on the ruby-talk mailing list, soma prescription, I have had some hard time figuring out all those inject()s and collect()s and each_slice()s and each_cons()s and other enumerator/iterator things - when I have thought I already understood them, soma prescription, somebody came with an even more complicated example and I was not so sure once again - until the moment I bought the book, soma prescription, that is.

    Soma prescription, The cookbook is very good at eliminating these vague and wobbly things like I had: you will not only understand what’s going on, soma prescription, but actually get comfortable using the idioms so typical for Ruby. Soma prescription, That’s so great about it. Soma prescription,

  • Soma prescription, Ruby Specific Constructs featuring Objects and Classes, soma prescription, Modules and Namespaces, soma prescription, and Reflection and Metaprogramming. Soma prescription, Every newcomer to Ruby encounters the wonders that (not exclusively but most characteristically) make the language so beautiful: code blocks, soma prescription, closures, soma prescription, mixins, soma prescription, the vast possibilities offered by metaprogramming and reflection just to mention some of them. Soma prescription, This chapter is written exactly to examine and discuss these constructs.

    Soma prescription, While probably I learned the most new things from this section, soma prescription, I have to say that I have been missing a meta-level here: The chapters (especially about metaprogramming) presented a lot of fancy LEGO bricks but did not show how to build a Statue of Liberty or Eiffel tower out of them (well, soma prescription, not even a simple medieval castle in my opinion :-). Soma prescription, Of course this does not need to be a problem - metaprogramming techniques should have a book on their own, soma prescription, and anyway a cookbook is not intended to solve concrete problems but rather reoccurring/frequent ones. Soma prescription, Probably I am just too curious about the ways of the meta :-). Soma prescription,

    Soma prescription, To sum it up, soma prescription, this and the previous section (Essentials) together helped to beef up my rubyish programming style by an enormous magnitude in the practice - nearly all information you need is there in the other books as well, soma prescription, but reading them does not make you comfortable with these techniques.

  • Soma prescription, Advanced Techniques include XML and HTML, soma prescription, Graphics and Other File Formats, soma prescription, Databases and Persistence, soma prescription, Multitasking and Multithreading, soma prescription, User Interface, soma prescription, Extending Ruby with Other Languages, soma prescription, and System Administration. Soma prescription, I was kind of unsure about this category - pairing UI with databases or system administration for example seemed odd for the first glance - but since I did not want to create even more categories, soma prescription, I have decided to put everything here which did not fit into the other ones, soma prescription, thus it can be viewed as a ‘miscellaneous’ section as well.

    Soma prescription, I would like to review two chapters here - HTML/XML and Databases and Persistence since these are the closest to my field of expertise and I also believe these two were the most deep in this category. Soma prescription, Again, soma prescription, this does not mean that the other chapters were not good, soma prescription, but in my opinion they just scratched the surface compared to above two.

    Soma prescription, The HTML/XML chapter really has it all: parsing, soma prescription, validating, soma prescription, transforming, soma prescription, extracting data from XML documents, soma prescription, encoding and XPath handling to highlight some interesting topics. Soma prescription, The coverage is surprisingly thorough for a language which is promoting YAML (Yaml Ain’t Markup Language) over XML. Soma prescription, The HTML chapters, soma prescription, though there is just a few of them, soma prescription, are also very useful:-downloading content from Web pages, soma prescription, extracting data from HTML, soma prescription, converting plain text to HTML and vice versa. Soma prescription, My only concern here is that I missed some third party package coverage (like RedCloth, soma prescription, BlueCloth, soma prescription, Hpricot or Mechanize) - but this is really nitpicking: if the author would take all my wishes into account, soma prescription, the book would have several thousand pages :-)

    Soma prescription, Databases and Persistence starts off with serialization recipes (using YAML, soma prescription, Marhsal and Madeleine). Soma prescription, Chapters on indexing unstructured as well as structured text (SimpleSearch, soma prescription, Ferret) are a pleasant surprise before the must-have topics take off: connecting and using different kinds of databases (MySQL, soma prescription, PostgreSQL, soma prescription, Berkley DB) as well as Object Relational Mapping frameworks (Rails ActiveRecord and Nitro Og) and doing every kind of SQL voodoo magic of course. Soma prescription, What should I add? Probably nothing.[6]

    Soma prescription, I would really like to write something about the other chapters in this category, soma prescription, too, soma prescription, but since I am constantly bashed for the length of my posts, soma prescription, just believe me that they are great as well :-).

  • Soma prescription, Internet and networking consists of Web Services and Distributed Programming, soma prescription, Internet Services and (surprise! surprise!) Web Development: Ruby on Rails. Soma prescription, It would be really a cliché to write about why and how much the Internet is so important nowadays, soma prescription, how much Web 2.0 rocks, soma prescription, SOA and WS and REST and FOO and BAR rules etc. Soma prescription, so I won’t do that ;-). Soma prescription, However, soma prescription, it is a fact that Web application development never mattered this much in the history - so these chapters were basically compulsory.

    Soma prescription, I would divide the category into two subcategories - Internet/Web stuff and distributed programming.

    Soma prescription, There is really not too much to add to the first category - there is an unbelievable amount of information crammed into two chapters: ‘abstract’ techniques (HTTP headers and requests, soma prescription, DNS lookup etc), soma prescription, using every kind of protocols (HTTP(s), soma prescription, POP, soma prescription, IMAP, soma prescription, FTP, soma prescription, telnet, soma prescription, SSH…), soma prescription, servlet, soma prescription, client/server and CGI programming as well as talking to Web APIs (amazon, soma prescription, flickr, soma prescription, google) and Web services of course (XML-RPC, soma prescription, SOAP). Soma prescription, In my opinion, soma prescription, the category offers more than enough information to get started and/or explore advanced techniques.

    Soma prescription, It’s a shame that Distributed Programming got the half of a chapter only - O.K., soma prescription, I admit I am somewhat inclined to these techniques and they are maybe not used by that much people. Soma prescription, The action is revolving mostly around DrB and Rinda, soma prescription, with an exception of 2 MemcCached recipes. Soma prescription, The chapter closes with a nice ‘putting things together’ recipe by creating a remote-controlled Jukebox.

    Soma prescription, I did not get too deep into the Ruby on Rails chapter, soma prescription, since I read Agile Web Development with Rails as well as Ruby for Rails and a lot of much more advanced Rails stuff previously - but judging from the recipe titles and skimming through some of them, soma prescription, the chapter looks very informative and unquestionably helpful if you have had no prior experience with Rails.

  • Soma prescription, Last but not least, soma prescription, Managing and Distributing Software includes Testing, soma prescription, Debugging, soma prescription, Optimizing, soma prescription, and Documenting, soma prescription, Packaging and Distributing Software and Automating Tasks with Rake. Soma prescription, If you plan to use Ruby for any other task than system administration (or writing very short scripts/one liners for whatever reason), soma prescription, documenting, soma prescription, testing, soma prescription, debugging and automating tasks is absolutely crucial. Soma prescription, I know that lot of coders does not like to hear this - since they want to code and not write tests, soma prescription, documentation etc. Soma prescription, - but I think nowadays, soma prescription, a serious programmer, soma prescription, no matter how much she would like to concentrate on hacking up feature MyNextCoolStuffWhichWillShakeTheEarth has to master these things. Soma prescription, In the long run, soma prescription, any software that is undocumented, soma prescription, tested and continuously refactored will turn into Spaghetti quite easily.

    Soma prescription, That said, soma prescription, these chapters were excellent for me. Soma prescription, I have experience with these tasks in Java - however, soma prescription, the toolset is radically different in some cases (like Ant vs. Soma prescription, Rake) and even if it is similar (Unit tests, soma prescription, rdoc vs. Soma prescription, JavaDoc) the re-learning of them was inevitable. Soma prescription, Fortunately, soma prescription, with the help of these recipes it was a breeze to learn them in Ruby (well, soma prescription, I have to add that actually these things (as nearly everything else) are considerably easier to do in Ruby, soma prescription, so the ease of learning stems from this fact as well). Soma prescription,

    Soma prescription, Rake absolutely rocks. Soma prescription, Maybe I am also concerned because I have been working with Apache Ant a lot - well, soma prescription, if the ratio between Ruby and Java code is say 1:10, soma prescription, then the ratio between Rake and Ant files is 1:50 if we also consider simplicity, soma prescription, maintainability and understandability. Soma prescription,

    Soma prescription, Finally, soma prescription, if you also plan to release your software, soma prescription, the chapter Managing and Distributing Software can come handy. Soma prescription, I think if you would like to distribute your stuff to the masses, soma prescription, packaging it into a gem is inevitable - rubygems are so cool that they made Rubyists too lazy to download something from a site instead of launching ‘gem my_cool_software’.

Conclusion


If you would like to become a serious Ruby hacker, soma prescription, don’t hesitate to buy this book. Soma prescription, In my opinion it is absolutely worth every cent - and even more. Soma prescription, My only problem is that there are no more recipes - however this is not a critique but rather a compliment: you simply can not get enough - not even from nearly 900 pages. Soma prescription, One could argue that some things are missing or he would rather see this instead of that (I believe the authors themselves have had some tough time deciding these matters) - but I guess everyone agrees that the material which made it to the book is absolutely top-notch. Soma prescription, 5 out of 5 stars - a great addition to anyone’s Ruby bookshelf.

Notes

Soma prescription,

[1] It is absolutely possible to learn Ruby withouth spending a nickel - there are excellent Ruby tutorials out there, soma prescription, like Why’s poignant guide to Ruby ( with cartoon foxes and chunky bacon :-)) or the first edition of the Pickaxe book which is available online for free, soma prescription, or Learning Ruby by Satish Talim, soma prescription, and a lot of other ones, soma prescription, too. Soma prescription, For some beginner ruby exercises you can also check out my earlier post: 15 exercises for learning a new programming language - or just use google…Back

Soma prescription,

[2] I am not sure whether it was the best move to include ‘Rails’ in the title - it may turn down some who would like to learn Ruby but not Rails. Soma prescription, However, soma prescription, I can assure you that this book is a true Ruby masterpiece. Soma prescription, Though there are some interesting Rails techniques included, soma prescription, the primary focus is unquestionably Ruby. Soma prescription, Back

Soma prescription,

[3] There is one possible exception: If you are new not only to Ruby but also to programming, soma prescription, you should probably check out Chris Pine’s Learning to program first. Soma prescription, Back

Soma prescription,

[4] Of course there will be always some overlapping and not every book can be absolutely correctly categorized in every case (for example, soma prescription, the Ruby Way has also a cookbook-like chapters) Back

Soma prescription,

[5] Of course this does not mean that the rest of the chapters were not that helpful - just coming from Python, soma prescription, I did not have so much ‘wow’ moments. Soma prescription, Nevertheless, soma prescription, they also teach a lot of idioms and are in no way less informative than the other two. Soma prescription, Back

Soma prescription,

[6] Devil’s advocate(tm) says: maybe some chapters on SQLite and Oracle, soma prescription, as well as advanced SQL stuff would be cool - however, soma prescription, this is really mega-über nitpicking since then the title should be ‘Ruby and SQL cookbook’ :-) Back

Soma prescription,

Similar Posts:xanax pills,soma prescription,discount diflucan,cialis tablet,buy cialis without prescription

Cialis pills

Thursday, November 16th, 2006

Cialis pills, A short time ago in a galaxy not so far, cialis pills, far away I came across a nice blog post: 15 Exercises for Learning a new Programming Language.

Cialis pills, One could argue if these are *really* the most appropriate 15(+) exercises to learn a new programming language - however, cialis pills, the task of answering this rather complex question is left as an exercise for the reader. Cialis pills, Instead of this I will show you their implementation in Ruby - rubyrailways.com style.

Cialis pills, Why did I bother to solve these problems (including not really trivial ones, cialis pills, like a scientific calculator with a GUI) ? Well, cialis pills, actually to learn a new programming language! I still consider myself a beginner Ruby apprentice just playing it by ear in my somewhat scarce free time, cialis pills, so I thought that systematically implementing a task list like this will mean great step forward for me compared to just coding random things at random times. Cialis pills, Fortunately I was perfectly right!

Cialis pills, Before we move onto the code, cialis pills, one last disclaimer: the fact that I am still a Ruby n00b implies that the code can be somewhat hairy/not optimal/[insert any other language than Ruby here]-ish so don’t use these snippets as a textbook solution of the problems or anything like that. Cialis pills, I would be glad if someone could suggest a bit of refactoring of the bad parts but I also hope that that there are some nice parts which you can learn from (actually I am quite sure about this since I used some magick formulas from a few Ruby (grand)masters in some cases).

Cialis pills, OK, cialis pills, enough talk for now. Cialis pills, Let’s see the stuff!

Cialis pills, 1. Cialis pills, Problem: “Display series of numbers (1, cialis pills,2, cialis pills,3, cialis pills,4, cialis pills, 5….etc) in an infinite loop. Cialis pills, The program should quit if someone hits a specific key (Say ESCAPE key).”

Cialis pills, Solution: Hmm, cialis pills, well, cialis pills, errr…uh-oh… Cialis pills, I could not solve this problem fully (what a terrific start :-)). Cialis pills, If Henry Ford would sit beside me now, cialis pills, he would say : You can hit any key to exit - so long as it’s ‘C’ - and one more advice: don’t forget to hold CTRL during this action :-). Cialis pills, More on this after the code snippet:

Cialis pills,

  1. i = 0
  2. loop { print "#{i+=1}, cialis pills, " }

Cialis pills, Comments : If anyone knows how to add code which will cause this program to stop with a specific keyhit (say ‘ESC’) please, cialis pills, please, cialis pills, please drop me a note. Cialis pills, I have been researching this for at least 10% of the time of solving all the tasks, cialis pills, nearly spitting blood when I gave up :-). Cialis pills, It seems (to me) that there is no simple (i.e. Cialis pills, no threads and similar) and clean platform-independent solution for this problem. Cialis pills, I guess (hope) the author’s idea here was different than to introduce threading or writing platform specific-code…

Cialis pills, 2. Cialis pills, Problem: “Fibonacci series, cialis pills, swapping two variables, cialis pills, finding maximum/minimum among a list of numbers.”

Cialis pills, Solution:

Cialis pills,

  1. #Fibonacci series
  2. Fib = Hash.new{ |h, cialis pills, n| n < 2 ? h[n] = n : h[n] = h[n - 1] + h[n - 2] }
  3. puts Fib[50]
  4.  
  5. #Swapping two variables
  6. x, cialis pills,y = y, cialis pills,x
  7.  
  8. #Finding maximum/minimum among a list of numbers
  9. puts [1, cialis pills,2, cialis pills,3, cialis pills,4, cialis pills,5, cialis pills,6].max
  10. puts [7, cialis pills,8, cialis pills,9, cialis pills,10, cialis pills,11].min

Cialis pills, Comments: The Fibonacci code was written by Andrew Johnson (found via Ruby Quiz). Cialis pills, I like it so much that I think it would be a shame to present a trivial version here. Cialis pills, I guess the rest of the code is self-explanatory.

Cialis pills, 3. Cialis pills, Problem: “Accepting series of numbers, cialis pills, strings from keyboard and sorting them ascending, cialis pills, descending order.”

Cialis pills, Solution:

Cialis pills,

  1. a = []
  2. loop { break if (c = gets.chomp) == ‘q’; a << c }
  3. p a.sort
  4. p a.sort { |a, cialis pills,b| b<=>a }

Cialis pills, Comments: This version is accepting strings - I think anybody who got to this point can adapt it to work with numbers. Cialis pills,

Cialis pills, 4. Cialis pills, Problem: “Reynolds number is calculated using formula (D*v*rho)/mu Where D = Diameter, cialis pills, V= velocity, cialis pills, rho = density mu = viscosity Write a program that will accept all values in appropriate units (Don’t worry about unit conversion) If number is < 2100, cialis pills, display Laminar flow, cialis pills, If it’s between 2100 and 4000 display 'Transient flow' and if more than '4000', cialis pills, display 'Turbulent Flow' (If, cialis pills, else, cialis pills, then...)"

Cialis pills, Solution:

Cialis pills,

  1. vars = %w{D V Rho Mu}
  2.  
  3. vars.each do |var|
  4.   print "#{var} = "
  5.   val = gets
  6.   eval("#{var}=#{val.chomp}")
  7. end
  8.  
  9. reynolds = (D*V*Rho)/Mu.to_f
  10.  
  11. if (reynolds < 2100)
  12.   puts "Laminar Flow"
  13. elsif (reynolds > 4000)
  14.   puts "Turbulent Flow"
  15. else
  16.   puts "Transient Flow"
  17. end

Cialis pills, Comments: Can you spot the trick in the part which is filling up the variables? They don’t go out of scope after the loop ends because they are constants. Cialis pills, Other possibility would be to use $global variables but I guess it is usually not a very good programming practice to do that.

Cialis pills, 5. Cialis pills, Problem: “Modify the above program such that it will ask for ‘Do you want to calculate again (y/n), cialis pills, if you say ‘y’, cialis pills, it’ll again ask the parameters. Cialis pills, If ‘n’, cialis pills, it’ll exit. Cialis pills, (Do while loop) While running the program give value mu = 0. Cialis pills, See what happens. Cialis pills, Does it give ‘DIVIDE BY ZERO’ error? Does it give ‘Segmentation fault..core dump?’. Cialis pills, How to handle this situation. Cialis pills, Is there something built in the language itself? (Exception Handling)”

Cialis pills, Solution:

Cialis pills,

  1. vars = { "d" => nil, cialis pills, "v" => nil, cialis pills, "rho" => nil, cialis pills, "mu" => nil }
  2.  
  3. begin
  4.   vars.keys.each do |var|
  5.     print "#{var} = "
  6.     val = gets
  7.     vars[var] = val.chomp.to_i
  8.   end
  9.  
  10.   reynolds = (vars["d"]*vars["v"]*vars["rho"]) / vars["mu"].to_f
  11.   puts reynolds
  12.  
  13.   if (reynolds < 2100)
  14.     puts "Laminar Flow"
  15.   elsif (reynolds > 4000)
  16.     puts "Turbulent Flow"
  17.   else
  18.     puts "Transient Flow"
  19.   end
  20.  
  21.   print "Do you want to calculate again (y/n)? "
  22. end while gets.chomp != "n"

Cialis pills, Comments: As you can see, cialis pills, I could not use the same trick here when asking for the variables, cialis pills, because when somebody wants to calculate again, cialis pills, Ruby will complain (although by printing a warning only) that the constants have been already set up. Cialis pills, Therefore I went for the hash solution. Cialis pills, I think the do-you-want-to-calculate-again part is straightforward so I won’t analyze that here.
“While running the program give value mu = 0.”
Ruby gives a rather interesting result in this case: infinity :-).
“Is there something built in the language itself?”
Sure: exception handling. Cialis pills, Division by zero could be caught with a ZeroDivisionError rescue clause.

Cialis pills, 6. Cialis pills, Problem: “Scientific calculator supporting addition, cialis pills, subtraction, cialis pills, multiplication, cialis pills, division, cialis pills, square-root, cialis pills, square, cialis pills, cube, cialis pills, sin, cialis pills, cos, cialis pills, tan, cialis pills, Factorial, cialis pills, inverse, cialis pills, modulus”

Cialis pills, Solution:
Since this code snippet is longer It would look ugly here - you can download it from here instead. Cialis pills,

Screenshot:

screenshot of the scientific calculator in action

Cialis pills, If you would like to try it, cialis pills, you will need the Tk bindings for Ruby (maybe you have them already, cialis pills, here on Ubuntu I did not). Cialis pills, Also note that only the regular 0-9 keys (and of course the mouse) work, cialis pills, the numpad ones do not. Cialis pills, One more little detail: % stands for modulo, cialis pills, not percent.

Cialis pills, Comments: Phew, cialis pills, this was a real challenge, cialis pills, mostly because I never did any GUI in Ruby before. Cialis pills, I was amazed that I could code up a relatively feature rich calculator in 100+ lines of code, cialis pills, without any golfing or trying to optimize for shortness. Cialis pills, What I wanted to say with this is that the shortness does not praise my programming skills (since I did not eve try to golf) but the superb terseness of Ruby. Cialis pills, OK, cialis pills, of course there are some problems (e.g. Cialis pills, cube, cialis pills, cos, cialis pills, tan, cialis pills, inverse are not implemented) but the usability/amount of code ratio is unbelievably high.

Cialis pills, The GUI is also not the nicest since I have used Tk - wxRuby or qt-ruby would produce much nicer results, cialis pills, but since I did not code any GUI in Ruby previously, cialis pills, I have decided to try the good-old-skool Tk for the first time.

Cialis pills, 7. Cialis pills, Problem: “Printing output in different formats (say rounding up to 5 decimal places, cialis pills, truncating after 4 decimal places, cialis pills, padding zeros to the right and left, cialis pills, right and left justification)(Input output operations)”

Cialis pills, Solution:

Cialis pills,

  1. #rounding up to 5 decimal pleaces
  2. puts sprintf("%.5f", cialis pills, 124.567896)
  3.  
  4. #truncating after 4 decimal places
  5. def truncate(number, cialis pills, places)
  6.   (number * (10 ** places)).floor / (10 ** places).to_f
  7. end
  8.  
  9. puts truncate(124.56789, cialis pills, 4)
  10.  
  11. #padding zeroes to the left
  12. puts ‘hello’.rjust(10, cialis pills,’0)
  13.  
  14. #padding zeroes to the right
  15. puts ‘hello’.ljust(10, cialis pills,’0)
  16.  
  17. #right justification
  18. puts ">>#{’hello’.rjust(20)}<<"
  19.  
  20. #left justification
  21. puts ">>#{’hello’.ljust(20)}<<"

Cialis pills, Comments: Amazingly lot of things can be done with sprintf() - I could solve nearly all the problems with it - but that would not really be rubyish, cialis pills, so I have decided for built-in (and one homegrown) functions. Cialis pills, However, cialis pills, mastering (s)printf() is a very handy thing, cialis pills, since nearly all big players (C (of course :-)), cialis pills, C++, cialis pills, Java, cialis pills, PHP, cialis pills, … Cialis pills, ) have it so you get a powerful function in more languages for the price of learning one). Cialis pills, As you can see, cialis pills, r/ljust is a nice one, cialis pills, too.

Cialis pills, 8. Cialis pills, Problem: “Open a text file and convert it into HTML file. Cialis pills, (File operations/Strings)”

Cialis pills, Solution: Well, cialis pills, this problem was not specified in a great detail, cialis pills, to say the least - or to put it otherwise, cialis pills, the solvers are given a great freedom to provide a solution spiced up with their fantasy. Cialis pills, This is what I came up with:

Cialis pills,

FINAL_DOC rules = {'*something*' => 'something', cialis pills, '/something/' => 'something'} rules.each do |k, cialis pills,v| re = Regexp.escape(k).sub(/something/) {"(.+?)"} doc.gsub!(Regexp.new(re)) do content = $1 v.sub(/something/) { content } end end doc.gsub!("\n\n") {"\n

Cialis pills, "} final_doc.sub!(/embed_doc_here/) {doc} puts final_doc

  1. doc = <<DOC
  2.  This is the first line in the first paragraph. <b>Cialis pills</b>, Nothing really interesting here, cialis pills, just plain text.
  3.  
  4. This is the second paragraph. <b>Cialis pills</b>, Let’s see some *strong* markup in action, cialis pills, and also /italic/. <b>Cialis pills</b>, So far soo good.
  5.  
  6. This is the last paragraph, cialis pills, with one more <strong>strong tag</strong>.
  7. DOC
  8.  
  9. final_doc = <<FINAL_DOC
  10. <html>
  11.   <head>
  12.     <title>Text to HTML fun!</title>
  13.   </head>
  14.   <body>
  15.     <p>Cialis pills,
  16.     embed_doc_here
  17.     </p>
  18.   </body>
  19. </html>
  20. FINAL_DOC
  21.  
  22. rules = {‘*something*’ => ‘<strong>something</strong>’, cialis pills,
  23.          ’/something/’ => ‘<i>something</i>’}
  24.  
  25. rules.each do |k, cialis pills,v|
  26.   re = Regexp.escape(k).sub(/something/) {"(.+?)"}
  27.   doc.gsub!(Regexp.new(re)) do
  28.     content = $1
  29.     v.sub(/something/) { content }
  30.   end
  31. end
  32.  
  33. doc.gsub!("\n\n") {"</p>\n<p>Cialis pills, "}
  34.  
  35. final_doc.sub!(/embed_doc_here/) {doc}
  36.  
  37. puts final_doc

Cialis pills, Comments: As you can see, cialis pills, besides that the text is wrapped around with a minimal HTML, cialis pills, every occurrence of words between asterisks is outputted in strong and between slashes in italic. Cialis pills, You can add as many such rules as you like, cialis pills, they will be (hopefully) substituted in the final output.

Cialis pills, 9. Cialis pills, Problem: “Time and Date : Get system time and convert it in different formats ‘DD-MON-YYYY’, cialis pills, ‘mm-dd-yyyy’, cialis pills, ‘dd/mm/yy’ etc.”

Cialis pills, Solution: Well, cialis pills, it was not really clear (for me) what should be the difference between ‘yyyy’ and ‘YYYY’ (resp. Cialis pills, ‘dd’ vs ‘DD’) so again I had to use my imagination. Cialis pills, However, cialis pills, I guess it does not matter too much, cialis pills, the solution has to be changed by 1-2 characters only if the original author had something different on his mind.

Cialis pills,

  1. require ‘date’
  2.  
  3. time = Time.now
  4. #’DD-MON-YYYY’, cialis pills, e.g. <b>Cialis pills</b>, 12-Nov-2006 in my interpetation
  5. puts time.strftime("%d-%b-%Y")
  6.  
  7. #’mm-dd-yyyy’, cialis pills, e.g. <b>Cialis pills</b>, 11-12-2006 in my interpetation
  8. puts time.strftime("%m-%d-%Y")
  9.  
  10. #’dd/mm/yy’, cialis pills, e.g. <b>Cialis pills</b>, 12/11/2006 in my interpetation
  11. puts time.strftime("%d/%m/%Y")

Cialis pills, 10. Cialis pills, Problem: “Create files with date and time stamp appended to the name”

Cialis pills, Solution:

Cialis pills,

  1. #Create files with date and time stamp appended to the name
  2. require ‘date’
  3.  
  4. def file_with_timestamp(name)
  5.   t = Time.now
  6.   open("#{name}-#{t.strftime(’%m.%d’)}-#{t.strftime(’%H.%M’)}", cialis pills, ‘w’)
  7. end
  8.  
  9. my_file = file_with_timestamp(test.txt)
  10. my_file.write(‘This is a test!’)
  11. my_file.close

Cialis pills, Comments: Maybe a more elegant solution could be to subclass File and override its constructor - but maybe that would be an overkill. Cialis pills, I have voted for the latter option in this case :-).

Cialis pills, 11. Cialis pills, Problem: “Input is HTML table. Cialis pills, Remove all tags and put data in a comma/tab separated file.”

Cialis pills, Solution: Since web extraction is both my PhD topic and my everyday job (and even my free-time activity :-)) I will present 3 solutions for this problem. Cialis pills, First, cialis pills, the classic old-school regexp way (by Paul Lutus), cialis pills, then with HPricot and finally with scRUBYt!, cialis pills, a simple yet powerful Ruby web extraction framework currently developed by me.

Cialis pills,

  1. table = <<DOC
  2. <table>
  3.   <tr>
  4.     <td>1</td>
  5.     <td>2</td>
  6.   </tr>
  7.   <tr>
  8.     <td>3</td>
  9.     <td>4</td>
  10.     <td>5</td>
  11.   </tr>
  12.   <tr>
  13.     <td>6</td>
  14.   </tr>
  15. </table>
  16. DOC
  17.  
  18. rows = table.scan(%r{<tr>.*?</tr>}m)
  19.  
  20. rows.each do |row|
  21.    fields = row.scan(%r{<td>(.*?)</td>}m)
  22.    puts fields.join(", cialis pills,")
  23. end

Cialis pills, Now for the HPricot solution (in the further examples let’s consider that table is initialized as in the previous example):

  1. require ‘rubygems’
  2. require ‘hpricot’
  3.  
  4. h_table = Hpricot(table)
  5.  
  6. rows = h_table/"//tr"
  7. rows.each do |row|
  8.   child_text = (row/"//td").collect {|elem| elem.innerHTML }
  9.   puts child_text.join(‘, cialis pills,’)
  10. end

Cialis pills, and last, cialis pills, but not least scRUBYt!

  1. require ’scrubyt’
  2.  
  3. table_data = P.table do
  4.                P.cell1
  5.              end
  6.  
  7. table_data.generalize :cell
  8.  
  9. puts table_data.to_csv

Cialis pills, Some explanation: first of all, cialis pills, at the moment scRUBYt! is avaliable on my hard disk (and partially in my head) only - it should be released around XMAS 2006. Cialis pills, I am using this solution for a little bit of self-promotion :-). Cialis pills,

Cialis pills, The example works like this: extract something (in this case a HTML <table>) which has something (in this case <td>) which has ‘1′ as its text (well in reality much more is going on in the background, cialis pills, but roughly along these lines). Cialis pills, This little code snippet will extract the first <td>s of ALL <tables> on a HTML page. Cialis pills, With the ‘generalize’ call we tell the extractor that it should not extract just the first <td> in a table (which is the default setting), cialis pills, but all of them.

Cialis pills, scRUBYt! can handle much, cialis pills, much, cialis pills, MUCH more complicated examples than this (like an ebay or amazon page) and has loads of sophisticated functions… Cialis pills, so stay tuned!

Cialis pills, 12. Cialis pills, Problem: “Extract uppercase words from a file, cialis pills, extract unique words.”

Cialis pills, Solution: (you can find some_uppercase_words.txt here and some_repeating_words.txt here

Cialis pills,

  1. open(’some_uppercase_words.txt).read.split().each { |word| puts word if word =~ /^[A-Z]+$/ }
  2.  
  3. words = open(’some_repeating_words.txt).read.split()
  4. histogram = words.inject(Hash.new(0)) { |hash, cialis pills, x| hash[x] += 1; hash}
  5. histogram.each { |k, cialis pills,v| puts k if v == 1 }

Cialis pills, 13. Cialis pills, Problem: “Implement word wrapping feature (Observe how word wrap works in windows ‘notepad’).”

Cialis pills, Solution: Unfortunately I am not a Windows user and I have seen notepad a *quite* long time ago - so I am not sure the task and it’s implementation are fully in-line - I have tried my best. Cialis pills, Here we go:

Cialis pills,

  1. input = "Lorem ipsum dolor sit amet, cialis pills, consectetur adipisicing elit, cialis pills, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. <b>Cialis pills</b>, Ut enim ad minim veniam, cialis pills, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. <b>Cialis pills</b>, Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. <b>Cialis pills</b>, Excepteur sint occaecat cupidatat non proident, cialis pills, sunt in culpa qui officia deserunt mollit anim id est laborum."
  2.  
  3. def wrap(s, cialis pills, len)
  4.   result = ”
  5.   line_length = 0
  6.   s.split.each do |word|
  7.     if line_length + word.length + 1  < len
  8.       line_length += word.length + 1
  9.       result += (word + ‘ ‘)
  10.     else
  11.       result += "\n"
  12.       line_length = 0
  13.     end
  14.   end
  15.   result
  16. end
  17.  
  18. puts wrap(input, cialis pills, 30)

Cialis pills, 14. Cialis pills, Problem: “Adding/removing items in the beginning, cialis pills, middle and end of the array.”

Cialis pills, Solution:

Cialis pills,

  1. x = [1, cialis pills,3]
  2.  
  3. #adding to beginning
  4. x.unshift(0)
  5.  
  6. #adding to the end
  7. x << 4
  8.  
  9. #adding to the middle
  10. x.insert(2, cialis pills,2)
  11.  
  12. #removing from the beginning
  13. x.shift
  14.  
  15. #removing from the end
  16. x.pop
  17.  
  18. #removing from the middle
  19. x.delete(2)
  20.  
  21. #we have arrived at the original array!

Cialis pills, 15. Cialis pills, Problem: “Are these features supported by your language: Operator overloading, cialis pills, virtual functions, cialis pills, references, cialis pills, pointers etc.”

Cialis pills, Solution: Well this is not a real problem (not in Ruby, cialis pills, at least). Cialis pills, Ruby is a very high level language ant these things are a must :).

Finally, cialis pills, you can download all the solutions in a single archive from here. I would like to see the implementation of these tasks in both Ruby (different (more optimal) solutions of course) as well as in anything else. Cialis pills, If you set out to do something like that, cialis pills, be sure to drop me a note.

Internet contains huge number of opportunities to earn money online. Cialis pills, Simply create a site that you think has the potential to sell hot items using ruby on rails. Cialis pills, Register a relevant domain name and purchase a web hosting service through hostgator, cialis pills, one of the better web host out there today. Cialis pills, Get a internet connection through one of the wireless internet providers to upload your site. Cialis pills, Work on search engine optimization to get a better traffic and also use affiliate marketing program for the same reason. Cialis pills, Finally get a free voip phone service to contact customers directly. Cialis pills, The pc to phone system is the most effective method of marketing.


Similar Posts:viagra prices,cialis pills,buy cialis no prescription required,buy zithromax without prescription,bactrim pills

Posted in Devel, Ruby, Tutorial | 31 Comments »


Bad Behavior has blocked 1213 access attempts in the last 7 days.