|
1. Because it is a good IDE for developing Windows/Web applications.
2. I don't know, why are you using Unix?
3. To access your database.
|
|
|
|
|
- You can use
Visual Studio for writing C++ applications targetting the Windows platforms. - If you are using
UNIX (or Linux ) then you are NOT using Visual Studio (and you are using a UNIX or Linux compiler, e.g. gcc ). SQL commands are used to deal with databases, see, for instance the SQL Wikipedia page[^].
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
Hi Guys,
I have a small problem i hope you guys can help.
Actually i have an Win32 application which contacts to a cloud server and the communication between my client and server code is both the XML and json formats.
But can u suggest me some other formats where size of my code should be less and communication should be fast and reliable.
Any suggestions please.
Thanks in advance.
|
|
|
|
|
There is bson which is a binary json. Many software products use sqlite3 and sync it to their server. For example Skype. You can also create yourself a small TCP/IP based protocol.
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
Thanks Michael actually we are thinking of writing our own binary format will it be a good idea ?
|
|
|
|
|
That seems to be the best idea but it is also important to structure the data properly and sdqlite3 can be great for doing so. You can ofcourse encrypt the sqlite3 database file then.
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
Member 10813090 wrote: where size of my code should be less and communication should be fast and reliable.
And why is what you are currently doing a problem? Is there a measured bottleneck that you have determined is caused by your code?
|
|
|
|
|
Using Visual Studio 2013 C++, I got compilation errors that I couldn't explain.
The compilation errors were:
*main.cpp(325): error C2601: 'FLAG' : local function definitions are illegal
main.cpp(323): this line contains a '{' which has not yet been matched
main.cpp(326): fatal error C1075: end of file found before the left brace '{' at 'main.cpp(323)' was matched*
But there was nothing wrong with my code. I counted all brackets and the number matched. There weren't any function inside another function.
I solved it by removing all "//" comments from the source code. It seems that the reason for that is bad line formatting which causes the compiler to miss a line break, so the line after a comment is treated as a comment as well.
For example:
This_is_a_line;
is treated as:
There are many posts of the net about similar problems and some even suggested that they could be caused by a memory (RAM) fault on the machine, so before you replace your RAM, just remove the comments and see...
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
I assume this could be a codepage problem. There is an option under Tools/Options/Environment/Documents to save documents in Unicode. Maybe this has a side effect. Also if you (or someone else) edited the source file in some other editor that removed the carriage return from the line break, this could be a problem.
I would open the source file in an editor that can show the specific line endings (e.g. Notepad2). Maybe you see something unusual there.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Thanks for the tips. I think one of the source files came from a Mac. Now when I place line breaks, get DEBUG messages, etc. it points to the wrong line and I don't know how to fix that.
- Michael Haephrati מיכאל האפרתי
|
|
|
|
|
Have you considered the possibility of a comment line containing a trigraph? See for example this article[^] on curious errors caused by accidental introduction of trigraphs in comment lines.
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)
|
|
|
|
|
Is it possible to use the Visual Studio ribbon editor with classes that I derive myself from CMFCRibbon... classes?
For instance, is it possible to derive my own combo box from CMFCRibbonComboBox and then somehow get it into the toolbox so I can add it to my ribbon at design time?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi,
I am working in MFC application. I faced one problem in my application. This application is alread developed. It has CAlarm class it inherited CListbox like
class CAlarmList : public CListBox it displays value through DrawItem
void CAlarmList::DrawItem(LPDRAWITEMSTRUCT lpDIS)
{
int iListItem = lpDIS->itemID;
CDC lDC;
lDC.Attach(lpDIS->hDC); It working fine but not have header. but client looking header but CListbox not have header control how to add header please help me.
|
|
|
|
|
Might you try changing to a CListCtrl (that has a built in header)? or maybe add a CHeaderCtrl object just above the list box?
"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
|
|
|
|
|
Hi all,
I'm working on a library of which I only want to distribute the .lib and a .h. The header defines the interface or api to the library, the idea being that the user does not bother much about the insides of it. However, I have a concept issue.
#include <map>
#include <string>
class MyApiClass{
public:
private:
std::map<std::string, Param> vars;
};
Obviously this throws an error saying Param is not defined when I compile another application that includes libApi.h and links the library. The thing is, the class Param is declared in Param.h and defined in Param.cpp, files that I don't want the user to play with.
What are my options??
Thanks in advance.
paul.
modified 9-Oct-14 10:12am.
|
|
|
|
|
What's wrong in including param.h in MyApiClass source file?
THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?!
-- C++ FQA Lite
|
|
|
|
|
well... the application in which I use the lib won't compile, will it?? Or am I missing something?
Including param.h in libApi.cpp , when compiling the application
#include "libApi.h"
void main (void)
{
}
I get an error saying "libApi.h: 'Param' undeclared identifier"
|
|
|
|
|
You can use the pimpl idiom:
class MyApiClass{
public:
private:
class MyApiClassImpl;
std::auto_ptr<MyApiClassImpl> impl;
};
and
#include <map>
#include <string>
#include "Param.h"
class MyApiClass::MyApiClassImpl
{
public:
private:
std::map<std::string, Param> vars;
};
MyApiClass::MyApiClass()
: impl(new MyApiClassImpl())
{}
int MyApiClass::SomeFunction()
{
return impl->SomeFunction();
}
MyApiClass::MyApiClassImpl::MyApiClassImpl()
{}
int MyApiClass::MyApiClassImpl::SomeFunction()
{
}
(Edited to fix code written too fast...)
modified 9-Oct-14 11:12am.
|
|
|
|
|
Your Approach only works as long as you are never required to pass a Param object as paramter or return one. Of course you could work with forward declaration (if you only pass references/pointers), but I would suggest another solution.
Create a libapi.hpp and include the headers in the correct order (i.e. map, string, Param.h, libApi.h). Consumers of your API inlclude the hpp. In the libApi.cpp you include the Param.h before the libApi.h. Then it should work.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
Ideally, you'd want minimal exposure, to ensure low coupling. The original post made a point of only showing Param in the private section, and said the user of the library should not be playing around with Param, so I assumed it was not a public type.
If the Param type was a public type used in the interface, the best solution would be to include Param.h in libApi.h instead of introducing a new file.
|
|
|
|
|
I am placing COM component (WMP) on dialog. When I place it and run the application, dialog does not appear but when I delete it and run, dialog appears.
Please suggest what can be issue?
I debug the code and saw DoModal function.
It is executing the portion of DoModal as m_hWnd is comiing NULL.
<pre lang="c++">
if (m_hWnd != NULL)
SetWindowPos(NULL, 0, 0, 0, 0, SWP_HIDEWINDOW|
SWP_NOSIZE|SWP_NOMOVE|SWP_NOACTIVATE|SWP_NOZORDER);
modified 9-Oct-14 7:54am.
|
|
|
|
|
Add the function AfxEnableControlContainer() in the InitInstance method of you app class.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++) (October 2009 - September 2013) Polymorphism in C
|
|
|
|
|
i have done my insertion code for the registration form but now i have to do password encryption after register which i totally have no idea on how to do it in C++ MFC dialog application. please help me if u have any source files. just encrypt the password part.
UpdateData();
MYSQL *ssock;
ssock = (MYSQL *)malloc(sizeof(MYSQL));
mysql_init(ssock);
conn = mysql_init(NULL);
if (conn == NULL) {
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
if (mysql_real_connect(conn, "127.0.0.1", "root", "Root", "inomatic", 0, NULL, 0) == NULL)
{
printf("Error %u: %s\n", mysql_errno(conn), mysql_error(conn));
exit(1);
}
int tmp = atoi((LPSTR)(LPCTSTR)m_Contact);
if(m_Password != m_CfmPassword)
{
MessageBox("Both Password do not match! Please enter again.");
m_EditPassword.SetFocus();
}
if(m_Username == "" || m_Password=="" || m_CfmPassword =="" || m_Email =="" || m_Contact =="" || m_Company == "")
{
MessageBox("Please fill in all the blanks.");
}
else if (m_Password == m_CfmPassword)
{
Insert(conn,(LPSTR)(LPCTSTR)m_Username,(LPSTR)(LPCTSTR)m_Password,(LPSTR)(LPCTSTR)m_Email,tmp,(LPSTR)(LPCTSTR)m_Company,"User");
MessageBox("Thank You! You have successfully registed into People Counter Application.");
}
UpdateData(FALSE);
mysql_close(conn);
m_EditUsername.SetSel(0,-1),m_EditPassword.SetSel(0,-1),m_EditCfmPassword.SetSel(0,-1),m_EditEmail.SetSel(0,-1),m_EditContact.SetSel(0,-1),m_EditCompany.SetSel(0,-1);
m_EditUsername.Clear();
m_EditPassword.Clear();
m_EditCfmPassword.Clear();
m_EditEmail.Clear();
m_EditContact.Clear();
m_EditCompany.Clear();
Winter
modified 8-Oct-14 9:09am.
|
|
|
|
|
As you were said in the previous post, this is the wrong forum for such questions.
Please search the right forum and post it there. Here is to post about the internal things of the site
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpful answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Do not use encryption for passwords. You should add a salt value and use the two pieces of data to create a one-way hash which you store in your database. Remember, encrypted data can be decrypted, hashes cannot. There are many articles and samples explaining this in detail, including Secure Password Authentication Explained Simply[^].
|
|
|
|