header image

Archive for 2006

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:lexapro online,soma prescription,reductil for order,zoloft pills,purchase valium online

Cheap prozac

Wednesday, December 6th, 2006

I am constantly trying to update rubyrailways.com with useful features and enhancements (feedback is warmly welcome - even the present look was influenced by a lot of your comments). Cheap prozac, This is the last set of updates:

  • Ajaxified Comment Preview

    Cheap prozac, is a handy WordPress plugin which can create a preview of the comment you are currently writing before you actually post it. Cheap prozac, Check out any of the posts (e.g. Cheap prozac, this one :-)) and scroll down to the ‘Leave a Reply’ section to see it in action (you don’t actually have to comment if you just would like to play around). Cheap prozac,

    Cheap prozac, Markdown should work with the comments, cheap prozac, too. Cheap prozac, For adding a comment which contains code, cheap prozac, I recommend to use the <pre> tag to preserve whitespace (unfortunately SyntHiHol (see next bullet) does not work here).

  • SyntHiHol

    Cheap prozac, is a code highlighter, cheap prozac, you can see it in action in my last post for example. Cheap prozac, All you have to do to achieve these nicely highlighted code blocks is to write the code in a div with the attribute “lang” (possible values include ruby, cheap prozac, python, cheap prozac, java, cheap prozac, php, cheap prozac, c, cheap prozac, c++, cheap prozac, c#, cheap prozac, bash, cheap prozac, …. Cheap prozac, nearly 70 languages!). Cheap prozac, Cool, cheap prozac, isn’t it?

  • Akismet

    Cheap prozac, though I don’t think so there is anybody who does not know akismet, cheap prozac, for completeness, cheap prozac, sake, cheap prozac, it’s “a plugin which identifies and blocks comment and trackback spam on blogs with integration to various blogging systems”. Cheap prozac, In the dark pre-akismet era I have received 10-15 spams a day on average. Cheap prozac, Guess how much did I get since the installation? Exactly zero. Cheap prozac, It sounds unbelievable but it’s true

    . Cheap prozac, I have just checked - akismet caught 370 spam comments during its 1-month reign.
  • Installed trac

    Cheap prozac, a web-based software project management tool - well this is not of too much interest to the readers of this blog (yet) but maybe someone is interested in my experience. Cheap prozac,

    Cheap prozac, Currently this site is hosted on dreamhost, cheap prozac, and fortunately I have found the DreamTrac script for trac installation on DH. Cheap prozac, Well, cheap prozac, I think now, cheap prozac, after all the struggling I would be able to install trac with this script for the first try - but the current installation took me about 3 hours and 8 tries. Cheap prozac,

    Cheap prozac, However, cheap prozac, this was not the biggest problem - after all I have managed to install and configure trac - it was much worse that the script (or trac configuration?) overwrote my .htaccess file in the home directory, cheap prozac, which caused the main site (https://rubyrailways.com ) to stop - and even worse, cheap prozac, it exposed my whole home directory to the world! :-) Since I did not count with such side effects, cheap prozac, I have found and corrected this problem after a few hours only.

    Cheap prozac, If this would not be enough, cheap prozac, ther is one ‘minor’ problem with trac on dreamhost: for me it is so slow that it is practically unusable (takes about 20-30 seconds, cheap prozac, sometimes more to load). Cheap prozac, I don’t know what can be the problem - it’s fastcgi enabled, cheap prozac, and though not explicitly optimized, cheap prozac, I don’t think so it should look like this… Cheap prozac, Any ideas?

Similar Posts:order zoloft,cheap prozac,cheap diazepam,discount alprazolam,buy clonazepam

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:generic lexapro,cialis pills,purchase phentermine online,reductil without prescription,clonazepam pills

Posted in Devel, Ruby, Tutorial | 30 Comments »

Viagra pharmacy

Tuesday, November 14th, 2006
  1. Viagra pharmacy, Sliced bread (1928, viagra pharmacy, Otto Frederick Rohwedder)
  2. Viagra pharmacy, Ruby (1995, viagra pharmacy, Yukihiro “Matz” Matsumoto)
  3. Viagra pharmacy, HPricot (2006, viagra pharmacy, Why the lucky stiff)
  4. Viagra pharmacy, Ruby on Rails (2005, viagra pharmacy, David Heinemeier Hansson)

What a relief! I really had the urge to tell everybody how cool HPricot is, viagra pharmacy, just did not know the way yet - until now. Viagra pharmacy, The cosmic balance is somewhat restored now that I blurted out this post :-).

Needless to say, viagra pharmacy, you need to take this list with a tiny droplet of humor: Of course if we consider development time, viagra pharmacy, amount and scope of offered solutions, viagra pharmacy, innovation, viagra pharmacy, community, viagra pharmacy, book coverage etc. Viagra pharmacy, etc. Viagra pharmacy, then Rails is a clear winner (and anyway, viagra pharmacy, the two players are not in the same league). Viagra pharmacy, However, viagra pharmacy, HPricot is a great example of how a not-new-at-all thing can be made much more usable, viagra pharmacy, fast and “heaps of fun to use” (really) just by clever design and usage of the right tools (and a dash of a cool programmer’s charisma). Viagra pharmacy, It is one thing to come up with a purple cow on a non-saturated market with lots of space for innovation, viagra pharmacy, and a different story to do the same when everything has been already said and done. Viagra pharmacy, And _why did it. Viagra pharmacy, Again.

I am writing a (not so) small web extraction framework in Ruby (planned release XMAS 2006) which heavily relies on HPricot as the HTML query language - so I dare to say I know (at least some parts of) HPricot pretty well, viagra pharmacy, yet it still keeps me totally amazed. Viagra pharmacy, What I like the most about it (besides that it is lightning-on-steroids fast compared to anything available for the same task, viagra pharmacy, feature rich, viagra pharmacy, reliable, viagra pharmacy, stable etc. Viagra pharmacy, etc.) is that it takes the ‘principle of least surprise’ to the next level: I would call it ‘principle of almost no surprise’. Viagra pharmacy, If someone has a bit of knowledge about org.w3c.dom, viagra pharmacy, XML, viagra pharmacy, XPath, viagra pharmacy, XSLT and/or has experience with other HTML/XML parsers/tools will have to refer to the documentation very rarely (of course there is a period of learning the basics and soaking into the HPricot-philosophy, viagra pharmacy, but the learning curve is really steep).

Before I get to the proof that HPricot is able to solve the food problems in Africa or something, viagra pharmacy, I need to cool down a bit :-): HPricot is not for everyone and not for every problem. Viagra pharmacy, If you need complex XPath evaluation for instance, viagra pharmacy, you will have to stick with the good old REXML (for now , viagra pharmacy, at least - I read that _why will add more XPath support and other goodies in the future). Viagra pharmacy, In the present version, viagra pharmacy, you won’t be able to evaluate things like axes (e.g. Viagra pharmacy, ancestor::html) or XPath functions (e.g. Viagra pharmacy, normalize-space) and not even XPaths with indices (like html/body/table[1]/tr[2]/td[5] - though I wrote a small script to remedy this problem temporarily.)

