스티브 잡스 사망. 향년 56세, An iconic figure of the era has gone.

English/NBC Nightly News 2011.10.06 23:26

May he rest in peace.

Breaking News at NBC Nightly News :

Brian Williams: Good evening, and before we get along with the broadcast tonight, instead we're going to begin with a late word of a breaking news story. So, for that, we go to our LA beureau to start things off with the report on the very latest details.

George Lewis: I'm George Lewis in LA. Apple Inc. announced tonight that company cofounder and former chief executive Steve Jobs has died at the age of 56. Here's a look back at his career.

He was the father of the iPhone, the iPod and the Apple Mac computer, turning electronic gadgets into objects of desire.

"I think if you do something and it turns out pretty good, then you should go do something else wonderfuler(?)"

As he was fond of saying, "Wait, there's more."

"Today, Apple is going to reinvent the phone."

And people did wait, in long lines for the first iPhones in 2007. And then three years later, they lined up for the iPad, changing the way people consume media.

"Design plus function equals the right life style, and that's what he filled."

In 1976, Jobs cofounded Apple Computer, and within a few years, was worth 100 million dollars. In 1984 he was showing off his new pride and joy, the Macintosh.

"And it has turned out insanely great."

As critics hail the Mac, Jobs was on the losing end of power struggle at his company and left Apple a year later. He went into computer animation acquiring Pixar Studios and striking __________ for the string of hit movies starting with Toy Stories.

Jobs came back to Apple in 1996 and began reinventing the Mac, dressing it up in a variety of colors.

"They look so good. You kindda wanna lick'em."

Concerns about the health of Steve Jobs began in 2004 when he underwent surgery for pancreatic cancer. A year later he spoke about that during a commencement speech at Stanford Univ.

"This was the closest I've been to facing death and I hope it's the closest I get for a few more decades."

An intensely private man with a quick temper, Jobs kept reporters at bay, saying his health was nobody's business. But Jobs was losing weight, something revealed in theses photos taken in 2007 and 2008. In April 2009, he underwent a liver transplant. Five month later, back on the job at Apple, he expressed his gratitude.

"I now have the liver of a mid-20s person who died in a car crash and was generous enough to donate their organs. And I wouldn't be here without such generosity."

On August 24 of this year, he stepped down as Apple's CEO. Back in 2005, he offered this bitter(?) advice to the Stanford Univ. Grads.

"Your time is limited. So don't waste it living someone else's life. Don't let the noise of other's opinions drown out your own inner voice."

Steve Jobs, the man whose own inner voice led him to create some of the most visionary products of the internet era. Jobs leaves behind a wife and four children.

George Lewis, NBC news Los Angeles.

George Lewis: Steve Jobs is being mourned tonight at Apple headquarters in Cupertino, CA where my colleague Janet Shamlian joins us now. Janet.

Janet Shamlian: George, here at the headquarters of Apple, the birthplace of so much of the technology that Steve Jobs has created and that the world uses. The campus is in mourn. You can see the flags behind flying at half staff. And on line, at apple.com, simply a picture of Steve Jobs and the dates of his birth and death. Apple has just released a statement that says,

"We are deeply saddened to announce that Steve Jobs passed away today. Steve's brilliance, passion and energy were the source of countless innovations that improve all of our lives. The world is immeasurably better because of Steve."

It is a statement that millions of users, of his fans all over the world would agree with.

George, back to you.

George Lewis: Thank you, Janet.

Once again, Steve Jobs, the man who gave the world the Macintosh computer, the iPhone, the iPod and the iPad, dead at 56.

Now back to Brian Williams in NY.

Trackback 0 : Comment 0

Write a comment

JLPT N1 합격

잡동사니 2011.09.01 00:39

지난 7월 (2011년) 쏟아지는 폭우를 뚫고 시험장까지 가서 JLPT N1 시험을 치루고 왔다.

시험이 많이 어려워서 합격할 자신이 없었다. 시험을 치른 후, 고생고생하면서 시험장까지 간 것이 아깝다는 생각과, 한번쯤 시험에 떨어지는 것도 나름대로의 좋은 경험이니 아깝지 않다는 생각이 교차하면서 복잡한 심정이었다.

합격할 자신이 없었음에도 불구하고, 사람의 마음이란 '혹시나 합격할 수도 있지 않을까' 하는 근거 없는 기대를 하게 된다.

그렇게 결과를 기다린지 2개월.

오늘 발표된 시험 결과를 방금 조회해 보았다.

결과는, 합격!

