When it comes to implementing autocompletion in C++ in some type of input field, the question is which algorithm to choose and where to get the source for completion. In this post I’ll try to answer both questions.
As for the algorithm, SO gives us hints about tries, segment trees and others. You can find good article about them. Author has implemented some of them in a repository called FACE (fastest auto-complete in the east). You can easily find it on GitHub. This solution is used for the autocompletion in search engine Duck-Duck-Go which should tell you how good it is. Unfortunately their solution requires dependencies on libuv and joyent http-parser, which is not good in case you need just to integrate autocompletion functionality into your C++ application, but not build auto-complete server and send queries to it. Another drawback – libuv and cpp-libface itself fails to compile in Windows which is bad in case you’re building cross-platform solution.
You can find out how to built FACE into your cross-platform C++ application below.
If you’re a photographer new to microstock photography, I highly reccomend you to embark this wonderful way of passive earning using your artworks. But I will suppose that you know what is this about and how basically use it. I would even suppose you’ve passed an exam on some stock agency and uploaded your first artworks. But did you know there’re plenty of stocks? And did you know it’s better to work with all major players of this industry? Shutterstock, iStock, Fotolia, Depositphotos to name just a few. And there is a lot more.
Keywording and uploading your photos to stocks can be fairly considered as the most boring part of this business. It’s quite a long way to upload your files to 10 different websites, keyword them and submit. For such a purpose I’m working on a keywording and uploading tool, called Xpiks. It’s main objective is to help you to dramatically reduce time you spend on keywording and uploading and enable you to upload to more stocks simultaneously. For that reason I added features like parallel editing of several files, keywords suggestion, spell checking, automatic FTP uploading, stock requirements checking and others.
Ok, you considered to build Hedgewars by yourself. To be clear, I’m going to build 0.9.21 on 10.10 Yosemite on MacBook Pro with Retina. First of all, read official manual. After source code pull from Mercurial failed via hg command I considered downloading source on the Downloads page.
As original HowTo says, you should build Ogg and Vorbis, but while Ogg build succeeded, Vorbis said it can’t resolve u_int16_t type and after some googling I’ve found it was a known issue and you should replace #include <inttypes.h> with #include <sys/types.h> under #elfif (defined(__APPLE__) && defined(__MACH__)) in file ogg/os_types.h. Then everything goes more or less ok until you’re trying to generate makefile with Cmake. I had to turn off video recording feature, screenshots in PNG (BMPs instead) and no local server. Finally, I came up with
After successful build you still can’t play, because hwengine fails to launch. It looks for libfreetype.6.dylib in /usr/X11, but you might even don’t have X11 installed. If yes, proceed to Quartz/X11, download and install it. Don’t forget after all make symlink to original X11 directory using sudo ln -s /opt/X11 /usr/X11.
And still, after everything is done, Hedgewars fail to run in fullscreen mode so you might consider running it via VirtualBox and some Linux distro instead.
My favorite tool, Darktable, does not support new Nikon D5300 NEF format and, obviously, a lot of other RAW formats due to proprietary software for them. But there is a solution. There is a free tool from Adobe for Windows and Mac: DNG converter, which is free and converts a lot (almost all, I guess) of proprietary RAW formats to DNG (Digital NeGative – open lossless raw format. Complete list of supported RAW formats for DNG Converter.
For now DNG Converter is fairly simple so it runs flawlessly under Wine and you’re able to export all your NEF (or other) photos first to DNG and then to process them in your favorite RAW editor. That’s it!
(in my case then I switched Alt-Tab from working DNG converter, it crashed under Wine, but when window is active all the time, it works ok)
Also, if you set file format to 12-bit NEF in your camera, it would have green colors if you open them in any RAW editor (Darktable, RAWTherapee, Lighthouse, etc). But if you chose 14-bit RAW, it looks ok despite the fact it would be more sharp in native Nikon Windows- and Mac-only software.
If you have any questions, feel free to ask them in commets!
UPD: Darktable 1.6 supports D5300 NEF files if processed without OpenCL
In this post I’ll describe whole TeamCity installation process on a fresh CentOS (on the moment I’m writing it’s 6.4) for your private project or startup.
First, proceed to the CentOS downloads page and download CentOS distro through .iso, .torrent or whatever-you-like and start the installation process. If you’re familiar with any linux distro installation, it won’t take you much time to complete the installation. I’m using the minimal configuration without any Desktop Environment and with minimum core- and other system utils. Nonetheless, consider installing iptables, elinks and java (openjdk).
After the installation is over, login, add a user for yourself with adduser and let’s start with TeamCity (maybe you’ll also consider adding yourself to the sudoers file).
We’ll use PostgreSQL for the internal database for TeamCity. So let’s install postgresql packages (8.4 for CentOS 6.4). For details of the PostgreSQL installation please refer to official webpage.
# yum install postgresql
# service postgresql initdb
# chkconfig postgresql on
Also edit the /var/lib/pgsql/data/pg_hba.conf file to allow authorization from localhost. Go to the end and replace ident to trust for localhost in the configuration for hosts. Now lets create another user for the future TeamCity database and create a database for that user.
I’ve spend half of a day trying to get MediaWiki working on a VirtualBox for the internal project in the internal network. Looks like it’s done now and I want to share tips to help someone to spend less time in the future.
I’ve been installing and configuring MediaWiki 1.21 on the OpenSUSE 12.3, but all tips are valuable for any linux distro.
I’ve been experiencing strange mouse delays and lags some time ago and now I’ve become tired of it. I’m using OpenSUSE with 3.7.10 kernel and first thing I tried was upgrading the kernel (to 3.12) which was quite useless. Googling related to my distro also wasn’t helpful.
The trick was in laptop-mode-tools which I’ve installed earlier to make my laptop battery life longer. There is an usb autosuspend options which just suspended my usb wireless mouse. So setting
Struggled to safely eject my 1TB Western Digital My Passport external hard drive in OpenSUSE. Googling regarding Western Digital was inefficient, because lots of people have been just saying not-such-a-good-things about WD products and nothing valuable regarding ejecting it.
Usual eject command had no success: hard drive continued to spin. I’ve even upgraded firmware to 1.49 on my Windows 7 machine at work. No succcess.
After some time googling I’ve found next working solution:
install udisks utility
run sudo udisks --unmount /mount/point from terminal
run sudo udisks --detach /your/device from terminal