There are a lots of HTML-extraction related questions on the Ruby mailing list (like how to extract every table cell from a <tablle:> etc.) My advice is to alwways check out HPricot first: Sometimes it can be an overkill to use it (if you can get what you want with a simple regexp, viagra pharmacy, for example) but usually it is the right tool to parse and query even the ugliest HTML pages out there- unless you need heavy XPath/XQuery machinery which is rarely the case in the real life.

What else do I need to add? Great job, viagra pharmacy, _why. Viagra pharmacy, Thanks man.

Similar Posts:zoloft,viagra pharmacy,order zithromax,ambien for order,phentermine without prescription

Posted in Ruby | 35 Comments »

Buy viagra

Friday, November 10th, 2006

These have been dugg and dzoned and [fill in your favorite social bookmarking site]d so nothing really new here , buy viagra, but they made me laugh out loud - so in the case anyone missed them:

:-)

Similar Posts:discount lexapro,buy viagra,ambien for sale,cheapest doxycycline,online pharmacy viagra

Posted in Devel, Fun | 4 Comments »

Cheapest viagra

Thursday, November 2nd, 2006

Before everything else, cheapest viagra, getting ready is the secret of success. Cheapest viagra, (Henry Ford)

Cheapest viagra, For the last few months of my professional/geek life I have felt like I am sitting on a huge roller coaster – reaching the sky today just to find myself at the bottom of a cozy swamp tomorrow. Cheapest viagra, Sometimes I have days when I achieve the work of ten people and I am filled with so much energy and enthusiasm that my family is afraid I might blow up in any minute :-). Cheapest viagra, Even after such a very busy day I usually can not sleep too well because I am thinking/dreaming about how this or that unit test or piece of code could be improved and how will I tackle it tomorrow morning.

Cheapest viagra, However, cheapest viagra, more frequently then I would like it to happen, cheapest viagra, the very next day everything may turn out quite the opposite: Working may be mixed with browsing, cheapest viagra, playing video games, cheapest viagra, watching TV etc. Cheapest viagra, instead of focused and effective work that was fueling me to the boiling point yesterday.To add to the frustration, cheapest viagra, it is more or less unpredictable in advance when and why are the ups and downs coming and how long will they persist. Cheapest viagra,

Cheapest viagra, My overall average productivity is about equal with a well balanced person: both of us is working 200 hours a month. Cheapest viagra, However, cheapest viagra, the balanced guy achieves this by working 50 hours a week whereas my pattern is absolutely unpredictable – it may be 30 + 80 + 20 + 70 or 20 + 30 + 40 + 110 or anything that sums up to 200. Cheapest viagra, I guess 200 + 0 + 0 + 0 did not happen for only single reason yet: because a week has just 168 hours. Cheapest viagra,

Cheapest viagra, Someone could argue: why bother then? After all, cheapest viagra, the job gets done and that is all what matters. Cheapest viagra, Well, cheapest viagra, for me this is not the only thing that matters: to effectively pursue a wide range of activities, cheapest viagra, some kind of planning is needed in order to be able to process them all at once, cheapest viagra, ensuring that each gets the proper weight at due time. Cheapest viagra, While the hectic model was OK during the campus life (i.e. Cheapest viagra, watch a season of 24 (24 hours), cheapest viagra, do the work of yesterday and today (20 hours), cheapest viagra, get some sleep at last (20 hours), cheapest viagra, rinse, cheapest viagra, repeat etc), cheapest viagra, the balanced way of doing things is recommended if you have a family and job yet you still would like to stay involved in a diverse array of activities. Cheapest viagra,

Cheapest viagra, My wife used to laugh at me in the mornings when I put on my loser or winner face. Cheapest viagra, With her constant teasing she made me understand that the fact that how I feel the given day and what I am able to do depends only on me and not on certain circumstances. Cheapest viagra,

Cheapest viagra, My biggest problem seems to be that after the first excitement I tend to easily lose my interest in about everything I start. Cheapest viagra, This of course leads to cooling down and eventually drifting off the track right before the finish line. Cheapest viagra, Why? Well, cheapest viagra, to jump into some “more interesting stuff” of course. Cheapest viagra, The result: constant feeling of failure and no results to show up. Cheapest viagra, Sad but true. Cheapest viagra,

Cheapest viagra, Since I am an optimistic person and I hate to be in unpleasant situations if I can choose not to, cheapest viagra, after all that struggling I decided to come up with a plan to “visit” the finish line more often ;-) The points I have identified work for me pretty well so far and I am updating and extending them from time to time based on the results in practice. Cheapest viagra, At the moment this is what I have:

  1. Have a clear vision – if you do not know exactly what do you want to reach or where you want to end up, cheapest viagra, you will never reach that point. Cheapest viagra, (Even if you would, cheapest viagra, how would you know? :-)
  2. Make a detailed plan – if you see the progress, cheapest viagra, it motivates you to continue. Cheapest viagra, You can break down any task to small pieces. Cheapest viagra, By the end of the day, cheapest viagra, looking at your to-do list you can put up your “I made a great step forward today” smile with reason. Cheapest viagra, I break down even the household chores to small tasks, cheapest viagra, so after looking at my all-checked to-do list my wife thinks I am the fastest and most effective clean-up guy on the globe ;). Cheapest viagra, “Nothing is particularly hard if you divide it into small jobs.” (Henry Ford)
  3. Find a partner – even the most excited people lose their enthusiasm over time. Cheapest viagra, A good partner can help you to stand up when you feel like falling or loosing interest and makes you go further if you are just about to give up.
  4. Value yourself and the progress you have achieved – do not be too critical but also do not overestimate yourself. Cheapest viagra, It leads to frustration and ruins your motivation step by step. Cheapest viagra,
  5. Always determine your current level correctly and try to expand from there - it is not the biggest problem if you are weak in certain areas (since that can be improved). Cheapest viagra, However, cheapest viagra, it is much worse if you don’t admit this to yourself (which means you won’t release any effort to improve it). Cheapest viagra, Once you acknowledge your current position (e.g. Cheapest viagra, that you can work only 10 minutes continuously) you can gradually improve it (e.g. Cheapest viagra, by working without break for 1 more minute daily) until you reach the desired goal (e.g. Cheapest viagra, Alt-Tab-less working for 2 hours). Cheapest viagra, Don’t be ashamed or blame yourself for any clumsiness – identify it and get rid of it!
  6. Do not be impatient - be realistic about the amount of work you are capable to do for the given period of time. Cheapest viagra, There are some things that can be done overnight. Cheapest viagra, (I wanted to finish my Ph.D. Cheapest viagra, in a week and I failed miserably ;-)
  7. Never give up – do not stop before the finish line. Cheapest viagra, Nothing is worst than a work without results. Cheapest viagra, It consumes too much time. Cheapest viagra, By looking at just the achievements (which is usually the practice in the real life) it is useless. Cheapest viagra, No credits, cheapest viagra, no recognition. Cheapest viagra, Never stop at 99%, cheapest viagra, since that is still an unfinished job. Cheapest viagra, Even 10 * 99% = 0 (and not 990%, cheapest viagra, which is 9 by rounding) - thus 1 * 100% > 10 * 99%. Cheapest viagra,
  8. Do not be sorry for yourself – it does not help and drags you down. Cheapest viagra,
  9. Do not look around too often – too many people fail because they look at their surrounding and can not step over the boundaries of the tiny world around them. Cheapest viagra, Who cares if the guy next door is ten times better at bugfixing or writes his papers ten times faster while you are struggling with every word? Even if you may feel this on your own skin, cheapest viagra, believe me that staring at the abilities of others and the constant comparison leads to a dead end. Cheapest viagra, After some time it makes you believe you are truly useless and stupid. Cheapest viagra, Do not believe everything – probably those “Supermans” are not half as good as they seem to be, cheapest viagra, and half of the stories about them are urban legends. Cheapest viagra, And what if they are really so superb? Does it change your abilities in any way? Of course not. If there is only one point you remember, cheapest viagra, this be it. Cheapest viagra, Believe me, cheapest viagra, it can make your life much easier. Cheapest viagra, At least it made mine.
  10. Do not look for excuses – it is the simplest way to get stuck.
  11. Do the interesting and annoying things side by side – it is easy to fall to the “trap of interesting parts”. Cheapest viagra, Unfortunately the most hated parts are also part of the project (at least I have not met a project with solely “fun” parts) and need to be done as well. Cheapest viagra, Do not leave them to the end if you do not want ot struggle just before the finish line. Cheapest viagra, If you do them aside with the fascinating jobs the suffering will “disappear”.

