If your Windows XP machine is using :

  • Static IP
    You might have to fill the Windows XP’s DNS Server with  the same address as the gateway (your Windows 7(server)’s local IP address).
  • DHCP (Automatic IP Address)
    You do not have to fill the DNS server in your Windows XP machine.
Advertisements

Oracle BI SE1 Services

June 20, 2009

To use Oracle Application Server we should start OC4J which can be done by “Start OC4J” and shutting it down by CTRL+C in the OC4J console.
And to completely shutdown the remaining services that BI uses:

net stop OracleServiceBISE1DB
net stop OracleDBConsolebise1db
net stop “Oracle BI Server”
net stop “Oracle BI Presentation Server”
net stop “Oracle BI Java Host”

This will stop the services and freeing your machine’s memories.

To start the services again just use the following commands:

net start OracleServiceBISE1DB
net start OracleDBConsolebise1db
net start “Oracle BI Server”
net start “Oracle BI Presentation Server”
net start “Oracle BI Java Host”

To make things easier, make .bat files and paste this commands.

**

If you can not start OracleDBConsolebise1db service then you should try this at cmd:

SET ORACLE_SID = bise1db
EMCTL START dbconsole

It will give you the error message, “/oc4j/j2ee/OC4J_DBConsole_118.136.27.180_bise1db not found.”

Go to “/oc4j/j2ee/” copy folder “OC4J_DBConsole_?????_bise1db” and rename it to “OC4J_DBConsole_118.136.27.180_bise1db”. Now start your dbconsole again.

Note: Adjust your ORACLE_SID and the missing folder name to yours

Recently I got my USB Driver downgraded from 2.0 to slower speed (1.1?). I think it happened when I plugged my friend’s external harddrive to my computer and it caused some error. So everytime I plugged my USB storage, the Windows pop this message :usb-low-speed

The USB Driver installed at that time :

usbdriver2

Now, the solution to fix the Driver back into USB 2.0 Driver:

  • Go to your BIOS, make sure the “USB 2.0” is enabled
  • Go to device manager Open the Universal Serial Bus Controllers (like above picture)
  • Uninstall the USB Drivers
  • Restart
  • Your Windows (XP SP1) will install the proper drivers now

Result:

usb20

HTS Programming 2

March 1, 2009

A year and a half ago, I played this hts game. It’s kinda addicting for me : ), learnt new stuffs, etc. And I reached Programming 2, with a little programming skill I tried to finish this and end up not knowing what to do. I didn’t want to skip the level so I didn’t continue to further levels, but I promised to my self to finished this level someday with C or C++. Eventually I just forgot about hts, but a couple days ago I suddenly remembered about this, so I gave it a try again. And I did it ; ). Yey I kept that promise ( although I took a year and a half to keep it ).

#include “CImg.h”
#include
#include
#include

using namespace cimg_library;
using namespace std;

const string morse[] = {
    “.-“, “-…”, “-.-.”, “-..”, “.”, “..-.”, “–.”, “….”, “..”,
    “.—“, “-.-“, “.-..”, “–“, “-.”, “—“, “.–.”, “–.-“, “.-.”,
    “…”, “-“, “..-“, “…-“, “.–“, “-..-“, “-.–“, “–..”, “.—-“,
    “..—“, “…–“, “….-“, “…..”, “-….”, “–…”, “—..”, “—-.”,
    “—–”
};

const char alphabet[] = {
    ‘A’, ‘B’, ‘C’, ‘D’, ‘E’, ‘F’, ‘G’, ‘H’, ‘I’, ‘J’, ‘K’, ‘L’, ‘M’,
    ‘N’, ‘O’, ‘P’, ‘Q’, ‘R’, ‘S’, ‘T’, ‘U’, ‘V’, ‘W’, ‘X’, ‘Y’, ‘Z’,
    ‘1’, ‘2’, ‘3’, ‘4’, ‘5’, ‘6’, ‘7’, ‘8’, ‘9’, ‘0’,
};

