Recently I’m trying to upgrade one big project from Ruby 1.8.7 to 1.9.3.
It is bumpy road but here are some thoughts gathered during this time:
1. Make small steps – especially when pushing those changes to production. You’ll never know what are going to break.
2. When changing API endpoint find every call to that endpoint. Record HTTP requests & responses and test them.
3. Improve test coverage. The more good specs you have, the better.
4. Update only necessary gems to get your code working on Ruby 1.9.3.
5. Set up Continuous Integration server to run specs on both Ruby versions: 1.8.7 & 1.9.3.
6. Analyze & understand business logic in code. Use metric_fu, simplecov to know more about code.
7. Delete unused code.
On my OS X 10.8.5 I tried to do specific task: I want to set up FTP server where user has full access to that specific place — he can upload/download and remove files without any problems. After spending some time with this I came to solution to create new user in system and set configuration of
/etc/ftpd.conf to sth like that:
chroot REAL /path/to/directory
To start & stop FTP server I used those commands
sudo -s launchctl load -w /System/Library/LaunchDaemons/ftp.plist
sudo -s launchctl unload -w /System/Library/LaunchDaemons/ftp.plist
Good reference book
In my current project I use JSON heavily as representation when “talking to” servers. I decided to read that book and possibly get some insights how design better APIs.
First three chapters are reminder how HTTP works, its semantics a protocol and what exactly REST stands for. As an example authors use simple microblog service. Consecutive chapters cover hypermedia, the collection pattern, the design procedure and much more.
From my perspective the most interesting part (& most useful) were chapter devoted to the collection pattern and discussion about minimising semantic gap. From my developer’s point of view: using consistent, well-defined structure for JSON responses can simplify parsing and it’s easier to manage.
What I miss in this book are more complex “real-life” examples. I like academic discussions but I like practical examples more
Product page: http://shop.oreilly.com/product/0636920028468.do
Cook your iOS apps
I like cookbooks and iOS6 Programming Cookbook is no exception. Author covers a lot of practical knowledge: basics of Objective-C, UI solutions, Xcode features (e.g. Interface Builder, Storyboards), concurrency, gestures, maps, networking, graphics, motion and many more.
Vandad presents material clearly, solutions contains screenshots, schemes, references and code to understand and implement it.
iOS6 Programming Cookbook is good reference book and I can recommend it to every iOS developer/hobbyist.
Product page: http://shop.oreilly.com/product/0636920027683.do
Na początek instalujemy potrzebne biblioteki i narzędzia do skompilowania Rubiego i gemów domyślnie będących w zależnościach Railsów.
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev curl git git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool nodejs
W przypadku korzystania z gemu ‘pg’ warto doinstalować:
sudo apt-get install libpq-dev
Następnie do pliku
.bashrc w katalogu domowym dodajemy następującą linijkę:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
W terminalu wczytujemy zmieniony
.bashrc za pomocą polecenia
Teraz opcjonalnie możemy stworzyć plik
.gemrc w katalogu domowym i dodać następujące linijki:
install: --no-rdoc --no-ri update: --no-rdoc --no-ri
Dzięki temu przy instalacji gemów nie będzie generowana dokumentacja.
rvm use 2.0.0 --default
wskazujemy, że domyślnie chcemy korzystać z Rubiego 2.0.0.
gem do najnowszej wersji:
gem update --system
Do zainstalowania pozostały jeszcze Railsy, co robimy poleceniem:
gem install rails
Po instalacji tworzymy testowy projekt, aby sprawdzić poprawność działania.
rails new projekt
Wchodzimy na stronę: http://localhost:3000, aby zobaczyć działającą aplikację.
Perl from the ground up
Learning Perl Video is almost 11 hours long lectures covering Perl from the ground up. Randal Schwartz presents concepts and quirks in Perl step by step. Videos are nicely divided by topics. Every video is shorter than 1 hours, so it’s optimal to pay attention to presented material and take break between videos.
Randal presents material clearly, tells some anecdotes but there are not too many examples. Hands-on experience seems to me vital when learning programming language and I checked many code snippets when I watched those lectures.
Product page: http://shop.oreilly.com/product/0636920014430.do
Scala in examples
Scala Cookbook is very practical book. Author presents every small example as problem to solve and possible solutions with discussion. I learned syntax for some concepts (like pattern matching, auxiliary constructors, executing external commands, lazy collections) I’ve seen in other programming languages. The book helped me better understand how implicits work.
Moreover, there are available bonus chapters providing recipes about XML, XPath, testing, debugging and Play framework.
Scala Cookbook is comprehensive book. It provides practical solution for typical developer’s problem and I recommend this book everybody interested in Scala.
Product page: http://shop.oreilly.com/product/0636920026914.do
When I first saw title of this book it seemed to be quite promising, but…
After studying 5 years Computer Science there are not too many surprising topics in that book. It was nice adventure to refresh some Python and go through “Case Study” chapters.
For me, topics are interesting, but many examples are presented in too boring form and they don’t have too much interesting context.
It would be better if code were gathered in one archive/repository and author provided script to install all dependencies at once.
Product page: http://shop.oreilly.com/product/0636920022480.do
W trakcie pracy z gitem natrafiam na różne problemy – szczególnie wtedy, gdy zaczynam coś psuć
Poniżej lista rozwiązań znalezionych w sieci, które przydają mi się w pracy z gitem:
- How do I clone all remote branches with Git?
- Update a Github Fork from the Original Repo
- Git: Move recent commit to a new branch
- Git: How to move existing work to new branch?
- cleaning up untracked files
- Undoing in Git – Reset, Checkout and Revert
- recovering a deleted branch using git reflog
- How do I delete a Git branch both locally and in Github?
Web is changing: new technologies, frameworks but also new devices for browsing Internet.
Big advantage of The Modern Web book is that at the end of chapter there is further reading section. Author provided source code of examples on: http://modernwebbook.com.
Product page: http://shop.oreilly.com/product/9781593274870.do