+1 Believe in yourself - “To succeed, cheapest viagra, we must first believe that we can.” (Michael Korda) or as Henry Ford put it: “If you think you can do a thing or think you can’t do a thing, cheapest viagra, you’re right.”. Cheapest viagra,

Remember: the work you have done is measured by the final result, cheapest viagra, not the time and effort you have invested in it. Cheapest viagra, Once you start something, cheapest viagra, never look back - just from behind the finish line.

Similar Posts:cheap cialis,cheapest viagra,viagra rx,cheap viagra tablets,purchase bactrim online

Posted in Devel, Productivity | 6 Comments »

Order lexapro

Thursday, October 19th, 2006

Order lexapro, Update: A lot of people were disappointed that 10.minutes.ago etc. Order lexapro, is not working in pure Ruby. Order lexapro, Well, order lexapro, after executing the line require ‘active_support’ it does - I think this is a fairly small thing to do to enable these powerful features.

Order lexapro, Every guide published on favorable writing principles emphasizes the power of brief and concise style. Order lexapro, This is especially true in the case of technical texts, order lexapro, and in my opinion, order lexapro, in the case of well-designed programming languages as well. Order lexapro,

Order lexapro, Note the word well-designed. Order lexapro, I did not say in the case of any (programming) language, order lexapro, since that would just not be true: conciseness can come at the cost of readability. Order lexapro, (If you ever tried to read kanji, order lexapro, you know what I am talking about ;-) . Order lexapro, However, order lexapro, I am claiming that in the case of a really well-designed programming language, order lexapro, succinctness helps readability, order lexapro, reduces bloat and leads to easier and faster understanding of the code. Order lexapro, In my experience, order lexapro, the amount of boilerplate code to write is decreasing proportionally with the terseness of the programming language, order lexapro, ultimately leading to a coding style where you (nearly) don’t need to write boilerplate at all.

Order lexapro, I will demonstrate this on a few Java vs. Order lexapro, Ruby code examples. Order lexapro, However, order lexapro, this is NOT a Ruby-bashing-Java article, order lexapro, but a few examples of idioms and interesting constructs; C++ vs Haskell or Lisp could serve equally well (sometimes even better), order lexapro, but since I am currently working with Java and Ruby on a daily basis, order lexapro, it is easier for me to use them.

Order lexapro, If you are a pro Ruby and/or Java programmer, order lexapro, and/or you think the article is too long for you, order lexapro, please jump to the “Random Code Snippets” section.

Order lexapro, Possibly the most straightforward reason why Ruby code is more readable even in shorter form is that really everything is an object [1] in Ruby-land. Order lexapro, For example in Java, order lexapro, primitives need wrapper classes to ‘become’ objects., order lexapro, while in Ruby they are first class objects on their own. Order lexapro, This makes constructs like

10.times { print "ho" }  #=> "hohohohohohohohohoho"
or (will output the same string)
print "ho" * 10 #=> "hohohohohohohohohoho"
possible. Order lexapro,

Order lexapro, There are a handful of other reasons which make Ruby more readable and elegant, order lexapro, but before I get bogged down in the explanation too much, order lexapro, let’s see the examples!

Whetting your appetite

In the first part I will describe some basic constructs which would make the life of any Java developer much easier. Order lexapro, These techniques are neat, order lexapro, but they are not using any really sophisticated stuff yet: I will try to take a look at those in the next bigger section.

The empty program

Java:

class Test
{
    public static void main(String args[]) {}
}

Ruby:


I did not forget the Ruby snippet; You can not see anything there because actually a Ruby program doing nothing is exactly 0 characters long. On the other hand, order lexapro, the Java version is slightly longer. Order lexapro, I is kind of weird to explain to a newcomer what do ‘class’, order lexapro, ‘public’, order lexapro, ’static’, order lexapro, ‘void’, order lexapro, ‘String’, order lexapro, the [] operator and several braces here and there mean, order lexapro, and why are they needed if the program does literally nothing

Fun with numbers

Note:For some of the next examples you will need to use Rails Active Support.
Java:

if ( 1 % 2 == 1 ) System.err.println("Odd!") #=> Odd!

Ruby:

if 11.odd? print "Odd!" #=> Odd!
Does not the first example make more sense (even for a non-programmer)?. Order lexapro, I believe it does. Order lexapro, More of this type:
Java:
102 * 1024 * 1024 + 24 * 1024 + 10 #=> 106979338

Ruby:

102.megabytes + 24.kilobytes + 10.bytes #=> 106979338

OK, order lexapro, maybe this is an unfair comparison since Java does not have (?) those functions. Order lexapro, However, order lexapro, the point is that even if it had, order lexapro, the best I could come up with would look like:

Util.megaBytes(102) + Util.kiloBytes(24) + Util.bytes(10) #=> 106979338

Which is far from the elegance and readability of the Ruby example.
In the next example we will assume that we have a Java function similar to ordinalize in Ruby.
Java:

System.err.println("Currently in the" + Util.ordinalize(2) + "trimester");

Ruby:

 print "Currently in the #{2.ordinalize} trimester"    #=> "Currently in the 2nd trimester"

In this example we can observe variable interpolation: anything wrapped in #{} inside double quotes gets evaluated and substituted in the string, order lexapro, providing a more readable form without a lot of + + Java constructs (which is cool mainly if you have more variables inside the double quotes).

Dates

In my opinion, order lexapro, handling dates and times is a great PITA in Java, order lexapro, especially if you are implementing some complex code.
Java:

System.out.println("Running time: " + (3600 + 15 * 60 + 10) + "seconds");

Ruby:

puts "Running time: #{1.hour + 15.minutes + 10.seconds} seconds"

Java:

new Date(new Date().getTime() - 20 * 60 * 1000)

Ruby:

20.minutes.ago

Java:

Date d1 = new GregorianCalendar(2006, order lexapro,9, order lexapro,6, order lexapro,11, order lexapro,00).getTime();
Date d2 = new Date(d1.getTime() - (20 * 60 * 1000));

Ruby:

