Monday, December 31, 2007

How to Send SMS Messages from a Computer / PC?

In general, there are two ways to send SMS messages from a computer / PC to a mobile phone:
Connect a mobile phone or GSM/GPRS modem to a computer / PC. Then use the computer / PC and AT commands to instruct the mobile phone or GSM/GPRS modem to send SMS messages.

Connect the computer / PC to the SMS center (SMSC) or SMS gateway of a wireless carrier or SMS service provider. Then send SMS messages using a protocol / interface supported by the SMSC or SMS gateway.
If you do not want to develop SMS software or applications but just want to use your computer / PC to send text messages, you may want to read our Quick Guide for Non-Developers.
0.1.The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS Modemoutline 10.1. The 1st Way: Sending SMS Messages from a Computer Using a Mobile Phone or GSM/GPRS Modem
The SMS specification has defined a way for a computer to send SMS messages through a mobile phone or GSM/GPRS modem. A GSM/GPRS modem is a wireless modem that works with GSM/GPRS wireless networks. A wireless modem is similar to a dial-up modem. The main difference is that a wireless modem transmits data through a wireless network whereas a dial-up modem transmits data through a copper telephone line. More information about GSM/GPRS modems will be provided in the section "Introduction to GSM / GPRS Wireless Modems". Most mobile phones can be used as a wireless modem. However, some mobile phones have certain limitations comparing to GSM/GPRS modems. This will be discussed in the section "Which is Better: Mobile Phone or To send SMS messages, first place a valid SIM card from a wireless carrier into a mobile phone or GSM/GPRS modem, which is then connected to a computer. There are several ways to connect a mobile phone or GSM/GPRS modem to a computer. For example, they can be connected through a serial cable, a USB cable, a Bluetooth link or an infrared link. The actual way to use depends on the capability of the mobile phone or GSM/GPRS modem. For example, if a mobile phone does not support Bluetooth, it cannot connect to the computer through a Bluetooth link.
After connecting a mobile phone or GSM/GPRS modem to a computer, you can control the mobile phone or GSM/GPRS modem by sending instructions to it. The instructions used for controlling the mobile phone or GSM/GPRS modem are called AT commands. (AT commands are also used to control dial-up modems for wired telephone system.) Dial-up modems, mobile phones and GSM/GPRS modems support a common set of standard AT commands. In addition to this common set of standard AT commands, mobile phones and GSM/GPRS modems support an extended set of AT commands. One use of the extended AT commands is to control the sending and receiving of SMS messages.
The following table lists the AT commands that are related to the writing and sending of SMS messages:
AT command
Send message
Send message from storage
Write message to memory
Delete message
Send command
More messages to send
One way to send AT commands to a mobile phone or GSM/GPRS modem is to use a terminal program. A terminal program's function is like this: It sends the characters you typed to the mobile phone or GSM/GPRS modem. It then displays the response it receives from the mobile phone or GSM/GPRS modem on the screen. The terminal program on Microsoft Windows is called HyperTerminal. More details about the use of Microsoft HyperTerminal can be found in the "How to Use Microsoft HyperTerminal to Send AT Commands to a Mobile Phone or GSM/GPRS Modem" section of this SMS tutorial.
Below shows a simple example that demonstrates how to use AT commands and the HyperTerminal program of Microsoft Windows to send an SMS text message. The lines in bold type are the command lines that should be entered in HyperTerminal. The other lines are responses returned from the GSM / GPRS modem or mobile phone.
ATOKAT+CMGF=1OKAT+CMGW="+85291234567"> A simple demo of SMS text messaging.+CMGW: 1OKAT+CMSS=1+CMSS: 20OK
Here is a description of what is done in the above example:
Line 1: "AT" is sent to the GSM / GPRS modem to test the connection. The GSM / GPRS modem sends back the result code "OK" (line 2), which means the connection between the HyperTerminal program and the GSM / GPRS modem works fine.
Line 3: The AT command +CMGF is used to instruct the GSM / GPRS modem to operate in SMS text mode. The result code "OK" is returned (line 4), which indicates the command line "AT+CMGF=1" has been executed successfully. If the result code "ERROR" is returned, it is likely that the GSM / GPRS modem does not support the SMS text mode. To confirm, type "AT+CMGF=?" in the HyperTerminal program. If the response is "+CMGF: (0,1)" (0=PDU mode and 1=text mode), then SMS text mode is supported. If the response is "+CMGF: (0)", then SMS text mode is not supported.
Line 5 and 6: The AT command +CMGW is used to write an SMS text message to the message storage of the GSM / GPRS modem. "+85291234567" is the recipient mobile phone number. After typing the recipient mobile phone number, you should press the Enter button of the keyboard. The GSM / GPRS modem will then return a prompt "> " and you can start typing the SMS text message "A simple demo of SMS text messaging.". When finished, press Ctrl+z of the keyboard.
Line 7: "+CMGW: 1" tells us that the index assigned to the SMS text message is 1. It indicates the location of the SMS text message in the message storage.
Line 9: The result code "OK" indicates the execution of the AT command +CMGW is successful.
Line 10: The AT command +CMSS is used to send the SMS text message from the message storage of the GSM / GPRS modem. "1" is the index of the SMS text message obtained from line 7.
Line 11: "+CMSS: 20" tells us that the reference number assigned to the SMS text message is 20.
Line 13: The result code "OK" indicates the execution of the AT command +CMSS is successful.
To send SMS messages from an application, you have to write the source code for connecting to and sending AT commands to the mobile phone or GSM/GPRS modem, just like what a terminal program does. You can write the source code in C, C++, Java, Visual Basic, Delphi or other programming languages you like. However, writing your own code has a few disadvantages:
You have to learn how to use AT commands.
You have to learn how to compose the bits and bytes of an SMS message. For example, to specify the character encoding (e.g. 7-bit encoding and 16-bit Unicode encoding) of an SMS message, you need to know which bits in the message header should be modified and what value should be assigned.
Sending SMS messages with a mobile phone or GSM/GPRS modem has a drawback -- the SMS transmission speed is low. As your SMS messaging application becomes more popular, it has to handle a larger amount of SMS traffic and finally the mobile phone or GSM/GPRS modem will not be able to take the load. To obtain a high SMS transmission speed, a direct connection to an SMSC or SMS gateway of a wireless carrier or SMS service provider is needed. However, AT commands are not used for communicating with an SMS center or SMS gateway. This means your have to make a big change to your SMS messaging application in order to move from a wireless-modem-based solution to a SMSC-based solution.
In most cases, instead of writing your own code for interacting with the mobile phone or GSM/GPRS modem via AT commands, a better solution is to use a high-level SMS messaging API (Application programming interface) / SDK (Software development kit) / library. The API / SDK / library encapsulates the low-level details. So, an SMS application developer does not need to know AT commands and the composition of SMS messages in the bit-level. Some SMS messaging APIs / SDKs / libraries support SMSC protocols in addition to AT commands. To move from a wireless-modem-based SMS solution to a SMSC-based SMS solution, usually you just need to modify a configuration file / property file or make a few changes to your SMS messaging application's source code.
The links to some open source and free SMS messaging libraries can be found in the article "Free Libraries/Tools for Sending/Receiving SMS with a Computer".

Another way to hide the low-level AT command layer is to place an SMS gateway between the SMS messaging application and the mobile phone or GSM/GPRS modem. (This has been described in the section "What is an SMS Gateway?" earlier.) Simple protocols such as HTTP / HTTPS can then be used for sending SMS messages in the application. If an SMSC protocol (e.g. SMPP, CIMD, etc) is used for communicating with the SMS gateway instead of HTTP / HTTPS, an SMS messaging API / SDK / library can be very helpful to you since it
Usually a list of supported / unsupported mobile phones or wireless modems is provided on the web site of an SMS messaging API / SDK / library or an SMS gateway software package. Remember to check the list if you are going to use an SMS messaging API / SDK / library or an SMS gateway software package.
10.1.1. Major Drawback of Sending SMS Messages through a Mobile Phone or GSM/GPRS Modem -- Low SMS Sending Rate
Using a mobile phone or GSM/GPRS modem to send SMS messages has a major drawback, that is the SMS sending rate is too low. Only 6-10 SMS messages can be sent per minute (when the "SMS over GSM" mode is used). The performance is not affected by the connection between the computer and the mobile phone or GSM/GPRS modem (i.e. the SMS sending rate is about the same no matter the mobile phone or GSM/GPRS modem is connected to the computer through a serial cable, USB cable, Bluetooth link or infrared link) and does not depend on whether a mobile phone or GSM/GPRS modem is used (i.e. the SMS sending rate is about the same no matter a mobile phone or a GSM/GPRS modem is used). The determining factor for the SMS sending rate is the wireless network.

Sunday, December 30, 2007

You may want to download all tools and print out these instructions before you start.

1.Make sure your version of Windows is Up to date (note: If you are running XP and have not upgraded to Service Pack 2, follow the Virus Removal Instructions before installing SP2. Malware infections can cause install failures).

2.Using Windows Explorer (not Internet Explorer) go to Tools/Folder Options/View- check " show hidden files and folders", "display the full path" and uncheck "hide file extensions for know file types"
3.Clean out all temp, cache, etc files. Do this in safe-mode . BootSafe is a tool to make booting into safe-mode simple-get it here and don't forget to read the instructions! CrapCleaner will help make cleaning easier.
4.Download David Lipman's Multi_AV here and save to disk. It is a self-extracting file. It will create a file C:\AV-CLS, use Start Menu to start M_AV. Run Multi_AV in normal mode so you can download the definition files for each of the scanners included in M_AV. There is a PDF manual (also included). You can read David's instructions here .
5.Restart in safe-mode (you may want to disconnect from the 'net at this point) and run M_AV (there are 4 scanners to choose from, Sophos, Trend, McAfee, Kaspersky) Each will create a log of what was done. Examine the log file. If the offending file is in "system restore" or "system volume" disable System Restore. If it can't be deleted because it is "locked" or "in use" there is a facility to stop a running process. Go here and look at the section on "Process Killer" or you can try using KillBox , CopyLock or MoveonBoot .
6.Download AdAware . Install, update and then run it-let it fix all critical items. If you lose your internet connection after running it you can use Winsock Fix and LSP fix (which you should download before running the scanners).
7.Download Spybot Search+Destroy . Install, update and then run it (enable all protection).
8.Download Spyware Blaster . Install, update and then run it (enable all protection)
9.Download BHODemon . Install, update and run. It checks for Browser Helper Objects.
10.Run a online scanner (choose one that is different from your main AV) I have some listed here .
11.Scan for Trojans using SwatIt , Bazooka and A-squared .
12.For CoolWebSearch problems use CWShredder .
13.If you still have problems, download HijackThis . Create a folder, put HijackThis in it and then run it. Don't let it fix anything yet. Save the log file it makes and post it to the forums to have it analyzed.
14.KL-Detector will scan for keyloggers-get it here .
15.Super Ad Blocker is another spyware cleaning tool-they offer a free and a paid version (with real-time monitoring and Ad Blocking)-get it here
16.Make sure you are using the latest version of Java, get it here . If you need to update-uninstall the old version first. If you are running the latest-clean out java's temp files.
Now that your system is relatively free from malware-learn to protect yourself. Read through my other pages and follow the links. The best protection begins with an educated Max M.Wachtel III all rights reserved

Saturday, December 29, 2007

What is XML-RPC?

XML-RPC is a standard network protocol that computers can use to talk to each other in a remote procedure call fashion. Remote procedure call essentially means that a program on one computer runs a program on another computer. But a simpler way of looking at this kind of network protocol is just that you have clients and servers. A client makes individual isolated requests of a server. A server sits around waiting for a request to arrive from some client, does what the request asks, and sends a response. It then goes back to waiting for the next request.

Here are some examples of remote procedure call (RPC) style communications:

There is a server that can measure atmospheric temperature. A client anywhere in the world can ask the server at any time what the temperature is. The "what temperature is it?" request and the "the temperature is..." response constitute an RPC transaction.
There is a server that can turn a light on or off. A client can tell the server to turn the light on. A request to turn the light on and the acknowledgement that the light has been turned on constitute an RPC transaction.
There is a server that knows the phone numbers of a million people. A client can supply a name and get back the phone number of the named person.
A network of 1000 computers is used to search millions of web pages. A dispatcher computer is a client and the rest are servers. The dispatcher sends each of the servers one URL at a time and some search terms. The server responds with yes or no as to whether the page with that URL contains the search terms. The dispatcher keeps a list of the URLs that match. Each of the requests to search a particular URL is an RPC transaction.
Here are some kinds of communication that are not RPC:

A long-lived connection such as an SSH login session.
A high volume transfer such as an FTP download.
A one-way transmission such as a UDP packet.
A dialogue such as an SMTP (mail) transaction.
The original RPC protocol is the ONC RPC protocol -- the one that NFS (the network fileystem protocol) uses. It's often called "Sun RPC" because Sun invented and promulgated it. The ONC RPC protocol is layered over UDP or sometimes TCP and uses a machine-friendly bits and bytes format, just like the TCP/IP layers under it.

XML-RPC differs from ONC RPC in that it encodes the information in the requests and responses in XML. That means they are human friendly -- XML is human-readable text, so a human can readily see what's going on from a network trace and quickly write code to create and decipher XML-RPC streams. Of course, the tradeoff is that XML-RPC uses way more network and computation resources than ONC RPC. Because XML-RPC is meant to be used for relatively small and infrequent transactions, this is thought not to matter.

In XML-RPC, the aforementioned XML is transported via HTTP (the protocol whose principal purpose is to implement web serving -- web browsing is a form of RPC, after all). HTTP is normally carried over TCP, which is carried over IP.

There are lots of servers in the world that use the XML-RPC protocol and lots of programs and programming libraries from which people can build XML-RPC-based servers and clients.

There are also other HTTP-based RPC protocols. SOAP and CORBA are the most famous. REST-RPC is a more recent entry.

For more information on XML-RPC, see The XML-RPC web site and The XML-RPC Howto. The latter includes information (with examples) on implementing XML-RPC clients and servers in languages other than C and C++, which is all that is covered in this document.

How Does XML-RPC For C/C++ Help with XML-RPC?
The function libraries in XML-RPC For C/C++ (Xmlrpc-c) let you write a program that makes XML-RPC calls (a client) or executes XML-RPC calls (a server program) at any of various levels of understanding of the XML-RPC protocol.

Here are some examples of client and server code.

The Xmlrpc-c Function Libraries
This is a list of the function libraries Xmlrpc-c provides, with links to the manual for each.

There are two sets of libraries -- C and C++. You can of course use the C libraries in a C++ program, but you cannot in general mix the two -- you use either the C Xmlrpc-c facilities or the C++ Xmlrpc-c facilities. The C++ libraries depend heavily on the C libraries, but apart from having to install and link to the C libraries, you won't see that from the outside.

The C++ libraries were all new in Xmlrpc-c 1.03 (June 2005).

There is an older C++ facility, which is just a thin wrapper around the C libraries. We do not document it in this manual or recommend it, but it remains part of Xmlrpc-c for backward compatibility. This library consists in the header file xmlrpc-c/oldcppwrapper.hpp (fka XmlRpcCpp.h) and the library libxmlrpc_cpp.

C Libraries
libxmlrpc - general facilities
libxmlrpc_client - facilities for implementing a client
libxmlrpc_server - facilities for implementing a server — facilities which are independent of the transport mechanism.
libxmlrpc_server_abyss - facilities for implementing a server, based on an Abyss HTTP server.
libxmlrpc_abyss - The Abyss server software.
libxmlrpc_server_cgi - facilities for implementing a server via CGI scripts under an arbitrary HTTP server (i.e. web server).
C++ Libraries
libxmlrpc++ - general facilities
libxmlrpc_client++ - facilities for implementing a client
libxmlrpc_server++ - facilities for implementing a server — facilities which are independent of the transport mechanism.
libxmlrpc_server_abyss++ - facilities for implementing a server, based on an abyss HTTP server.
libxmlrpc_server_pstream++ - facilities for implementing a pseudo-XML-RPC server that uses a packet stream in place of HTTP and has multi-RPC client/server connections.
Utility Programs
Xmlrpc-c comes with a few utility programs that you can use to diagnose problems or learn about XML-RPC or Xmlrpc-c. These programs double as examples of how to use the Xmlrpc-c function libraries.

Because the utility programs are not essential to the package, the default install tools don't install them at all. The builder does build them, though, and if you build Xmlrpc-c from source, you will find them all in the tools/ directory.

You'll also find more complete documentation there.

xmlrpc is a general purpose XML-RPC client program. It performs one XML-RPC call, which you describe in its command line arguments.


$ xmlrpc http://localhost:8080/RPC2 sample.add i/3 i/5

This makes a call to the XML-RPC server at the indicated URL, for the method named "sample.add", with two arguments: the integer 3 and the integer 5.
xmlrpc prints to Standard Output the result of the call, which it gets back from the server.

You can abbreviate the URL; xmlrpc assumes "http://" and "/RPC2":

$ xmlrpc localhost:8080 sample.add i/3 i/5
Integer: 8

The port number defaults to 80, so you can abbreviate even more:

$ xmlrpc localhost sample.add i/3 i/5

String arguments look like this:

$ xmlrpc method_that_takes_string s/hello

If you don't include a type specifier such as "i/" or "s/", xmlrpc assumes "s/". So you can use this shortcut, equivalent to the above:

$ xmlrpc method_that_takes_string hello

Each argument to xmlrpc describes on XML-RPC parameter. So in a typical command shell, the following would make an XML-RPC call with two paramters: "hello" and "see you later":

$ xmlrpc mymethod s/hello "s/see you later"

Compound values for parameters look the following, except that these aren't implemented yet. Only "i/" and "s/" are implemented right now.

Note that this is an example of a Bourne shell command, so some of the characters (most notably the quotation marks) are part of the shell language, not the xmlrpc syntax.

$ xmlrpc \
meerkat.getItems \
title: String: DatabaseJournal: OpenEdge-Based Finance ...
link: String:
description: String: "Finance application with embedded ...
title: ...
link: ...
description: ...

$ xmlrpc localhost:8080 array_processing_method \

xmlrpc is implemented using the Xmlrpc-c client library, but its function is not in any way tied to Xmlrpc-c. It makes a standard XML-RPC call and does not know or care whether the server is implemented with Xmlrpc-c or not.

For extra diagnostic information, use the XMLRPC_TRACE_XML environment variable so you can see the XML that goes back and forth to perform the call. (This is not specifically xmlrpc function -- it's tracing function that's automatically there because xmlrpc uses libxmlrpc_client).

This section describes some alternatives to using XML-RPC For C/C++.

Other Progamming Languages
There are plenty of facilities to help you create XML-RPC clients and servers in a language other than C or C++. Search on Freshmeat.

It is worth mentioning that with some of these other-language facilities, the client or server is way slower than with XML-RPC for C/C++, due to the nature of the language. For example, I have used the Perl RPC::XML modules from CPAN and found a client program that takes 50 milliseconds to run when written with XML-RPC For C And C++ takes 2000 milliseconds to run when done with RPC::XML::Client.

In the case of Perl, there is a middle ground. The RPC::Xmlrpc_c modules from CPAN are based on Perl extensions that use the libraries of XML-RPC For C And C++. One reason RPC::XML is so slow is that it is built on top of a stack about 6 layers high, each one implemented in interpreted Perl. With RPC::Xmlrpc_c, all those layers except the top are implemented as executable machine code, efficiently compiled from C, so you have the same ease of Perl coding, without the slowness.

RPC::Xmlrpc_c is much younger than RPC::XML, so doesn't have many features, and in fact does not include any server facilities. But you could add missing features yourself (and, ideally, submit them for inclusion in the RPC::Xmlrpc_c package on CPAN, so others can use them).

RPC::Xmlrpc_c was new in December 2006 and needs XML-RPC For C And C++ Release 1.08 or better.

In other interpreted languages, the same hybrid may be possible -- replacing slow interpreted code with executable XML-RPC libraries.

Apache Module
You can make a nice XML-RPC server based on an Apache HTTP server (which may or may not simultaneously be a regular web server) using an Apache module. mod_xmlrpc is one such module. mod_xmlrpc is actually built on Xmlrpc-c, so you can use the same method code as you do for other Xmlrpc-c-based implementations

An even simpler, though less efficient and more limited way to make an XML-RPC server out of an Apache server is to do it via a CGI script. That script can be written in a variety of languages, but if you write it in C, you can use Xmlrpc-c's libxmlrpc_server_cgi library.

Other RPC Protocols
SOAP and CORBA are common alternatives to XML-RPC. Lots of expensive commercial software helps you use those. There is more to know and more you can do with them.

REST-RPC was invented in 2006 and was meant to be superior to XML-RPC for at least some things. It is easier to use in many ways than XML-RPC. Like XML-RPC, it uses HTTP, and like XML-RPC an RPC's result is XML. But unlike XML-RPC, a call is not XML. It is encoded entirely in the query part of a URL. (Example: http:/ In the result, there are no inherent data types; server and client agree on those separately. The Xins project has more information.

Introductory Examples
Here, to show you what Xmlrpc-c is, we present example code (almost an entire C program) for a simple XML-RPC client that exploits the Xmlrpc-c libraries, and a corresponding simple XML-RPC server.

You can find complete working versions of these, and lots of other examples in the examples/ directory in the Xmlrpc-c source tree.

In these examples, the service to be provided is adding of two numbers. You wouldn't do this with RPC in real life, of course, because a program can add two numbers without the help of a remote server. This is just to demonstrate the concept.

Table Of Contents
Small C Client Example
Small C Server Example
CGI C Server Example
Small C++ Server Example
Small C++ Client Example
Small C Client Example
Here is an example of C code that implements an XML-RPC client using the highest level facilities of Xmlrpc-c. This client sends a request to add 5 and 7 together to an XMLRPC-C server that is designed to provide the service of adding numbers.


#include "config.h" /* information about this build environment */

#define NAME "XML-RPC C Test Client"
#define VERSION "1.0"

main(int const argc,
const char ** const argv) {

xmlrpc_env env;
xmlrpc_value * resultP;
int sum;
char * const url = "http://localhost:8080/RPC2";
char * const methodName = "sample.add";

/* Initialize our error-handling environment. */

/* Start up our XML-RPC client library. */
xmlrpc_client_init2(&env, XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION, NULL, 0);

/* Make the remote procedure call */
resultP = xmlrpc_client_call(&env, url, methodName,
"(ii)", (xmlrpc_int32) 5, (xmlrpc_int32) 7);

/* Get our state name and print it out. */
xmlrpc_parse_value(&env, resultP, "i", &sum);
printf("The sum is %d\n", sum);

/* Dispose of our result value. */

/* Clean up our error-handling environment. */

/* Shutdown our XML-RPC client library. */

return 0;

Small C Server Example
Now, here is code that implements an XML-RPC server that provides the number-adding service from the previous section.


static xmlrpc_value *
sample_add(xmlrpc_env * const envP,
xmlrpc_value * const paramArrayP,
void * const serverContext) {

xmlrpc_int32 x, y, z;

/* Parse our argument array. */
xmlrpc_parse_value(envP, paramArrayP, "(ii)", &x, &y);
if (env->fault_occurred)
return NULL;

/* Add our two numbers. */
z = x + y;

/* Return our result. */
return xmlrpc_build_value(envP, "i", z);

main (int const argc,
const char ** const argv) {

xmlrpc_server_abyss_parms serverparm;
xmlrpc_registry * registryP;
xmlrpc_env env;

if (argc-1 != 1) {
fprintf(stderr, "You must specify 1 argument: The Abyss "
"configuration file name. You specified %d.\n", argc-1);


registryP = xmlrpc_registry_new(&env);

&env, registryP, NULL, "sample.add", &sample_add, NULL);

serverparm.config_file_name = argv[1];
serverparm.registryP = registryP;

printf("Starting XML-RPC server...\n");

xmlrpc_server_abyss(&env, &serverparm, XMLRPC_APSIZE(registryP));

return 0;

There's a lot going on under the covers of this example server. What the xmlrpc_server_abyss() statement does is run a whole HTTP server. The function doesn't normally return. The HTTP server runs the abyss web server (i.e. HTTP server) program. abyss is like the more serious web server program apache, but on a much smaller scale. An XML-RPC call is just an HTTP POST request, so while abyss was not designed specifically for XML-RPC, it provides much of the function an XML-RPC server needs.

The only way this Abyss web server differs from one you would run to do traditional web serving is that it contains a special handler to call Xmlrpc-c functions to handle an XML-RPC POST request. The server calls that handler for any URI that starts with "/RPC2", which is what XML-RPC URIs conventionally have.

While abyss is distributed independently of Xmlrpc-c, Xmlrpc-c contains an old copy of it, somewhat modified. So you don't need to install abyss separately.

In this example, you have to provide an example abyss configuration file as a program argument. The main thing you need that file for is to specify on which TCP port the server will listen. A single "Port 8080" statement is probably enough. (I say 8080, because in the example client code above, I hardcoded 8080 as the port in the URI the client uses).

There are lots of other ways to use Xmlrpc-c libraries to build XML-RPC clients and servers. The more code you're willing to write, and the more involved in the guts of the protocol you want to get, the more control you can have.

CGI Server Example

/* A simple CGI-based XML-RPC server written in C. */


static xmlrpc_value *
sample_add(xmlrpc_env * const env,
xmlrpc_value * const param_array,
void * const user_data) {

xmlrpc_int32 x, y, z;

/* Parse our argument array. */
xmlrpc_decompose_value(env, param_array, "(ii)", &x, &y);
if (env->fault_occurred)
return NULL;

/* Add our two numbers. */
z = x + y;

/* Return our result. */
return xmlrpc_int_new(env, z);

main(int const argc,
const char ** const argv) {

/* Process our request. */
xmlrpc_cgi_add_method_w_doc("sample.add", &sample_add, NULL,
"i:ii", "Add two integers.");

return 0;

Small C++ Client Example
Here is an example of C++ code that implements an XML-RPC client using the highest level facilities of Xmlrpc-c. This client sends a request to add 5 and 7 together to an XMLRPC-C server that is designed to provide the service of adding numbers.

The example server above would be a suitable server for this client.


using namespace std;

main(int argc, char **argv) {

if (argc-1 > 0) {
if (argv) {}
cerr << "This program has no arguments" << endl;

string const serverUrl("http://localhost:8080/RPC2");
string const methodName("sample.add");

xmlrpc_c::clientSimple myClient;
xmlrpc_c::value result;, methodName, "ii", &result, 5, 7);

int const sum((xmlrpc_c::value_int(result)));
// Assume the method returned an integer; throws error if not

cout << "Result of RPC (sum of 5 and 7): " << sum << endl;

return 0;

To keep it brief, we don't catch any thrown errors, though various parts of this program can throw them.

Small C++ Server Example
Here is C++ code that implements the same kind of XML-RPC server shown in C above.



using namespace std;

class sampleAddMethod : public xmlrpc_c::method {
sampleAddMethod() {}

execute(xmlrpc_c::paramList const& paramList,
xmlrpc_c::value * const retvalP) {

int const addend(paramList.getInt(0));
int const adder(paramList.getInt(1));


*retvalP = xmlrpc_c::value_int(addend + adder);

main(int const argc,
const char ** const argv) {

xmlrpc_c::registry myRegistry;

xmlrpc_c::methodPtr const sampleAddMethodP(new sampleAddMethod);

myRegistry.addMethod("sample.add", sampleAddMethodP);

xmlrpc_c::serverAbyss myAbyssServer(
8080, // TCP port on which to listen
"/tmp/xmlrpc_log" // Log file
// never returns

return 0;

About This Document
This document is part of the XML-RPC For C/C++ project. It is the main user documentation for the project.

The master copy of this document lives at The HTML copy there is the original source -- it is hand edited.

This is a living document. It gets updated continuously, both to document changes in Xmlrpc-c and to improve the documentation. It documents all current and past, and, where possible, future releases of Xmlrpc-c. There is no benefit to keeping an old copy of the document to use with an old copy of the code.

Bryan Henderson wrote and published the first draft of this document in November 2004, as an entirely original work. Bryan placed it in the public domain.

LEARN C/C++ TODAY (A list of resources/tutorials)

This is a list of a few C and C++ language tutorials available to a
user. This list includes interactive tutorials, public-domain code
collections, books etc. I've developed this FAQ purely as a volunteer
effort as a service to the Internet community. Although every effort
has been made to insure that all the information here is as accurate as
possible, no guarantee is implied or intended.

I welcome comments, suggestions or criticism for all the people out
there on the net that read this. If you can help me make this list a
little better, you will be helping a lot of people out there on the
net. I am a horrible writer and an even worse speller. If you find
any errors or would like to suggest any additions please feel free to
email me at the address below:
What's new in this issue:

This section of the document will point out all the new additions,
corrections, updates etc. If there is enough interest, I will start
producing a 'diff' version.
1. Added a second web server that has the HTML and PS version of this
2. Updated the information on the 'C++ on the WWW'. The address has
of the web server has changes. The author also converted Dordill's
C++ course to HTML which is online.
3. Updated the information in the MSDOS/Windows compiler section.
4. Added a new item called `Programming in C' that contains a great
collection of C and programming items.
5. Updated the information on the C++ FAQ.
6. Added a lot of information on OS/2. (Joe Dougherty)
7. Added more information about Scott Meyers new book titled "More
Effective C++".
8. Updated the info and the directory structure has
been changed.
9. Update the information on the C Snippets packages. The author
released a new package that includes 400+ files.
I am switching to URL in place of the standard ftp and filename format.
URL stands for "Uniform Resource Locator". Think of it as a networked
extension of the standard filename concept: not only can you point to a
file in a directory, but that file and that directory can exist on any
machine on the network, can be served via any of several different
methods, and might not even be something as simple as a file: URLs can
also point to queries, documents stored deep within databases, the
results of a finger or archie command, or whatever.

File URL:

Gopher URL:
To connect to a particular gopher server, use this URL:


News URL:
To point to a Usenet Newsgroups, the URL is simply:


HTTP stands for HyperText Transport Protocol. HTTP servers are
commonly used for serving hypertext documents

This file is posted on the 1st and the 15th of each month to the Usenet
NEWS.ANSWERS & COMP.ANSWERS. The HTML and postscript version of this
documents are available. Here's the URL:

NOTE: This is my Linux PC that does get inundated with request. The
last time I checked the stats, there were about 27 connections every
minute. If you get timed out, please try again. The most recently
posted version of this document is kept on the news.answers archive on You can receive it via anonymous ftp. The URL is listed
If you don't have access to ftp, you can also receive this file via
e-mail by sending mail to with:
send /pub/usenet/news.answers/C-faq/learn-c-cpp-today

in the body (not subject line) of your message. You can also receive
the latest version via electronic mail by e-mailing me.
Subject: send learn-c-cpp-today
Body: ignored. Can be blank.

A lot of tutorials discussed here are available via anonymous ftp. If
you don't have ftp, you can also retrieve these files via a ftp-email
gateway. To retrieve files via e-mail, send mail to with the command HELP in the body of the message
to receive a complete list of all commands. A typical message would
look something like this:

chdir /simtel/msdos/c

Some of the items discussed here are platform-dependent, but most of
the items are applicable across all platforms (portable). If you have
any comments, suggestions, complaints, additions, etc, please feel free
to e-mail me at the following address:

If you are working on a tutorial or would like something added to this
list, please e-mail me at the address given above.

The Origins of C and C++:

The 'C' programming language was originally developed for and
implemented on the UNIX operating system, on a DEC PDP-11 by Dennis
Ritchie. One of the best features of C is that it is not tied to any
particular hardware or system. This makes it easy for a user to write
programs that will run without any changes on practically all machines.
C is often called a middle-level computer language as it combines the
elements of high-level languages with the functionalism of assembly

C allows the manipulation of bits, bytes and addresses- the basic
elements with which the computer functions. Another good point about C
is its portability which makes it possible to adapt software written
for one type of computer to another. C was created, influenced, and
field tested by working programmers. The end result is that C gives
the programmer what the programmer wants. C offers the speed of
assembly language and the extensibility of FORTH, but few of the
restrictions of Pascal and Modula-2.

C++ is an enhanced version of the C language. C++ includes everything
that is part of C and adds support for object-oriented programming
(OOP). In addition, C++ also contains many improvements and features
that make it a "better C", independent of object oriented programming.
C++ is actually an extendible language since we can define new types in
such a way that they act just like the predefined types which are part
of the standard language.

If you just use C++ as a better C, you will not be using all of its
power. Like any quality tool, C++ must be used the way it was designed
to be used to exploit its richness. Some of the new features include
encapsulation, inline function calls, overloading operators,
inheritance and polymorphism. I am not going to explain what they mean
here as that would simply take me away from my purpose here, but you
can refer to any good C++ book or the C++ FAQ (Item 7) for more

What do you need to get started?

The first thing you need is a compiler. A compiler reads the entire
program and converts it into object code, which is a translation of the
program source code into a form that the computer can execute directly.


Type cc at the % prompt. If you don't get any error messages, you
probably have a C compiler . If you get an error message, try acc, gcc
or g++. If any of these don't work, contact your local system
administrator and ask him/her to get you a C/C++ compiler. GNU C/C++
compiler is available from a lot of anonymous ftp sites free of charge.
Look into it. (I've got g++ running on my Linux box without any


There are a lot of good compilers available to you. Microsoft Quick C
and Borland Turbo C/C++ are both good products for beginners. You can
buy both of them for under $50.00. I use Microsoft Quick C and
MS-Visual C/C++, and I prefer Quick-C for all my DOS programs as it is
small, and yet very powerful. Most of my programming is now on my
Linux PC with gcc/g++. (If you want a great 32 bit operating system,
you should look into Linux. E-mail me for details). You can also get
the DOS port of GNU C/C++ called DJGPP from

The increased popularity of OS/2 and it's latest incarnation Warp, has
provided programmers with a wider selection of compilers and
programming tools. Still available for free is the GNU gcc package
under the name emx. Emx integrates nicely with the Extended Editor
included with OS/2. It's available on,,
and other sites. IBM provides the CSet++ 2.x, as well as a smaller,
less-expensive package on CD-ROM called CSet++ First Step. Other
popular compilers include Borland C++ 1.0 for OS/2, and Watcom C/C++
for OS/2 10.0, and CA-C++ for OS/2 from Computer Associates.


If you're on a VAX, type in CC to check and see if you have a C
compiler. VAX C is not the best compiler around, but it certainly does
the job. If you don't have a C compiler, look into the GNU C/C++
compiler GCC. You can get the VAX version of GCC from via
anonymous ftp. If on a AXP system, you should have access to DEC
C/C++. Please contact your local system administrator or computer
consultant for more site specific questions.

Macintosh (Apple/PowerMac)

There are three main players in the Mac compiler market: MPW (from
Apple), THINK C / Symantec C++ (both from Symantec), or CodeWarrior
(from Metrowerks): THINK C is $225 (only a C compiler), while Symantec
C++ is $375 (includes C and C++ compilers). CodeWarrior comes in two
versions: bronze and gold, at $199/299/399, respectively. The Symantec
C++ compiler (ver 8.0) is PowerMac native. Symantec and Metrowerks
offer academic pricing on their products which are substantially less
than the commercial prices.

There have been two attempts at freeware/shareware Mac C compilers:
Sesame C and Harvest. Harvest C was an ambitious attempt at a
production-quality freeware compiler which was later abandoned by the

Friday, December 28, 2007

Creating the SimpleSample XML Expansion Pack Manifest File (Visual C++ Tutorial)

Start Notepad or another text editor.
Open the Manifest.xml file included in the supporting files for the SimpleSample smart document. For more information about the schema for the XML expansion pack manifest file, see the XML Expansion Pack Manifest Schema Reference.

Determine the location where you will deploy the SimpleSample smart document. This may be a network share (for example, \\sharedfolder), an intranet path (for example, http://mysmartdocument), or an Internet address (for example,
You can also use a relative path. For example, if your smart document is located in the same folder as your supporting files, you can use a relative address to the file by entering only the file name into the filePath element.

Note The file names referenced in the Manifest.xml file are relative addresses, so you can copy the file into most folders without modification. However, if you store your SimpleSample smart document on a network share or Web server, you may need to provide the absolute path to the smart document dynamic-link library (DLL) and supporting files in the filePath element.

Locate the class identifier (CLSID) for the SimpleSample DLL that you compiled earlier, and paste it into the CLSID element in the Manifest.xml file. You can locate the CLSID by opening the registry and searching for "SimpleSample.clsActions." For more information, see Locating the CLSID.
Change the value of the solutionID element to a globally unique identifier (GUID). You can generate a GUID by using the Uuidgen.exe utility included with Microsoft Visual Studio.
Change the value of the alias element to "SimpleSmart Document Sample - C++".
Save the Manifest.xml file.

Basic PHP

Basic PHP
A PHP scripting block always starts with "" . A PHP scripting block can be placed anywhere in the document.

Variables in PHP

$txt = "Hello World!";
$number = 16;

Strings in PHP

$txt="Hello World";
echo $txt;

The output of the code above will be:
Hello World

$txt1="Hello World";
echo $txt1 . " " . $txt2;

The output of the code above will be:
Hello World 1234

echo strlen("Hello world!");

The output of the code above will be:

echo strpos("Hello world!","world");

The output of the code above will be:

Conditional Statements

if ($d=="Fri")
echo "Have a nice weekend!";
elseif ($d=="Sun")
echo "Have a nice Sunday!";
echo "Have a nice day!";

The Switch Statement

switch ($x)
case 1:
echo "Number 1";
case 2:
echo "Number 2";
case 3:
echo "Number 3";
echo "No number between 1 and 3";

PHP Arrays
a.Numeric array - An array with a numeric ID key
b.Associative array - An array where each ID key is associated with a value
c.Multidimensional array - An array containing one or more arrays

$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";

The ID keys can be used in a script:

$names[0] = "Peter";
$names[1] = "Quagmire";
$names[2] = "Joe";echo $names[1] . " and " . $names[2] .
" are ". $names[0] . "'s neighbors";

echo "The number is " . $i . "
echo "The number is " . $i . "
while ($i<5);
for ($i=1; $i<=5; $i++)
echo "Hello World!

$arr=array("one", "two", "three");foreach ($arr as $value)
echo "Value: " . $value . "

PHP Functions
function writeMyName($fname)
echo $fname . " Refsnes.
}echo "My name is ";
writeMyName("Kai Jim");echo "My name is ";
writeMyName("Hege");echo "My name is ";

function writeMyName($fname,$punctuation)
echo $fname . " Refsnes" . $punctuation . "
}echo "My name is ";
writeMyName("Kai Jim",".");echo "My name is ";
writeMyName("Hege","!");echo "My name is ";

The output of the code above will be:
My name is Kai Jim Refsnes.
My name is Hege Refsnes!
My name is Ståle Refsnes...
function add($x,$y)
$total = $x + $y;
return $total;
}echo "1 + 16 = " . add(1,16);

The output of the code above will be:
1 + 16 = 17

tutorial from

Thursday, December 27, 2007

Apa itu CakePHP ?

Yeah, apa sich CakePHP itu ? Sejenis script PHP kah ? Atau CMS (Content Management System), atau apaan ? Emm, secara singkat barangkali CakePHP bisa diterangkan sebagai berikut :

Cake PHP atau orang lebih mengenalnya dengan nama CakePHP, adalah sebuah framework atau kerangka kerja untuk membuat aplikasi CRUD (Create, Read, Update, Delete) berbasis bahasa pemrograman PHP. CakePHP juga menjadi salah satu framework pilihan

yang memungkinkan seorang developer web untuk membuat sebuah aplikasi dengan karakter pengembangan RAD (Rapid Application Development), yang memungkinkan untuk digunakan dan dikembangkan menjadi aplikasi lain yang lebih kompleks. CakePHP masih satu keturunan dan mempunyai hubungan darah yang cukup erat dengan Ruby on Rails, sebuah framework pemrograman Ruby. Artikel kali ini akan menjelaskan sedikit mengenai CakePHP. Harapannya, sebagai developer web kita tidak hanya terpaku pada satu metode konvensional saja, akan tetapi cobalah untuk meningkatkan kemampuan kita dalam mengembangkan aplikasi, seiring dengan semakin mudah dan berkembangnya bahasa pemrograman PHP itu sendiri.

Menurut pengalaman penulis (halah), CakePHP lumayan lengkap untuk disebut sebagai sebuah framework berbasis PHP. Selain mendukung penggunaan dan pengembangan web service, CakePHP juga sudah mendukung penggunaan AJAX secara built in. Tinggal di-include-kan saja component dari Class nya. Beres !

Beberapa keuntungan menggunakan CakePHP adalah :

1. Ringan . Ya, CakePHP adalah salah satu framework paling ringan yang ada di dunia, dengan ukuran 300 Kb dalam satu file .zip . Salah satu prinsip yang dijunjung tinggi oleh para programmer CakePHP adalah “no we-might-need-it code”, atau dengan kata lain, semua code dalam CakePHP adalah bermanfaat dan selalu digunakan dalam pembuatan aplikasi. Tidak ada code-code sampah yang tidak berguna dan memperbesar ukuran framework secara keseluruhan.

2. Kompatibel dengan PHP 4 dan PHP 5.

3. Scaffolding feature. CakePHP mempunyai fitur yang mampu men-generate prototype aplikasi kita, sebelum kita menyusun source code nya secara lengkap. Cukup tambahkan variabel $scaffold di controller anda, dan zapp ! Aplikasi anda sudah bisa anda nikmati ..

4. Mendukung AJAX. Buat kamu-kamu yang suka mainan animasi real time pake AJAX, CakePHP sudah mendukung AJAX. Yang pasti aplikasi Web 2.0 AJAX yang kamu buat akan berjalan dengan cepat dan mudah.

5. Komunitas developer yang luas. Yah, bagi Anda yang memang sudah siap terjun untuk menjadi pengembang CakePHP, silahkan sambangi komunitas-komunitas yang ada, di, atau di channel #cakephp

6. Yang jelas, CakePHP yang dikembangkan oleh Cake Software Foundation ini sangat cocok untuk diterapkan dalam berbagai project Anda.

Ada beberapa kelemahan juga, sih. Tapi sedang dalam proses perbaikan koq :

1. Dokumentasi yang belum lengkap. CakePHP adalah framework yang selalu berkembang, demikian pula dokumentasinya. Maka dari itu, komunitas pengembang CakePHP selalu meng-update dokumentasi CakePHP, sesuai dengan perkembangan CakePHP itu sendiri

2. Belum ada dukungan internasionalisasi. Ya, sampai saat ini, release terbaru dari CakePHP belum support i18n, alias internasionalisasi bahasa-bahasa yang ada di dunia. Tapi sekali lagi, ini adalah bagian dari proses pengembangan, yang akan disempurnakan di release-release terbaru.
Tertarik? or

The Cake Blog Tutorial

Welcome to Cake! You're probably checking out this tutorial because you want to learn more about how Cake works. Its our aim to increase productivity and make coding more enjoyable: we hope you'll see this as you dive into the code.

This tutorial will walk you through the creation of a simple blog application. We'll be getting and installing Cake, creating and configuring a database, and creating enough application logic to list, add, edit, and delete blog posts.
Here's what you'll need:

A running web server. We're going to assume you're using Apache, though the instructions for using other servers should be very similar. We might have to play a little with the server configuration, but most folks can get Cake up and running without any configuration at all.

A database server. We're going to be using mySQL in this tutorial. You'll need to know enough about SQL in order to create a database: Cake will be taking the reigns from there.

Basic PHP knowledge. The more object-oriented programming you've done, the better: but fear not if you're a procedural fan.

Finally, you'll need a basic knowledge of the MVC programming pattern. A quick overview can be found in Chapter "Basic Concepts", Section 2: The MVC Pattern. Don't worry: its only a half a page or so.

Let's get started!

Section 2
Getting Cake
First, let's get a copy of fresh Cake code.

To get a fresh download, visit the CakePHP project at Cakeforge: and download the stable release.

You can also checkout/export a fresh copy of our trunk code at:

Regardless of how you downloaded it, place the code inside of your DocumentRoot. Once finished, your directory setup should look something like the following:

VERSION.txtNow might be a good time to learn a bit about how Cake's directory structure works: check out Chapter "Basic Concepts", Section 3: Overview of the Cake File Layout.

Section 3
Creating the Blog Database
Next, lets set up the underlying database for our blog. Right now, we'll just create a single table to store our posts. We'll also throw in a few posts right now to use for testing purposes. Execute the following SQL statements into your database:

/* First, create our posts table: */
title VARCHAR(50),
body TEXT,

/* Then insert some posts for testing: */
INSERT INTO posts (title,body,created)
VALUES ('The title', 'This is the post body.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('A title once again', 'And the post body follows.', NOW());
INSERT INTO posts (title,body,created)
VALUES ('Title strikes back', 'This is really exciting! Not.', NOW());

The choices on table and column names are not arbitrary. If you follow Cake's database naming conventions, and Cake's class naming conventions (both outlined in Appendix "Cake Conventions"), you'll be able to take advantage of a lot of free functionality and avoid configuration. Cake is flexible enough to accomodate even the worst legacy database schema, but adhering to convention will save you time.

Check out Appendix "Cake Conventions" for more information, but suffice it to say that naming our table 'posts' automatically hooks it to our Post model, and having fields called 'modified' and 'created' will be automagically managed by Cake.

Section 4
Cake Database Configuration
Onward and upward: let's tell Cake where our database is and how to connect to it. This will be the first and last time you configure anything.

A copy of Cake's database configuration file is found in /app/config/database.php.default. Make a copy of this file in the same directory, but name it database.php.

The config file should be pretty straightforward: just replace the values in the $default array with those that apply to your setup. A sample completed configuration array might look something like the following:

var $default = array('driver' => 'mysql',
'connect' => 'mysql_pconnect',
'host' => 'localhost',
'login' => 'cakeBlog',
'password' => 'c4k3-rUl3Z',
'database' => 'cake_blog_tutorial' );
Once you've saved your new database.php file, you should be able to open your browser and see the Cake welcome page. It should also tell you that your database connection file was found, and that Cake can successfully connect to the database.

Section 5
A Note On mod_rewrite
Occasionally a new user will run in to mod_rewrite issues, so I'll mention them marginally here. If the Cake welcome page looks a little funny (no images or css styles), it probably means mod_rewrite isn't functioning on your system. Here are some tips to help get you up and running:

Make sure that an .htaccess override is allowed: in your httpd.conf, you should have a section that defines a section for each Directory on your server. Make sure the AllowOverride is set to All for the correct Directory.

Make sure you are editing the system httpd.conf rather than a user- or site-specific httpd.conf.

For some reason or another, you might have obtained a copy of CakePHP without the needed .htaccess files. This sometimes happens because some operating systems treat files that start with '.' as hidden, and don't copy them. Make sure your copy of CakePHP is from the downloads section of the site or our SVN repository.

Make sure you are loading up mod_rewrite correctly! You should see something like LoadModule rewrite_module libexec/httpd/ and AddModule mod_rewrite.c in your httpd.conf.

If you don't want or can't get mod_rewrite (or some other compatible module) up and running on your server, you'll need to use Cake's built in pretty URLs. In /app/config/core.php, uncomment the line that looks like:

define ('BASE_URL', env('SCRIPT_NAME'));
This will make your URLs look like rather than

Section 6
Create a Post Model
The model class is the bread and butter of CakePHP applications. By creating a Cake model that will interact with our database, we'll have the foundation in place needed to do our view, add, edit, and delete operations later.

Cake's model class files go in /app/models, and the file we will be creating will be saved to /app/models/post.php. The completed file should look like this:


Because of the way the class and file are named, this tells Cake that you want a Post model available in your PostsController that is tied to a table in your default database called 'posts'.

The $name variable is always a good idea to add, and is used to overcome some class name oddness in PHP4.

For more on models, such as table prefixes, callbacks, and validation, check out Chapter "Models".

Section 7
Create a Posts Controller
Next we'll create a controller for our posts. The controller is where all the logic for post interaction will happen, and its also where all the actions for this model will be found. You should place this new controller in a file called posts_controller.php inside your /app/controllers directory. Here's what the basic controller should look like:


Now, lets add an action to our controller. When users request, this is the same as requesting Since we want our readers to view a list of posts when they access that URL, the index action would look something like this:

/app/controllers/posts_controller.php (index action added)
set('posts', $this->Post->findAll());

Let me explain the action a bit. By defining function index() in our PostsController, users can now access the logic there by requesting Similarly, if we were to define a function called foobar(), users would be able to access that at

The single instruction in the action uses set() to pass data to the view (which we'll create next). The line sets the view variable called 'posts' equal to the return value of the findAll() method of the Post model. Our Post model is automatically available at $this->Post because we've followed Cake's naming conventions.

To learn more about Cake's controllers, check out Chapter "Controllers".

Section 8
Creating Post Views
Now that we have our database connected using our model, and our application logic and flow defined by our controller, let's create a view for the index action we defined above.

Cake views are just HTML and PHP flavored fragments that fit inside an application's layout. Layouts can be defined and switched between, but for now, let's just use the default.

Remember in the last section how we assigned the 'posts' variable to the view using the set() method? That would hand down data to the view that would look something like this:

// print_r($posts) output:

[0] => Array
[Post] => Array
[id] => 1
[title] => The title
[body] => This is the post body.
[created] => 2006-03-08 14:42:22
[modified] =>
[1] => Array
[Post] => Array
[id] => 2
[title] => A title once again
[body] => And the post body follows.
[created] => 2006-03-08 14:42:23
[modified] =>
[2] => Array
[Post] => Array
[id] => 3
[title] => Title strikes back
[body] => This is really exciting! Not.
[created] => 2006-03-08 14:42:24
[modified] =>
Cake's view files are stored in /app/views inside a folder named after the controller they correspond to (we'll have to create a folder named 'posts' in this case). To format this post data in a nice table, our view code might look something like this:


Blog posts


link($post['Post']['title'], "/posts/view/".$post['Post']['id']); ?>

Hopefully this should look somewhat simple.

You might have noticed the use of an object called $html. This is an instance of the HtmlHelper class. Cake comes with a set of view 'helpers' that make things like linking, form output, JavaScript and Ajax a snap. You can learn more about how to use them in Chapter "Helpers", but what's important to note here is that the link() method will generate an HTML link with the given title (the first parameter) and URL (the second parameter).

When specifying URL's in Cake, you simply give a path relative to the base of the application, and Cake fills in the rest. As such, your URL's will typically take the form of /controller/action/id.

Now you should be able to point your browser to You should see your view, correctly formatted with the title and table listing of the posts.

If you happened to have clicked on one of the links we created in this view (that link a post's title to a URL /posts/view/some_id), you were probably informed by Cake that the action hasn't yet been defined. If you were not so informed, either something has gone wrong, or you actually did define it already, in which case you are very sneaky. Otherwise, we'll create it now:

/app/controllers/posts_controller.php (view action added)
set('posts', $this->Post->findAll());

function view($id = null)
$this->Post->id = $id;
$this->set('post', $this->Post->read());

The set() call should look familiar. Notice we're using read() rather than findAll() because we only really want a single post's information.

Notice that our view action takes a parameter. This parameter is handed to the action by the URL called. If a user requests /posts/view/3, then the value '3' is passed as $id.

Now let's create the view for our new 'view' action and place it in /app/views/posts/view.thtml.



Verify that this is working by trying the links at /posts/index or manually requesting a post by accessing /posts/view/1.

Section 9
Adding Posts
reading from the database and showing us the posts is fine and dandy, but let's allow for the adding of new posts.

First, start with the add() action in the PostsController:

/app/controllers/posts_controller.php (add action added)
set('posts', $this->Post->findAll());

function view($id)
$this->Post->id = $id;
$this->set('post', $this->Post->read());


function add()
if (!empty($this->data))
if ($this->Post->save($this->data))
$this->flash('Your post has been saved.','/posts');

Let me read the add() action for you in plain English: if the form data isn't empty, try to save the post model using that data. If for some reason it doesn't save, give me the data validation errors and render the view showing those errors.

When a user uses a form to POST data to your application, that information is available in $this->params. You can pr() that out if you want to see what it looks like. $this->data is an alias for $this->params['data'].

The $this->flash() function called is a controller function that flashes a message to the user for a second (using the flash layout) then forwards the user on to another URL (/posts, in this case). If DEBUG is set to 0 $this->flash() will redirect automatically, however, if DEBUG > 0 then you will be able to see the flash layout and click on the message to handle the redirect.

Calling the save() method will check for validation errors and will not save if any occur. There are several methods available so you can check for validation errors, but we talk about the validateErrors() call in a bit, so keep that on the back burner for a moment while I show you what the view looks like when we move on to the section about data validation.

Section 10
Data Validation
Cake goes a long way in taking the monotony out of form input validation. Everyone hates coding up endless forms and their validation routines, and Cake makes it easier and faster.

To take advantage of the validation features, you'll need to use Cake's HtmlHelper in your views. The HtmlHelper is available by default to all views at $html.

Here's our add view:


Add Post

url('/posts/add')?>" method=post>

input('Post/title', array('size' => '40'))?>
tagErrorMsg('Post/title', 'Title is required.') ?>

textarea('Post/body', array('rows'=>'10')) ?>
tagErrorMsg('Post/body', 'Body is required.') ?>

submit('Save') ?>

As with $html->link(), $html->url() will generate a proper URL from the controller and action we have given it. By default, it prints out a POST form tag, but this can be modified by the second parameter. The $html->input() and $html->textarea() functions spit out form elements of the same name. The first parameter tells Cake which model/field they correspond to, and the second param is for extra HTML attributes (like the size of the input field). Again, refer to Chapter "Helpers" for more on helpers.

The tagErrorMsg() function calls will output the error messages in case there is a validation problem.

If you'd like, you can update your /app/views/posts/index.thtml view to include a new "Add Post" link that points to

That seems cool enough, but how do I tell Cake about my validation requirements? This is where we come back to the model.

/app/models/post.php (validation array added)


The $validate array tells Cake how to validate your data when the save() method is called. The values for those keys are just constants set by Cake that translate to regex matches (see /cake/libs/validators.php). Right now Cake's validation is regex based, but you can also use Model::invalidate() to set your own validation dynamically.

Now that you have your validation in place, use the app to try to add a post without a title or body to see how it works.

Section 11
Deleting Posts
Next, let's make a way for users to delete posts. Start with a delete() action in the PostsController:

/app/controllers/posts_controller.php (delete action only)
function delete($id)
$this->flash('The post with id: '.$id.' has been deleted.', '/posts');
This logic deletes the post specified by $id, and uses flash() to show the user a confirmation message before redirecting them on to /posts.

Because we're just executing some logic and redirecting, this action has no view. You might want to update your index view to allow users to delete posts, however.

/app/views/posts/index.thtml (add and delete links added)

Blog posts

link('Add Post', '/posts/add'); ?>


link($post['Post']['title'], '/posts/view/'.$post['Post']['id']);?>
'Are you sure?'

This view code also uses the HtmlHelper to prompt the user with a JavaScript confirmation dialog before they attempt to delete a post.

Section 12
Editing Posts
So... post editing: here we go. You're a Cake pro by now, so you should have picked up a pattern. Make the action, then the view. Here's what the edit action of the Posts Controller would look like:

/app/controllers/posts_controller.php (edit action only)
function edit($id = null)
if (empty($this->data))
$this->Post->id = $id;
$this->data = $this->Post->read();
if ($this->Post->save($this->data['Post']))
$this->flash('Your post has been updated.','/posts');
This checks for submitted form data. If nothing was submitted, go find the Post and hand it to the view. If some data has been submitted, try to save the Post model (or kick back and show the user the validation errors).

The edit view might look something like this:


Edit Post

url('/posts/edit')?>" method=post>
hidden('Post/id'); ?>

input('Post/title', array('size' => '40'))?>
tagErrorMsg('Post/title', 'Title is required.') ?>

textarea('Post/body', array('rows'=>'10')) ?>
tagErrorMsg('Post/body', 'Body is required.') ?>

submit('Save') ?>

This view ouputs the edit form (with the values populated), and the necessary error messages (if present). One thing to note here: Cake will assume that you are edititing a model if the 'id' field is present and exists in a currently stored model. If no 'id' is present (look back at our add view), Cake will assume that you are inserting a new model when save() is called.

You can now update your index view with links to edit specific posts:

/app/views/posts/index.thtml (edit links added)

Blog posts

link("Add Post", "/posts/add"); ?>


link($post['Post']['title'], '/posts/view/'.$post['Post']['id']);?>
'Are you sure?'
link('Edit', '/posts/edit/'.$post['Post']['id']);?>

Section 13
This part is optional, but helpful in understanding how URLs map to specific function calls in Cake. We're only going to make a quick change to routes in this tutorial. For more information, see Chapter "Configuration", Section 3: Routes Configuration.

Cake's default route will take a person visiting the root of your site (i.e. to the PagesController, and render a view called home. Rather than do that, we'll want users of our blog application to go to our soon-to-be-created PostsController.

Cake's routing is found in /app/config/routes.php. You'll want to comment out or remove the line that looks like this:

$Route->connect ('/', array('controller'=>'pages', 'action'=>'display', 'home'));
This line connects the URL / with the default Cake home page. We want it to connect with our own controller, so add a line that looks like this:

$Route->connect ('/', array('controller'=>'posts', 'action'=>'index'));
This should connect users requesting '/' to the index() action of our soon-to-be-created PostsController.

Section 14
Creating applications this way will win you peace, honor, women, and money beyond even your wildest fantasies. Simple, isn't it? Keep in mind that this tutorial was very basic. Cake has many more features to offer, and is flexible in ways we didn't wish to cover here. Use the rest of this manual as a guide for building more feature-rich applications.

Now that you've created a basic Cake application you're ready for the real thing. Start your own project, read the rest of the Manual and API.

Comparing VPN Options

Virtual private networking has become necessity for business users who need to remotely access their files. Of course, they could dial in directly to a remote access server, but that solution has a couple of significant drawbacks. The solution, of course, is a VPN connection. This article will discuss the different VPN options available

Virtual private networking has become more of a necessity than a luxury for business users who need a way to access files on an office network when they’re on the road, working from home or otherwise physically separated from the network. Of course, they could dial in directly to a remote access server, but that solution has a couple of significant drawbacks:

If your remote location is not in the same calling area as the remote access server, you’ll have to pay long distance charges – and those can add up fast if you need to spend much time connected to the network.
The remote access server will need multiple phone lines and modems in order to accommodate more than one incoming connection at a time – that cost, too, can add up if many.
The solution, of course, is a VPN connection. If the remote computer has Internet connectivity (via modem, broadband or through a LAN) and the office network has a permanent connection to the Internet such as T-1 or business-class broadband, the most cost effective way for remote users to connect is by tunneling through the public network. VPN technologies use tunneling protocols to create the connection and encryption protocols to provide the “private” part, allowing you to securely access a VPN server on the company network and through it (if the VPN server is set up to allow it), other computers on the company LAN.

So the question today is not whether to use VPN technology, but which VPN technology to use. There are four popular VPN protocols in use, and each has advantages and disadvantages. In this article, we’ll take a look at each and discuss how they compare, depending on your purpose.

Four Favorite Flavors of VPN
Because a VPN creates a secure “tunnel” through the public network, the protocols used to establish this tunneled connection are called tunneling protocols. If you ask the typical Windows administrator to name five VPN tunneling protocols, he/she is apt to get be stumped, having dealt only with the two VPN methods for which Windows provides built-in support. The five most common methods of creating a virtual private network include:

The first two, of course, are familiar to Windows admins. The last two may be less so. Unfortunately, there is no clear cut one-size-fits-all solution. The best choice for your organization depends on a number of factors: server and client operating systems deployed, network resources to which access is needed, level of security required, performance issues, administrative overhead, and so forth.

The Point-to-Point Tunneling Protocol (PPTP), developed by Microsoft in conjunction with other technology companies, is the most widely supported VPN method among Windows clients, and it is the only VPN protocol built into Windows 9x and NT operating systems. PPTP is an extension of the Internet standard Point-to-Point protocol (PPP), the link layer protocol used to transmit IP packets over serial links. PPTP uses the same types of authentication as PPP (PAP, SPAP, CHAP, MS-CHAP, EAP).

PPTP establishes the tunnel but does not provide encryption. It is used in conjunction with the Microsoft Point-to-Point Encryption (MPPE) protocol to create a secure VPN. PPTP has relatively low overhead, making it faster than some other VPN methods.

Because the client software is built into most Microsoft operating systems, PPTP servers can be deployed without having to worry about installing client software on those systems. PPTP clients are also available for Linux (see and Macintosh OS 9.x (see Mac OS X 10.2 comes with built-in support for PPTP, and there are also third-party clients available for OS X (see PPTP VPNs are supported by many major firewall appliances and enterprise level software firewalls, including ISA Server, Cisco PIX, SonicWall and some models of WatchGuard.

PPTP has been criticized in the past for various security flaws; many of these problems have been addressed in current versions of the protocol. Using EAP authentication greatly enhances the security of PPTP VPNs. One advantage of using PPTP is that there is no requirement for a Public Key Infrastructure; however EAP does use digital certificates for mutual authentication (both client and server) and highest security.

The Layer 2 Tunneling Protocol (L2TP) was developed in cooperation between Cisco and Microsoft, combining features of PPTP with those of Cisco’s proprietary Layer 2 Forwarding (L2F) protocol. One advantage of L2TP over PPTP is that it can be used on non-IP networks such as ATM, frame relay and X.25. Like PPTP (and as its name implies), L2TP operates at the data link layer of the OSI networking model. L2TP VPNs are supported by many major firewall products, including ISA Server, CheckPoint, Cisco PIX, and WatchGuard.

The L2TP client is built into Windows 2000, XP and 2003, but you can download client software for most pre-Windows 2000 operating systems (Windows 98, ME and NT 4.0).

IP Security (IPSec), and more specifically its Encapsulating Security Payload (ESP) protocol, provides the encryption for L2TP tunnels.

L2TP requires the use of digital certificates. User authentication can be performed via the same PPP authentication mechanisms as PPTP, but L2TP also provides computer authentication. This adds an extra level of security.

L2TP has several advantages over PPTP. PPTP gives you data confidentiality, but L2TP goes further and also provides data integrity (protection against modification of the data between the time it left the sender and the time it reached the recipient), authentication of origin (confirmation that the user who claims to have sent the data really did), and replay protection (which keeps a hacker from being able to capture data that is sent, such as the sending of credentials, and then “replay” it to “trick” the server). On the other hand, the overhead involved in providing this extra security can result in slightly slower performance than PPTP.

Windows administrators know IPSec as the protocol used for encryption in conjunction with the L2TP tunneling protocol. However, IPSec can itself be used as a tunneling protocol, and is in fact considered by many to be the “standard” VPN solution, especially for gateway-to-gateway (site-to-site) VPNs that connect two LANs. IPSec operates at a higher level of the OSI model, the network layer (Layer 3).

Many hardware VPN appliances use an implementation of IPSec. For example, Cisco’s VPN Concentrators and PIX firewalls support IPSec, as do NetScreen, SonicWall, and WatchGuard appliances. Enterprise level software firewalls such as ISA Server, CheckPoint and Symantec Enterprise Firewall also support IPSec VPNs.

IPSec in tunnel mode secures packets that are transmitted between two gateways or between a client computer and a gateway. As its name implies, an IPSec VPN works only with IP-based networks and applications. Like PPTP and L2TP, IPSec requires that the VPN client computers have client software installed.

Authentication is accomplished via the Internet Key Exchange (IKE) protocol with either digital certificates (which is the more secure method) or with a preshared key. IPSec VPNs can protect against many of the most common attack methods, including Denial of Service (DoS), replay, and “man-in-the-middle” attacks.

Many vendors include “managed client” features in their VPN client software, which make it possible for you to establish policies regarding such things as a requirement that the client machine have anti-virus software or personal firewall software installed in order to be allowed to connect to the VPN gateway.

IPSec support is included in Windows 2000/XP/2003, but not in older Windows operating systems. VPN gateway vendors, such as Cisco and CheckPoint, provide client software for their IPSec-based VPNs. Note that you may have to purchase licenses for the client software.

A VPN technology that has been growing in popularity is the Secure Sockets Layer (SSL) VPN. A big advantage of SSL VPNs is that you don’t need special VPN client software on the VPN clients. That’s because the SSL VPN uses the Web browser as the client application. Thus, SSL VPNs are known as “clientless” solutions. This also means the protocols that can be handled by an SSL VPN are more limited. However, this can also be a security advantage. With SSL VPNs, instead of giving VPN clients access to the whole network or subnet as with IPSec, you can restrict them to specific applications. If the applications to which you want to give them access are not browser-based, however, custom programming might be necessary to create Java or Active-X plug-ins to make the application accessible through the browser. A disadvantage of this is that in order to use such plug-ins, the client’s browser settings will have to be opened up to allow active content – thus exposing the browser to malicious applets unless you set it to block unsigned active content and ensure that the plug-ins are digitally signed.

SSL VPNs operate at an even higher layer of the OSI model than IPSec VPNs: the session layer. This gives them the ability to control access more granularly. SSL VPNs use digital certificates for server authentication. Other methods can be used for client authentication, but certificates are preferred as the most secure.

Even though there is no client software installed (other than the Web browser), SSL VPN gateways can still provide the advantages of “managed clients” by forcing the browser to run applets, for example, to verify that anti-virus software is in place before the VPN connection can be established.

Virtual private networking is often the best and most cost effective way to provide remote access to your company network. The first step in deploying a VPN server/gateway is selecting the type of VPN technology to use. The four most common VPN technologies in use are PPTP, L2TP, IPSec and SSL. Each has advantages and disadvantages, so it is important to familiarize yourself with the characteristics of each, and with your users’ needs, before making a decision. In this article, we’ve provide a brief overview of each of these VPN protocols.

Scan Effectively with Anti-Virus

This procedure can remove common threat on your computer using only your installed Anti-Virus software.
Operating System:
Windows ME/2000/XP

1. Installed Anti-Virus Software
2. Internet connection
3. Administrative privilege
1. Temporarily Disable System Restore in Windows XP. For Windows ME user, please click here.
Note: You must have an Administrator Privilege to be able to disable System Restore on Windows XP. It is advised to enable it after this procedure.
a) On the Desktop, Right Click on My Computer
b) Select the System Restore Tab
c) Mark the “Turn Off System Restore” to disable and UnMark to Enable
d) Click Apply on the Bottom of the Dialog Box to save the settings.
e) A message “This deletes all existing restore points” will appear, click Yes to disable.
f) Click OK.
2. Connect to internet and update your Anti-Virus software
3. Reboot computer in SafeMode
a) During BootUp process Press F8 continuously until selection appears
b) Use Arrow Up+Down to select SafeMode on the selections menu.
c) Hit Enter to proceed.
4. Thoroughly scan your computer with Anti-Virus installed and clean/delete all infected files.
5. Reboot computer and start it normally.
6. Do another scan to make sure that there are no threats present on your computer.

Wednesday, December 26, 2007


versions of an executable program.
The most common file size is 107,520 bytes. But the following file sizes have also been seen:
172,032 bytes
222,461 bytes
272,131 bytes
197,120 bytes
106,496 bytes

The filename NEW FOLDER.EXE refers to many The unsafe files using this name are associated with the malware group WORM.VB.NLJ.Some files using the name NEW FOLDER.EXE are also associated with the malware groups:
These files have no vendor, product or version information specified in the file header.
NEW FOLDER.EXE has been seen to perform the following behavior(s):
The Process is packed and/or encrypted using a software packing process
Disables Access to the Windows Registry Editior
Modifies Windows Security Policies to restrict/expand User Privlidges on the machine
Disables Access to the Task Manager built into Windows
Adds a Registry Key (RUN) to auto start Programs on system start up
Disables the built in Windows File Protection System
This Process Creates Other Processes On Disk
This Process Deletes Other Processes From Disk
Executes a Process
Terminates Processes
Writes to another Process's Virtual Memory (Process Hijacking)
Can communicate with other computer systems using HTTP protocols
Registers a Dynamic Link Library File
Changes the Internet Explorer Home Page Settings
Changes of IE options including home page, security tab, colour, font, advanced, menu
Disables the Built in Windows System Restore Feature
Adds a Link in the Start Menu
NEW FOLDER.EXE has been the subject of the following behavior(s):
Created as a process on disk
Executed as a Process
Added as a Registry auto start to load Program on Boot up
Writes to another Process's Virtual Memory (Process Hijacking)
Executed by Internet Explorer
Deleted as a process from disk
Terminated as a Process
Added as a Link in the Start Menu
NEW FOLDER.EXE can also use the following file names:

2007-09 (SEP).EXE