Trackback 0 : Comments 3
  1. BlogIcon 금메달.아빠 2011.09.01 23:08 신고 Modify/Delete Reply

    안녕하세요. 축하합니다.

  2. BlogIcon MuSe씨 2011.12.13 14:23 신고 Modify/Delete Reply

    자랑~~~ 부럽다. 부럽다..

Write a comment

Memo: perl tips

메모 2011.06.16 18:26



Perl specail variables: http://perldoc.perl.org/perlvar.html#General-Variables

/usr/bin/perl -p -i -e "s/$1/$2/g" $3

디렉토리 내의 모든 py 파일의 tearDown(self): 메쏘드에 self.delete_cache() 를 호출하는 부분 추가

find . -name '*.py' -exec /usr/bin/perl -p -i -e 's/tearDown\(self\):(?!.*tearDown\(self\):)/$&\n        self.delete_cache()/s' {} \;

중간의 어떤 값을 빼서 맨 뒤로 돌림:

perl -p -i -e "s/(.*)('This is Subject')(, )(.*)(\],$)/\1\4 ,\2],/g"


입력: ['19', '1', 'MID19', 'This is Subject', 'Y', '1019', 'Y', '5'],


출력: ['19', '1', 'MID19', 'Y', '1019', 'Y', '5' ,'This is Subject'],

Deleting matching lines:

Perl does not have sed's g/re/d, which deletes entire line if the line matches pattern.
You're gonna need some trick(?):
Perl's command line option -n tells perl to just execute commands for every line (without printing the line processed), while -p option executes command AND PRINT the line processed. You could use it to delete matching lines:

perl -n -i -e 'print unless /make_more_abridged_response/' filename.py

