Showing posts from April, 2010

Kick Ass (2010), was funny!!

“I can’t read your mind, but I can kick your ass” Today, I watched movie Kick Ass (2010). It's directed by Matthew Vaughn, who also directed "Wanted". His movie seems always satisfy the deviant desires of salaryman like me. ★★★★★!!! When I watched a preview of this movie, it was too babyish. But, there are many scenes of brutality, and it was very impressive to me. Especially, the rescue scene of Kick Ass/Big Daddy part of the final act brought tears to my eyes. (-_-;;)

Installing SciPy

Original article: Installing SciPy If one couldn't guess from my having built this site using Django, I happen to be a big fan of using Python in various stages of software development. My focus on graphics and image processing requires more robust array and matrix datatypes and their associated operations than what Python includes in its standard library. There are two extensions to Python that provide this functionality: numpy, for efficient, native memory arrays and matrices, and scipy for numerical tools such as solvers, optimization, and Fourier transforms. While the default installs of these modules are significantly faster than any Python-native implementation, they are still quite slow. The code included in with numpy and scipy to perform this computation is not very efficient. Optimized libraries have been written for the methods that numpy and scipy rely on, so the best of both worlds would be the ease-of-use provided by Python and the performance of tuned architectur

Deleting files that have a minus symbol as file name

아래와 같은 (-) 심볼을 갖은 파일이 생겨서 지우고 싶었는데, 도저히 지울수가 없었다. -rw-r--r-- 1 edwardyoon other 0 Apr 12 01:43 --no-check-certificate -rw-r--r-- 1 edwardyoon other 0 Apr 12 01:46 -S -bash-3.00$ rm -rf **certificate mv: illegal option -- no-check-certificate .. 지우고 싶은데 명령어 option 으로 인식되니까.. 그런데 나도 참 바보다. (-_-;) 아래처럼 지우면 되는 것을. -bash-3.00$ rm -rf ./-S

A Multi-Threaded Pi Estimator

Hadoop 의 Map/Reduce 로 Pi estimator가 구현되어있는데, 이를 Hama, BSP로 처리하면 M/R과 어떠한 성능/코드복잡도 차이를 보여줄까? 물론 안봐도 비디오로 예측되는 바, 이 예제로는 딱히 큰 매리트가 없을것도 같으나.. 어쨌건 연습삼아 아래와 같은 Pi 계산 알고리즘을 multi-threaded 프로그래밍을써서 간단하게 만들어 봤다. iterations = 10000 circle_count = 0 do j = 1,iterations generate 2 random numbers between 0 and 1 xcoordinate = random1 ycoordinate = random2 if (xcoordinate, ycoordinate) inside circle then circle_count = circle_count + 1 end do PI = 4.0*circle_count/iterations 이를 자바로 구현해보면 아래와 같다. public class PiEstimator { private double pi = 0.0; private final int numTasks = 10; private int allFinished = 0; private long starttime = 0; class PiEstimatorTask extends Thread { private PiEstimator Parent = null; private static final int iterations = 100000; public PiEstimatorTask(PiEstimator Parent) { this.Parent = Parent; } public void run() { int in = 0, out = 0; for (int i = 0; i < iterations; i++) { double x = 2.0 *