For those new to message boards please try to follow a few simple rules when posting your question.
Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
Keep the subject line brief, but descriptive. eg "File Serialization problem"
Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode HTML tags when pasting" checkbox before pasting anything inside the PRE block, and make sure "Ignore HTML tags in this message" check box is unchecked.
Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
Please do not post links to your question in one forum from another, unrelated forum (such as the lounge). It will be deleted.
Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
No advertising or soliciting.
We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
Our project uses a stl map to save meta info. The map is the entrance of all operations, include read / write / update, etc. It must be very efficient.
Every item of the map is about 0.1kB. Now the length is 1M at most. So, the memory used is not over 100M. It is OK by now.
However, in the further, the length might be 1G or more. We have to consider a distrusted solution with high performance…
We tested memcached / Redis. The performance is not so good (no more than 5k query per seocns, need time to optimise.) What’s more, both the solution (memcached / redis) bring many issues for product deployment.
Is there a light weight solution for distrusted map in memory? For example, hold 3 maps in 3 servers and a meta in primary. In detail,
1. All query / update / insert / delete operation is finished in primary 2. If the info is in primary, do it locally, otherwise, send request (query / insert / update / delete) to peer. 3. Three parts of information can be balanced dynamically.
I need some help from you: I try to render an SVG image on the screen (with alpha channel). The problem is, when I try to draw the image on the screen, I see absolutely nothing. First of all, my SVG image is loaded correctly, and the ATL CImage from the below code, contains a correct image. The problem start when I try to use Gdiplus + alpha channel. For instance, if I use PixelFormat24bppRGB instead of PixelFormat32bppARGB, the image is drawn correctly, but alpha channel is not preserved - a black halo is shown around my image. Do you see any problem in my code?
PS: I use Win7, 32 bit + Visual Studio 2013 Ultimate.
void CAppView::OnDraw(CDC* pDC)
int width = 600, height = 600;
GError* pError = NULL;
g_my_svg = rsvg_handle_new_from_file("d:\\myImage.svg", &pError);
cairo_surface_t *surface = cairo_win32_surface_create_with_dib(CAIRO_FORMAT_ARGB32, width, height);
cairo_t* cr = cairo_create(surface);
HDC srcHDC = cairo_win32_surface_get_dc(surface);
// Create ATL CImage, then, copy the content of srcHDC in the CImage HDC
image.Create(width, height, 32);
HDC imageHDC = image.GetDC();
TransparentBlt(imageHDC, 0, 0, width, height, srcHDC, 0, 0, width, height, RGB(0, 0, 0));
// Initialize Gdiplus
Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
// Problems starts from this point.// Create a Gdiplus bitmap, and copy the content of CImage in bitmap, then write the bitmap on the screen.
Gdiplus::Bitmap bmp(image.GetWidth(), image.GetHeight(), image.GetPitch(), PixelFormat32bppARGB, static_cast<BYTE*>(image.GetBits()));
graphics.DrawImage(&bmp, Gdiplus::Rect(0, 0, width, height));
Can I first say you have no error checking at all in that code ... really bad programming practice
cairo_win32_surface_get_dc can fail and return NULL ... read the manual. Why might there not be a win32 surface, well because you have to set a #define CAIRO_HAS_WIN32_SURFACE 1 in the cairo library .... again in the manual.
You code is totally reliant on srcHDC being valid ... Yet inexplicably you don't check it.
Secondly you probably want an alpha channel on the CIMage .. the create should be CreateEx
Thirdly read TransparentBlt detail and if we do the Alpha channel it will then copy the source alpha onto the destination alpha ... is that Ok? If not you have to use AlphaBlend function.
Fourth check GDIPlus I seem to remember it had issues with Alpha channels.
Final comment is you seem to be making life difficult for yourself using 3 different systems for reasons that aren't clear. You are moving bitmap data around between systems for no real reason what you want can be done in any of the 3 systems and even natively on the Win32 API. You are even initializing the GDI plus system with a draw process ... like seriously please don't do it are you really hell bent on making the draw as slow as possible. Start the GDIPlus with the window or program and close it when done but not in a draw process ever.
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment "Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst "I don't drink any more... then again, I don't drink any less." - Mike Mullikins uncle
I am new to VC++/MFC but have C++ background. I am using addpage() of CPropertySheet class to add new tabs. My problem is that on click of a radiobutton control all tab pages should be disable except one.