perl command line options -p and -n (from perlrun manpage):

       -n   causes Perl to assume the following loop around your program, which makes it iterate over filename
            arguments somewhat like sed -n or awk:

                while (<>) {
                    ...             # your program goes here

            Note that the lines are not printed by default.  See -p to have lines printed.  If a file named by an
            argument cannot be opened for some reason, Perl warns you about it and moves on to the next file.

            Also note that "<>" passes command line arguments to "open" in perlfunc, which doesn't necessarily
            interpret them as file names.  See  perlop for possible security implications.

            Here is an efficient way to delete all files that haven't been modified for at least a week:

                find . -mtime +7 -print | perl -nle unlink

            This is faster than using the -exec switch of find because you don't have to start a process on every
            filename found.  It does suffer from the bug of mishandling newlines in pathnames, which you can fix if
            you follow the example under -0.

            "BEGIN" and "END" blocks may be used to capture control before or after the implicit program loop, just
            as in awk.

       -p   causes Perl to assume the following loop around your program, which makes it iterate over filename
            arguments somewhat like sed:

                while (<>) {
                    ...             # your program goes here
                } continue {
                    print or die "-p destination: $!\n";

            If a file named by an argument cannot be opened for some reason, Perl warns you about it,
            and moves on to
the next file.  Note that the lines are printed automatically. 
            An error occurring during printing is
treated as fatal.  To suppress printing use the -n switch. 
            A -p overrides a -n switch.

            "BEGIN" and "END" blocks may be used to capture control before or after the implicit loop, just as in

Adding lines to multiple files:

perl -pi -le 'print "/*\n * \$Id\$\n *\n * vim 설정\n * vim:ts=4:shiftwidth=4:et:cindent:fileencoding=utf-8:\n */\n" if $. == 1; close ARGV if eof' $(cat filelist.txt)

if 관련 바꾸기

find src -name '*.cpp' -exec perl -p -i -e "s/if\s*\(\s*(.*) \)\s*$/if \(\1\)\n/g" {} \;

Exact word matching

Just wrap pattern with '\b': 's/\bint\b/int32_t/g'

Revoming trailing white space

find . -name '*hpp' -exec /usr/bin/perl -p -i -e 's/ +$//g' {} \;

Matching as few characters as possible (non-greedy regex)

[irteam@ccassandra01.nm bin]$ echo "http://orchistro.tistory.com/" | perl -pe "s/http:.*\//THIS/g"


[irteam@ccassandra01.nm bin]$ echo "http://orchistro.tistory.com/" | perl -pe "s/http:.*?\//THIS/g"


Just adding '?' after * will do the magic.

Trackback 0 : Comment 0

Write a comment

잠시 근황 - 2011년 2/4분기 애니메이션 및 드라마 시청

아니메, 드라마 2011.06.04 00:59

요즘은 목요일 25시에 방영하는 あの日見た花の名前を僕達はまだ知らない。 (그날 본 꽃의 이름을 우리들은 아직 알지 못한다. 이하 "아노하나"로 표기) 그리고, 일요일 22시에 방영하는 花咲くいろは(꽃이 피는 첫걸음) 덕에 스트레스를 해소하며 산다.

오늘 방영분 "아노하나"는 아주 흥미진진했다. 특히 마지막 즈음에 와서는, "진작 그러지, 쪼옴!" 이라고... 다음주 금요일이 많이 기다려진다.

평소에 애니메를 볼 때 오프닝, 엔딩은 항상 건너뛰면서 본다.
그러나, "아노하나"는 엔딩의 저 장면이 아주 좋기 때문에 ("하악!" 하는 부분이다) 빠지지 않고 엔딩을 매주 보고 있다 :D

"꽃이 피는 첫걸음"은, '이게 뭐야, 진흙투성이 아수라장이 될 건가!' 하는 예감이... 전부터 있었지만, 더 강하게 들기 시작하지만, 한 회 한 회의 작화의 질이 극장판이라, 놓칠 수가 없다.

이 두 애니메가 번갈아가면서, 이번주는 얘가 더 재미있고, 지난주는 쟤가 더 재미있었고, 하면서 스트레스 해소를 톡톡히 해 주고 있다.

또 하나 더 있는데, 이건 화장실개그, 허리하학적 개그가 난무하는, 거의 성인물에 가까운 것이라 여기서 소개하기는 약간 거시기하지만,

일단, 소개하자면, 금요일 23시의 よんでますよ、アザゼルさん。(부르고 있어요, 아자젤씨) 되겠다.
말이 빠르고 저질스런 단어가 많이 쓰여서 좀 곤란하긴 하지만 (자막제작자도 한두편 만들다가 잠수탄 듯)
박장대소를 할 수 있기에 가끔 모아서 보고 있다.

아, 그리고!!! 진 2기도 보고 있는데,,, 드라마는 너무 길어서, 볼만한 여유가 나지 않아 묵혀 두고 있다.

Trackback 0 : Comment 1
  1. BlogIcon diemall 2011.07.28 01:00 신고 Modify/Delete Reply

    음..덕후양반이 다되셨네. 좋은글좀 올려주세요 ㅋㅋ

Write a comment

How to generate SIGBUS on x86 processors

Computing 2011.05.15 01:54


0. No SIGBUS on x86?!
1. Why?
2. How to tell x86 to warn me an unaligned memory acess?
3. So, what? - A real world application
4. Possible worry
5. When programming for Intel's CPUs, no need to care about alignment?

0. No SIGBUS on x86?!

According to wikipedia, there are two cases where a processor generates bus error:
1. non-existent address
2. unaligned memory access.

Strangely, you may have never seen such an error on x86 processors.
Compile following code and run it on a x86 machine:

You will find no problem with your program on x86 machines:

shawn.r2:~/work/aligntest$ uname -a
Linux r2 2.6.18-194.el5xen #1 SMP Tue Mar 16 22:01:26 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
shawn.r2:~/work/aligntest$ gcc a.c
shawn.r2:~/work/aligntest$ ./a.out

On the contrary, if you try it on SPARC or IA64 machines, You will definitely end up with bus error:

shawn.sx1000:~/work/align$ uname -a
HP-UX sx1000 B.11.31 U ia64 1177235479 unlimited-user license
shawn.sx1000:~/work/align$ cc a.c
shawn.sx1000:~/work/align$ ./a.out
Bus error (core dumped)

shawn.v880:~/work/align$ cc a.c
shawn.v880:~/work/align$ uname -a
SunOS v880 5.10 Generic_142900-01 sun4u sparc SUNW,Sun-Fire-880
shawn.v880:~/work/align$ ./a.out
Bus Error (core dumped)

1. Why?

Well, my speculation is that it is because x86 processors do something to take care of this kind of unaligned memory access on microinstruction level.

Intel provides a way to switch off this feature. According to Intel's ia32 system programming guide, the EFLAGS register has a flag called AC (Alignment Check) flag. It is bit 18 in the EFLAGS register. After turning the AC flag on, you will be able to encounter with bus errors.

CPL is abbr. of Current Privilege Level. Intel's processors (x86 family) have 4 CPLS: 0, 1, 2, 3. Usually CPL 0 is used by the kernel (privileged mode), and CPL 3 is for user level processes.

2. How to tell x86 to warn me an unaligned memory acess?

Now, how to turn it on? First, you need to push the content of the EFLAGS register on the stack with PUSHF assembly instruction. And raise the bit 18 of the value on top of the stack, which is current value of EFLAGS. And then pop it back into EFLAGS register (RFLAGS for x86_64) with POPF assembly instruction. Following is the assembly code (AT&T convention):

Note that if you do this on a 32bit x86, you need to use ESP register instead, as noted in the comment.
The difference between ESP and RSP is that ESP is 32-bit, and RSP is 64-bit. If your processor is x86_64, it uses RFLAGS instead of EFLAGS. You need to use your stack pointer correspondingly.

Now, insert this assembly code into the original source code :

Behold, now you have SIGBUS on an x86 processor:

shawn.r2:~/work/aligntest$ gcc a.c
shawn.r2:~/work/aligntest$ ./a.out
Bus error (core dumped)
shawn.r2:~/work/aligntest$ uname -a
Linux r2 2.6.18-194.el5xen #1 SMP Tue Mar 16 22:01:26 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

3. So, what? - A real world application

We use a bunch of workstations at my workplace. People prefer x86 Linux systems because they offer more convenience to developers with great GNU tools. And they are faster than Solaris or HP-UX or AIX systems because systems other than x86 were bought at least 5 years ago.

But, the fact that people prefer x86 Linux systems over SUN's or IBM's systems brings a problem because x86 processors do not detect unaligned memory access. For that reason, I have constantly urged my crew to test their programs on Solaris (of course not to test them on Solaris x86). But people are not pleased to use slow and crowded Solaris machines when they have fast, new x86 Linux machines.

It would be very good if I applied this one line of assembly code to our product because it will enable programmers to detect their unaligned access to the memory even on x86 machines. It would be horribly embarrassing if our product crashed, especially because of a bus error! It implies that we do not thoroughly test our product and the company's credentials would be undermined. Happy to prevent it more easily beforehand.

4. Possible worry

Some people might be worried that turning AC flag on would have side effects on another processes running on the system. But, it is nothing to worry about, because flag register(s) is(are) in the process's context. It only affects the process that turned it on. When a context switching is to take place, the operating system pushes EFLAGS register and bunch of registers on the stack of the process that's going background, and then load the context of the process selected for the next active process. The context of the process includes EFLAGS register.

This is my speculation and I have not yet tested: if you want to enable alignment checking systemwide, you are going to want to set AC flag in the CR0 control register instead of the one in the EFLAGS register. I am not sure if it is true or not for the time, but I am going to test it tomorrow. If it were true, the system I will be testing it on might go down though :-)


Unfortunately, you must be in the ring 0, or CPL 0 to access CR0. That is, you can set AC flag in the CR0 only if you were in kernel module :-p. And, my speculation turned out to be true lol


Added 12 March, 2011:

5. When programming for Intel's CPUs, no need to care about alignment?

Intel CPUs allow unaligned access of words, double words, quad words. They don't generate GP(General Protection) exception that causes a SIGBUS signal even if an access to a memory is unaligned.

Then doesn't it make sense that programmers who work on Intel's CPU do not need to care about address alignment, right? Yes. It makes sense.

But, programmers SHOULD know of the fact that an unaligned memory access requires additional memory bus cycle even on Intel's CPUs. Intel's CPU manual says:

A word or doubleword operand that crosses a 4-byte boundary or a quadword operand that crosses an 8-byte boundary is considered unaligned and requires two separate memory bus cycles for access.

- Intel 64 and IA-32 Architectures Software Developer's Manual Volume 1, Section 4.1.1

So, it is always good practice for programmers to make every effort to use aligned memory access even on Intel's machines.


포스팅 날짜 변경. 원 날짜 : 2010/10/27 12:12

Trackback 0 : Comments 5
  1. phlow 2010.10.28 10:14 신고 Modify/Delete Reply

    유용하겠군요. 전사로 전파할 가치가 있네요.

    • BlogIcon Orchistro 2010.10.28 17:16 신고 Modify/Delete

      곧장 적용하기가 힘들어 보입니다.
      어셈블리 3라인과 #ifdef compiler directives 한두어개에 불과한데, 꽤나 곤란해 하시더라고요 ㅎㅎ
      할 수 없는 거죠.
      점점 일하기 힘들어지고 있는 듯 합니다.

  2. BlogIcon Jamie Fargen 2011.05.31 21:02 신고 Modify/Delete Reply

    Even better, make your developers commit their code to a repo, and use scripts to compile and test binaries across all the supported platforms.

    • BlogIcon Orchistro 2011.06.06 21:52 신고 Modify/Delete

      Sure. Even though an automated daily build system is running, every developer has to check if their code passes all the regressiton test set at least on the platform they developed their code on. But it is not their responsibility to check if their code runs fine on ALL platforms. It is automatically checked by every day's build script by cron.

  3. BlogIcon 먹튀 검증 2018.08.07 14:22 신고 Modify/Delete Reply


Write a comment

티스토리 툴바