20.minutes.until("2006-10-9 11:00:00".to_time)

Order lexapro, I think you do not have to be biased towards Ruby at all to admit which code makes more sense instantly…

I have recently found a very cool way of parsing dates in Ruby: using Chronic. Order lexapro, However, order lexapro, I would not like to present it here since it is not a feature of the language, order lexapro, ‘just’ a nifty natural-language date parser [2].

A little bit more advanced stuff

Classes

Java:

Class Circle
  private Coordinate center, order lexapro, float radius;

  public void setCenter(Coordinate center)
  {
    this.center = center;
  }

  public Coordinate getCenter()
  {
    return center;
  }

  public void setRadius(float radius)
  {
    this.radius = radius;
  }

  public Coordinate getRadius()
  {
    return radius;
  }
end;

Ruby:

class Circle
  attr_accessor :center, order lexapro, :radius
end

Order lexapro, Believe it or not, order lexapro, the two code snippets are absolutely equal; The getter and setter methods in Ruby code are generated automatically, order lexapro, so not only you do not have to write them, order lexapro, but they are not even there to clutter the code.

Order lexapro, I have seen argumentation from Java guys that stuff like this (i.e. Order lexapro, the public static void main … Order lexapro, thing, order lexapro, getters/setters and other boilerplate code) can be generated with any decent GUI like Eclipse (or by tools like XDoclet etc) is a non-issue. Order lexapro, Well, order lexapro, as for their generation, order lexapro, let us say this is true. Order lexapro, But for the readability of code it is absolutely not!

Order lexapro, For example. Order lexapro, take getters/setters: Every variable in Java ads 8 more lines of code (not counting the lines between the function declarations) compared to the Ruby :attr_accessor idiom. Order lexapro, That is, order lexapro, a simple class definition having 10 fields in Java will have 80+ lines of code compared to 1 lines of the same code in Ruby. Order lexapro, For me, order lexapro, this definitely means a big difference.

Arrays (and other containers)

Order lexapro, This section was inspired by a blog entry by Steve Yegge.

Order lexapro, Arrays are interesting citizens of Java: They are not really objects in the “classical” sense , order lexapro, so they have very limited functionality compared to first-class Java objects. Order lexapro, On the other hand, order lexapro, they are offering a huge advantage over the other container classes: they can be easily initialized.
Java:

String languages[] = new String[] {"Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "Perl"};
instead of
List<String> languages = new LinkedList<String>();
languages.add("Java");
languages.add("Ruby");
languages.add("Python");
languages.add("Perl");
which is kind of lame when you quickly need to hack up some testing data.

Order lexapro, However, order lexapro, they have also some serious problems: you have to define the number of the elements upon construction time, order lexapro, like so:
Java:

String someOtherLanguages<String>[] = new String[15];
which sometimes really cripples their functionality. Order lexapro, [3]

Order lexapro, How does this work in Ruby? Let’s see on three different examples (All three code snippets provide the same result):
Ruby:

stuff = [] #An empty array - as you can see there is no need to define the size
stuff << "Java", order lexapro, "Ruby", order lexapro, "Python" #Add some elements
#Initialize the array with the values
stuff = ["Java", order lexapro, "Ruby", order lexapro, "Python"]
#Yet another method yielding the same result
stuff = %w(Java Ruby Python)

Order lexapro, In my opinion, order lexapro, these forms (especially the last one) are more straightforward and can save a lot of typing.

Order lexapro, Another major shortcoming of Java arrays is that besides the [] operator you have only the methods inherited from Object and a single instance variable : length [4]. Order lexapro, This means that even essential functionality like sorting, order lexapro, selecting elements based on something etc. Order lexapro, has to be done via a ‘third party’ function, order lexapro, like this:
Java:

Arrays.sort(languages);
which seemed quite normal to me when I have been learning Java and have had no previous experience with dynamic languages, order lexapro, but now it looks kind of annoying.

Order lexapro, Another Java-container-woe compared to Ruby is that in Java, order lexapro, an array is an array. Order lexapro, A list is a list. Order lexapro, A stack is a stack. If you are wondering what the hell I am talking about, order lexapro, check out these Ruby code snippets: Ruby:

stuff = %w(Java Ruby Python)
#Add the string "Perl" to the array
stuff << "Perl"
#Prepend the string "Ocaml" 
stuff.unshift "Ocaml"  
=> ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "Perl"]
#Use the array as a stack
stuff.pop 
=> "Perl"  #stuff is now ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python"] 
stuff.push "C", order lexapro, "LISP"
=> ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "C", order lexapro, "LISP"]
#Update C to C++ 
stuff[4] = "C++"
=> ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "C++", order lexapro, "LISP"]
#Remove the fisrt element
stuff.shift
=> "OCaml" #stuff is now ["Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "C++", order lexapro, "LISP"] 
#Let's just stick with Java and Ruby - slice out the  rest!
stuff.slice!(2..4)
=> ["Python", order lexapro, "C++", order lexapro, "LISP"] #stuff is now ["Java", order lexapro, "Ruby"]
As you can see, order lexapro, the Ruby Array class offers functionality that could be achieved only by mixing up several Java containers into one (to my knowledge, order lexapro, at least) [5]. Order lexapro, In practice, order lexapro, this usually speeds things up a lot.

Order lexapro, Another thing that really annoys me when using containers in Java is the lack of this functionality:
Ruby:

stuff = ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "C++", order lexapro, "LISP"]
#Lua is just gaining steam, order lexapro, add it to the 7th place
stuff[7] = "Lua"
=> ["OCaml", order lexapro, "Java", order lexapro, "Ruby", order lexapro, "Python", order lexapro, "C", order lexapro, "LISP", order lexapro, nil, order lexapro, "Lua"]
i.e. Order lexapro, that if I am adding an element to an index which is bigger than the size of the array, order lexapro, the empty space inbetween is filled with nils. Order lexapro, Now seriously, order lexapro, who would not exchange this for the Java behaviour (an IndexOutOfBoundsException is thrown) - after all, order lexapro, if I would need this functionality (which is VERY seldomly the case) in Ruby, order lexapro, I could check it myself and raise an exception if I don’t like what I see.

Order lexapro, I wanted to write a bit about differences between hashes and files in Ruby and Java, order lexapro, but the post is already longer now then I wanted it to be so I guess I will just show some concrete code snippets to conclude.

Random Code Snippets

Order lexapro, In this section I would like to present some real cases I have been solving with Ruby recently. Order lexapro, Since I am still new to Ruby, order lexapro, I was totally amazed just how much more simpler, order lexapro, shorter yet much more understandable the code can be in Ruby compared to Java.

Files and Regular Expressions

Order lexapro, As Bruce Eckel once put it, order lexapro, In Java, order lexapro, it’s a research project to open a file. Order lexapro, Well, order lexapro, I have to agree. Order lexapro, Maybe I am the only one Java programmer (besides Bruce) who - even after using Java professionally for five years - still can not write to a file without using google first. Order lexapro, Maybe I should learn it one day?

Order lexapro, Regular expression support in java is OK (at least one does not have to use external packages as in the pre-1.4 era), order lexapro, however, order lexapro, compared to Ruby the syntax is quite heavy. Order lexapro,