// Dummy WriteFunction
size_t dummy (void* , size_t size, size_t nmemb, void*){
    return size*nmemb;
}

// Get Ascii value of specific x,y
int getAsciiValue( int x, int y, int& curr, int& prev ){
    int result;

    curr = x + (100*y);
    result =  curr – prev;
    prev = curr;
    return result;
}

// Return a string contains TEXT of the datamorse
string getText( string datamorse ){
    string temp, datatext;
    int i=0,j=0;
    for( i=0; ihttp://www.hackthissite.org/user/login“;
    char *url2 = “http://www.hackthissite.org/missions/prog/2/“;
    char *url3 = “http://www.hackthissite.org/missions/prog/2/PNG/“;
    char *url4 = “http://www.hackthissite.org/missions/prog/2/index.php“;
    char *postdata = “username=USERNAME&password=PASSWORD&btn_submit=Login”;    //change USERNAME and PASSWORD to yours
    char *cookiefile = “tempcookie”;

/*Logging in and retrieving the image*/
    curl = curl_easy_init();
    if( curl ){
        curl_easy_setopt(curl, CURLOPT_COOKIEFILE, cookiefile);        //  Enable cookies
        curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);            // Follow HTTPresponse redirections
        curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, dummy);        // Disable CURL output to stdout
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postdata);        // Send Post data
        curl_easy_setopt(curl, CURLOPT_URL, url);                    // Setting target url

        // Connect to target (login)
        result = curl_easy_perform(curl);
        if( result ){
            cout << "Cannot connect to site, check your url!\n";         }         // Setting new target url         curl_easy_setopt(curl, CURLOPT_URL, url2);         // Connect to target (mission page)         result = curl_easy_perform(curl);         if( result ){             cout << "Cannot connect to site, check your url!\n";         }         // Open file         fp = fopen("PNG.png", "wb");         if( fp == NULL ) cout << "File cannot be opened";         curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, NULL);    // Set to default stdout         curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);            // store stdout to file         curl_easy_setopt(curl, CURLOPT_URL, url3);                // Setting new target Url         // Grab image         imgresult = curl_easy_perform(curl);         if( imgresult ){             cout << "Cannot grab the image!\n";         }         // Close the file         fclose(fp);     } /*End of Logging in and retrieving the image*/ /*Open PNG file, read morsecode, decode and write the TEXT*/     CImg img(“PNG.png”);                        // Open PNG.png
    string datamorse, answer;
    int x=0,y=0;
    int curr=0, prev=0;

    for( y=0; y<30; y++ ){         for( x=0; x<100; x++ ){             if( img(x,y,0,0) == 255 ){                 datamorse.push_back(getAsciiValue(x,y,curr,prev));    // If at x,y the pixel has RED value == 255 it gets the AsciiValue and store it to datamorse             }         }     }     cout << datamorse << endl;     answer = getText(datamorse);     cout << answer << endl; /*End of Open PNG file, read morsecode, decode and write the TEXT*/ /*Answering the Mission*/     fpResult = fopen("htsresult.htm", "wb");                // Opening file to write the final result     if( fp == NULL ) cout << "File cannot be opened";     char tempanswer[answer.length()+2];                        // Make an empty array for tempanswer         stringToChar(answer, tempanswer);                    // Move answer value to tempanswer     char postanswer[100] = "solution=";         strcat(postanswer, tempanswer);                        // "solution="+tempanswer         strcat(postanswer, "&submitbutton=submit");            // "solution="+tempanswer+"&submitbutton=submit"     curl_easy_setopt(curl, CURLOPT_URL, url4);                // Setting new target Url     curl_easy_setopt(curl, CURLOPT_WRITEDATA, fpResult);    // store stdout of the final result to file htsresult.htm     curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postanswer);    // Fill Post data with the answer     // Posting the answer     result = curl_easy_perform(curl);     if( result ){         cout << "Cannot connect to site, check your url!\n";     }     // Clean up curl's the resources     curl_easy_cleanup(curl); /*End of Answering the Mission*/     return 0; } [/sourcecode]

It will connect to hts site and log in using USERNAME and PASSWORD. Retrieve Programming 2 PNG file, retrieve the morse code, decode it to text, submit the answer. This program will generate PNG.png file and htsresult.htm file which contains your result for that challenge.

Note:

  • When compiling be sure to link the necessary library that cURL and CImg need.
  • It seems WordPress try to make the url a hyperlink even though I use sourcode tag, just get rid of it all leaving only the url.

Using cURL in MinGW

March 1, 2009

curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, LDAP, LDAPS and FILE. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos…), file transfer resume, proxy tunneling and a busload of other useful tricks.

  • You can download the curl library for C in the website: http://curl.haxx.se/ . I use curl-7.19.3.zip .
  • Extract the file so it’s all in same folder (I assume the folder name as curl).
  • Navigate to that folder through command line and use mingw32-make mingw32 command.
  • The command will generate files in /curl/lib folder.
  • Now you can test it by compiling the example in /curl/docs/examples/
  • Navigate to /curl/docs/examples
  • Compile using gcc -DCURL_STATICLIB -I ../../include -L ../../lib simple.c -o simple -lcurl -lws2_32 -lwinmm
  • Run the executeable file simple and you will see the html file you’ve successfully fetched.

Note:

  • Use -DCURL_STATICLIB (I will  post more about this when I know about dynamic/static library)
  • Make sure the compiler know where to search the curl’s include and lib folder
  • Library needed : curl, ws2_32, winmm

Using CImg in MinGW

March 1, 2009

The CImg Library is an open source C++ toolkit for image processing designed with these properties in mind: Usefulness, Genericity, Portability, Simplicity, Extensibility, Freedom.

You can see the details and download it at http://cimg.sourceforge.net/

To use this, first you need to download the library ( I’m using CImg-1.3.0.zip as I’m writing this post). After your download the library, you will get a bunch of stuff: documentations, examples, resources, etc. The one you need is only the CImg.h.

Move it your MinGW include folder or your can just include it at compile time ( using -I as in i not L ). Now you are ready to code using CImg. : )

#include "CImg.h"

using namespace cimg_library;

int main(int argc, char *argv[]) {
    CImg<unsigned char> img(640,400,1,3);            // Define a 640x400 color image with 8 bits per color component.
    img.fill(0);                                       // Set pixel values to 0 (color : black)
    unsigned char purple[] = { 255,0,255 };         // Define a purple color
    img.draw_text(100,100,"Hello World",purple,0,1,35); // Draw a purple "Hello world" at coordinates (100,100).
    img.display("My first CImg code");               // Display the image in a display window.
    return 0;
}

Note:

  • Use cimg_library namespace to help writing your code
  • When compiling, be sure the compiler found CImg.h
  • When compiling, link it to gdi32 library
  • If you want to use CImg to open image file such as (JPEG, PNG, etc) you have to install other library such as ImageMagick that CImg uses. To download ImageMagick visit the site : http://www.imagemagick.org/. I installed version ImageMagick-6.4.9-7-Q16-windows-static.exe

Installing MinGW

February 27, 2009

Files needed:

  • binutils (binutils-2.17.50-20060824-1.tar.gz)
  • gcc-core (gcc-core-3.4.5-20060117-3.tar.gz)
  • mingw-runtime (mingwrt-3.15.1-mingw32.tar.gz)
  • w32api (w32api-3.12-mingw32-dev.tar.gz)

Optional:

  • gcc-g++ (gcc-g++-3.4.5-20060117-3.tar.gz)
  • mingw32-make (mingw32-make-3.81-20080326-2.tar.gz)
  • etc
*the green text are the version that I use when writing this post

To download those files, visit http://www.mingw.org/ and check for the latest releases.

After finished downloading those files, simply extract all the files in a folder. When choosing the “Destination Folder” for the installation, please consider not installing MinGW in a path that contains spaces. (C:/MinGW)

Add your PATH variable with the installation folder (C:/MinGW)

To compile your code

g++ foo.c -o bar.exe