|
전 골수 SK 팬은 아니지만, 그래도 2차 연고(-서울에서 나고 유년기를 보냈지만, 인생의 절반 이상은 인천에서 산 관계로)에 따라 SK를 응원하기는 합니다. 어찌되었건... 어제는 술 약속 때문에 경기를 못 봤는데 주전 포수 박경완 선수가 큰 부상을 당하셨더군요. 사실상 시즌 아웃이라는데 정말 안타깝습니다. 전력의 반이라 평가받고있는데 말이죠. ㅠㅠ 한참 두산과 박빙의 1,2위 싸움을 벌이고 있는데 전력에 큰 공백이 생겼으니 앞으로 어떻게 될지 염려스럽네요. 박경완 선수의 빠르 쾌차를 기원하며 내년에 다시 좋은 모습 보여주시리라 믿습니다. 흑...
This is too late posting - about 1 month -.. Sorry!! :-)
Happening May 4-7, 2009 at the Las Vegas Hilton, RailsConf is the official event for the Ruby on Rails community. And it is the largest official conference dedicated to everything Rails. As you know, Ruby and Ruby on Rails is the heart of CLIK system, so the conference was also important to us. The conference is consist of 1 tutorial day and 3 session days. As most other IT conferences, they have multi-track sessions, it is only one bad thing of the conference to me (in this respect, I like RubyFringe). :-) ![]() In session days, I attended many sessions as possible as I can. They organized 5 sessions in one time and 4 or 5 times in a day. A lot of various topics were talked and discussed in each session. Scaling, performance, architectural design, user interface design, testing, code quality, patterns and so on. I couldn’t attend all of them, so I chose sessions about performance and code quality. In Ruby and Ruby on Rails community, the performance is still important issues. Because a ability of handling heavy load environment – we call it ‘enterprise’ – is important barometer of that Ruby and Ruby on Rails can be major programming language or not. Many developers and companies showed how to they improved performance and solved their problems. Code quality is also important issue for every IT project. Because bad quality codes can lead to unexpected errors, hard maintenance, increasing cost in various fields. Sometimes it can be a reason of project failure. Nowadays, developers are trying to improve code quality with automated code quality checker. Of course, they can not guarantee high quality by only use them but it’s so helpful to figure out which codes are duplicated, bad style, etc. Metirc_fu is one of the automated code quality checking frameworks. Most significant feature of it, it uses several other frameworks for making code quality reporting. So the result is more helpful than using single framework and can reduce human effort to use several each framework. After came back Korea, I tested Metric_fu and I was very surprised how CLIK has many points which potentially be a problem in future. We’ve been improving CLIK source quality based on the result report and we’re going to use Metric_fu continuously. Most impressive session, technically it’s not a session – it was a keynote – was Robert C. Martin (we call him Uncle Bob)’s presentation “What Killed Smalltalk Could Kill Ruby Too”. Smalltalk is pretty elegant and powerful Object-Oriented programming language and it was so popular from end if 1970’s, through 1980’s, to mid of 1990’s. Many good practices and patterns came from Smalltalk community, for instance, Refactoring, Test Driven Development, object oriented software design and so on. And Ruby and Python have been influenced by Smalltalk. However, recent days, comparing to Java/C and C++/C#, not many developers use it to their project even Smalltalk is so powerful. Anyway, by the really exciting key note, he gave us – Ruby and Ruby on Rails developers – several topics that we should think about. Although there many pros and cons on the internet about his key note, it was a valuable time to me and other Ruby on Rails developers, I think. For days are not long times to talk about deep side of one thing, however, I was influenced many other developer’s knowledge and passion and I can get some useful ideas how we work with our CLIK system better. I hope I can have other opportunity to attend RailsConf again. ![]()
In last post, I used 2 dimension array. Below is 1 dimension version.
class Board def initialize(rows, cols) @rows, @cols = rows, cols @blocks = [] end def add(block) @blocks[index(block.x, block.y)] = block block.board = self block end def get_block(x,y) @blocks[index(x,y)] if inside_board?(x,y) end def to_s str = "" @blocks.each_with_index do |block, index| str += "\n" if (index > 0 and (index+1) % @cols == 0) str += block.to_s end str end def friends_of(block) candidates = [] (block.x-1).upto(block.x+1) do |target_x| (block.y-1).upto(block.y) do |target_y| candidates << get_block(target_x, target_y) end end candidates.compact end #sometimes, minus index of Ruby array leads extra work. :-< def inside_board?(x,y) (x >= 0 and x < @cols and y >= 0 and y < @rows) end def index(x, y) @cols * y + x end end
Actually this quiz came from 'minesweeper' of programming challenges.
It's not difficult code, so skip explanation. And I have another idea that can reduce amount of memory usage when input data is huge size (for instance, 405060 X 405060). But I don't have enough space to write it :-). Anyway below code has only one if and one case statement. It's so cool, isn't it? :-) class Board def initialize(rows, cols) @rows, @cols = rows, cols @blocks = [] rows.times { @blocks << [] } end def add(block) @blocks[block.y][block.x] = block block.board = self block end def get_block(x,y) @blocks[y][x] if inside_board?(x,y) end def to_s @blocks.map{ |line| line.map(&:to_s).join }.join("\n") end def friends_of(block) candidates = [] (block.x-1).upto(block.x+1) do |target_x| (block.y-1).upto(block.y) do |target_y| candidates << get_block(target_x, target_y) end end candidates.compact end #sometimes, minus index of Ruby array leads extra work. :-< def inside_board?(x,y) (x >= 0 and x < @cols and y >= 0 and y < @rows) end end class Block attr_accessor :board, :x, :y, :around_mine_number def self.make(type, x, y) case type when '*' then MineBlock.new(x, y) when '.' then NormalBlock.new(x, y) end end def initialize(x, y) @x, @y = x, y @around_mine_number = 0 end def update_with_around_blocks @board.friends_of(self).each do |f| f.update_mine_status(self) self.update_mine_status(f) end end end class MineBlock < Block def to_s; '*'; end def update_mine_status(other) other.around_mine_number += 1 end end class NormalBlock < Block def to_s; @around_mine_number; end def update_mine_status(other); end end inputs = "5 3 *.. *.. ... .*. ...".split(' ') num_of_rows, num_of_cols = inputs.slice!(0..1).map(&:to_i) board = Board.new(num_of_rows, num_of_cols) num_of_rows.times do |row| marks = inputs.slice!(0).split('') num_of_cols.times do |col| assigned_block = board.add(Block.make(marks[col], col, row)) assigned_block.update_with_around_blocks end end puts board PS. Egloos is not good for code posing.
I was a idiot. Yeah.. I thought if I merge two Google analytics javasciprt section to one, it would be helpful to reduce our CLIK loading time like below:
Original: <script type="text/javascript"> My mistake: <script type="text/javascript"> Since I did it (May 24), our access statistics in Google analytics shows wrong result. During the period CLIK never had serviced anything to user according to the alaytics. But our team accessed CLIK and some our user also use CLIK during the period. (May 25 ~ June 2) ![]() |
누구냐, 너?
태그
activeresource
23쪽
피터
APCC
고객
야구
SK
Youtube
Boom-de-yada
요구사항
google-anaytics
RESTFul
netbeans
rails
railsconf2009
CLIK
Proc
Symbol_to_proc
Enum
2.3.2
Discovery
스포츠온
jruby1.1.4
박경완
javascript
ruby
quiz
jruby1.1.5
passenger
롯데
이글루 파인더
카테고리
최근 등록된 덧글
1년 전에 짠 코드네요. 요즘 ..
by 애자일컨설팅 at 07/01 안녕하시죠? J 는 정말 신기한 .. by 허진영 at 06/30 http://club.filltong.net/co.. by 애자일컨설팅 at 06/29 저런;;; by 윤군 at 06/18 이 정도면 충분하지 이녀석 .. by 허진영 at 06/16 엘레강스 하지 않은걸요 ? ㅋㅋ by 윤 at 06/16 그냥 추정이다만 첫번째에 보면.. by 허진영 at 06/16 저 두개가 먼차이 죠 ? by 윤 at 06/05 옆에 베너처럼 공돌이는 대단해 .. by 윤 at 05/29 사실 전 그런거 발견하는 사람.. by 국재리 at 05/27 최근 등록된 트랙백
싸부 ~ 받아유~~ ㅋㅋ
by is 윤군! MediaWiki 설치 하기 by With Sol & Jinny... 피터가 말했습니다. 2008.12.31 by dazzilove 피터가 말한 23쪽. by [HelolS] 꼬라지 하고는.. ;; 피터가 말했습니다. by 정의의소의 블로그 피터가 말했습니다. by The note of Legendre 종부세 기준 내년부터 6억원→.. by 정책공감 - 소통하는 정부대표.. 용우의 생각 by mixed's me2DAY 용우의 생각 by mixed's me2DAY 눈뜨고는 볼 수 없는 일 by nooegoch 이전 블로그
라이프 로그
포토로그
|