The arrow keys allow moving from one check box to another. If you don't want this behaviour use the resource editor to set the group property of the corresponding check boxes and the following control in the tab order.
If you want to use conditions within the RC file you have to pass them using build options because the definitions used when compiling are not passed when processing RC files.
for a tcp server which would handle at most 10240 clients.
I want to manage all the clients.there are two solutions
1: use a std:map, and a mutex over all map operation
2: use a C array. and assign an ID(0-10239) for each client if connected,If disconnected,the Id would be recycled.
if I use an array,mutex would only be necessary over the ID operations.such as assign an Id to a client when connected,recycle an Id when a client is disconnected.
in fact,they are not different if I only have to handle connect or disconnect.
but if I want to change the CLIENT_DATA for each client.
for the first solution:I have to lock the whole map;
for the second, I could maintain a mutex in each CLIENT_DATA.
my question is, solution 1 is much more easy to code.solution 2 seems much more efficient.
which one do you prefer?
Only understandable way to do this. But has some constraints. My assumptions won't consider that using a mutex is necessary unless your application allows asynchronous processing + write access for connected devices. If writing process is maintained by your server program, then you know how to do that — Hint: create a condition inside function and don't make it visible in threads, abstract the implementation.
use a C array. and assign an ID(0-10239) for each client if connected,If disconnected,the Id would be recycled.
How about you don't use this. Suppose if there are only 10 clients connected, C array will still allocate all of the areas in RAM. Totally not worth it, and as you said — Id would be recycled —, how? What is your algorithm for that?
There are many parts missing in your post, such as, what data will they access, are they going to write data too, to same file or not — mutex and thread-safety makes sense if something is happening on same time at different threads, if not then don't worry about this.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
Some thoughts about your posts (the initial one and the above reply to Afzaal Ahmad Zeeshan).
Do you really need to store the IP? If so, don't store it as string.
There is no need to generate a (re-usable) connect ID. You already have one:
The connection socket handle.
Using the handle avoids also storing the IP because you can get the IP from the handle using getpeername. But using the handle makes using a map more appropriate.
There is also a solution to avoid locking at all:
Just let the functions be executed in the same thread. As far as I understand there are three events: connection, disconnection, and periodical updates. If connection and disconnection are events issued from other threads, implement signaling functions passing the socket handle.
Use a map storing the socket handle and avoid locking by putting all associated functions into a single thread.
in fact there are two threads.
Thread A would get some CLIENT_DATA pointer to do something frequently,but would not change the map
Thread B Is the update thread include handling connect and disconnect,the map would only be changed here.
so If I update the map in thread B, It should be locked while updating.
it would block the Thread A at somewhere like GetClientData(int nClientId);
solution 2 is designed to avoid locking the whole CLIENT_DATA collection in Thread B.
my question is:
If the map is not vary large,use a std::map is fine,but if the collection of CLIENT_DATA is very large,
such as 10240,Is std::map ok?
connect and disconnect
Seldom, single add / remove. Locking is no problem.
Periodically, all items must be accessed. Locking is a problem when updating requires a significant time.
Single? access in peridocally? short/long? intervals.
If locking is a problem depends on query frequency and number of items.
So it seems that only updating is critical. But as I understood you will update all items at once and know the max. number of items. Regardless of the choosen storage type, the first optimisation is reserving the required memory to avoid re-allocations and avoid members that use dynamic memory allocation like std::string.
So your requirements are:
Inserting and deleting performance is not critical
Iterating over all items is critical
Accessing single items is not critical?
When using a map, use an unordered_map because it satifies the above (fast iterating over all elements but slow iterating over a subset of the elements).
When using an array, list, or vector, you have to perform a find to access single elements (which is also there but hidden when using a map).
When using a pre-allocated C array you have to implement also functions to add and remove elements where adding is simple (append) but removing requires moving memory. But this will be probably the fastest option when iterating over all items.
But I don't think that the performance of a plain C array is much better than using a container iterator (note that you must use the iterator rather then using the at or  operator because that result in a lookup with maps and include out of range checks with other container types).
You may implement different versions and benchmark them to see the differences. But a max. number of 10240 should be not critical.
I think you've got the meaning of "signalled" the wrong way around. The wait function will return only when the event is signalled. An auto-reset event will automatically reset the event to non-signalled when it returns, and manual reset event will not. Use the SetEvent to release other threads, or the ResetEvent to block other threads.
Think of the event of some operation that has to happen in your code. Other threads need to wait for that operation to complete. Once it has been completed, you signal the other threads that it is ok to proceed.
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
Okay how about the second parameter to CreateEvent if that is FALSE does that mean that after
a signal'ed event returns right away from WaitForSingleObject Windows will Automatically turn the event to NON signalled
There is a component for Visual Studio C ++ "assimp" (Open Asset Import Library).
With the help of "assimp" on the screen built scene with a 3D object.
Can I with the help of "assimp" export the scene image with a 3D object into graphical file, for example BMP or JPEG?
Looking at the site, the package it already does that via it's viewer (open3mod).
They call it a "screenshot" although more technically it is a render. They are inserting a camera position against the 3D model in a 3D space and rendering what would be seen. You would have to do the same.
I like to live dangerously so I'll risk forum or administration wrath with this one.
Found this Linux application which supposedly helps with file linking.
I have created using pkg_config - "opencv.pc" file and added it in -L - add library path. It does contain OpenCV libraries , I verified that, but linker complain of "incorrect extension ".
However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc". Also this pkg_config info is not that new. There is no open access user forum which makes me suspicious if this "packaging libraries " is a good and useful tool.
Please, if this post is not in line with CodeProject policies just ignore it or let me know and I'll delete it.
However, I cannot find in any pkg_config related sites HOW to actually tell GCC linker to use this "opencv.pc".
The linker doesn't use .pc files. You must use the pkg-config command to generate the options for the compiler or linker. Use command substitution[^] to embed the pkg-config command on the linker command line or to store the output in a variable.
Still struggling with the issue Here is exact syntax I have used - it suppose to "print" , I assume substitute, the libraries in package ( opencv ) to the linker as -l options. It does not matter if the options are --libs opencv or opencv --libs - which is expected.
"$(pkg-config opencv --libs)"
Here is partial liker output
make all Building target: TEST_1 Invoking: GCC C++ Linker <b>g++: error: missing argument to ‘-l’</b> g++ -L/usr/local/lib -o "TEST_1" ./src/TEST_1.o <b>-l""</b> make: *** [TEST_1] Error 1 makefile:45: recipe for target 'TEST_1' failed
I have tried different format / syntax and "$(command)" is correct per the link you have provided. From the output it is notable that no -l files were included - -l"".
I do not know what else can be wrong. The command does not expands to anything linker can use and it should look as terminal output.
So Resource compiler starts with exactly one macro RC_INVOKED and includes only macros that are included in it's include section. Once upon a time there was an undocumented _WIN32 but I think even that has gone these days.
So the more usual trick is to use the build options tab on the resource file to preset a define. On your resource build you have configurations and you can add predefined macros.
Config Properties -> Resources -> General In the macros tab add _WIN64 manually to the 64 bit build. Add _WIN32 to the 32 bit build tab.
I hope this forum will forgive me to ask this, but...
CMake wants to have line added <b><b><b></b></b>cmake_minimum_required(VERSION 3.5)</b>
after which opencv.sh complains
./opencv.sh: line 1: syntax error near unexpected token `VERSION' ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'
I am enclosing my crude log to illustrate some details.
And no, I do not know how to change CMake options to remove this version requirement and still would like to know the "syntax" error I made.
pre lang="text"><pre lang="text">CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies): Unknown CMake command "ocv_check_dependencies". CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as
should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. Configuring incomplete, errors occurred! after adding CMake Error at traincascade/CMakeLists.txt:2 (ocv_check_dependencies): Unknown CMake command "ocv_check_dependencies". CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as
should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it. Configuring incomplete, errors occurred! after adding
im-desktop $ ./opencv.sh ./opencv.sh: line 1: syntax error near unexpected token `VERSION' ./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)' jim@jim-desktop $
./opencv.sh: line 1: syntax error near unexpected token `VERSION'
./opencv.sh: line 1: `cmake_minimum_required(VERSION 3.5)'
The error ir pretty clear:
There is a syntax error in line 1 of the file opencv.sh. The .sh extension indicates that it is a shell script file which is processed by the shell (probably bash) which will off course know nothing about CMake commands.
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
Here CMake complains about a missing command in the file CMakeLists.txt.
So you have to add the command to the CMake file CMakeLists.txt.
_MY_PROJECT_NAME_ being what you want to call the project
I am sorry for having to ask and check all these really beginner stuff but there is something strange going on.
Whatever the situation I suggest you simply open up a command line window, change to the directory and manually type in the cmake command (so we have any scripts out of the way) and we can see the exact screen spit from cmake itself without the script which is just another source of possible error.
Assuming we pass all this basic stuff there is left one other possibility that your first makelist pulls other makelists and those later makelists have version requirements but that is not the sort of error you seem to be getting. The problem is the exact messages change depending on version CMake and exact OS type so I will leave it as a possibility.
The syntax error is:
The program processing the file is not able to parse the command cmake_minimum_required(VERSION 3.5).
The reason is:
You have pasted the command into the file opencv.sh which is processed by the shell (the Unix command line interpreter; see Unix shell - Wikipedia[^] ).
But it should be pasted into the file CMakeLists.txt which is processed by CMake.
The solution (see my initial answer):
So you have to add the command to the CMake file CMakeLists.txt.
CMake expects you to run it "out of the source tree"... meaning that you run it from some "build" directory where all the build binaries will be stored. That keeps the source separate from any build artifacts. It's warning you that you're building from within your source directory.
In simple terms... if you have a source tree that looks like this:
When you run the CMake command, it should be from a separate, self contained directory:
That keep all the build artifacts in "build_dir" so if you need to blow away your build, it's easy to do so without messing with the source. In this case, to launch cmake, go into your build_dir and launch with cmake ../ -DANYOTHERCMAKEARGS .
I think the problem is "descriptive terminology". I have a "mother directory" OpenCV with CMakeList.txt file I execute using CMake. I did not bother to find were CMake resides. Now CMake wants to know "source directory". That is why I asked - apparently it is the "mother directory" and not some specific real source code of OpenCV. ( I suppose analyzing CMake would give some clue )
Now CMake will build OpenCV library and again - where should this "build" be? Logically it belongs under the mother directory just to keep things under common directory. Apparently, and I do not discount I made some other mistake, that caused the warning.
It all sounds pretty simple, but turns difficult to troubleshoot when things do not go right. For example CMake finishes the "build" gives no "option" to quit / exit -just ask for same "click this or that again ". But I am making some progress thanks to this forum. Cheers Vaclav
Sure but there isn't much to those two they are just followed by a folder path string for the library directory or the include directory.
For header files GCC uses 4 default directories in a set order, the name of those directories is set when the version of GCC.EXE was created. So I can't tell you what they are because it depends on versions, CPU etc. However you can get them back out to screen with a command
I don't do a lot with libraries and from what I know there are 2 default directories in a set order again set at compile time of the linker executable ld.exe and again it has a command to display them
Your commands above change the user directories and you can check what is happening by inserting your command line and putting -v at end and you can see what it changes.
Thanks Leon, this is my first usage of Eclipse and I am in "GUI" stage so far. The problem is little too much for me. First I used install.sh script for OpenCV and added "library search path" (-L) /usr/local/lib. Than I am suppose to choose the actual library to use via (-l) from pull down box - but there is no pull down , only text box. After "updating " Eclipse to newest I noticed that when I type in search path /usr/local/lib it ends up as "/usr/local/lib" , but still no pull down box with the libraries. I must be missing some other option. ( I do wish I was better using command line, but I am not ready for it.)
So I added cv2.so under library add (-l) . Now everything compiles , but linker stops because it cannot find the "cv2.so" - but I can see it in correct directory.
I still think my (-l) syntax is wrong.
I also tryied to link to OpenCV .../build/lib with same results . This "build/lib" was a product of CMake I found with OpenCV.
I think my biggest issue is - I do not understand how does "shared" library works in Elipse and which library search path is correct.
Have you checked at CDT Documentation[^]? The command line options for GCC will all be listed on the GCC website, but generally for linking you need the directories listed via -L (capital L), and the names of the libraries vie -l (small l). It is sometime since I have built an application on Unix/Linux so some features may have changed.
It would probably help if you showed your complete GCC command line (between <pre> tags for clarity.) and the exact error message(s) that you receive.
If the library file does not match this style (lib prefix, .a or .so extension, or you want to link dynamically to a .so file but there is also a matching .a file), you can pass the full name with path as argument like for object files (gcc recognises if the file is an object file or a libray).
I can't help much regarding Eclipse. But a quick search shows that there are two different sections where you can configure libraries:
The general library settings (C/C++ Properties - Folder - General - Paths and Symbols)
The project and tool specific settings (C/C++ Properties - Project - Build - Settings - Tool Settings - Linker)
The first should be used for system wide general library paths while the second is for project specific settings. To add an object or library with full path and name, enter it at Miscellaneous - Other objects.
Thanks to all, I really appreciate your help. I did some more messing around and managed to input correct -L using / copying stuff affecting ALL projects. It sort off worked. Than I did -l and typed cv2.so and the linker could not find it. I'll try just cv2 without the so extension next. AS I said , there is an GUI option to select "shared" files so as soon as I can get the linker to work I'll play with that. I just rebuild another "buidl" using CMake again and will see what I messed up this time. I'll cannot post the linker output until I have it back working after this new Make, sorry.