Hi everyone! 新しいインターン生のマフディーです!- 1日目 -

f:id:techinterfirm:20140819091451j:plain


Hi everyone! This is Mahdi from Tunisia. I am the new intern at Interfirm!


I'm writing this right after the first day of my internship. I am very optimistic about my future with Interfirm after experiencing such an amazing first day!

Everyone has been really kind, fun and helpful to me. I really loved the friendly atmosphere in the office.


My first project


While setting up my development environment to tackle my first project, I ran into quite a few problems (as expected!)

The first one was with the Ruby gem 'libv8'. The error was "libv8 did not install properly, expected binary v8 archive to exist, but it was not found".

I turned out that 'libv8' is the interface for the V8 Engine used by therubyracer, and that there was an easy way to install 'libv8' using the system's V8 Engine:

(solution found here:
rubygems - Installing libv8 gem on Mavericks - Stack Overflow
)

gem install libv8 [-v YOUR_VERSION] -- --with-system-v8


or for bundler (to be added in the Gemfile):

bundle config build.libv8 --with-system-v8


If that doesn't work, please try installing v8 with homebrew and then retrying the above commands:

brew install v8

It is important to note that it simply might not work until you update your ruby version. In my case, the system-provided "ruby-2.0.0p481" was not enough, pushing me to resort to installing "ruby-2.1.1" (also known as "ruby-2.1.1p76")



The second issue I encountered was with setting up the environment variables for mysql's login details in Rails, but thankfully my friend Shun was quick to the rescue!

Application configuration variables can be set in the file "project/config/application.yml", so in this case it is easy to specify the connection details variables:

PROJECT_USERNAME: ""
PROJECT_PASSWORD: ""
PROJECT_SOCKET: "/tmp/mysql.sock"


then, they could be used in "project/config/database.yml" through the ENV array:


default: &default
adapter: mysql2
encoding: utf8
pool: 5 
username: <%= ENV['PROJECT_USERNAME'] %> 
password: <%= ENV['PROJECT_PASSWORD'] %> 
host: 127.0.0.1 
socket: <%= ENV['PROJECT_SOCKET'] %>

This is a really practical method, as I used to specify the login details in the database.yml file directly in the past.



And finally, a problem caused by the gem 'spring' which prevented rails from starting the server and kept showing the error "in/rails:6: warning: already initialized constant APP_PATH".


The solution to this, was an easy (but probably inconvenient) removal or commenting of the gem 'spring' in the Gemfile. I'll leave it to you to find a better solution!


That's it for today! I had so much fun and I would like to thank everyone at Interfirm for the opportunity, and for getting to work with such great people!


よろしくおねがいしますー!

      • -


簡単訳

こんにちは、みなさん!チュニジアから新しいインターン生としてきましたマフディーです。
(今日から5ヶ月間インターファームでインターンします!)
1日目がとっても待ち通しかったです。みんないい人で、優しくて面白いって、、、もういいことしか書いてないですね!

その後は1日目に行ったセットアップについて、書いてくれました。

以上マフディーからの初ブログでした!

マフディーが日本語レベルアプしてくれて2言語ブログを書いてくれる日がくるのが楽しみです←
翻訳さぼってごめんなさい。(by @zippo_m)