Since I like to stay up-to-date with at least the most important programming languages, libraries and frameworks, I finally decided to take a good look at lambdas introduced in Java 8.
Having been struck by both power and elegance of the Ruby’s Enumerable module, since then I’ve been beginning new programming language evaluation process by checking how it facilitates collection handling. Keeping in mind how verbose it was in Java, I opted for Scala and Clojure when it came to JVM-based languages.
For the purpose of one of the IT events I’m attending, I created a presentation containing NoSQL solutions overview. I also made a deliberation on whether they are worth our attention or not. Enjoy!
Because of being invited to take part in a Rails Girls event, I created two presentations. Both of them are intended to be used as short introductions (to Ruby and Git, respectively).
Take a look if you’d like to use them to train other beginners, possibly at an another Rails Girls event.
Introduction to Ruby It tries to cover:
Variables; simple calculations; conditions; functions; collections; symbols; classes. Introduction to Git It goes through the basic workflow:
Yesterday (that is, April 07, 2014) I took an active part in the 4Developers conference. By saying “active” I mean I not only attended some presentations, but also did my own one. It was entitled “Do You Need a Software Team Leader?” and was more or less related to my eBook.
Here you can see the presentation:
You may also view it directly on Speaker Deck.
If you speak Polish, you may be interested in this version: “Czy potrzebujesz lidera w zespole deweloperskim?
Have you heard of 8th Color? It’s the company which created PullReview, a tool that automates code reviews for Ruby developers using GitHub.
Since doing code review is one of the most essential topics covered in my eBook entitled “Memoirs of a Software Team Leader”, I thought that contacting 8th Color might be a good idea. One of the 8th Color founders, Martin Van Aken, was so kind as to read the eBook and write a review.
I’m happy to announce that the eBook I wrote recently, “Memoirs of a Software Team Leader”, is now a featured book on the Leanpub homepage:
Peter Armstrong, Leanpub co-founder, decided that my eBook will make a good fit. That’s great news, because advertising an eBook on one’s own hook is a difficult and time-consuming task.
I hope that thanks to Leanpub more people will at least get a chance to hear about the eBook.
A fellow Rubyist, Tim Millwood, is about to write an eBook on Sinatra. In order to begin writing, he needs to get appropriate funding on Kickstarter first. If you want to show your support, visit his eye-appealing website and back the project!
What’s interesting about the eBook? The author states:
“There is some great documentation and online tutorials for Sinatra and even some top tutorials. What’s really lacking is a guide on how Sinatra can relate to real world scenarios.
Are you a team leader or want to become one? Great, this eBook is for you!
I decided to write “Memoirs of a Software Team Leader” in order to preserve my experience. By reading it, you can save yourself learning the hard way.
Some of the topics covered include decomposing requirements into small, comprehensible tasks, visualizing task dependencies, becoming a good leader, doing code review and recruiting developers.
I hope you’ll like it!
A Lightning Talk On 21st of July, I took a part in the lightning.io conference, which took place in Poznań, Poland. The conference itself was quite unusual, because - as its name may suggest - it consisted of lightning talks only. What’s more, each and every attendee was also a speaker.
On one hand, I chose a topic which I was really keen on. On the other, making it fit into 5 minutes was a really difficult task.
Terminal and Terminator It was long time ago when I realized that the major part of my work is being done in the Linux terminal. This is why I pay attention to things like shell and GNU tools, because knowing them well is often more than a half of job done.
Afterwards, I found out that having just one terminal window is not enough. Even though having many windows (represented by tabs in Linux terminal-handling tools or by many Putty instances) can solve this problem, it is often desired to keep things in sight at the same time.
Two weeks ago I posted a short information concerning picking a topic for my Ruby-related e-book. I also included a link to a short, one-question survey and promised (in one of the comments) to post the results. So here they are!
For those of you who didn’t read the previous post: these were my Ruby-related e-book proposals. I received 75 answers in total, the vast majority of them within first few days.
For some time, I’ve been wondering whether writing a Ruby-related e-book would be a good idea. I missed writing, and in particular I wanted to work on something more challenging than just a blog post. It didn’t take too long for me to make the decision whether I should write at all, but then another problem appeared: what topic should I choose?
First, I chose the topic I considered to be the most interesting, but then I changed my mind.
Introduction Web programming is, in general, a business of dealing with texts. Client sends a text request and receives a text response. Processing web documents consists mostly of processing texts, often in a sophisticated way. While new methods like image search are under active development these days, it’s the text search that is the most well-known and adopted method.
Text algorithms offer different ways of efficient text representation, processing and lookup.
For many beginning Rubyists, especially those having experience in other programming languages such as Java or C, checking whether variable is nil may seem a little bit confusing. And even those speaking Ruby quite fluently don’t usually know the tiny little details that stand behind the nil object.
NilClass and Nil Object In Ruby, there are no primitives. I don’t mean people hunting for mammoths and living in caves, I mean primitive types.
There is a long-awaited moment after launching a web application, when technical means used so far are no longer sufficient. Long story short, number of pageviews increases each day and at the same time response time increases rapidly. One of the first things which should be considered in such a case is introducing data caching.
Among filesystem and local memory, memcached is one of the most widely-used storage systems being adapted to cache data in web applications.
Disclaimer: most of the following observations refer to web applications development. It shouldn’t be difficult, though, to find their counterparts in the desktop world.
Introduction Unit Tests are often a subject of a heated debate. People either love or hate them, there is no much space left between these two attitudes. Since I’ve realized that my beliefs evolved from love to something intermediate, I decided to sum up two attitudes I encounter most often and describe thoroughly the third one, which I incline to agree with.
When thinking of parsing math expressions (which can be thought of as kind of language interpretation), one should not give the Interpreter Pattern a miss.
Interpreter is one of the design patterns originally described by the “Gang of Four”. It refers to interpreting some abstract language and it shows one of the ways of building an interpreter.
The keynote is simple: write a class for each kind of symbol that may occur in expression, then instantiate those classes and connect the objects together so they will form a tree.
RuPy is the strongly dynamic conference concerning mostly Ruby and Python programming languages. Registration is open from some time and now we have also completed the agenda. There will be a load of talks and many geek world stars will come to talk about their experiences.
After the first day of talks, we invite all attenders to join the Geek Party, where one can discuss Ruby and Python-related issues while holding a glass of cold beer.
Rake is a build tool written in Ruby, similar to make, Ant and Phing. There is a major difference between Rake and the others, though. Unlike the rest of the tools, Rake does not provide an external DSL (like XML build file in Ant). Instead, all the task are written in pure Ruby. Therefore you gain full flexibility and can take advantage of some nice Ruby features.
What Are The Build Tools?
We have a first confirmed speaker - Obie Fernandez. Obie is a well-known Ruby on Rails developer and founder of the Hashrocket company. He also keeps a blog and often speaks at conferences.
Obie, with all his experience, is surely going to make a stunning presentation. It’s a great argument for taking a part in RuPy!
Last year I have had the occasion of attending the RuPy Conference. Idea of the community-driven conference took my fancy and I decided to take an active part in the 2009 edition of RuPy.
I cooperate with the RuPy Conference organizers and I will be responsible mainly for keeping the community together. There is also a chance that I’ll make a presentation entitled “Artificial Intelligence Methods in Ruby”.
If I only get to know something new, I will gladly share the information with you.
In the introduction to building a math parser I already mentioned the Reverse Polish notation, also called “postfix notation”.
Its main advantage is unambiguity: you can simply read expression from left to right and calculate its value at the same time. You have to neither set up operators priorities nor use parenthesis. Refer to the Reverse Polish notation description for further details.
There are many implementations of Reverse Polish notation parser available, but most of them seem to be too complicated.
Generally, it is a good idea to automate every boring, complicated programming task that often needs to be repeated. Firstly, developer’s time and nerves can be spared. Secondly, the risk of doing something wrong (e.g. making a typo or leaving out one of the steps required) is minimized. Prepare the task once and don’t repeat yourself anymore.
There are many tools available and the choice is determined principally by the language and environment we use.
A Hash in Ruby is a data structure that holds values in the key => value fashion. Symbols are often being used as keys to speed up the process of key lookup.
The Hash class provides many useful methods, some of them come from the Enumerable module. We won’t go through all of them now, we’ll rather focus on the often forgotten, but worth its value method: default().
Let’s start with the basics.
Sometimes, when we are working with objects in Ruby, we want to make a copy of them. But what for? Well, in most cases we want to have a working copy and still maintain the original, intact object. Changing a reference back to the primary object is much simpler than repairing object’s state.
To our relief, Ruby makes object copying easy. It provides the clone() method that can be applied to any object.
If you don’t know what is a sitemap, I strongly encourage you to fill this gap in knowledge first and then get back to reading.
It seems to be clear that manual updating a sitemap can turn into a horror. Hopefully we can make the Rails do the job for us.
So, what components are we going to need to build a dynamic sitemap? Well, we are going to need a separate action (or even controller), an XML view and model methods to provide us with URL data.
Sometimes we want part of the website to be available to specific users only. Either we don’t want our users to interact with a piece of functionality we are still working on or we want to show the new function to our client first, before making it available to the public. In both cases, we can’t let a single unwanted user to slip through our fingers.
The first idea that crosses developer’s mind in such a situation is creating an authentication system based on the session.
Tidy is a quite powerful program which main purpose is to fix errors in HTML documents. TidyLib is a library version of Tidy written in C and by reason of easy C linkage, it can be used from within nearly any programming language, including PHP.
The common way to invoke Tidy functions from PHP is to use the Tidy extension, which can be easily enabled. Tidy extension has dual (both procedural and object-oriented) nature and from now on we’ll focus on the latter.
Rails ActiveRecord is a quite useful piece of software, though it lacks some features and way of achieving the desired result is not always obvious.
Let’s assume that we have two tables in our database: categories and posts. We would like to get most essential categories; i.e. those having at least 10 posts assigned to them. We can achieve this using the SQL JOIN, GROUP BY and HAVING clauses. However, there is no :having parameter on the find() method’s parameter list.
Writing test code is a worthwhile practice and building a parser is a good example to prove this claim. We have seen previously that the Parser class consists of many methods and each method is a part of a chain in top-down analysis. It won’t be a good idea to start writing the parser from scratch, add all methods we think necessary and then run the code for the first time.
The example implementation of a math parser is going to be written in Ruby because of its simplicity. Remember, however, that parsers are usually written in low-level languages, like C or C++. They are often located in the backbone of much bigger programs and are called frequently, so their performance has a great influence on overall system performance. Note that C code is fast, but its main disadvantage is the lack of portability (C code has to be compiled for every software platform separately).
In general, parser is a program that determines whether its input is valid, referring to the given grammar. So, if we would like to parse math expression, we have to set a formal grammar first. The most convenient way to do this is to write the context-free grammar’s production rules using EBNF (Extended Backus-Naur Form) notation. Take a look at this simple example:
digit = "0"|"1"|"2"|"3"|"4"|"5"|"6"|"7"|"8"|"9" The line we wrote is called a production rule and it reads: a digit can be equal to 0 or 1 or 2… or to 9.
Everyone knows how to calculate value of a simple math expression, like "2 + 3 * 7". But not every programmer knows how to write a program that would accomplish the same task.
The first idea usually looks like this:
result = get_number() while operator = get_operator() operand = get_number() result = result operator operand end return result It means: “read the expression from left to right and perform appropriate calculations when operator occurred”.