Let’s see a demonstration on the following task: Open the file ‘test.txt’ and write all the sentences to the console (one sentence per line) which contain the word ‘Ruby’. Order lexapro, First, order lexapro, the Java solution:
Java
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Test 
{
    public static void main(String[] args)
    {
        try {
            BufferedReader in = new BufferedReader(new FileReader("test.txt"));
            StringBuffer sb = new StringBuffer();
            String str;
            while ((str = in.readLine()) != null) 
              { sb.append(str + "\n"); }            
            in.close();
            String result = sb.toString();
            Pattern sentencePattern = Pattern.compile("(.*?\\.)\\s+?");
            Pattern javaPattern = Pattern.compile("Ruby");
            Matcher matcher = sentencePattern.matcher(result);
            while (matcher.find()) {
                String match = matcher.group();
                Matcher matcher2 = javaPattern.matcher(match);
                if (matcher2.find())
                    System.err.println(match);
            }
        } catch (IOException e) 
          {
            e.printStackTrace();
          }     
    }
}
It is quite straightforward what this relatively simple code snippet doing - but if this is straightforward, order lexapro, what should I say about the Ruby version?
Ruby
File.read('test.txt').scan(/.*?\. Order lexapro, /).each { |s| puts s if s =~ /Ruby/ }

Order lexapro, Well, order lexapro, umm… Order lexapro, I guess this example quite much expresses the point I am talking about from the beginning: sometimes less is more, order lexapro, a.k.a. Order lexapro, Succinctness is Power!

Order lexapro, Again, order lexapro, I wanted to show much more examples, order lexapro, but I have the feeling that since the article is already too long, order lexapro, no one would read it :-) It is a big pity since I did not even talk about hashes, order lexapro, blocks, order lexapro, closures, order lexapro, metaprogramming (well, order lexapro, I will mention it briefly in the last (really :-)) example) and other goodies - maybe in part 2?

If this is still not enough…

Order lexapro, Although I find it very easy and natural to express a lots of things in Ruby, order lexapro, the language can not offer anything I would ever need. Order lexapro, However, order lexapro, there is a powerful concept to invoke in such situations, order lexapro, called metaprogramming.

Order lexapro, A few days ago I needed to test some algorithms on trees, order lexapro, so I needed to hack up a lot of tree test data. Order lexapro, Here is how I would go about this in Java using the example below (let’s assume in both languages that we have a simple data structure Tree):

               a
            /      \
          b         c
         /  \      / | \
        d    e    f  g  h

Java

Tree a = new Tree("a");

Tree b = new Tree("b");
Tree c = new Tree("c");
a.addChild(b);
a.addChild(c);

Tree d = new Tree("d");
Tree e = new Tree("e");
b.addChild(d);
b.addchild(e);

Tree f = new Tree("f");
Tree g = new Tree("g");
Tree h = new Tree("h");
c.addChild(f);
c.addChild(g);
c.addChild(h);

Another possibility would be to create an XML file with the description of the tree and parse it from there. Order lexapro, This solution is even more convenient since though you have to write the parsing code, order lexapro, you just have to edit an XML file once it is written. Order lexapro, One possibility how the tree of this example could look something like
XML

  <node name="a">
      <node name="b">
          <node name="d"/>
          <node name="e"/>
      </node>
      <node name="c">
          <node name="f"/>
          <node name="g"/>
          <node name="h"/>
      </node>
  </node>

Order lexapro, The latter solution is quite cool. Order lexapro, After all you do not need to write any code, order lexapro, just alter the XML file and that’s it.

Order lexapro, Now let’s see the Ruby solution I came up with:
Ruby

tree = a {
            b { d e }
            c { f g h }
          }

Order lexapro, Well… Order lexapro, suddenly even the XML file seems too heavy, order lexapro, does not it? :-) Not to mention the fact that the latter example is pure Ruby code - there is no need to open an external file and parse it - you just run it and the variable tree will contain your tree. Order lexapro, That’s it.

Order lexapro, Of course Ruby can not handle this code as it is - for this we need to invoke some metaprogramming magic. [6]

Order lexapro, Metaprogramming is a way to drive Ruby with Ruby. Order lexapro, Java (especially J2EE) is usually driven by XML (which is not always really a good thing in my opinion) As you could see, order lexapro, Ruby is driven by Ruby instead :-)

Order lexapro, This example merely scratched the surface of Ruby’s possibilities through metaprogramming. Order lexapro, However, order lexapro, as with the other examples, order lexapro, my goal was not to advocate a concrete pattern/method over a different one, order lexapro, but rather to show how a specific toolset can change the way of thinking about the task at hand, order lexapro, and the way of code design/implementation in general.

Final thoughts

Order lexapro, When I was a child, order lexapro, I spoke as a child, order lexapro, I understood as a child, order lexapro, I thought as a child: but when I became a man, order lexapro, I put away childish things. - The Bible, order lexapro, I Corinthians 13:11

Order lexapro, This thought pretty well expresses how I felt about Java/C++/(substitute any non-dynamic language here) when I came to know (some of) Ruby’s true dynamism and expressive power through terse yet powerful idioms which transformed my whole thinking about programming. Order lexapro, Of course I do not claim that I ‘became a man’ because that’s still a very long way to go, order lexapro, but still, order lexapro, even with my very limited knowledge of Ruby, order lexapro, the way to express things in Java/C++ now seems… Order lexapro, well… Order lexapro, childish ;-). Order lexapro, [7]


Creating a site on online tutorials is not a completely bad idea. Order lexapro, One should include courses for 642-054, order lexapro, 642-054, order lexapro, 642-176, order lexapro, ruby on rails, order lexapro, cissp certification. Order lexapro, If you have the knowledge for creating the tutorials, order lexapro, the rest is very simple. Order lexapro, By using dot5hosting company’s site you can purchase a web hosting package that is economical. Order lexapro, Even dedicated servers can be found for low prices. Order lexapro, Then through the use of ip telephony one can directly reach its potential clients. Order lexapro, Other internet marketing methods should also be considered to create awareness the site.


Notes

[1] I wonder whether this déjà vu will happen to me in the future once again: I have had this ‘Wow, order lexapro, everything is an object’ feeling when coming from C++ to Java; Then after coming from Java to Python; and most recently, order lexapro, after coming from Python to Ruby. Order lexapro, Back


[2] Some examples that Chronic can handle:
  summer
  6 in the morning
  tomorrow
  this tuesday
  last winter
  this morning
  3 years ago
  1 week hence
  7 hours before tomorrow at noon
  3rd wednesday in november
  4th day last week
Kudos… Back


[3] In the previous array initialization example this was not needed since it is trivial when all the elements are stated beforehand.Back


[4]which somewhat confusing given that all the other containers use the method size() (and not a field!) to determine the count of elements. Order lexapro, To nicely mesh with the confusion, order lexapro, the String object provides the method length() (and not a field, order lexapro, as with array) to query the number of characters… Order lexapro, Back


[5] I mean it is not possible to construct any container - other than an array - with literals, order lexapro, you can use the [] operator on arrays only, order lexapro, you can not get the i-th element of a stack etc. Order lexapro, Back


