Panayotis Matsinopoulos

Senior Software Engineer: Love Creating Software, Taking Entrepreneurial Risks, Teaching Computer Programming & Blogging here or in many other places


My Courses


My Contact Details


My Projects


My Scheduled Classes


Books

Neo4j Essentials:

I have been technical reviewer on this book. That was a very exciting experience. Click below to see details of the book.


Posts

Making Rails Logger Use One Log File Per Process With Phusion Passenger

| Comments

Introduction

Today, I had to find a way to make my production Rails application log into different log files per process. I have the application deployed using Phusion Passenger as an Apache 2 module. The reason I decided to do that was the fact that I wanted to analyze the logs with Request Log Analyzer tool. This tool requires the log files to be separate so that they do not interleave the log entries of different requests.

My First iOS App

| Comments

This is my first encounter with iOS apps and Objective C. I followed the whole tutorial which is given here. I am a Ruby developer and I decided to take this trip to iOS development because it is necessary for my work. I am offering professional services to Book&Table, which is sponsoring me writing this blog post.

Following this tutorial, I had to keep some notes. Here are the most important ones. Maybe you will find them useful too. But most importantly, I am seeking feedback from experienced iOS developers.

Rails Params Does the Job

| Comments

When you have a Ruby on Rails end point, the client usually sends data in one of the following:

  1. For GET requests, URL encoded in the URI
  2. For POST requests, in the body of the request encoded with application/x-www-form-urlencoded or application/json or other popular format.

Sometimes, there is a combination of the above methods. In other words, in a POST request, some of the data may come both URL encoded in the URI and other data may come encoded with another method in the body of the request.

Ruby Array Sum

| Comments

This short post is going to demonstrate how we can sum an array of integers or an array of objects that have an integer attribute.

Let’s start:

Class vs Instance Variables

| Comments

demo of `Class` vs `Instance` variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Here, I am defining a class Dog with an class variable "@@number_of_feet"
# and an instance variable "@color", assuming that all dogs in the world
# have the same number of feet but they might differ in color. Or, at least,
# this is the general rule.
#
class Dog
  @@number_of_feet = 4

  def initialize(color)
    @color = color
  end

  def number_of_feet=(value)
    @@number_of_feet = value
  end

  def tell_me_about_you
    puts "My color is #{@color} and I have #{@@number_of_feet} feet"
  end
end

# The next two statements will set the "@color" instance variable to different values
# for max and rocky. But both dogs will have the same number of feet, which will be 4,
# since when class is initialized the "@@number_of_feet" instance variable takes the value 4.

max = Dog.new('black')
rocky = Dog.new('brown')

max.tell_me_about_you    # will print black and 4
rocky.tell_me_about_you  # will print brown and 4

# Now, I am changing the value of the class variable "@@number_of_feet" and I am setting that
# to "3". You will see that now all dogs change to have 3 feet. 
max.number_of_feet = 3

max.tell_me_about_you    # will print black and 3
rocky.tell_me_about_you  # will print brown and 3

United States, Counties, Cities, Zips CSV & Ruby Loading Code

| Comments

I just wanted to have the United States, their Counties, the Cities in the Counties and the Zip codes in each City in CSV format. But I wanted that normalized. In different CSVs. So, here it is. You can also find here some Ruby on Rails sample code that loads these files. Primitive stuff, but sometimes useful.

My sponsor on that is Book&Table
I am about to start a Seminar: Introduction to Programming. If you are interested in, register here.