Best technical video on the Net

Posted by Dmytro Shteflyuk on under Resume

BestTechVideosFew days ago my best friend Alexey Kovyrin started new site which name is BestTechVideos.com. As he mentioned, this site has been created because there are lots really interesting videos on the Net, but if you’d like to fine some good tech video, it is not so simple to find them because of tons of crappy “funny videos” like “funny cats” and so on.

This site is interesting for me because I really like to see smarty people and listen their thoughts. Project is just started therefor video collection is not so large as I want, but it grows every day. I found interesting screencasts about AJAX, Web 2.0 and others here.

So, If you like to attend technical conferences and watch conference sessions on video, if you like idea of screencasts, etc, then this site is for you! Welcome to Best Tech Videos you’ll be impressed by amount of hi-quality and useful videos on the Net.

In-place file upload with Ruby on Rails

Posted by Dmytro Shteflyuk on under Ruby & Rails

My friends often asked me how to upload file using AJAX, and usually they got answer “in no way”. Correct answer, but what if I need to upload file without full page reloading? And, of course, I want to use RJS in this case. Here I’ll explain what to do to get effect very similar to AJAX file upload (btw, Gmail uses this technique).

Read the rest of entry »

Flexible application configuration in Ruby on Rails

Posted by Dmytro Shteflyuk on under Ruby & Rails

In my current project based on Ruby on Rails framework, I need to store application specific configuration somehow. There are several approaches I’ve found in Internet: AppConfig plugin, several methods described on the HowtoAddYourOwnConfigInfo wiki page, but neither one looks “config-like”. Me with my friend, Alexey Kovyrin, discovered all of them and decided to use YAML-file as a configuration format. In my opinion, the ideal configuration file looks like this:

1
2
3
4
5
6
7
8
9
10
11
common:
  support_email
: [email protected]
  root_url
: myhost.com
  photos_max_number
: 6

production
:
  email_exceptions
: true

development
:
  root_url
: localhost:3000
  photos_max_number
: 10

In this example you can see three sections: common will be used as a base configuration for all environments, production and development — environment specific options. Optional sections are production, development, and testing, or any other custom environment name. I’ve placed this file in config/config.yml and created lib/app_config.rb which looks like this:

1
2
3
4
5
6
7
8
# Load application configuration
require 'ostruct'
require 'yaml'
 
config = YAML.load_file("#{Rails.root}/config/config.yml") || {}
app_config = config['common'] || {}
app_config.update(config[Rails.env] || {})
AppConfig = OpenStruct.new(app_config)

Now I’m able to use constructions like AppConfig.support_email and AppConfig.root_url. Looks like I’ve kept all my configs as DRY as possible :-)

Upgrading Apache to version 2.2 in Debian

Posted by Dmytro Shteflyuk on under Ruby & Rails

Great news, guys! Apache 2.2 is in unstable now. I was very discouraged when tried to do apt-get install apache2-utils and it proposed me to remove apache2 and install it again :-) I decided to install new version to test rails with Apache 2.2, mod_proxy_balancing and mongrel. In this post I’ve described my adventures (or misfortunes?)

Read the rest of entry »