[6] The code I have been using to accomplish this task relies on the method_missing idiom:
class Object
  @stack = []
  @parent = nil

  def method_missing(method_name, order lexapro, *args, order lexapro, &block)
    tree = Tree.new(method_name)
    @parent.add_child(tree) if @parent != nil
    if block_given?
      @stack ||=[]
      @parent = tree
      @stack.push @parent
      yield block
      @stack.pop
      @parent = @stack.last
    end
    tree
  end
end
Back


[7] This does not necessarily mean that Java is bad and Ruby is good - just that it was the ‘Ruby way’ that struck a chord in me after trying/playing around with programming in many programming languages. Order lexapro, Many of the features I adore in Ruby are there in Java as well, order lexapro, but they did not ‘came through’ whereas with Ruby there was a point of enlightenment when I really understood a lot of generic, order lexapro, non-language specific principles. Order lexapro, Back

Similar Posts:cheap phentermine,order lexapro,reductil without prescription,diflucan online stores,ambien prescription

Posted in Devel, Java, Ruby, Tutorial | 78 Comments »

Buy lexapro

Saturday, October 7th, 2006

Currently I am working on a Ruby web-extraction framework (more on this in a future post) and I have chosen Hpricot for the HTML parsing and XPath evaluation. Buy lexapro, So far, buy lexapro, it seems to be the perfect choice - it is lightning fast (nothing I have encountered so far - REXML, buy lexapro, Htree, buy lexapro, RubyfulSoup - was even near in terms of speed), buy lexapro, very intuitive to use, buy lexapro, and it simply works for nearly everything you will need for day-to-day tasks. Buy lexapro,

However, buy lexapro, since my Web-extractor is relying on XPath very heavily, buy lexapro, sometimes I need things not included in the ‘nearly-everything’ bag of goodies - but so far I have always managed to come up with a solution. Buy lexapro, Last time it was the evaluation of XPaths with indices. Buy lexapro, This is what I hacked up:

def to_hpricot(xpath)
  "#{'(' * (xpath.split(/\d+/).size-1)}" +                 
  xpath.gsub(/\d+/) { |num| (num.to_i - 1).to_s }. Buy lexapro, 
        gsub(/\/(.*?)\[/) { |p| "/'#{$1}')[" }            
end

Whew, buy lexapro, that's ugly - but it works quite well. Buy lexapro, Let's see a simple example:

doc = Hpricot("<p>A<b>very</b>simple<b>
  <i>small</i>test<i>document</i>.</b>Very cool.</p>")

eval(to_hpricot('doc/p[1]/b[2]/i[2]')) 
=> {elem <i> {text "document"} </i>}

OK, buy lexapro, it is really just a hack - it does not consider special cases, buy lexapro, does not handle anything besides indices (i.e. Buy lexapro, no axes, buy lexapro, @’s or anything) etc. Buy lexapro, - but anyway this is hopefully just a temporary solution and _why will add evaluation of indexed XPaths to Hpricot soon. Buy lexapro, There would be at least one HPricot user who would be really delighted about it :-)

Similar Posts:lexapro online,buy lexapro,buy generic propecia,discount xanax,prozac no prescription

Posted in Devel, Ruby | 6 Comments »

Cheap tramadol

Friday, September 29th, 2006

Tagline: Blogging is a very easy looking activity, cheap tramadol, until you actually begin with it…

Most probably even the irregular readers of rubyrailways have noticed a 3 month period of silence during the summer, cheap tramadol, which has just ended a few days ago. Cheap tramadol, In my opinion it is generally not a very good idea to temporarily abandon a blog, cheap tramadol, without even announcing a summer holiday or posting a note like “to be continued after an undefined period of blogger’s block” or something. Cheap tramadol, Why did I allow it happen then?

Well, cheap tramadol, there are a handful of reasons for this: summer holidays, cheap tramadol, though days at the work, cheap tramadol, lot of stuff to do on my PhD but mainly a kind of a blogger’s crisis. Cheap tramadol, Although all the reasons are very interesting, cheap tramadol, I would like to elaborate on the last one a bit.

The first problem stems from the relative success of my previous entries: Tutorials like Install Internet Explorer on Ubuntu Dapper in 3 easy steps, cheap tramadol, Data extraction for Web 2.0: Screen scraping in Ruby/Rails or Getting Ruby on Rails up and running on Ubuntu Dapper were quite popular and set a standard which was not easy to top (or at least to maintain) in terms of equally interesting topics. Unfortunately I can pursue Ruby, cheap tramadol, Rails and even screen scraping/web extraction only in my spare time which is a scarce resource (it’s kind of hard to work full time, cheap tramadol, roll a PhD and blog simultaneously :-)) and therefore I do not bump into an interesting topic just every second day. Cheap tramadol, However, cheap tramadol, this eventually got me into a kind-of an inverse Concorde-effect: If I have waited a week, cheap tramadol, then I can wait another to deliver something sexy. Cheap tramadol, After a month: Now that I have waited a month, cheap tramadol, I surely have to come up with something really juicy… Cheap tramadol, You get the idea.

I believe I am not the only one around with this thinking pattern, cheap tramadol, and I am not sure how are others handling this problem, cheap tramadol, but I have decided to give up this habit - in the future I would like to blog regularly, cheap tramadol, even at the cost that not every post will be a top-notch blockbuster :-).

The second problem is that I am kind of a renaissance guy: I am interested in new technologies, cheap tramadol, programming, cheap tramadol, science research, cheap tramadol, economics, cheap tramadol, reading books just about everything, cheap tramadol, photography, cheap tramadol, traveling, cheap tramadol, computer games, cheap tramadol, sports… However, cheap tramadol, since rubyrailways is my first attempt at blogging, cheap tramadol, I am quite unsure how to deal with this amount of information: what should be the ratio of not-necessarily-correlated topics (e.g. Cheap tramadol, Ruby, cheap tramadol, travelling and PhD research). Cheap tramadol, I am nearly sure though that it is not a good idea to blog about everything, cheap tramadol, since then every post will be uninteresting for most of the readers. Cheap tramadol,

Yes, cheap tramadol, I know that categories were invented to workaround this problem. Cheap tramadol, However, cheap tramadol, in my experience most of the people today are using feed aggregators and/or personal start pages like bloglines, cheap tramadol, netvibes or pageflakes, cheap tramadol, and hence are facing this problem nevertheless. Cheap tramadol, Yes, cheap tramadol, they could ignore the posts that are not interesting to them, cheap tramadol, but after doing so a few times they will potentially ignore your whole blog. So how to find the golden mean?

A possible solution is to have a separate blog for everything: In my case this would mean at least a software development (mainly Ruby/Rails), cheap tramadol, general technology, cheap tramadol, Linux/Ubuntu, cheap tramadol, Science/PhD research and a travelling blog. Cheap tramadol, Well, cheap tramadol, I certainly would not have the time to keep up all of them since I am struggling even with rubyrailways :-)… Cheap tramadol, I could of course ignore what people think about my blog and just write it to myself, cheap tramadol, but that would deprive me from knowing what other people think about the things I am after, cheap tramadol, which is a very valuable information for me.

I would be very much interested in your opinion on this topic: How do you solve this ‘feature creep’ on your blog - by maintaining more blogs, cheap tramadol, focusing on just one topic and ignoring the others, cheap tramadol, or trying to balance somehow?

Please leave me a comment or send me a mail, cheap tramadol, I’d really like to hear your opinion…

