|
Hello all. I've recently been digging around the job market and several times I've come across programmer positions that are asking for candidates with experience in "STL relational database" development. I'm wondering what exactly is meant by that? In my exposure to STL in general I don't recall coming across anything akin to .NET classes such as DataTable, DataRow, DataSet, etc... So when an employer makes this request, what are they looking for? I can think of two possibilities:
1. Just looking for someone who knows how to establish ODBC connections with STL to retrieve data from a data source (SQL Server, MySQL, Oracle, or whatever) and populate simple STL data structures like Lists.
2. Use simple STL structures to actually program an entire database-like series of interrelated classes so that no database is even needed on the back end.
Can anyone clarify this for me? Also, can anyone point me to a good, *in-depth* STL resource (websites or published books)?
Thanks for reading!
|
|
|
|
|
I can't be sure but perhaps this[^] is what you are looking for.
I must get a clever new signature for 2011.
|
|
|
|
|
That sounds really intriguing and I'd love to read it, but $80 (Amazon Marketplace) for a mere 150 pages is terribly steep.
|
|
|
|
|
Hi,
I have an MDI application that call a dialog in dll by passing the handle of parent A_hWndParent.
the dll receive this handle and create an instance of my dialog ( Login dialog (security) ) and set A_hWndParent as its parent like this :
MyDialog Dlg;
Dlg.SetParent(A_hWndParent);
Dlg.DoModal();
But when lunching application and switch window to an other window( like Notepad++ ) and return to it I can manipulate the parent application without login (parameters login ok in the dialog) which is not logic
NB: the parameter A_hWndParent is managed correctly in the parent application and is passed correctly to the dll.But it seems not correctly managed in the dll.
there is something wrong in my code ie there is a problem in SetParent function?
|
|
|
|
|
Try passing the parent window to to CDialog's constructor, when creating MyDialog object.
See here
More over, is it your own SetParent function which takes HWND as parameter?
|
|
|
|
|
The solution is to pass the HWND parent as parameter to DoModal() instead ::GetActiveWindow().
Thank you for help.
|
|
|
|
|
I'd like to be able to change the style of a DateTimePicker control at runtime. Normally I would expect something like this to work just fine (as it does with the Listview control)
void DateTimePicker::setUpDownControlsVisible( const bool& val )
{
LONG_PTR style = ::GetWindowLongPtr( hwnd_, GWL_STYLE );
if ( val ) {
style |= DTS_UPDOWN;
}
else {
style &= ~DTS_UPDOWN;
}
::SetWindowLongPtr( hwnd_, GWL_STYLE, style );
::SetWindowPos( hwnd_, NULL, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED );
InvalidateRect( hwnd_, NULL, TRUE );
}
However when this is executed there is no change in the control. Is this not allowed for the date time control, or is there something else you need to do here?
|
|
|
|
|
DTS_UPDOWN cannot be added or removed after creation of the control, using SetWindowLong or otherwise.
To change the style of your DateTimePicker control at runtime, you'll have to read the current style (with GetWindowLong as you do now), then destroy the control, and then create a new control with the same style except with DTS_UPDOWN toggled on or off as appropriate.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Thanks for the tip. I was half suspecting that this was going to be the case. Seems completely ridiculous, but oh well
|
|
|
|
|
Need to pass private member of a Class as a argument to function of another class and get modified there and Class A will again user the modifed value of x there after..
int .Net Managed C++
class A
{
<pre> private :
int ^x;
...
B ^ ojbB;
ojbB->TheFunctionneedsPrivateObjectof_A( int &x)
}</pre>
<pre>class B
{
public TheFunctionneedsPrivateObjectof_A(int ^x)
{
Modify x here
}
}</pre>
|
|
|
|
|
Please, do not cross-post. You have already posted the same question in Managed C++/CLI[^] forum.
Your question has nothing to do with ATL/WTL/STL.
Please stick to Managed C++/CLI forum.
|
|
|
|
|
How to get the delagate value via property
<pre>property MyCallback^ CallBack1
{
MyCallback^ get {return m_pCallBack; }
}
Private MyCallback^ m_pCallBack;</pre>
Thanks
|
|
|
|
|
|
Hi,
Is there any function that returns an index of a particular element in a numeric array.
Thanks
P.S. I am looking for an equivalent of MATLAB's find() function.
|
|
|
|
|
You can use a combination of std::find[^] and std::distance[^] in order to search for an element and get its index.
The standard algorithms will work both on standard containers and arrays. Here is a quick example for you, which demonstrates the usage of std::find and std::distance with std::vector and regular array:
int arr[] = {31, 53, 7, 9, 45, 20};
const int size = (sizeof(arr) / sizeof(arr[0]));
int* arr_beg = arr;
int* arr_end = arr + size;
std::vector<int> vec;
std::copy(arr, arr + size, std::back_inserter(vec));
std::cout << "\n Searching the array for element with value 7...";
int* res1 = std::find(arr, arr + size, 7);
if(res1 != arr_end)
std::cout << "\n The element is found at index: " << std::distance(arr_beg, res1);
else
std::cout << "\n The element is not found";
std::cout << "\n Searching the array for element with value 8...";
int* res2 = std::find(arr, arr + size, 8);
if(res2 != arr_end)
std::cout << "\n The element is found at index: " << std::distance(arr_beg, res2);
else
std::cout << "\n The element is not found";
std::cout << "\n Searching the vector for element with value 7...";
std::vector<int>::iterator it1 = std::find(vec.begin(), vec.end(), 7);
if(it1 != vec.end())
std::cout << "\n The element is found at index: " << std::distance(vec.begin(), it1);
else
std::cout << "\n The element is not found";
std::cout << "\n Searching the vector for element with value 8...";
std::vector<int>::iterator it2 = std::find(vec.begin(), vec.end(), 8);
if(it2 != vec.end())
std::cout << "\n The element is found at index: " << std::distance(vec.begin(), it2);
else
std::cout << "\n The element is not found";
I hope this helps.
|
|
|
|
|
you can use std::find function.you need to include algorithm header file
for example if you have a vector containing some integers you can call it like this
vector<int>::iterator the_index = std::find( vcNumbers.begin(),vcNumbers.end(), number_to_search );
you can check if the index is valid by checking it against vcNumers.end().Something like this.
if( vcNumbers.end() != the_index) cout << *it;
hopes this helps
If u can Dream... U can do it
|
|
|
|
|
Please help. I haven't programmed unmanaged C++ in 10 years. I'm trying to re-educate myself but I don't seem to be having a lot of luck. I swear I just stepped into the twilight zone. This code:
#include <string>
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
std::string s = " ";
printf(s);
return 0;
}
...fails to compile with 2 errors: C2039 "string is not a member of std" and C2065 "'s' undeclared identifier".
So then I tried a "using namespace" declaration like this:
#include <string>
#include "stdafx.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
string s = " ";
printf(s);
return 0;
}
...and I still get the C2065, though the C2039 is gone.
I also tried other ideas, like changing to . Nothing is working. What am I doing wrong??? I am using VS2010 on a Win7 (64bit) machine. Thanks for your help.
|
|
|
|
|
you cannot do printf( s) , instead you can do like printf( s.c_str() ) or cout << s ( make sure that yo include iostream ).
If u can Dream... U can do it
|
|
|
|
|
The precompiled header (stdafx.h ) should always be the first header included. Also dump the printf . Try code like this:
#include "stdafx.h"
#include <iostream>
#include <string>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
string s = "Hello, world!";
cout << s << endl;
return 0;
}
Steve
|
|
|
|
|
Re-ordering the #includes did the trick. I had read about the use of printf/cout but I hadn't gotten to that point since I couldn't even get my variable declaration to compile. Thanks for the pointers.
|
|
|
|
|
Hi all!
I'am use ms sql server 2000 and msvs 2005 (visual c++)
Need to execute stored procedure in c++ client code.
On line
err = cmd.MoveFirst();
it's failed, because m_spRowset is NULL,
BUT then I remove line
update dbo.States set Name = '@' where StateId = 3 from stored procedure - it's OK?
What's wrong here?
Thanks for help!
sp code:
<br />
go<br />
alter procedure trans_GetList<br />
as<br />
begin<br />
update dbo.States set Name = '@' where StateId = 3<br />
<br />
select StateId from dbo.States<br />
end<br />
go<br />
c++ code:
<br />
CDataSource con;<br />
<br />
HRESULT err;<br />
<br />
err = con.OpenFromInitializationString(L"...");<br />
<br />
CSession session;<br />
<br />
err = session.Open(con);<br />
<br />
CCommand < CDynamicParameterAccessor, CBulkRowset, CMultipleResults > cmd;<br />
<br />
err = cmd.Create(session, L"exec dbo.trans_GetList");<br />
err = cmd.Prepare();<br />
<br />
void *bufCmd = 0;<br />
<br />
err = cmd.BindParameters(&cmd.m_hParameterAccessor, cmd.m_spCommand, &bufCmd);<br />
err = cmd.Open(0, 0); <br />
err = cmd.MoveFirst();
<br />
while(err == S_OK)<br />
{<br />
...<br />
err = cmd.MoveNext();<br />
}<br />
<br />
session.Close();<br />
con.Close();<br />
|
|
|
|
|
just add
SET NOCOUNT ON
in the procdure
it's a magic.
|
|
|
|
|
I have made a OLE DB Provider using "ATL OLE DB Provider Wizard" in VS 2005.I tried to implement bookmark in it
but it seems consumers can not recognize bookmark bookmark capability of my provider.I have these lines in
property map set of my rowset object:
PROPERTY_INFO_ENTRY_EX(BOOKMARKS, VT_BOOL, DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE , VARIANT_TRUE, 0)
PROPERTY_INFO_ENTRY_EX(BOOKMARKSKIPPED,VT_BOOL, DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ, VARIANT_TRUE, 0)
PROPERTY_INFO_ENTRY_EX(BOOKMARKTYPE, VT_I4, DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ, DBPROPVAL_BMK_NUMERIC, 0)
PROPERTY_INFO_ENTRY_EX(LITERALBOOKMARKS, VT_BOOL, DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE, VARIANT_TRUE, 0)
PROPERTY_INFO_ENTRY_EX(ORDEREDBOOKMARKS, VT_BOOL, DBPROPFLAGS_ROWSET | DBPROPFLAGS_READ | DBPROPFLAGS_WRITE, VARIANT_TRUE, 0)
and even my data source tables don't have bookmark column,I put an extra column(with ordinal=0) as the first
column of rowset object which is created in Execute method of this object.
But in session object,IRowsetSchema interface only returns the tables columns not included any entry for Bookmark.
should I include a column entry for Bookmark in column schema of any table?
should I always include bookmark column in returning data rowsets or it depends on consumer request?
Is there any sample code which shows implementing bookmark inside the "Execute" method of rowset object?
May you answer these questions please?
Thanks in advance
|
|
|
|
|
Hi friends,
My product have a ATL/COM based C++ service (32 bit). It get registered and run fine on XP 32 bit and Vista 32 bit.
But now I want to run the same on Windows7 64 bit also. I tried to register the service the following way:
1 I did Copy MyService.exe at C:\Windows\SysWOW64.
2 Then executing "C:\Windows\SysWOW64\MyService.exe" -RegServer from Start->Run
3 Then executing "C:\Windows\SysWOW64\MyService.exe" -Service from Start->Run
But my service is not getting registered. While registering it, I don't get any error message. Also I didn't find any entry in event viewer (I saw event viewer first time. Don't know where to see the log about registration of my service). And I didn't find entry for my service at Control Panel\Administrative Tools\Services.
Please advise me how can I register my service?
Thanks in Advance
Regards
|
|
|
|
|
Did you install your service first? How was your service is installed in XP 32?
Service is installed with CreateSerice() API. Check out how this was handled in XP 32 case.
You can have your own logs during CreateService() API and see what went wrong in Win7 x64.
I am not sure why you need to copy the MyService.exe in SysWow64 folder.
Your service Dll\EXE can be anywhere.
-Prashanth Jaligama
|
|
|
|