Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 C++


  A Tiny MySQL++ Tutorial; C++ and MySQL; MySQL++ Example

I wrote a post about how to install MySQL++ and I thought I will write a quick tutorial on how to use it too.This is a very basic MySQL++ program and it’s very self explanatory:#include <mysql++.h>#include <stdlib.h> using namespace std;using namespace mysqlpp; int main() { try { Connection conn(false); conn.connect("DB NAME", "DB HOST probably localhost", "DB USER", "DB PASS"); Query query = conn.query(); } catch (BadQuery er) { // handle any connection or // query errors that may come up cerr << "Error: " << er...

17,990 4       C++ EXAMPLE MYSQL++ INSERT API


  Make a directory using C++ for windows

If you want to create a folder at windows using c++/cpp language, there is an easy way for make a folder. You can do it just including the <windows.h> header file. To make a folder at C:\ drive named "deadman"#include<windows.h>int main(){   CreateDirectory ("C:\\deadman", NULL);   return 0;}If you want to delete a fodler from the C:\ directory.#include<windows.h>int main(){   RemoveDirectory("C:\\deadman");   return 0;}Also you can use the system command from c++ to create or delete a fodler. for examplesystem("mkdi...

16,862 1       WINDOWS C++ EXAMPLE DIRECTORY CREATEDIRECTORY


  QScrollArea Scrollbar Display Solution

Qt framework is a popular C++GUI framework developed by Nokia. And it is also cross platform compatible. Manydevelopers are using Qt to develop C++ GUI programs. In Qt, some importantcomponents are deserved our close attention. Many developers faced the problemwhen they put some widgets in a QScrollArea widget and they want it to displayscroll bars when the widgets inside the QScrollArea overflows. After manyexperiments, I propose a way which can show scroll bars as you expected. The relationship betweenwidgets and layout is the key here. Generally, we need not to add layout toscroll area dire...

16,644 3       C++ SOLUTION GUI QT QSCROLLBAR SCROLLBAR NOT DISPLAY


  malloc/free and new/delete in C++

malloc and free are C++/C language standard library functions, while new/delete are operator of C++. They can be used to allocate dynamic memory and free memory in C++ programs malloc/free can not meet the requirements of dynamic objects creation. Object needs to call the constructor to initialize the object when creating, the object needs to call the destructor before it is destroyed  Since malloc() and free() are library functions rather than operators, the compiler has no control permissions on them, so it can not impose the task of object construction and destruction on malloc() and f...

14,681 1       MEMORY C++ DELETE FREE MALLOC NEW


  Get associated file icon with only extension name using C++ on Windows

I have searched on Google for a few examples on how to get associated file icon with only file extension name using C++ on Windows. There are some useful information provided on MSDN which explains the use of SHGetFileInfo() function.It also gives an example code, but it doesn't say how to do it with only the extension name.  Here I give an example code on how to achieve this after I gathered and summarized some  useful information from Internet. I have tested the code on my PC, it works fine./* * @method * getFileIcon() * @param * int : icon type--FILE_ICON_SMA...

14,105 0       FILE ICON WINDOWS ASSOCIATION EXTENSION NAME C++


  A C++ program puzzle

Recently I came across a question asked by wang2191195 on a Chinese IT forum CSDN which asks about a C++ program puzzle. He has a code snippet which cannot be compiled. The code is:#include <cstdlib>#include <iostream>using namespace std;class Base{public: virtual void func(){ cout << "Base::func()" << endl; } virtual int func( int num ){ cout << "Base::func( int " << num << " )" << endl; return 0; }};class Derived : public Base{public: virtual void func(){ cout << "Derived::func()" << endl; ...

11,375 4       C++ OVERLOAD PUZZLE HIDE


  C++ : string beginWith and endWith

C++ is an very powerful programming language. It is efficient and flexible. When writing C++ programs, we may often need to process strings and often we need to check whether a string begin with some substring or end with some substring. We can use following functions to ahieve these:    static bool beginWith(const std::string str,const std::string needle){        return (!str.compare(0,needle.length(),needle));    }    static bool endWith(const std::string str,const std::string needle){       &...

7,799 1       C++ BEGINWITH ENDWITH


  10 Questions with Facebook Research Engineer – Andrei Alexandrescu

Today we caught up with Andrei Alexandrescu for a “10 Question” interview. He is a Romanian born research engineer at Facebook living in the US, you can contact him on his website erdani.com or @incomputable.We will talk about some of the juicy stuff that going on at Facebook, so let’s get started.Hello Andrei, welcome on Server-Side Magazine.1. Tell us a little bit about yourself. Who are you? Where and what do you work?Who am I? Ah, the coffee breath of one talking about himself. Well let me try. I’m a hacker living in the US, originally from Romania. In 2001 I wrot...

7,571 1       PHP C++ FACEBOOK FUTURE MACHINE LEARNING