Similar Posts:prozac online,cheap tramadol,viagra cheap,viagra buy online,zovirax online

Posted in Blogging, News, Web2.0 | 10 Comments »

Viagra pills

Wednesday, September 27th, 2006

I have just finished reading Ruby for Rails: Ruby techniques for rails developers from David A. Viagra pills, Black. Viagra pills, Here is my (WARNING: highly opiniated) review…

I have been a Python fanatic for quite some time, viagra pills, and decided to give Ruby a shot. Viagra pills, After some googling, viagra pills, I found most references pointing to a book called the ‘Pickaxe’. Viagra pills, Quite a strange name for a programming book, viagra pills, thought to myself, viagra pills, but picked it up nevertheless. Viagra pills, I have been instantly converted after a few dozen pages - mining Ruby with the pickaxe was an awesome experience! Since then, viagra pills, I have finished reading the second edition and became a Ruby enthusiast.

After lurking around a bit, viagra pills, I have learned that the common standpoint is that every newcomer/beginner should grab a copy of the Pickaxe to get started. Viagra pills, Based on my previous, viagra pills, positive experience I could not agree more - until I came across R4R.

Ruby for Rails is awesome: The technical depth is just right to not distract beginners, viagra pills, yet detailed enough for even the more advanced readers. Viagra pills, I did not skip a single page (though years of programming experience and tons of similar programming books I came across during that time could allow me) and finished reading it in no time. Viagra pills,

I could write some more about how cool this book is (and it would deserve every bit of it), viagra pills, but I think you can read about that just anywhere (a nice review can be found here), viagra pills, so I would like to point out something different: If we consider the Pickaxe THE book for newcomers, viagra pills, then IMHO R4R is a Pickaxe killer.

Don’t get me wrong: I am a great fan of the Pickaxe, viagra pills, which is another very high-quality technical book - but if someone wants to apply the ‘right tools for the right job’ principle, viagra pills, I think newcomers who already decided to learn Ruby should grab Ruby for Rails. Viagra pills, Programming Ruby’s Part I is absolutely well suited to get the ‘feeling’ of Ruby, viagra pills, and it’s next chapters are great to learn the advanced stuff - however in my opinion, viagra pills, the leap between the first and the next chapters is too big for an absolute beginner. Viagra pills, Ruby for Rails is there to fill this gap.

Maybe someone might not advice this book to a newbie eager to learn Ruby, viagra pills, since it has ‘Rails’ in it’s title. Viagra pills, However, viagra pills, R4R is still primarily a Ruby book, viagra pills, and while I found the Rails parts to be very helpful, viagra pills, I can recommend it to anyone who would not like to learn Rails at all - though the full potential of the book comes through if one would like to learn both.

Conclusion: Ruby for Rails is an awesome book on Ruby. Viagra pills, If you are beginner, viagra pills, would like to get a solid understanding of the Ruby principles, viagra pills, or your goal is to polish up your Ruby knowledge to grasp the Rails framework - R4R was made just for you! Check it out - you won’t be disappointed.

Similar Posts:viagra,viagra pills,cheap generic viagra,purchase amoxil online,cheapest lexapro

Posted in Devel, Rails, Ruby | 10 Comments »

Lexapro pills

Thursday, June 22nd, 2006

As weird as this may sound, lexapro pills, sometimes even Linux users need Internet Explorer - for example to check how they current web design looks in the good old IE, lexapro pills, to browse an ‘IE only page’ (probably not as big problem as a few years ago though), lexapro pills, or to log in to a legacy system for example. Lexapro pills, For some time I have thought this is possible only with Crossover Office (which is not not expensive, lexapro pills, but still not free) until Gabor told me about a completely free, lexapro pills, easy-to-install and working solution: IEs4Linux.

Paradoxically, lexapro pills, IEs4Linux provides a functionality which is (AFAIK) not available to Windows users: It installs 3 versions of Internet Explorer: 5.0, lexapro pills, 5.5 and 6.0. Maybe the time has come for Win32 users to install Ubuntu so they can view their webdesign in all the currently used versions of IE? ;-)

So, lexapro pills, now for the installation:

Check /etc/apt/sources.list - make sure you have access to the ‘universe’ packages by uncommenting the following lines:

deb http://us.archive.ubuntu.com/ubuntu dapper universe
deb-src http://us.archive.ubuntu.com/ubuntu dapper universe

There you go. Lexapro pills, After specifying which versions you need, lexapro pills, choosing a locale and a few minutes of installation you should have the links on your desktop.

Check out the original page for new versions, lexapro pills, updates or to donate for this awesome stuff!

Making a website for distance learning about ruby on rails is a great way to create awareness for the language. Lexapro pills, With the help of online certificate such as ibm certification, lexapro pills, which is attained through sitting the ibm exams. Lexapro pills, With this you can create this site efficiently and with the guidance of oracle certification you can create a strong database for it. Lexapro pills, Next look around for internet hosting companies to upload the site on. Lexapro pills, One good example is bluehost, lexapro pills, as it hires the best out, lexapro pills, such as cisco’s 350-029 certified, lexapro pills, there to provide quality services. Lexapro pills, To ensure that your site gets a good traffic work on search engine marketing. Lexapro pills, Employ affiliate marketing program to cater a wide scope of audience.

Similar Posts:tramadol,lexapro pills,discount lorazepam,buy viagra,buy lorazepam

Posted in Tutorial, Ubuntu, Web design | 59 Comments »

Cialis prescription

Friday, June 16th, 2006

Finally… Cialis prescription, After several months, cialis prescription, my google analytics invitation has arrived.
Does it offer more than any ‘usual’ page statistics tool that can be found on the net?
Short answer: absolutely! For the detailed analysis of analytics read on…

My site is hosted at dreamhost, cialis prescription, and they offer a pre-installed logfile analyser, cialis prescription, analog, cialis prescription, which claims to be ‘The most popular logfile analyser in the world’. Cialis prescription, It has a decent feature set (not too much graphical fancy stuff, cialis prescription, but nice analysis nevertheless), cialis prescription, still i wanted to give a try to something different, cialis prescription, too - so i have installed statcounter, cialis prescription, ‘A free yet reliable invisible web tracker, cialis prescription, highly configurable hit counter and real-time detailed web stats’.

I have been quite satisfied with both statistics (although in the free version of statcounter, cialis prescription, the log size is limited to 100 hits) - until i have seen what google analytics is capable of.

The number of features that google analytics has to offer is HUGE. Cialis prescription, I am using it for a week now, cialis prescription, and there are still some statistics which i simply did not have time to look at. Cialis prescription, There are quick overview screens for everything important (above you can see one of them) - and if you would like to drill down to every single hit, cialis prescription, you have the possibility too. Cialis prescription,

Ever wanted to know everything about your visitors? No problem. Cialis prescription, You can view every single visititor’s referral link, cialis prescription, which country/city did he come from (also displayed on the world map), cialis prescription, connection speed, cialis prescription, platform, cialis prescription, browser, cialis prescription, screen resolution (even color depth!), cialis prescription, language, cialis prescription, which keywords did lead them to you, cialis prescription, their loyalty, cialis prescription, conversion rate (i have listed just a small fraction of featues)… Cialis prescription, and all this presented with nice graphs, cialis prescription, charts etc. Cialis prescription, Simply unbelievable. Cialis prescription,

