- Click Start, click Control Panel, and then double-click System.
- Click the Advanced tab. Then, under Performance, click Settings.
- Click the Data Execution Prevention tab.
- Click Turn on DEP for essential Windows programs and services only to select the OptIn policy.
- Click Turn on DEP for all programs and services except those I select to select the OptOut policy.
- If you selected the OptOut policy, click Add and add the applications that you do not want to use DEP with.
Thursday, January 12, 2012
How to install web service client application in windows server
This post based on my experience when try to install my web service client application created using delphi. I have no idea, why i was get error when fetching data from web service. The problem is setting of data execution prevention that must be enabled in windows server.
The following is the steps to enable data execution prevention :
Wednesday, January 11, 2012
How to compile in linux
How to compile in linux |
One benefit of using linux is it is open source. So if we have problem with our program, we can recompile it by our self. Actually, recompiling program is not difficult. We just need some steps as below :
- Download source code
We can download source code of our program from it's official web site. It is usually compressed using tar.gz or tar.bz2. For example, if we want to download apache source code, go to apache website - Extract downloaded file
We can user tar -zxvf [file_name].tar.gz or tar -jxvf [file_name].tar.bz2. For example as below :# tar -zxvf httpd-2.0.49.tar.gz
- Login as root
# su -
- Go to directory
# cd httpd-2.0.49
- Configure source code with option
The configure option can be various, depend on software we want to compile. For example we want to compile apache with command as below :# ./configure --prefix=/usr/local/httpd --enable-so
- Do Make
After compiling, we need to make it using this command :# make
- Install
The last thing we need to do is install it using this command :# make install
Tuesday, January 10, 2012
How to install ntfs on rhel
Redhat Enterprise Linux (RHEL) is not automatically detect any hdd formatted with ntfs. So it can't be mounted. But now there is a way to make it detected, by using NTFS-3g.
NTFS-3G allows us to handle NTFS file systems of Windows OS. Its an open source read/write NTFS for Linux installations. It offers the capability to create, delete, rename, move files, directories, hard links, and streams. Special files such as the symbolic links, devices and FIFOs, ACL, extended attributes can be easily handled. Below are the steps to install ntfs-3g :
- Logged in as Root
# su -
- Install ntfs-3g, we can use yum or rpm -ivh
# yum install ntfs-3g # rpm -ivh ntfs-3g fuse-ntfs-3g-1.1004-1.el5.rf.i386.rpm
-
Determine the name of an NTFS partition :
# fdisk -l /dev/sdb ;replace /dev/sdb with your own
-
Load the fuse driver :
# modprobe fuse
-
Create a mount point
# mkdir /mnt/ntfs
- Mount the ntfs partition
# mount -t ntfs-3g /dev/sdb1 /mnt/ntfs
# umount /mnt/ntfs
Monday, January 9, 2012
How to handle exception in delphi
Almost in all programming language, there are mechanism to handle exception. So do in delphi. We can use try...except mechanism. The following is the example of exception handling in delphi :
var bagi, nol : Integer; begin try nol := 0; bagi := 1 div zero; ShowMessage('1/0 = ' + IntToStr(bagi)); except on E : Exception do ShowMessage(E.ClassName + ' error raised, with message : ' + E.Message); end; end;In that example, if the try clause generates an exception, it will the execute except clause that will display window showing what type of error generated. This is used to take alternative action when something unexpected goes wrong. Beside that, the other form of handle exception can be done as follow :
var bagi, nol : Integer; begin try nol := 0; bagi := 1 div zero; ShowMessage('1/0 = ' + IntToStr(bagi)); finally if bagi = -1 then begin ShowMessage('Number was not assigned a value - using default'); bagi := 0; end; end; end;In a try...finally construct, the finally statement will be executed absolutely whether thereis error or not. It is normally used to allow cleanup processing, such as freeing memory etc. Both kind of construct cannot be combined together using try..except..finally. So, the question is how to handle exception while we want to execute a set of clean up statements, in other words, how to tricky combine both except and finally ?? This can be done with nested try statements, as construct below :
Try Try ... Except ... End; Finally ... End;Need to be noticed that when you want to test exception handling, don't do it using F9/Run. But do it by execute application (ctrl+f9 then double click application.exe created)
Sunday, January 8, 2012
How to convert date to char in oracle
In every dbms, conversion is something that almost always happen. In oracle, if we want to convert date to char we can use to_char() function. otherwise, if we want to convert char to date we can use to_date() function.
Below is the sample to_char() and to_date() usage in oracle :
The second result will be '29/03/2012 08:18:45'.
Below is the sample to_char() and to_date() usage in oracle :
select to_char(sysdate, 'DD/MM/YYYY HH24:MI:SS') from dual;
select to_date('29/03/2012 08:18:45', 'DD/MM/YYYY HH24:MI:SS') from dual;
The first result will be the current date time of your database serverThe second result will be '29/03/2012 08:18:45'.
Saturday, January 7, 2012
Friday, January 6, 2012
How to insert post programmatically in wordpress
Sometimes, we need to insert post to our blog through code. This case occur in condition for example when we need to insert more than 1 post in 1 time.
Here is the code to do that :
Here is the code to do that :
// Create post object $my_post = array(); $my_post['post_title'] = 'My post'; $my_post['post_content'] = 'This is my post.'; $my_post['post_status'] = 'publish'; $my_post['post_author'] = 1; $my_post['post_category'] = array(8,39); // Insert the post into the database wp_insert_post( $my_post );
Thursday, January 5, 2012
How to create xml document in PHP
Using domdocument, we can create xml document as we wish. Combined with the how-to-create-xml-in-php we will create xml directly in browser.
Here is the code to create xml from php :
Here is the code to create xml from php :
$domDocument = new DOMDocument('1.0', "UTF-8"); $domElement = $domDocument->createElement('field','some random data'); $domAttribute = $domDocument->createAttribute('name'); $domAttribute->value = 'attributevalue'; $domElement->appendChild($domAttribute); $domDocument->appendChild($domElement); header("Content-type: text/xml"); echo $domDocument->saveXML();
Here is the screenshot of the code above :
Wednesday, January 4, 2012
How to create xml in php
To create xml in php you can do the following step :
- You can use domdocument or create string in form of xml.
- Create header xml as code below :
header("Content-type: text/xml");
Tuesday, January 3, 2012
How to get list files of a directory in delphi
Dear reader. Sometimes we need to get list of file names of a directory. This procedure below will do that for us :
procedure GetFilenames(Path: string; Dest: TStrings); var SR: TSearchRec; begin if FindFirst(Path+'*.*', faAnyFile, SR) = 0 then repeat Dest.Add(SR.Name); until FindNext(SR) <> 0; FindClose(SR); end;
To use that function, for example you need to create a form with a button and listbox, we name it button1 and listbox1. Here is the code to use that procedure
procedure TForm1.Button1Click(Sender: TObject); var path:string; begin path := 'C:\Movies\'; GetFilenames(path, ListBox1.Items); end;Here is the result when we click on button 'Get List Files Name'
get list files name in delphi |
Monday, January 2, 2012
Sunday, January 1, 2012
Adsense v3 app doesnot appear in firefox
Have you ever got a problem that adsense app page doesn't appear when open it using firefox? or have you ever got image as below when accesing adsense app page
if it's so, the problem is your adblock plugin. To enable that page do the steps below:
if it's so, the problem is your adblock plugin. To enable that page do the steps below:
- check your adblock plugin (in my computer, i am using adblock plus)
- choose 'Disable on this page only'
- refresh your browser
Subscribe to:
Posts (Atom)