Pages

Wednesday, September 11, 2013

Activate QtWebKit module for Qt Quick after manually building Qt inWindows

After building Qt from source code, you’ll find out that Qt Creator will complain that “module QtWebKit is not installed” for your Qt WebKit 3.0 applications.

In this case, follow the order here as a remedy:

  1. Copy jsc.exe and QtWebBrowser.exe in qtwebkit/bin to qtbase/bin
  2. Copy QtWebKit directory from qtwebkit/import to qtbase/qml
  3. in qtbase/qml/QtWebKit, make a new file named qmldir, and write down following:
    module QtWebKit
    plugin qmlwebkitplugin
  4. Try your code
  5. PROFIT! :)

Windows에서 Qt를 build한 후 QtWebKit을 활성화하는 방법

Qt를 소스코드에서 빌드한 후 Qt Quick에서 QtWebKit 3.0을 import한 후 실행해보면, Qt Creator가 “module QtWebKit is not installed”라는 메시지를 내며 Qt WebKit을 제대로 가져오지 못하는 경우가 있습니다. 이 경우 다음을 따라해보세요:

  1. qtwebkit/bin에 있는 jsc.exe와 QtWebBrowser.exe를 qtbase/bin으로 복사합니다
  2. qtwebkit/import에 있는 QtWebKit 디렉토리를 qtbase/qml에 복사합니다
  3. qtbase/qml/QtWebKit 디렉토리에 qmldir이라는 이름의 파일을 새로 생성하고 다음의 내용을 입력합니다:
    module QtWebKit
    plugin qmlwebkitplugin
  4. 코드를 테스트합니다
  5. PROFIT! :)

Sunday, May 5, 2013

Hidden dependency of pacbuilder in Arch Linux

pacbuilder is a useful tool in Arch Linux when you try to rebuild all the packages from the source, regardless of the repository(ABS or AUR).

But seldom someone notices the idea that the tool has the hidden package dependency of pacbuilder - sudo. I didn’t know that and in the pacbuilder-svn AUR there was no indication of the dependency. I had to read the script itself and modify some of the codes to see the blackholed message myself.

If you try pacbuilder(like pacbuilder -v —world) but you encountered error such as “makepkg failed”, just run pacman -S sudo and everything would work fine. I think I’ll report a new PKGBUILD for the package in AUR.

아치 리눅스 - pacbuilder의 숨겨진 의존성

Arch Linux의 3rd party tool 중 하나인 pacbuilder는 리포지토리에 상관없이(ABS든 AUR이든) 시스템에 설치된 모든 패키지를 쉽게 다시 컴파일할 수 있도록 도와줍니다. 하지만 많은 사람들이 이 도구에 숨겨진 패키지 의존성이 있다는 것을 모르는 것 같습니다: pacbuilder는 sudo가 없으면 동작을 제대로 안 하더군요. AUR에 있는 pacbuilder-svn에는 이러한 의존성이 표시되어 있지 않아서 스크립트를 보면서 찾아다녀야 했습니다.

혹시 pacbuilder를 쓰려고 하는데 makepkg error 등의 문제가 일어나거든 pacman -S sudo를 실행해주시면 될겁니다. AUR 관리자에게 PKGBUILD를 수정해서 보내던가 해야 할 것 같네요.

Sunday, September 23, 2012

Performance of an application - it’s not the tool, but the person

Frankly speaking, I was still benchmarking Qt and Lazarus on making my application with Qt, and yesterday I concluded. It was not the tool or language itself, but the users’ capabilities which determines the performance of an application. Whether it be Pascal or C++, LCL or Qt, if the programmer generates spaghetti code, the application SHALL SURELY slow down. In my recent benchmarks, if I use only the same routine and algorithms, time elapsed was always the same between two environments by 1/1000 seconds. So, anyway the problem is pilot, whether the personal trooper be Gespenst or Alteisen(?).

So finally I chose Object-Pascal based Lazarus. Though I have used Qt in my development, as I continue my benchmark with the hope in Pascal language, I could assure myself if the programmer has enough capabilities then tools are just ‘tools.’ Of course I’m a huge fan, or Otaku(….. :P) of Pascal language. Though it does not have features as rich as Qt does, which is overwhelming, I can easily and more simply implement those features, and the my performance of implementation was similar to that in Qt. So I’m going with Lazarus, which is surely my best partner.

But I don’t want to say that Qt is poor. It’s still great library. Personally, the structure of Qt is the most beautiful after Delphi VCL. But restrictions in 3rd party libraries due to the structure of the library itself as well as its unique preprocessing represented by moc makes me hesitate to choose the environment as my favorite. And debugging is yet another problem - Now I encountered memory leak, and I don’t see any solution with features provided by QString. When I load a data of a few hundred megabytes into RAM, in 32bit environment application hangs with “out of memory” error. I’d like to do manual garbage collection, but the memory manager Qt uses didn’t allow me to do that. It’s like a bit unfit clothes to me.

So, I planned to start rebuilding the application by making some libraries for features not implemented in base library, but now I become lazy and tired….. I don’t want to do anything right now. Baaaaaaah. -o-

Would there be anything that excites my passion?

프로그램의 성능, 문제는 도구가 아니라 사람

그동안 프로그램을 짜면서 Qt와 Lazarus의 성능을 계속 벤치마킹하고 있었는데, 어제 최종적으로 결론을 내렸습니다. 결론인즉 프로그램의 성능을 좌우하는건 도구나 언어가 아니라 그걸 쓰는 사람의 역량이더군요. 파스칼이든 C++이든, LCL이든 Qt든 간에 쓰는 사람이 프로그램을 베베 꼬아놓으면 결국 프로그램도 버벅대게 마련이더군요. 이번에 완전히 같은 루틴을 쓰면서 테스트해보니 결과값이 양쪽 모두 1/1000초까지도 거의 동일하게 나왔습니다. 결국 게슈펜스트나 알트아이젠이나 문제는 파일럿이에요(응?).

그래서 저는 그냥 Object Pascal 기반의 Lazarus로 가기로 했습니다. 그동안 계속 Qt로 개발을 수행했지만, 파스칼에 대한 일말의 희망을 놓지 않고 꾸준히 벤치마킹한 결과 프로그래머가 능력이 되면 도구는 말 그대로 도구일 뿐이더군요. 물론 제 자신이 파스칼을 좀 심하게 사랑하는 파스칼빠(….. :P)이기도 하죠. 비록 Qt처럼 말이 안 나올 정도로 풍부한 기능을 제공하지는 않지만, 그런 기능을 훨씬 더 간단하게 구현할 수 있을 뿐더러, 구현 후 속력이 Qt의 속력과 거의 비슷하다는 것을 고려한다면 제게 최적의 개발도구는 Lazarus인 것 같습니다.

Qt는 매우 훌륭한 라이브러리입니다. 개인적으로는 Delphi의 VCL 이후 가장 아름다운 hierarchy라고 생각합니다만, moc으로 대표되는 Qt만의 preprocessing과 기타 구조적인 문제로 인해 3rd party library의 사용에 제약이 발생하는 경우가 있습니다. 그리고 디버깅도 어렵습니다 - 지금 만드는 프로그램도 memory leak이 발생하는데, QString에서 제공되는 함수들로는 이런 문제를 해결할 수 있는 방법이 보이지 않습니다. 수백 MB에 이르는 데이터를 통채로 메모리에 올려서 작업하다보면 32bit에서는 얼마 안 되어 바로 메모리 부족으로 프로그램이 터져버리더군요(…..). 가능하면 메모리 관리자로 바로 접근해서 garbage collection을 수동으로 수행하고 싶은데, Qt는 메모리 관리를 자체적으로 따로 수행하는지라 이것도 실질적으로는 불가능하고….. 좀 답답하더군요.

해서 오늘부터 부족한 기능부터 라이브러리로 만들고 슬슬 작업을 시작해볼까 했는데….. 의욕이 안 섭니다. 귀찮아요. 모든게 다 귀찮아요. 으어어. -o-

어디 의욕과 투지가 끓어오르게 할만한 뭔가가 없을까요.

Sunday, April 22, 2012

How to boot your Linux box on USB media without initrd or initramfs

It is widely known you need initrd or initramfs to boot your Linux box over USB media, namely USB HDD or Flash memory drives, but you can do it without it.

Basically, USB media relies on SCSI driver for its recognition. The problem is that you have to wait for some time to make it recognized, namely one or two seconds or so. And during the time your kernel doesn’t wait for the media to be recognized - yes. it was the “common sense.”

However, you can make your Linux kernel to wait for root devices to be recognized. Simply add “rootwait” option on your kernel boot parameter and everything is done. Or, you can use “rootdelay=NN” option to make some timeout. These options are introduced in kernel 2.6, and I heard that there’s a patch for 2.4 kernels to do the same.

The only problem here is that you can’t make use of UUID or disk labels to recognize the boot media. Dynamic devfs like mdev or udev need to be run to assign UUIDs or read disk labels from each partition. So, chances are that you must rely on traditional static devfs - boot to /dev/sda or so.

Of course there’s a issue that you do may not know which device file is assigned to your boot media on boot. Your /dev/sda can be either SATA or SAS HDD, and there can be more than one - chances are, most of the time your boot media can be assigned as /dev/sdb or sdc or sdd or….. Whatever. In this case, you can compile your kernel to include only SCSI disk driver and USB media only and compile others(SATA, SAS, IDE…..) as modules so that during the initial boot kernel can recognize only USB media and other media can be recognized later on init stage when udev or mdev is populated(=daemon is started).

Hope this helps you simplifying your boot process of Linux from USB media. Good luck!