I will not write anything more about this tool, cialis prescription, since if you have it, cialis prescription, you know what i am talking about, cialis prescription, and if not, cialis prescription, go and get it if you are interested in your web site stats!

My advice is: forget about ANY kind of stat counter, cialis prescription, and request a google analytics account ASAP.

Similar Posts:buy tramadol,cialis prescription,xenical,viagra generic,cheap cipro

Posted in News, Web2.0 | 1 Comment »

Xanax sale

Wednesday, June 14th, 2006

I am planning to write a series of entries on screen scraping, xanax sale, automated Web navigation, xanax sale, deep Web mining, xanax sale, wrapper generation, xanax sale, screen scraping from Rails with Ajax and possibly more, xanax sale, depending on my time and your feedback. Since these entries are going to be longer, xanax sale, I will be posting them to separate pages, xanax sale, and announce them on my blog.

The first article is ready, xanax sale, you can read it here.

It is an introduction to screen scraping/Web extraction with Ruby, xanax sale, evaluation of the tools along with installation instructions and examples.

Feedback would be appreciated (leave your comment here/on the article page, xanax sale, or send me a mail at peter@[name of this site].com), xanax sale, I will update/extend the document and publish new ones based on your feedback.

Similar Posts:cheap prozac,xanax sale,diazepam for order,cheap phentermine,buy zoloft online

Posted in Rails, Ruby, Tutorial, Web2.0 | 3 Comments »

Generic viagra

Sunday, June 11th, 2006

Programming is great fun (mainly with Ruby ;-). Generic viagra, However, generic viagra, this statement does not contradict with the fact that sometimes programming can be also hard. Generic viagra, I came across a nice site today which can offer some help in these moments: Programming is hard. Generic viagra, Judging from the size of Ruby/Rails/ActiveRecord tags (there is even a script.aculo.us tag!) it seems that it has a nice dose of Ruby/Rails stuff - solutions for common problems and also links to tutorials, generic viagra, frequenty asked nuby questions etc. Generic viagra, Be sure to check it out!

Similar Posts:discount lexapro,generic viagra,nexium,buying cialis,generic viagra

Posted in Rails, Ruby, Tutorial | 13 Comments »

Order tramadol

Thursday, June 8th, 2006

After being a very happy Python programmer for 2 years, order tramadol, i have switched to Ruby a few months ago, order tramadol, and though Python is still my 2nd favourite language, order tramadol, i have never thought of going back to it for a second. Order tramadol, In fact, order tramadol, this feeling was so natural that i did not even think about it’s reason for some time.

If someone compares these two languages just from the technical point of view, order tramadol, the difference is de facto non-existent. Order tramadol, Both languages are built on similar principles, order tramadol, both of them serve essentially the same purpose. Order tramadol, What is the secret sauce of Ruby then? Why did i get attracted to it immediately, order tramadol, past the point of no return? Here are a few points that came to my mind:

‘He is the ONE

The list could go on and on… Order tramadol,
A Rubyist with no previous Python experience may ask ‘Well, order tramadol, what’s so cool about this? It’s normal’. Order tramadol, Well, order tramadol, i am glad that in Ruby is, order tramadol, but Python is a different story. Order tramadol, I think it lacks the books like PickAxe and Agile Web Development with Rails, order tramadol, and also the community is divided up between Django, order tramadol, Turbogears, order tramadol, Pylons, order tramadol, Subway, order tramadol, … Order tramadol, and the other dozen of web frameworks.
nice application of the DRY principle :-)

Rolling on Rails

If you would ask random people to summarize in one point why Ruby is so popular today, order tramadol, i am quite sure most of them would say ‘because of Ruby on Rails’. Order tramadol, This framework is really that cool, order tramadol, believe it or not. Order tramadol, Some people are already apostrophing it ‘the language/framework of web2.0′, order tramadol, pointing out that Rails is the next big thing in the web space.

Spread the word

A programming language is essentially a bunch of boring definitions: Some grammar, order tramadol, rules, order tramadol, constructs etc. Order tramadol, Even if it is very very cool, order tramadol, no one will notice it unless it is evangelized. Order tramadol, That’s why great stuff needs great evangelizators: Perl+Larry Wall. Order tramadol, Microsoft+Bill Gates. Order tramadol, Ruby+DHH. To follow the logic, order tramadol, i should have written Ruby+Matz. Order tramadol, But i would not write Matz, order tramadol, just as i would not pair Python with Guido van Rossum in this sense. Order tramadol, These smart gentlemen are really good at language crafting, order tramadol, but the analogy with Perl/Larry Wall stops here. Order tramadol, Fortunately Ruby has a great evangelizator, order tramadol, too, order tramadol, although an ‘indirect’ one: David Heinemeier Hansson, order tramadol, who, order tramadol, in my opinion made Ruby really popular through the Rails framework.

Community

After a few dozen of mails, order tramadol, i have much much better experience with the ruby-talk ML than with python-tutor. Order tramadol, Of course one should not judge based on a few dozen mails, order tramadol, but the Ruby community feels to me like a big family, order tramadol, whereas the Python community is more like a bunch of engineers in white suits. Order tramadol, Matz’s ‘Why does Ruby suck’ kind of style appeals me much much more than Python’s agnostic approach - ‘Maybe it is not even sure that there is a problem - first you should define what do you think the term ‘problem’ means, order tramadol, anyway’ etc. Order tramadol, Of course this rigorous style may appeal to some - but not for me.

Integration [with Java]

From the JRuby page: [JRuby is] A 1.8.2 compatible Ruby interpreter written in 100% pure Java
On the Jython page, order tramadol, i could not even find the compatibility with java - but according to the page, order tramadol, “The final release of Jython-2.1 occurred on 31-dec-2001″
For comparison: Ruby 1.8.2 is almost the latest stable, order tramadol, and JRuby’s last release was on 27-march-2006. Order tramadol, JRuby makes also some Rails integration possible already, order tramadol, and the authors are focusing on other J2EE issues like calling EJBs etc.
I think in a world where Java is the king of the hill (at the moment), order tramadol, Java integration can be a deciding factor.

Goodies

T-shirts. Order tramadol, Cofee Mugs. Order tramadol, Baseball caps. Order tramadol, Other kind of good-for-nothing junk - must haves for all geeks! Of course with their favourite stuff on it. Order tramadol, Well, order tramadol, after looking on cafepress.com (and on google in general) Ruby is a winner again when compared to Python.

The list could continue on, order tramadol, but since this entry is already too long i am going to stop here ;-) Of course, order tramadol, as everything on this blog, order tramadol, this article reflects my opinion, order tramadol, my perception of Ruby/Python. Order tramadol, If you think Python is better suited for you, order tramadol, i am not arguing or anything - it would not make sense. Order tramadol, However, order tramadol, i think Ruby has much more potential to become widely accepted as a mainstream language right now than Python - and this, order tramadol, besides that i like to code in Ruby much more, order tramadol, will keep me in the Ruby camp for a long-long time…

Similar Posts:xanax prescription,order tramadol,zoloft,low price cialis,cialis online

Posted in Devel, Ruby | 7 Comments »


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