Changing tab switch shortcuts in LiteIDE

If you’re using LiteIde for golang development you may see that shortcuts for tab change (Ctrl+Tab and Ctrl+Shift+Tab) can’t be changed via settings. For somebody (like me) it’s a big usability problem – I have Ctrl+PgUp and Ctrl+PgDown in all other applications. But small change of code and recompilation helps as allways :) --- a/liteidex/src/liteapp/editormanager.cpp +++ b/liteidex/src/liteapp/editormanager.cpp @@ -270,9 +270,9 @@ bool EditorManager::eventFilter(QObject *target, QEvent *event) if (event->type() == QEvent::KeyPress)

C vs php vs hhvm vs go simple benchmark

Last time i do many thing starting from small utilities and up to big projects in golang. And many friends ask me why… first time i just said that golang is simple and cool :) But now i decided to do simple benchmark to show why… So, used interpreters/compilers: PHP: $ php --version PHP 5.6.4-4ubuntu6 (cli) (built: Apr 17 2015 15:47:51) Copyright (c) 1997-2014 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies HHVM: $ hhvm --version HipHop VM 3.7.2 (rel) Compiler: tags/HHVM-3.7.2-0-gfc9f29b2799933d8215faaadfa83de722df64e26 Repo schema: 34f16546e395aed44ad434467b6f96c89b0d8a8b C: $ gcc --version gcc (Ubuntu 4.9.2-10ubuntu13) 4.9.2 Copyright (C) 2014 Free Software Foundation, Inc.

QHash and QMap in threaded application

As you know QMap/QHash are little bit faster than std::map and std::unordered_map … but why? I have no ideas about this before I have used them in high-load muti-thread application. I send data in QHash via queued signal/slot between threads. Anything looks fine, but 1-2 times per day application gets segfault. It was very strange because it crashed after different count iterations but it was millions iterations. GDB shows something like this: #0 0x00007f8421029107 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007f842102a4e8 in __GI_abort () at abort.c:89 #2 0x00007f8421067044 in __libc_message (do_abort=do_abort@entry=1, fmt=fmt@entry=0x7f8421159c40 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #3 0x00007f842106c81e in malloc_printerr (action=1, str=0x7f8421159d90 "double free or corruption (out)", ptr=<optimized out>) at malloc.c:4996 #4 0x00007f842106d526 in _int_free (av=<optimized out>, p=<optimized out>, have_lock=0) at malloc.c:3840 #5 0x00007f8421ede054 in QHashData::free_helper (this=0x7f8418003a80, node_delete=0x40b324 <QHash<unsigned long, logdata>::deleteNode2(QHashData::Node*)>) at tools/qhash.cpp:496 #6 0x000000000040b364 in QHash<unsigned long, logdata>::freeData (this=0x7f84180bb5e0, x=0x7f8418003a80) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:600 #7 0x000000000040f208 in QHash<unsigned long, logdata>::~QHash (this=0x7f84180bb5e0, __in_chrg=<optimized out>) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qhash.h:310 after some days of hard debug, Qt source code reading and liters of green tea i have found that different instances of QHash (and also QMap) may share some data structures.

Qt meta-object system

What is is and why we need it? From the Qt documentation we know that “Qt’s meta-object system provides the signals and slots mechanism for inter-object communication, run-time type information, and the dynamic property system.” [1]. I hope everyone knows what is signal-slot in Qt and why you need Q_OBJECT macro at the beginning of each class declaration. Meta-object is also used for object casting using qobject_cast template function. It’s much more safe then build-in C++ cast functions and often is much faster.