Archive for the ‘Programming’ Category

How to develop augmented reality apps with Vuforia for Windows 10

Dripcap – Caffeinated Packet Analyser and…

Probably Wireshark is too much, it can be good to try this elegant packet analyser, Dripcap. It’s made of a web app framework called Electron. It can be good to know that. Nowadays I don’t hear much about Ember and so on. Lots of Web frameworks are on people’s mouth and gone so quickly so…


libiconv from OS X and Mac Port, and change of Xcode behavior

I have an old project for converting wrongly encoded Korean to properly encode to properly encoded one in mp3 files.

However due to file system corruption while in upgrading to OS X 10.11.6, ย I had to rebuild the project again. I found out that I had another project for the same purpose to use different ID3 library. I didn’t remember which project was correct one.

I finally identified the correct one, but had some issues. It was built previously without a problem, but it failed this time. It could be due to changes in Xcode. Yes. there is such change. I will talk about that after taking about difference of libiconv from OS X and Mac Port.

When tried to build, it complaint _iconv, _iconv_open, _iconv_close were missing.
I recalled that there was difference between libiconv from OS X and Mac Port, and there was a comment I wrote for that, but didn’t remember its detailed reasoning for that.

So, I googled and found the stack overflow question above, and it made me recall what problem it had completely.

So, ย this time I would like to record it here.

This is the result with libiconv from Mac Port.

JongAms-Mac-mini:lib jongampark$ nm -mย  libiconv.2.dylib | grep iconv

0000000000002db1 (__TEXT,__text) external _libiconv
0000000000002dd3 (__TEXT,__text) external _libiconv_close
000000000000158c (__TEXT,__text) external _libiconv_open

This is the result with libiconv from OS X.

JongAms-Mac-mini:lib jongampark$ nm -m /usr/lib/libiconv.dylib | grep iconv

000000000000301c (__TEXT,__text) external _iconv
000000000000336d (__TEXT,__text) external _iconv_canonicalize
000000000000303e (__TEXT,__text) external _iconv_close
0000000000001c41 (__TEXT,__text) external _iconv_open

So, the difference is that the ones from Mac Port have _lib is prefixed while the ones from OS X don’t.

Also, the included iconv.h file should match with the library file.

Finally I would like to talk about the changes of Xcode behavior.

With a version of 7.x.x, Apple changed that default libraries and header files could be searched without specifying them. Especially, if a library, for example, /usr/lib/libiconv.dylib is linked using the build phase, Xcode didn’t require the /usr/lib is added to the library search path. It was new behavior at that time.

However, they changed it again from some version of Xcode later than the version mentioned above. So, the library path should be set to include /usr/lib.
Without that, even though the /usr/lib/libiconv.dylib is linked by build phase setting (Link Binary with libraries ), Xcode couldn’t find that it’s in /usr/lib.

Apple doesn’t document this kind of changes, and it gives headache.
I wonder why Apple keeps changing from one behavior to the other behavior from time to time. If they keep changing to a newer behavior, it could be understandable, although I don’t like it. However, they are kind of going forwardย and backward.

This is small difference, but can affect big way.
Apple should document this kind thing and handle this seriously.

How to use Apple’s Unicode Hex Input IME

It’s explained here, but ‘how to use’ is buried in the long text without indentation etc.

So, here.

  1. To type U+03B1, press the “Option” key.
  2. press 0, 3, B, 1 while still pressing the “Option” key.


When both ‘true’ and ‘false’ are right

I ran into very interesting logic issue. Probably if someone asks me what case it was, then I would not be able to recall this, because it’s subtle ( but simple ).

