Vamsi Pavan’s Place

When curiousity outbursts …..

Entries Tagged as 'Source Code'

SSL Authentication in HTTP : Using cURL - Part 3

September 30th, 2011 · No Comments · Articles, Gen, Source Code, Tools

Open source curl is one of best & stable http client tool as well as library. In this article, we’ll see how can we use libcurl library as well as curl command line utility for two way client authentication.
Using libcurl library for HTTPS client authentication:
Here are the basics steps for the client setup before going […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

xerces-c: C++ SAX2 Parser

July 21st, 2011 · 1 Comment · Articles, C/C++, Source Code

Basics of validating xmls with a given schema in C++.
1. Create parser instance.

SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();

2. Set required features to parser instance as follow.
// Enable the parser’s schema support parser->setFeature(XMLUni::fgXercesSchema, true);
// Schema validation requires namespace processing to be turned on.<br />parser->setFeature(XMLUni::fgSAX2CoreValidation,true);<br />parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,true);

3. Set schema location using setPropery api call with/without namespace. If we want use […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:·····

xerces-c: C++ SAX2 Parser

January 24th, 2011 · No Comments · C/C++, Source Code

Basics of validating xmls with a given schema.
1. Create parser instance.

SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();

2. Set required features to parser instance as follow.
// Enable the parser’s schema support
parser->setFeature(XMLUni::fgXercesSchema, true);

// Schema validation requires namespace processing to be turned on.
parser->setFeature(XMLUni::fgSAX2CoreValidation,true);
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces,true);

3. Set schema location using setPropery api call with/without namespace. If we want use ‘ExternalSchemaLocation’ property we need to […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:·····

Building DOM tree by reading an xml file in Java

December 19th, 2007 · No Comments · Java, Source Code

import java.io.*;
import javax.xml.parsers.*;
import org.w3c.dom.*;
import org.xml.sax.*;
public class BasicDom {
public static void main(String[] args) {
Document doc = parseXmlFile(”infilename.xml”, false);
}
// Parses an XML file and returns a DOM document.
// If validating is true, the contents is validated against the DTD
// specified in the file.
public static Document parseXmlFile(String filename, boolean validating) {
try {
// Create […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Bubble Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

The source code for bubble sort.

#include
#define NUM 6

void swap(int arr[], int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}

main() {

int arr[NUM],i,j;

// start reading nums
for(i=0;i

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Shell Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

Source code for shell sort is provided below.

#include
#define NUM 6

main() {

int arr[NUM],i,j, incr=2;

// start reading nums
for(i=0;i

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Insertion Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

Source code for Insertion sort in C language.

#include
#define NUM 6

main() {

int arr[NUM],i,j;

// start reading nums
for(i=0;i

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

Selection Sort

April 15th, 2007 · No Comments · Algorithms, C/C++, Source Code

The code for the selection sort in C lang is provided below.

#include
#define NUM 6

void swap(int arr[], int i, int j) {
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp;
}

main() {

int arr[NUM],i,j;

// start reading nums
for(i=0;i arr[j])
swap(arr,i,j);

// print sorted arr
for(i=0;i
Please point your web link to this page if you are using this code for any purposes.

Bookmark it!
These icons […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags:

File upload code in Jsp : using apache’s commons-upload.jar

April 13th, 2007 · 6 Comments · Jsp/servlets, Source Code

Please follow the below steps before coding the upload script in jsp.
1. Download the commons-upload.jar from Apache’s website.
2. Put that jar file into the classpath, i.e in WEB-INF/lib/ directory.
3. Then create a jsp file with the following code and any static HTML page for initial page.
The code here goes:

<%@ page import=”org.apache.commons.fileupload.*,
org.apache.commons.fileupload.servlet.ServletFileUpload,
org.apache.commons.fileupload.disk.DiskFileItemFactory,
org.apache.commons.io.FilenameUtils,
java.util.*,
java.io.File,
java.lang.Exception,
java.io.*,
java.net.*,
org.apache.poi.hssf.usermodel.*” %>
<h1>Data Received at the […]

Bookmark it! These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Live
  • StumbleUpon
  • BlinkList
  • YahooMyWeb
  • NewsVine
  • blogtercimlap
  • Netvouz
  • Technorati
  • Slashdot
  • Print this article!

[Read more →]

Tags: