Pages

Thursday, June 20, 2019

Qt 5.13.0: Develop in C++, Run in Browser!

At June. 19th, 2019, Qt 5.13.0 is released. Among the new features there was one thing that caught my eyes....... Qt for WebAssembly. It uses Emscripten to buld a Qt application into WebAssembly. Oh yeah. Now you can run your QML or Qt Widgets applications inside your favorite web browser.

It's surely distinguished from yet another fancy feature, Qt WebGL Streaming Plugin. Under WebGL Streaming Plugin the application runs in the program and web browser merely delivers the GUI interfaces, while Qt for WebAssembly downloads the application to the client and run inside the web browser sandbox environment. Since the program runs in client system, the server load is low, and multiple clients can use the app, whereas in WebGL Streaming Plugin only one client can connect to the server(all other connections are queued until 1st user disconnects).

After encountering the news, well, now I wonder whether they're really humans - oh yeah. They're Trolls(:P) but it was their former glory. Now I'm not sure which alien technology they thieved. Well, anyway.......

Now we can develop under your favorite C++ environment and run in the web browser! To all Qt users and enthusiasts, you don't have to learn Angular or React or Vue.js or whatever to provide a web GUI! The market is moving to the web and now Qt is moved too! Now, DEVELOP WITH Qt AND RUN IN YOUR WEB BROWSER!

......but it didn't take much that my burning heart suddenly got calm. I encountered a few drawbacks.

1. WebGL
Sometimes I have to run web browsers in server environment, but there are a lot of servers(even modern ones) which doesn't support OpenGL 2.0 well. For example, HP DL series server used Matrox graphic chipset until 7th generation at least, which supports only OpenGL 1.2. In that case, you'll encounter an error message from the loader page. :P


2. Broken Hangul (I think that's same for CJK)
I'm not sure whether it's because of WebAssembly sandbox environment itself, Qt for WebAssembly doesn't have privilege to access system fonts. To resolve, you have to "internalize" the font to the application, e.g. putting in qrc file.
Well, I tried, and...... I'm not sure whether this is because of my lack of skills, it doesn't work. Hangul is not shown. And what's more, I can't input Hangul inside the app. The only way to input Hangul is copy and paste - type outside the app, copy it, and paste into the app.Update at Jun.21st. 2019: if I embed a font file into .qrc file, load via QFontDatabase::addApplicationFont(), and set the font as default using QGuiApplication::setFont() at least I can read Hangul, but still I can't input Korean(......).

And there are a handful of small annoyances, e.g. QMAKE_WASM_TOTAL_MEMORY option not working, but considering it's only in the initial release, I think I can overlook those small ones...... :P

Anyway, that's that and there are more limits in the WebAssembly environment. To fully make use of web browser interface, I had better learn Vue.js more, whose structure is said to be similiar to QML.

Qt 5.13.0: C++로 개발해서 웹브라우저에서 실행하자!

2019년 6월 19일부로 Qt 5.13.0이 발표되었습니다. Qt 5.13.0의 새로운 기능 중에서 제 눈길을 꽤 끈 신기능이 하나 있었는데요....... Qt for WebAssembly입니다. 그러니까...... Emscripten을 사용해서 Qt를 WebAssembly로 컴파일하는 녀석 되겠습니다. 예. QML이나 Qt Widgets로 만든 프로그램을 그대로 웹브라우저에서 돌릴 수 있게 되었다는 거죠.

기존에 있던 또다른 신기한(......) 기능인 Qt WebGL Streaming Plugin하고는 다른데, WebGL Streaming Plugin은 프로그램이 서버에서 실행되면서 웹브라우저에서는 GUI 화면만 보여주는 형태인 반면 Qt for WebAssembly는 프로그램을 웹브라우저가 다운로드받아 브라우저 내 샌드박스에서 실행시키는 차이가 있습니다. 프로그램이 클라이언트에서 실행되기 때문에 서버 부하가 줄어들 뿐 아니라, WebGL Streaming Plugin마냥 GUI를 한번에 한 사람밖에 못쓰는(......) 문제도 없습니다.

이 기능을 보고나서 제가 느낀건 뭐랄까...... 일단 이것들이 인간이 맞나 싶더군요. 도대체 어디의 외계인을 고문하고 다니는 건지 모르겠습니다. 그리고 그 뒤에는 환희가 몰려왔습니다.
이제 C++로 개발한 뒤에 웹브라우저에서 실행시킬 수 있어요! Qt 개발자 여러분, GUI의 대세가 web이라 울며 겨자먹기로 Angular나 React나 Vue.js같은걸 억지로 학습할 필요가 없습니다! 이제 Qt로 개발하고 웹브라우저에서 실행시키시면 됩니다!

......그런데 그렇게 부푼 가슴이 쪼그라드는데는 몇시간도 안 걸리더군요. 이거 단점들이 꽤 있습니다.

1. WebGL이 지원 안되면 못씀
저같은 경우는 특성상 서버에서 웹브라우저를 돌려야 되는 환경도 고려해야 하는데, 이 경우 서버 하드웨어에서 OpenGL 2.0이 지원되지 않아 화면이 안 나오는(......) 문제가 발생할 수 있습니다. 멀리 갈 것 없이 HP DL시리즈 서버의 경우 최소한 7세대까지는 매트록스 그래픽 칩셋을 사용했습니다(8세대 이후로는 안써봐서 모르겠습니다). OpenGL 지원따위...... 저 하늘 위의 별같은 거죠.

2. 한글 지원 문제(아마 CJK 환경이 다 문제일 것 같습니다만......)
WebAssembly 샌드박스 환경의 특성인지는 모르겠지만, Qt for WebAssembly는 시스템 폰트에 직접 접근할 수 있는 권한이 없답니다. 이걸 해결하려면 별도 폰트를 프로그램에 qrc 등의 형태로 내장시켜야 한다고 하네요.
해봤습니다만, 뭐...... 제가 요령이 없어서 그런지 잘 안 됩니다. 한글 왕창 깨지고요(......). 거기에 한글 입력도 안 됩니다. 혹시 몰라서 클립보드를 활성화시킨 뒤에 이것저것 해봤는데, 외부에서 복사한 후 붙여넣기는 되는 것 같습니다만 프로그램 내부에서 한글을 입력하지는 못하는 것 같습니다.2019.6.21 업데이트: 폰트를 qrc에 내장한 뒤 QFontDatabase::addApplicationFont()로 등록하고 QGuiApplication:setFont()로 기본 폰트를 변경하면 출력은 됩니다. 하지만 입력은 여전히 안되네요(......).

그 외에 위키에 적혀있는 QMAKE_WASM_TOTAL_MEMORY 옵션이 실제로는 적용이 되지 않아서 Makefile을 수동으로 고쳐야 한다던가 하는 문제가 더 있긴 합니다만 이건 뭐 최초 지원이니만큼 그냥 눈감아줄 수 있다고 치고......

하여간 그렇습니다. 웹브라우저 환경을 최대한 활용하려면 당분간은 QML과 구조가 대충 비슷하다고 알려진 Vue.js를 좀 더 공부하는게 더 나을 것 같습니다. -_-;

Wednesday, October 10, 2018

OneNote 노트북을 공유하려고 하는데 MS쪽 오류라면서 공유가 안된다면.......

흔한 상황은 아닙니다만, Windows 10용 OneNote에서 노트북을 공유하려고 하면 갑자기 마이크로소프트쪽에서 문제가 생겼다면서 노트북 공유가 안되는 경우가 있을 수 있습니다. 잘 쓰다가 이쯤 되면 갑자기 정신이 혼미해지죠. 갑자기 왜? -_-

제 경험상, 이 경우 OneDrive 웹페이지(https://onedrive.live.com)로 로그인하면 분명히 MS가 당신이 bot이 아님을 증명하라고 할겁니다. 문자메시지로 받은 PIN번호를 입력하니 바로 풀어주더군요.

어이 마이크로소프트씨, 우리 집사람이 나보고 인공지능 탑재형 로봇같다고 뭐라고 그러긴 하지만, 나 분명히 인간 맞거든? -_-

If your OneNote complains that your notebook can't be shared because MS has some problem.......

This is rare condition, but sometimes OneNote for Windows 10 complains that your notebook can't be shared because there's something from Microsoft side. And you have no idea where and why.

In this case(as I experienced), log in to OneDrive web page(https://onedrive.live.com). And I'm sure that MS will ask you to prove you're not a bot(but why?). I proved myself by confirming a PIN number vis SMS.

Hey Microsoft, though my wife complains that I'm like an A.I.(artificial intelligence)-installed robot, I'm more human than a bot. :P

If deleted OneNote notebook still shows in your OneNote for Windows 10 (UWP) application......

Yes. I'm sure so many people experienced it. You surely deleted your notebook from OneNote for Windows and OneDrive, but if you click More Notebooks you'll see your deleted notebook is still on the list. What's more, if you try to open them, it says OneNote failed to open them. What the hell?
So called Phantom Notebook by someone, this is quite a nuisance. And I'm sure you may also have seen a lot of "solutions" when you have MS Office 2016 - clear Recent in OneNote 2016. Well, the problem arises when you don't have MS Office. And everyone will agree that it's quite too much to subscribe to Office 365 to remove the list......

But did you know that there's one more location where you can access and clear that Recent? You can't find it in OneDrive. It's on Office.com.

Oh yeah. https://www.office.com/ ← Log in here.

If you visit the page and log in, you'll see the list of recently opened documents, and you can also see your deleted OneNote notebooks. You can safely remove those 'phantoms' by clicking ... icon in the middle of the list; after that, go to OneNote Online or OneNote for Windows 10, you can see your list is finally clean now. :)

Hope this helps if you're uncomfortable with it.

OneNote for Windows 10 (UWP)에서 지운 노트북이 계속 보인다면......

예. 아마 많은 분들이 경험하셨을겁니다. 분명히 OneNote for Windows와 OneDrive에서 노트북을 지웠는데 OneNote의 전자 필기장 더 보기를 선택하면 지워진 노트북이 목록에 그대로 떠있는 경우가 있습니다. 해외에서는 Phantom Notebook이라는 표현을 쓰기도 하는 것 같더군요.
뭐, OneNote 2016을 쓰고 있다면 Recent를 지워서 해결할 수 있는데, 문제는 OneNote 2016을 쓰지 않는 경우입니다. 목록 지우자고 Office 365를 구매하는건 좀 오버인 것 같고......

그런데 이 최근 문서 목록을 지울 수 있는 위치가 한군데 더 있습니다. OneDrive에서는 찾을 수 없고요, Office.com으로 로그인하면 바로 나옵니다(-_-).

예. https://www.office.com/ ← 바로 여깁니다.

여기 가시면 여태까지 열었던 문서들의 목록이 나오고, 그중에 지워진 OneNote 노트북도 보이실겁니다. 중간의 ... 아이콘을 클릭하시면 바로 해당 목록을 삭제하실 수 있고, 삭제하신 뒤 OneNote Online이나 OneNote for Windows 10을 열어서 확인해보시면 지워진 노트북이 보이지 않는 것을 확인하실 수 있으실겁니다.

혹시 이것때문에 많이 불편하신 분이 계셨다면 도움이 되셨길 바랍니다.

Thursday, September 13, 2018

Choosing a database

Nowadays I'm developing a new product and I'm stuck with choosing the "right" database.
 Well, today we have a wide variety of choices including NoSQL, but too many choices makes me more difficult on selection. I have to consider more things, and I have no idea on how the users will use the product. In my situation I concluded NoSQL is not the way so I'm considering three among SQL engines, but all the candidates bite me on some area.
  1. SQLite: unlike what others think, SQLite has no problems at all on using in production environment. It's stable and FAST. Especially, it's so "lightning" fast that the spiral booster is always turned on(c.f. Cyber Formula). In almost all cases it overwhelms the others. However, it doesn't support concurrent write. To do it, I have to make a wrapper to do it for the database. OTL
  2. PostgreSQL: magnificent. I dare to say it's the best in the world of open source. Though it is based on SQL(I know it's ORDB, but anyway) yet supports NoSQL too. The problem is it's damn sloooooooooooooow like snail and consumes a lot of resources. I can tune it to make it faster but still it lacks some speed.
  3. MariaDB: Fast. I see the speed on most of SQL commands I use. If I use Aria with some setup, in some (limited) conditions it can be faster than SQLite. However, it sometimes hits my back hard. Pretty hard. Even just now, I found a 2-second query suddenly took 11 minutes. And now it takes 42 seconds. Hey you seal?
From the viewpoint of a developer, speed is important, but the more important is whether it's foreseeable or not. If it's slow I can tune it hard, and if it's still slow I can make the application to do another thing concurrently when doing slow stuff, but if the performance is that random, simply I can't use it.

Well, I think I have to ride the elephant again and drop my belief to the Holy Mother.
(or making with the database for missiles......)