Posts

Linux mount error when previously okay

Image
I've encountered an error when mounting in my Linux box. Previously it was okay but somehow now it didn't. To fix all I did is restart the service where the "//XXX.XXX.XXX.XXX/Share"  is located as below, That's it!

How to call Java code from C/C++

Image
I wanted to call Java functions from C++ and searching in the internet I found some codes but seems lacking more details. What I will do here is to make it complete. CALLING JAVA IN C++ USING MS VISUAL STUDIO 2008 Requirements: -JDK ( I used jdk1.7.0_55 32bit)  -Visual Studio 2008 Procedure: 1. Add the library "jvm.lib". Remember this library exist when you install the JDK 2. Add the 2 path of the include files of the JDK 3. Add the library path 4. Create the Java source and compile them (javac * to compile everything in the folder). The source location in my MS Windows environment is D:\MyFiles\Downloads\Java Src\TestStruct //HelloWorld.java public class HelloWorld {       public static void main(String args[])       {          System.out.println("Hello World!");          System.out.println("This is the ma...

How to implement mouse drag using wxWidgets

I have an application without borders so I cannot move the application. This application has a wxPanel so the only way I can click and drag is thru the wxPanel. How to implement mouse drag? class myFrame : public wxFrame { public: myFrame(const wxString& title, wxWindow *parent=NULL); wxWindow* parent; private: wxDECLARE_EVENT_TABLE(); } class myPanel : public wxPanel { public: myPanel (wxWindow* parent)     { this->parent = parent; dragging=false; x=0,y=0;               Create(parent, wxID_ANY,wxDefaultPosition, *new wxSize(100,100));     } void onMouseDown(wxMouseEvent& evt) { CaptureMouse(); x = evt.GetX(); y = evt.GetY(); dragging=true; } void onMouseUp(wxMouseEvent& evt) { ReleaseMouse(); dragging=false; } void onMove(wxMouseEvent& evt) { if(dragging) { wxPoint mouseOnScreen = wxGe...

How to put an image to wxPanel using wxWidgets

Image
1. I created the class xOsdHeaderPanel 2. Must call the function wxInitAllImageHandlers(); 3. Create a wxBitmap object and call SetBackgroundBitmap(..) class xOsdHeaderPanel : public wxCustomBackgroundWindow<wxPanel> { public: xOsdHeaderPanel(wxWindow* parent)     { wxInitAllImageHandlers(); const wxSize xxsize(733,80);         Create(parent, wxID_ANY,wxDefaultPosition,xxsize); wxBitmap bitmap(*new wxImage(wxT("./Header.png"),wxBITMAP_TYPE_PNG)); SetBackgroundBitmap(bitmap); new wxButton(this,wxID_ANY,wxT("Sample Button"));     } }; Result:

How to build Boost in Windows and Linux

============ WIN7 ============ Prerequisites -------------- -  Visual Studio 2008 Professional with SP3 Build Steps -------------- 1. Unzipped boost_1_55_0.zip 2. Execute \boost_1_55_0\bootstrap.bat 3. Use the following command to generate files of release    bjam toolset=msvc-9.0 variant=release threading=multi link=shared define=_BIND_TO_CURRENT_VCLIBS_VERSION 4. The binaries can be found in \boost_1_55_0\bin.v2 ============= SLEPOS11SP3 ============= Prerequisites -------------- - GCC 4.3.4 - Linux 3.0.93 Build Steps ------------- 1. Unzipped boost_1_55_0.zip 2. Execute ./bootstrap.sh --with-libraries=all --with-icu --prefix=/usr/local/boost 3. Execute ./b2 variant=release toolset=gcc link=shared threading=multi runtime-link=shared install 4. The files can be found in \usr\local\boost That's it!

How to build Xerces-c in Windows and Linux

================= MS Windows (Win7) ================= Prerequisite: - Visual Studio 2008 SP3 - xerces-c-3.1.1.zip Build Steps: 1. Unzipped xerces-c-3.1.1.zip 2. Open the solution in VS 2008 \xerces\xerces-c-3.1.1\projects\Win32\VC9\xerces-all\xerces-all.sln 3. Build the projects in "Release" mode 4. The binaries can be found in \xerces\xerces-c-3.1.1\Build\Win32\VC9\Release =========== Linux (Suse) =========== prerequisites -------------- - GCC 4.3.4 - Linux 3.0.93 xerces -------- 1. Unzipped xerces-c-3.1.1.zip in \usr\local 2. Create another folder (any folder name but in this example it's "xerces") 3. Choose current directory "xerces" and call "../xerces-c3.1.1/configure 4. Choose current directory "xerces" and call "make build" 5. Choose current directory "xerces" and call "make install" 6. The libraries can be found in \usr\local\lib 7. The b...

How to display all environment variables and its values (C/C++)

#include<stdio.h> int main(int argc, char* argv[], char* env[]) {     int i=0;     while(env[i])     {         printf("%s\n",env[i]);         i++;     }     return 0; }