'전체 글'에 해당되는 글 68건
- 2010.07.20 Python Expression For Nuke.
- 2010.07.14 Rails 에서 업로드 컴포넌트로 플래쉬를 사용할 경우에.
- 2010.07.09 ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법.
- 2010.06.28 Rails 에서 정말 간편한 Helper 함수들 목록.
- 2010.06.26 QT4 VS2008 Installer
- 2010.06.25 QT4 프로그래밍에서 한글 입출력 관련..
- 2010.06.10 inplace select 에 필드추가 기능 넣기
- 2010.06.10 Super inplace controls의 사용.
- 2010.06.08 PaperClip 사용방법.
- 2010.06.03 QT4에서 SLOT 을 선언하는 방버.
- 2010.05.31 CUDA Tips #1.
- 2010.05.27 QT4 With Visual Studio x64 1
- 2009.03.23 CentOS 5.2 에서 rails 설치.
- 2009.03.05 JQuery 기본적인 사용방법.
- 2009.03.05 Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2
- 2009.02.19 Rails 에서 Prototype 과 JQuery 를 동시에 사용하기.
- 2009.02.16 ActiveRecord 정렬하는 방법.
- 2009.01.29 Ajax 에서 로딩중인 이미지를 만들어 보자~
- 2009.01.28 꽤 쓸모가 있을 만한 Rounded Corner CSS
- 2009.01.28 Activescaffold 에서 rounded corner 를 사용하는 방법.
Python Expression For Nuke.
'OLD POSTS' 카테고리의 다른 글
OGRE3D FOR IPHONE 1.7.1 (0) | 2010.08.27 |
---|---|
OGRE3D for iPhone. (0) | 2010.08.26 |
Rails 에서 업로드 컴포넌트로 플래쉬를 사용할 경우에. (0) | 2010.07.14 |
ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법. (0) | 2010.07.09 |
Rails 에서 정말 간편한 Helper 함수들 목록. (0) | 2010.06.28 |
Rails 에서 업로드 컴포넌트로 플래쉬를 사용할 경우에.
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
#protect_from_forgery # See ActionController::RequestForgeryProtection for details
self.allow_forgery_protection = false
# Scrub sensitive parameters from your log
# filter_parameter_logging :password
layout "application"
end
'OLD POSTS' 카테고리의 다른 글
OGRE3D for iPhone. (0) | 2010.08.26 |
---|---|
Python Expression For Nuke. (0) | 2010.07.20 |
ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법. (0) | 2010.07.09 |
Rails 에서 정말 간편한 Helper 함수들 목록. (0) | 2010.06.28 |
QT4 VS2008 Installer (0) | 2010.06.26 |
ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법.
'OLD POSTS' 카테고리의 다른 글
Python Expression For Nuke. (0) | 2010.07.20 |
---|---|
Rails 에서 업로드 컴포넌트로 플래쉬를 사용할 경우에. (0) | 2010.07.14 |
Rails 에서 정말 간편한 Helper 함수들 목록. (0) | 2010.06.28 |
QT4 VS2008 Installer (0) | 2010.06.26 |
QT4 프로그래밍에서 한글 입출력 관련.. (0) | 2010.06.25 |
Rails 에서 정말 간편한 Helper 함수들 목록.
http://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#M000423
Rails 의 Helper 함수들.
테이블 리스트로 출력시 cycle('odd', 'even') 이건 정말이지. 짱이삼.!
'OLD POSTS' 카테고리의 다른 글
Rails 에서 업로드 컴포넌트로 플래쉬를 사용할 경우에. (0) | 2010.07.14 |
---|---|
ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법. (0) | 2010.07.09 |
QT4 VS2008 Installer (0) | 2010.06.26 |
QT4 프로그래밍에서 한글 입출력 관련.. (0) | 2010.06.25 |
inplace select 에 필드추가 기능 넣기 (0) | 2010.06.10 |
QT4 VS2008 Installer
'OLD POSTS' 카테고리의 다른 글
ruby에서 UTF-8 문자열을 EUC-KR 로 변환하는 방법. (0) | 2010.07.09 |
---|---|
Rails 에서 정말 간편한 Helper 함수들 목록. (0) | 2010.06.28 |
QT4 프로그래밍에서 한글 입출력 관련.. (0) | 2010.06.25 |
inplace select 에 필드추가 기능 넣기 (0) | 2010.06.10 |
Super inplace controls의 사용. (0) | 2010.06.10 |
QT4 프로그래밍에서 한글 입출력 관련..
'OLD POSTS' 카테고리의 다른 글
Rails 에서 정말 간편한 Helper 함수들 목록. (0) | 2010.06.28 |
---|---|
QT4 VS2008 Installer (0) | 2010.06.26 |
inplace select 에 필드추가 기능 넣기 (0) | 2010.06.10 |
Super inplace controls의 사용. (0) | 2010.06.10 |
PaperClip 사용방법. (0) | 2010.06.08 |
inplace select 에 필드추가 기능 넣기
'OLD POSTS' 카테고리의 다른 글
QT4 VS2008 Installer (0) | 2010.06.26 |
---|---|
QT4 프로그래밍에서 한글 입출력 관련.. (0) | 2010.06.25 |
Super inplace controls의 사용. (0) | 2010.06.10 |
PaperClip 사용방법. (0) | 2010.06.08 |
QT4에서 SLOT 을 선언하는 방버. (0) | 2010.06.03 |
Super inplace controls의 사용.
'OLD POSTS' 카테고리의 다른 글
QT4 프로그래밍에서 한글 입출력 관련.. (0) | 2010.06.25 |
---|---|
inplace select 에 필드추가 기능 넣기 (0) | 2010.06.10 |
PaperClip 사용방법. (0) | 2010.06.08 |
QT4에서 SLOT 을 선언하는 방버. (0) | 2010.06.03 |
CUDA Tips #1. (0) | 2010.05.31 |
PaperClip 사용방법.
'OLD POSTS' 카테고리의 다른 글
inplace select 에 필드추가 기능 넣기 (0) | 2010.06.10 |
---|---|
Super inplace controls의 사용. (0) | 2010.06.10 |
QT4에서 SLOT 을 선언하는 방버. (0) | 2010.06.03 |
CUDA Tips #1. (0) | 2010.05.31 |
QT4 With Visual Studio x64 (1) | 2010.05.27 |
QT4에서 SLOT 을 선언하는 방버.
protected slots:
private slots:
public slots:
위 세가지 지시자를 사용한다.!
slots 로 선언하지 않은 함수는 SIGNAL 과 연결지어도 실행되지 않는다.
--> 에러메시지 혹은 warning 이라도 뜨면 좋으련만 그렇지 않아서 약간의 시간을 날려버렸다.
'OLD POSTS' 카테고리의 다른 글
Super inplace controls의 사용. (0) | 2010.06.10 |
---|---|
PaperClip 사용방법. (0) | 2010.06.08 |
CUDA Tips #1. (0) | 2010.05.31 |
QT4 With Visual Studio x64 (1) | 2010.05.27 |
CentOS 5.2 에서 rails 설치. (0) | 2009.03.23 |
CUDA Tips #1.
거창한 팁 시리즈들은 아니고
CUDA 를 사용해서 프로그래밍을 하던 중 이것저것 알아낸 부분이 있으면 정리하기 위한! 시리즈!
그 첫번째!
오늘 하루종일 삽질하던 에러..
cpp 파일에서 cu 파일의 함수를 불러오는 중에 (call by ref, call by param)
dim3 변수가 제값을 전달하지 못하는 에러가 발생했다.
10, 10, 10 을 넣었는데 16390, 0, 1231994 등의 이상한 값들이 계속 발생. dim3 를 int 로 바꿔봐도 마찬가지.
이것저것 골머리를 앓던중에 알아낸 것은!
x64 환경에서 cu 파일을 32비트로 컴파일하고 그냥 링크하는 것이었다. –_-
딱히 경고나 에러 메시지가 전혀 나오지 않아서 계속 삽질만 하던중에 혹시(?) 라고 판단 64비트 옵션을 주어서 –m64
nvcc 에서 컴파일하니깐 제대로 돌아간다…
* nvcc –m64 option.
'OLD POSTS' 카테고리의 다른 글
PaperClip 사용방법. (0) | 2010.06.08 |
---|---|
QT4에서 SLOT 을 선언하는 방버. (0) | 2010.06.03 |
QT4 With Visual Studio x64 (1) | 2010.05.27 |
CentOS 5.2 에서 rails 설치. (0) | 2009.03.23 |
JQuery 기본적인 사용방법. (0) | 2009.03.05 |
QT4 With Visual Studio x64
일단 QT4 를 설치 한 상태이고 visual studio addin 을 설치한다.
visual studio 2008 x64 Win64 Command Prompt 를 실행한 후에
QT4 의 디렉토리로 가서 configure 를 실행한다.
실행을 하면 자동으로 nmake 파일들이 생성이 되는데.
이어서 nmake 를 실행시켜서 QT4 를 다시 컴파일해주면 된다.
visual studio 2008 에서 New > QT4 프로젝트를 생성해서 컴파일 실행이 가능하다!~
'OLD POSTS' 카테고리의 다른 글
QT4에서 SLOT 을 선언하는 방버. (0) | 2010.06.03 |
---|---|
CUDA Tips #1. (0) | 2010.05.31 |
CentOS 5.2 에서 rails 설치. (0) | 2009.03.23 |
JQuery 기본적인 사용방법. (0) | 2009.03.05 |
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2 (0) | 2009.03.05 |
CentOS 5.2 에서 rails 설치.
1. Install ruby
> yum install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc
2. Install gem
> wget http://rubyforge.org/frs/download.php/45905/rubygems-1.3.1.tgz
> tar xvf rubygems-1.3.1.gz
> cd rubygems-1.3.1
> ruby setup.rb
3. Install Rails
> gem install rails
'OLD POSTS' 카테고리의 다른 글
CUDA Tips #1. (0) | 2010.05.31 |
---|---|
QT4 With Visual Studio x64 (1) | 2010.05.27 |
JQuery 기본적인 사용방법. (0) | 2009.03.05 |
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2 (0) | 2009.03.05 |
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기. (0) | 2009.02.19 |
JQuery 기본적인 사용방법.
dom 선택
css selector와 같은 형식으로 dom을 선택할 수 있다. selector를 사용하기 위해서 jQuery 혹은 $를 사용한다.
- jQuery("#id")
- $(".class")
- $("tag.class")
return되는 것은 jQuery 객체이다.
event handling
가장 맘에 드는 event handling이다. 다음과 같이 선택된 DOM에 원하는 event 함수들을 달아놓으면 된다.
- $(document).ready( function() {
- $("#project_submit").click(function(){
- alert("submit the form");
- return true;
- });
- });
$(document).ready 는 브라우져가 모든 js 들을 다 download 받은 후 실행될 것을 보장한다. (window.onload와 같다.)
$("#project_submit").click 은 project_submit이란 id를 가진 dom에 click 이벤트가 발생하면 실행된다.
더 자세한 event에 대해서는 http://docs.jquery.com/Events 를 참조한다.
Effect
간단한 effect들 역시 손쉽게 사용할 수 있다.
- $("#message_box").fadeOut();
더 자세한 효과들에 대해서는 http://docs.jquery.com/Effects 를 참조.
each, map, unique
배열이 있고 배열을 iteration 하고 싶은 경우 each를 사용할 수 있다.
- members = ["juddy", "james"];
- $.each(members, function() {
- project.members.push(this));
- });
function 안의 this는 각 member를 가르킨다.
selector를 이용했다면 다음과 같이 더 간결한 표현도 가능하다.
- $(".project").each( function() {
- });
Ajax Request
Ajax request도 간단하게 사용할 수 있다.
- $.ajax({
- type: "POST",
- url: "/projects/recent",
- data: "duration=5&user=juddy",
- success: function(html){
- $("#recent_projects").replaceWith(html);
- }
- });
success는 요청 성공시 호출되는 event handler이다. 이렇게 각 요청에 대해서 event handler를 작성할 수도 있고, 모든 요청에 대한 global event handler를 다음과 같이 정의할 수도 있다.
- $("#ajax_msg").ajaxSuccess(function(evt, request, settings){
- $(this).append("<li>Successful Request!</li>");
- });
json request를 callback과 함께 사용하고 싶다면 getJSON을 사용할 수도 있다. (GET요청만 사용가능)
- $.getJSON("/projects/recent",
- function(data){
- // handle data
- });
- });
더 자세한 내용은 http://docs.jquery.com/Ajax 를 참조.
'OLD POSTS' 카테고리의 다른 글
QT4 With Visual Studio x64 (1) | 2010.05.27 |
---|---|
CentOS 5.2 에서 rails 설치. (0) | 2009.03.23 |
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2 (0) | 2009.03.05 |
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기. (0) | 2009.02.19 |
ActiveRecord 정렬하는 방법. (0) | 2009.02.16 |
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2
지금 현재 JRails 플러그인을 깔아놓은 형태이긴 한데.
<%= javascript_include_tag :defaults %>
이 부분에서 약간 혼란이 있는듯 하다.
JRails 플러그인 설명에 보면 이부분이 자동적으로 JQuery 로 바뀌는 듯하다.
뭐 어쨌건 지금은
<%= javascript_include_tag :defaults %>
<%= javascript_include_tag 'jrails', 'jquery', 'jquery-ui', 'application' %>
<%= javascript_include_tag 'prototype', 'effects', 'dragdrop' %>
<%= active_scaffold_includes %>
이 순서로 로딩해서 사용하고 있다. application.js 부분에는
jQuery.noConflict();
이걸 추가해준 상태다.
테스트로 drag div 에 drag 속성을 줬다.
<script>
jQuery("#job_1166").draggable();
new Draggable("job_1116");
</script>
프로토타입과 jquery 에서 ID 찾는 방법이 차이가 있는데
프로토타입에서는 그냥 id name 만 쓰면 되지만.
JQuery에서는 # 을 꼭 붙여줘야한다.
'OLD POSTS' 카테고리의 다른 글
CentOS 5.2 에서 rails 설치. (0) | 2009.03.23 |
---|---|
JQuery 기본적인 사용방법. (0) | 2009.03.05 |
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기. (0) | 2009.02.19 |
ActiveRecord 정렬하는 방법. (0) | 2009.02.16 |
Ajax 에서 로딩중인 이미지를 만들어 보자~ (0) | 2009.01.29 |
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기.
JQuery 가 플러그인 형태로 제공되는 라이브러리들이 굉장히 많다는 장점 때문에.
JQuery 가 끌리는게 사실이다.
Prototype 라이브러리를 JQuery 로 완전히 바꾼 JRails 가 있긴 하지만.
굳이 아직까지는 완전히 대체할 필요까지는 없는 듯하다.
앞으로 계속 JQuery 를 사용한다면 얘기는 달라지긴 하겠지만.
일단 Prototype 과 JQuery 를 같이 사용할 예정이다.
같이 사용하는 방법에 대해서는
Using jQuery with Other Libraries
prototype과 jquery 같이 사용하기 [JQuery 클릭, 링크 이벤트 포함]'OLD POSTS' 카테고리의 다른 글
JQuery 기본적인 사용방법. (0) | 2009.03.05 |
---|---|
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2 (0) | 2009.03.05 |
ActiveRecord 정렬하는 방법. (0) | 2009.02.16 |
Ajax 에서 로딩중인 이미지를 만들어 보자~ (0) | 2009.01.29 |
꽤 쓸모가 있을 만한 Rounded Corner CSS (0) | 2009.01.28 |
ActiveRecord 정렬하는 방법.
ActiveRecord 를 많이 사용하다 보면
정렬해서 볼 필요가 많이 생기는데.
기본적으로.. sort, sort_by 메쏘드를 많이 사용하게 된다.
enum.sort => array
enum.sort {| a, b | block } => array
Returns an array containing the items in enum sorted, either according to their own <=> method, or by using the results of the supplied block. The block should return -1, 0, or +1 depending on the comparison between a and b. As of Ruby 1.8, the method Enumerable#sort_by implements a built-in Schwartzian Transform, useful when key computation or comparison is expensive..
%w(rhea kea flea).sort #=> ["flea", "kea", "rhea"] (1..10).sort {|a,b| b <=> a} #=> [10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
enum.sort_by {| obj | block } => array
Sorts enum using a set of keys generated by mapping the values in enum through the given block.
%w{ apple pear fig }.sort_by {|word| word.length} #=> ["fig", "pear", "apple"]
The current implementation of sort_by generates an array of tuples containing the original collection element and the mapped value. This makes sort_by fairly expensive when the keysets are simple
require 'benchmark' include Benchmark a = (1..100000).map {rand(100000)} bm(10) do |b| b.report("Sort") { a.sort } b.report("Sort by") { a.sort_by {|a| a} } end
produces:
user system total real Sort 0.180000 0.000000 0.180000 ( 0.175469) Sort by 1.980000 0.040000 2.020000 ( 2.013586)
However, consider the case where comparing the keys is a non-trivial operation. The following code sorts some files on modification time using the basic sort method.
files = Dir["*"] sorted = files.sort {|a,b| File.new(a).mtime <=> File.new(b).mtime} sorted #=> ["mon", "tues", "wed", "thurs"]
This sort is inefficient: it generates two new File objects during every comparison. A slightly better technique is to use the Kernel#test method to generate the modification times directly.
files = Dir["*"] sorted = files.sort { |a,b| test(?M, a) <=> test(?M, b) } sorted #=> ["mon", "tues", "wed", "thurs"]
This still generates many unnecessary Time objects. A more efficient technique is to cache the sort keys (modification times in this case) before the sort. Perl users often call this approach a Schwartzian Transform, after Randal Schwartz. We construct a temporary array, where each element is an array containing our sort key along with the filename. We sort this array, and then extract the filename from the result.
sorted = Dir["*"].collect { |f| [test(?M, f), f] }.sort.collect { |f| f[1] } sorted #=> ["mon", "tues", "wed", "thurs"]
This is exactly what sort_by does internally.
sorted = Dir["*"].sort_by {|f| test(?M, f)} sorted #=> ["mon", "tues", "wed", "thurs"]
'OLD POSTS' 카테고리의 다른 글
Rails 에서 JQuery와 Prototype 을 함께 사용하는 방법 #2 (0) | 2009.03.05 |
---|---|
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기. (0) | 2009.02.19 |
Ajax 에서 로딩중인 이미지를 만들어 보자~ (0) | 2009.01.29 |
꽤 쓸모가 있을 만한 Rounded Corner CSS (0) | 2009.01.28 |
Activescaffold 에서 rounded corner 를 사용하는 방법. (0) | 2009.01.28 |
Ajax 에서 로딩중인 이미지를 만들어 보자~
'OLD POSTS' 카테고리의 다른 글
Rails 에서 Prototype 과 JQuery 를 동시에 사용하기. (0) | 2009.02.19 |
---|---|
ActiveRecord 정렬하는 방법. (0) | 2009.02.16 |
꽤 쓸모가 있을 만한 Rounded Corner CSS (0) | 2009.01.28 |
Activescaffold 에서 rounded corner 를 사용하는 방법. (0) | 2009.01.28 |
Javascript 를 가지고 Rounded Corner 만드는 방법. (0) | 2009.01.28 |
꽤 쓸모가 있을 만한 Rounded Corner CSS
pre { background-color: #def; color: #112; padding: 10px; font-size: 13px;
overflow: auto; margin: 4px 0px; overflow-x: auto; overflow-y: hidden; margin-top: 12px; border: 1px solid #9ad; -moz-border-radius: 25px 10px 25px 10px; CCborderRadiusTL: 25px;
CCborderRadiusTR: 10px;
CCborderRadiusBL: 10px;
CCborderRadiusBR: 25px;
}
'OLD POSTS' 카테고리의 다른 글
ActiveRecord 정렬하는 방법. (0) | 2009.02.16 |
---|---|
Ajax 에서 로딩중인 이미지를 만들어 보자~ (0) | 2009.01.29 |
Activescaffold 에서 rounded corner 를 사용하는 방법. (0) | 2009.01.28 |
Javascript 를 가지고 Rounded Corner 만드는 방법. (0) | 2009.01.28 |
link_to_remote 에서 자바스크립트를 사용하기. (0) | 2009.01.20 |
Activescaffold 에서 rounded corner 를 사용하는 방법.
activescaffold 에서는
Rico 라는 Ajax 프레임 웍을 사용하는데.
이중에서 Rounded Corner 를 사용하는 방법은..
<script type="text/javascript">
Rico.Corner.round($$('#myBox').first());
</script>
이런식으로 사용한다.
'OLD POSTS' 카테고리의 다른 글
Ajax 에서 로딩중인 이미지를 만들어 보자~ (0) | 2009.01.29 |
---|---|
꽤 쓸모가 있을 만한 Rounded Corner CSS (0) | 2009.01.28 |
Javascript 를 가지고 Rounded Corner 만드는 방법. (0) | 2009.01.28 |
link_to_remote 에서 자바스크립트를 사용하기. (0) | 2009.01.20 |
ActiveScaffold 에서 value field 를 셀렉트 박스로 만들기. (0) | 2009.01.14 |