bool vaFacebookAPI::HandleResponse(zuint32 what, zRecord *record, zRecord *current, zRecord *previous)
    bool isHandled = true;

    if (record == nullptr || current == nullptr) {

        // You can think of this as 'handled' or 'not handled' depending on
        // how you think. But architecturally it should be treated as 'not handled'
        return false; // ๐Ÿ‘ˆ๐Ÿผ This case 


1. You can think that it can return ‘true’, because such case is considered and you decided not to do anything. So, It’s handled as such. So, it’s right to be ‘true’.

2. You can think it it can return ‘false’, because for that case nothing is processed and just returns. So, you can regard it as ‘not handled’. So, ‘false’ is correct.

Interesting, isn’t it?
One logic, depending on how you think it can be thought as ‘true’ and ‘false’

So, true is true, and false is also true. ๐Ÿ˜‰

deprecation of C++ style for loop and its replacements are…

New Features in Swift 2.2

Swift… ์ด๊ฑฐ ์ฐธ..
Telestream์—์„œ ์ผ์„ ํ•œ ์ด๋ž˜, ์ œ๋Œ€๋กœ Objective-C/Cocoa์—์„œ ์ƒˆ๋กœ ๋‚˜์˜ค๋Š” ๊ฒƒ์„ ์‹œ๋„ํ•˜๊ฑฐ๋‚˜, ์‹ฌ์ง€์–ด Swift๋ฅผ ๊ณต๋ถ€ํ•  ์งฌ์ด ์—†์—ˆ๋‹ค. C#/.NET์ด๋‚˜ C++๋„ ๋งˆ์ฐฌ๊ฐ€์ง€…
์ด์ „ ํšŒ์‚ฌ๋“ค์—์„  ํ‡ด๊ทผํ•˜๊ณ ์„œ๋„ ๋‹น์—ฐํžˆ ํ–ˆ๊ณ , ํšŒ์‚ฌ ๋‚ด์—์„œ๋„ ํ•  ์ผ ๋‹คํ•˜๊ณ , ์ถ”๊ฐ€๋กœ ๋” ์•Œ์•„๋ณด๊ณค ํ–ˆ๋Š”๋ฐ, ๋„๋Œ€์ฒด ์ด ํšŒ์‚ฌ์—์„ …
Cocoa์— ๋Œ€ํ•ด์„œ ์•Œ๊ณ  ์žˆ๋˜ ๊ฒƒ๋„ ๊นŒ๋จน๊ณ . ๊ทธ๋ž˜์„œ๋“ค ๋ฏธ๊ตญ ์• ๋“ค์ด ์ด๋Ÿฐ ํšŒ์‚ฌ์— ์ง€์›์„ ์•ˆํ•˜๋‚˜๋ณด๋‹ค.

์•„๋ฌดํŠผ ํˆฌ๋œ๋Œ€๋Š” ๊ฒƒ์€ ์ด๋งŒํ•˜๊ณ ..
๋‚œ ย Swift๊ฐ€ ๋„๋Œ€์ฒด ๋งˆ์Œ์— ๋“ค์ง€ ์•Š๋Š”๋‹ค.
Swift๊ฐ€ ํ›„์ ธ์„œ๊ฐ€ ์•„๋‹ˆ๋ผ, ์ด๊ฑด ์ˆœ์ „ํžˆ ๋งˆ์ผ€ํŒ…์— ์˜ํ•œ ๊ฒƒ์ด๋ž€ ์ƒ๊ฐ์ด ๋“ค๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
GNU์˜ Objective-C ์ปดํŒŒ์ผ๋Ÿฌ๋ฅผ ๋“ค์ถฐ๋ณธ ์‚ฌ๋žŒ๋“ค์€ ์–ผ๋งˆ๋‚˜ ๊ฐ„๋žตํ•˜๊ฒŒ Objective-C๊ฐ€ ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š”์ง€ ์•ˆ๋‹ค. C++์ชฝ์€ ๋ณ„ ์ด์ƒํ•œ ์ง“์„ ํ•ด์„œ๋ผ๋„ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•˜๋Š”๋ฐ, ๊ตณ์ด ๋ช‡๊ฐ€์ง€ Objective-C์˜ ๋‹จ์ ์„ ๋“ค์ถฐ์„œ ๊ทธ๊ฑธ Swift๋ฅผ ํ•ฉ๋ฆฌํ™”ํ•˜๋Š” ๊ฑด ๋ญํ•˜์ง€ ์•Š๋‚˜? ๋ฌธ์ œ๊ฐ€ ์žˆ์œผ๋ฉด ๊ณ ์น˜๋ฉด ๋˜์ง€ ์•Š๋‚˜?

๋”๊ตฐ๋‹ค๋‚˜ Swift๋Š” ํ—ท๊ฐˆ๋ฆฌ๋Š” ๋ฉด์ด ๋งŽ๋‹ค. ์ƒˆ๋กœ ์–ธ์–ด๋ฅผ ๋ฐฐ์šฐ๋Š” ์–ด๋ฆฐ ํ•™์ƒ๋“ค์ด์•ผ ๋ชจ๋ฅด๊ฒ ์ง€๋งŒ, ๋‚ด๊ฒ ์ด Swift๋Š” ์–ด๋–ค ๋ฉด์—์„  Pascal, ์–ด๋””์„  C, ์–ด๋””์„  Perl ๊ฐ™์€ ๋Š๋‚Œ์ด ๋“ ๋‹ค. Python์„ ํ•˜๋Š” ์‚ฌ๋žŒ๋“ค์€ Python ๊ฐ™์€ ๋ถ€๋ถ„๋„ ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค.
์ผ๋‹จ ๋ชจ๋“œ๊ฐ€ Pascal ๋ชจ๋“œ๋กœ ๋ฐ”๋€Œ๋ฉด Pascal ๋‹ค์›Œ์•ผ ํ•˜๊ณ , C๋กœ ๋ฐ”๋€Œ๋ฉด C ๋‹ค์›Œ์•ผ ํ•œ๋‹ค. ๊ทธ๋ž˜์•ผ ๊ธฐ์–ตํ•˜๊ธฐ๋„ ์ข‹๊ณ  ๊ทธ๋ ‡์ง€. ์ด๊ฑด ์ˆœ์ „ํžˆ ์žกํƒ•๊ฐ™์€ ๋Š๋‚Œ์ด์–ด์„œ, ๊ฐ„๋งŒ์— Swift ๋ฌธ์„œ๋ฅผ ์ฝ์–ด์„œ ์ตํ˜€ ๋‘์–ด๋„ ๋‚˜์ค‘์— ๊ธฐ์–ต์ด ์ž˜ ์•ˆ๋‚œ๋‹ค. ์™œ? ํŒŒ์Šค์นผ ๊ฐ™์œผ๋ฉด ์ญ‰ ํŒŒ์Šค์นผ ๊ฐ™์•„์•ผ ํ•˜๋Š”๋ฐ, ์–ด๋Š ์ˆœ๊ฐ„ Perl ๊ฐ™๋‹ค๊ฑฐ๋‚˜ ๊ทธ๋Ÿฐ์‹์ด๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.

๊ทธ๋ฆฌ๊ณ  2.2์—์„œ ์ƒˆ๋กœ ๋‚˜์˜จ ๋ฌธ๋ฒ•์„ ๋ณด์ž.
๋‹ค์Œ์˜ ์ฝ”๋“œ๋ฅผ ๋ณด์ž

for var i = 0; i < 10; i++ {

์ด๊ฑธ ์ด์ œ ์—†์• ๊ณ  ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ฐ”๊พผ๋‹ค ํ•œ๋‹ค.

for i in 0 .. < 10 {

์ด๊นŒ์ง„ ์ข‹๋‹ค. Fast Enumeration ์Šคํƒ€์ผ์ด๋‹ˆ๊นŒ.

๊ทผ๋ฐ, ๋‹ค์Œ์„ ๋ณด์ž.

for i in (1...10).reverse() {

for i in 0.stride(to: 10, by: 2) {

์ €๊ฑฐ ๊ทธ๋ƒฅ (10…1)๋กœ ๋ชป ๋งŒ๋“œ๋‚˜? ๋ฌผ๋ก  reverse()๋„ ์ง€์›ํ•˜๋ฉด์„œ?
๋ญ ์ฒซ๋ฒˆ์žฌ ์˜ˆ๋Š” ๊ทธ๋ ‡๋‹ค์น˜์ž.
๋‘๋ฒˆ์žฌ ์˜ˆ..

์ €๊ฑฐ.. ์˜์–ด๊ฐ€ ๋ชจ๊ตญ์–ด์ธ ์‚ฌ๋žŒ์€ 0.stride(to..)๊ฐ€ ์™€ ๋‹ฟ์„์ง€ ๋ชฐ๋ผ๋„, ์™ธ๊ตญ์ธ๋“ค์—๊ฒ ๊ทธ๋ ‡์ง€ ์•Š๋‹ค. stride์˜ ๋œป์ด ๊ทธ๋‹ค์ง€ ๊ฐ•ํ•˜๊ฒŒ ๋‹ค๊ฐ€์˜ค์ง€ ์•Š๊ธฐ ๋•Œ๋ฌธ์ด๋‹ค.
๋‹จ์–ด์˜ ๋œป์„ ์•„๋Š” ๊ฒƒ๊ณผ, ๊ทธ๊ฒƒ์ด ์–ผ๋งˆ๋‚˜ ๊ฐ•ํ•˜๊ฒŒ ๋‹ค๊ฐ€์˜ค๋Š๋ƒ๋Š” ๋‹ค๋ฅธ ๋ฌธ์ œ์ด๋‹ค.
Apple์˜ ์‚ฌ์ „ ์•ฑ์—์„œ ๋œป์„ ๋ณด์ž.
1. ์„ฑํผ ์„ฑํผ ๊ฑท๊ธฐ. ํ™œ๋ณด
2. ํ•œ๊ฑธ์Œ, ํ•œ๋‹ฌ์Œ.

์•„.. ์•ˆ๋‹ค๊ฐ€์˜จ๋‹ค.
์ด๋Ÿฐ๊ฒŒ ๋‚ซ์ง€ ์•Š๋‚˜?

for i in 0.increment(to: 10, by: 2) {

for i in 0.increment(to: 10, by: -2) {

๋‘๋ฒˆ์งธ ๊ฒƒ์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋™์ผ ํ‘œํ˜„์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ๊ฒ ๋‹ค.

for i in 10.decrement(to: 0, by: 2) {

Swift๋Š” ์ปดํ“จํ„ฐ ์–ธ์–ด์—์„œ์˜ cultural difference์™€ ์‚ฌ๋žŒ์ด ์“ฐ๋Š” ์–ธ์–ด์—์„œ์˜ cultural difference๋ฅผ ๊ณ ๋ คํ•˜์ง€ ์•Š๊ณ  ๋””์ž์ธ๋˜๋Š” ๋Š๋‚Œ์ด๋‹ค.
์ด๊ฑด ๋ฌธ์ œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ๋‚ด๊ฐ€ Swift๋ฅผ ์ข‹์•„ํ•˜์ง€ ์•Š๋Š” ๋ฌธ์ œ ์ค‘์˜ ํ•˜๋‚˜์ด๋‹ค.

Dialogue’s Guiding Principles, or a Healthy Hatred of OOP two chain links

Dialogue’s Guiding Principles, or a Healthy Hatred of OOP two chain links

Well, it will be interesting to read the post.
However, I found out that problems among US programmers in terms of C++ is that they follow C++ techniques or new syntax etc, which are just supplemental rather than keeping philosophy of OOP and meta-programming.
Syntax-sugar is good. But problems of C++ is that ( don’t misunderstand that. As you can see I’m a long-time C++ programmer and I liked its initial paradigm a lot. ) a lot of features have been added to C++ for the sake of convenience ( with difficulty of using it ) or more power. People, who just judge others’ knowledge on C++ just by asking terminology and features, thus missing core values, love to use any new features.
Knowing such things are good and beneficial, but not always.
I’ve worked on pSosystem at Samsung and other systems where the greatest and the latest C++ features were omitted intentionally for the purpose of the system or unintentionally (just old C++ compiler). If people just stick to the greatest and latest feature and when exposed to such system, they are embarrassed often.
So, I’m always in the attitude of choosing common ground, which maximizes compatibility of source code and your knowledge compatibility.

Anyway, folks. Knowing more terminology and new features will make look more knowledgeable person especially here in the US due to its culture, but actually it’s not. What is more important is to know why you need to use this or that, philosophy behind of a language you choose, etc.

Here I see Objective-C code which is not written by people who understand Objective-C philosophy. They argue that they know, but if you see such code, ou will be able to see that they don’t understand the philosophy.
They oppose Objective-C or any other language without understanding their philosophy. Criticism can be good only and only if people criticize after understanding philosophy or background history on why this language/system is designed as such.

So far, my experience here in the US is that when interviewers were too picky and just judges people by asking if the interviewee knows(memorizes) one thing, I usually found out that their source code were dirty and messy in every angle.
If an interviewee is not a liar or a salesperson who wants to sell himself rather than an engineer, they tend to memorize terminology etc. But if they are engineers, they know but at the moment of being asked, they may not answer the interviewers question. It’s not because they don’t know about the answer, but they can guess something else.

For example, I’ve been asked like “implement this thing using STL.”
Well, I use Win32 collection APIs, Cocoa/Core Foundation collection APIs and also STL. Also I use boost. They are similar. If you happen to use Win32 collection API for the week when you are interviewed, you can temporarily forget STL. But if you look up document, you can quickly write in STL. Then doesn’t he know the STL?

Here in the US, although they say they are Objective-C programmer, they write in C++ and STL mostly. So, they can remember STL syntax.

I’m different. When I implement Win32 code, I stick to Win32 stuffs mostly. When I implement Cocoa/Core foundation code, I stick to them.
If I need to implement something common code, which I may need to use on Window / Mac / iOS/ Unix, I write with pure C/C++/STL. Then, I can temporarily forget one syntax. But does it mean that I don’t know about it?

I’m versatile person. However, the way US people interview others are not like that and they stick to one thing and say they are “the other” programmer.

Another example is … I’m asked how to implement XOR in C++ while being asked about bit-wise operations. So, I told him it’s ^ operator.
He said “No.”
Actually in the conversation, he jumped from logical operation and bit-wise operation. So, I wonder why he said “No.”
Well, what he wanted “DeMorgan’s law” to express logical XOR.
Damn.. then he must be clear on that.
In Korea, DeMorgan’s law is taught in middle school. Everybody knows DeMorgan’s law. Well, actually what is taught here in the US are mostly taught in middle school or high school like calculus, probability etc. Well. some are taught in here too in high school. But compared to the level of things taught in Korea, well here.. I understand why Obama mentioned education in Korea, although I oppose to his intention.
Anyway, then he treated me like a person who doesn’t know C++.

What the..

%d bloggers like this: