|
Using buckets in maps really has nothing to do with hash. It is just a standard optimization. It really comes into play more when your maps are stored on disk. But, the same still holds true for memory maps.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Sh*t, sorry Tim , I re-readed again your post and on the 1st try I misunderstanded it.
*Grin*
You are right about this, I don't understand either and I'm not a algorithm boy, the STL guys must had a reason to implement it without buckets ... now, the reason, I liked very much to known
Cheers,
Joao Vaz
|
|
|
|
|
If I use CAsyncSocket a method called OnClose is called when a connection is closed! okay, but if I don't use MFC to build a soccket app. How does it work then ? ?
hope you understand! short summary: I want an similar functionality in a non-MFC Winsock program to CAsyncSocket's OnClose!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
maybe this will help.
You do a recv(), if it returns 0, it means the connection on the other side is closed, so you close your socket too.
|
|
|
|
|
Wee!
Tackar så mycket (thank you so much)!
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Do you know what's the difference between checking and unchecking this option?
I mean, from the programmer's point of view.
It must be a change in getting messages form the message queue, because i
wrote an application which works perfectly when the option is enabled, and has
a strange behavior when it is disabled. It's about moving controls in a dialog window.
rechi
|
|
|
|
|
bogdan_rechi wrote:
Do you know what's the difference between checking and unchecking this option?
Pretty much the obvious: you get a lot more move and paint messages. If you depend on that granularity, i suppose something could break.
Developers that like shiny objects also dig case mods and scratch-and-sniff stickers. Klaus Probst, The Lounge
|
|
|
|
|
What is the difference between the dialog types available in resource editor?
In resource editor, when we select dialog and reght click ,we will get menu .From the menu,Select dialog.Then different types of dialogs will be listed if we select '+' sign infrontof the dialog.
I want to know the difference between them.
Any help would be grateful.
Be creative
Once your mind is streched by a new idea, it will never regain its original dimension
|
|
|
|
|
Nothing realy.....
they are just simple dialog resources.
only thing changed is the Child / Popup styles
|
|
|
|
|
Hi!
I work with database from MFC (Access).I want to send Sql command.
My function recieve parameter and I use variable type CString with format.
For example:
strSql.Format("SELECT COUNT([TblCatalogList].[CatalogId]) FROM [TblCatalogList] WHERE [TblCatalogList].[PcBoard] LIKE '%s%'",strBoard);
But it does not work and failed becouse unknown format.LIKE must have this format,for example
LIKE '123%' it means that I want to find string that begin from 123,but how must I write if I have a parameter???
Help me,please with syntax!!!
|
|
|
|
|
What does strSql contain after the format statement? I suspect from the example you gave that you'll be missing a percentage and quote sign. This is because the two characters "%'" will be removed from your string. To get a '%' character in a string you need to put two of them (%%):
strSql.Format("SELECT COUNT([TblCatalogList].[CatalogId]) FROM [TblCatalogList] WHERE [TblCatalogList].[PcBoard] LIKE '%s%%'",strBoard);
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
To get a literal % sign you'll need to specify it as %% in the format string.
You know, for kids!
|
|
|
|
|
Hi.
I would like to enable and disable one or more toolbar *buttons*. According to what Prosise mentioned, it can be done using the Enable() that the framework passes to a menu/toolbar update message handler. However, I am not quite clear on how to disable a specific toolbar button. For example, let say I have a toolbar with five buttons.
[button1][button2][button3][button4][button5]
How would I enable/disable, say, button2?
Thanks,
Kuphryn
|
|
|
|
|
When you create each button in the toolbar, it should have an associated command ID. These IDs are passed in as an array in the CToolBar::SetButtons() command. If you create a toolbar in the resource editor (this is from memory, I don't normally do it this way) I think you just select one of the buttons on your toolbar and bring up the properties, then add a command ID there.
Anyway, this ID is the command ID used in the ON_UPDATE_COMMAND_UI update handler (ie you have one handler per toolbar button, not for the toolbar as a whole). If you have a range of toolbar buttons and you don't want to write code for all of them, you can also use ON_UPDATE_COMMAND_UI_RANGE.
So, in summary, each Update Command handler should apply to a single toolbar button.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Okay. Thanks.
I am uncertain one something. Here is what I am trying to do. When the application first starts, I want to disable one or more buttons. When the user select a certain option via menu, then the program would enable the button. I need a way to get a hold of a pointer to the toolbar right when the application starts up so I can disable one or more buttons. It can be done with commandUI and commandUI_RANGE, but how about any other arbitrary time?
Kuphryn
|
|
|
|
|
Well, you can put your command handler anywhere that message are received. The best place to put them in this case would probably be the CFrameWnd-derived class where you create the toolbar. The same class would also have a handler for the menu item. For example, if the menu item is ID_ALLOW_BUTTON and the button itself is ID_MY_BUTTON:
In the header:
bool m_bButtonAllowed;
afx_msg void OnAllowButtonMenu();
afx_msg void OnUpdateMyButton(CCmdUI *pCmdUI);
afx_msg void OnMyButton();
In your constructor:
m_bButtonAllowed = false;
In the message map:
ON_COMMAND(ID_ALLOW_BUTTON, OnAllowButtonMenu)
ON_UPDATE_COMMAND_UI(ID_MY_BUTTON, OnUpdateMyButton)
ON_COMMAND(ID_MY_BUTTON, OnMyButton)
Then:
CMainFrame::OnAllowButtonMenu()
{
m_bButtonAllowed = true;
}
CMainFrame::OnUpdateMyButton(CCmdUI *pCmdUI)
{
pCmdUI->Enable(m_bButtonAllowed ? 1 : 0);
}
CMainFrame::OnMyButton()
{
AfxMessageBox("Got me!");
}
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks. That is exactly what I thought of.
Just one more thing: should I map the command UI update in the MainFrm or the view? I am working with doc/view architecture.
Kuphryn
|
|
|
|
|
Aaah, that old chestnut! It really depends on what the toolbar button does. If the operation of the button could apply to more than one view type (for example, the program I'm working on has ten doc/view types, and some buttons apply to all, while others apply to only one) then it probably makes more sense to put it in MainFrame. If the button only really applies to one view type, it's probably going to be easier to update in the view, otherwise you're going to need to do something like:
void CMainFrame::MyUpdateHandle(CCMdUI *pCmdUI)
{
pCmdUI->Enable(FALSE);
CFrameWnd *vpFrame = GetActiveFrame();
if (vpFrame != NULL)
{
CView *vpView = vpFrame->GetActiveView();
if (vpView != NULL)
{
if (vpView->IsKindOf(RUNTIME_CLASS(CMyButtonView)))
{
CMyButtonView *vpMyView = static_cast<CMyButtonView *>vpView;
if (vpMyView->ShouldIEnableTheButton())
{
pCmdUI->Enable(TRUE);
}
}
}
}
} Whew! As opposed to:
CMyButtonView::OnUpdateButton(CCmdUI *pCmdUI)
{
pCmdUI->Enable(ShouldIEnableTheButton());
}
So, all in all, it's really a style/ease of programming kind of question. I'll leave that decision up to you...
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Good point! Thanks.
I will stick with the simple code for now since all m views use the same toolbar.
Kuphryn
|
|
|
|
|
Could anyone suggest a book(s) that covers the printing process for VC6 comprehensively or even adequately?
Maybe I'm looking in the wrong section but most books seem to touch on the subject and quickly move on.
Any advice is appreciated.
|
|
|
|
|
I haven't found any books that cover printing from Windows application very well. I think the 'best' printing solutions may have a lot to do with what you are trying to accomplish.
For starters you could look at these articles here at The Code Project:
A Simple Printing Mechanism
Easy! Reports
Very Simple Print Preview without the Doc/View architecture
|
|
|
|
|
I want to receive notify messages when data comes using UDP Sockets.
Can I do this?
I can only use UDP and I don't want the socket to be in blocking mode.
Besides polling, is there any better way to check whether there is data waiting to be received?
|
|
|
|
|
Use CAsyncSocket. Just what you're looking for.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Oops. Maybe you're not using MFC. If not, you'll have to use the FDZERO / FDSET etc... Macros. Their described in the sockets ref on MFC.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I want to get the keycode when the user press a key immediately.
Normally I can open a thread and use getc(stdin), but this works only when the
user press a key and then press 'Enter'.
I want to get the key without pressing 'Enter'.
Can and how can I do this?
|
|
|
|