Tuesday, May 25, 2010

Change Web Root Path for XAMPP on Windows

Change Web Root Path for XAMPP on Windows
I had an existing XAMPP install on a shared location that I wanted to access using a laptop with its own local XAMPP install. I didn’t want to do any heavy lifting with the laptop, just wanted to access the web files on the shared server through the laptop’s localhost.
I also didn’t want to relocate the entire XAMPP folder on my laptop, so I instead modified the httpd.conf file on my local XAMPP install to point to the web root of the remote XAMPP install.
Here’s what I did:
1. Locate httpd.conf file on my local XAMPP install: C:\xampp\xampp\apache\conf\httpd.conf
2. Edit the “DocumentRoot” line to the location of the remote \htdocs folder. I changed mine from:
“C:/xampp/xampp/htdocs” to “C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
3. Edit the “Directory” tag to the same remote location you set for DocumentRoot. My Directory tag looked like Directory “C:/Users/Ann/Documents/My Dropbox/Dev/Xampp/xampp/htdocs”
4. Save the file and restart your local Apache server.
5. Navigate to “http://localhost/” in your browser and you should see the remote web site files.

Tuesday, May 11, 2010

Provide Text Editing facility with CK(FCK) editor

What is CK editor

CKEditor (formerly FCKeditor) is an open source WYSIWYG text editor from CKSource that can be used in web pages. It aims to be lightweight

Its core code is written in JavaScript, having server side interfaces with ASP, ASP.NET, ColdFusion, Java, JavaScript, Lasso, Perl, PHP and Python

CKEditor is compatible with most Internet browsers, including: Internet Explorer 6.0+ (Windows), Firefox 2.0+, Safari 3.0+, Google Chrome (Windows), Opera 9.50+, and Camino 1.0+

Using this facility Admin(end user) of site can modify contain of webpage

Because CKEditor is licensed under flexible Open Source and commercial licenses, you'll be able to integrate and use it inside any kind of application. This is the ideal editor for developers, created to provide easy and powerful solutions to their users.

To see the demo: http://ckeditor.com/demo

To download editor: http://ckeditor.com/download

For more information and documentation : http://ckeditor.com/

Saturday, May 8, 2010

Java: MYSQL -JDBC connection

To connect Java with MYSQL you can use bellow code but before using this code you have to download MYSQL-java Connector
Download MYSQL-JAVA Connector
Put this jar file in lib directory of your project


Port="3306";Host="root";Pw="";Db="database";
try
{
Class.forName("com.mysql.jdbc.Driver").newInstance();
String url ="jdbc:mysql://localhost:"+Port+"/"+Db;
cn =DriverManager.getConnection(url,Host,Pw);
}
catch(Exception e)
{
return e+": Error in Connection";
}
return "OK";
}

Oracle : varray nasted table

create type tool_ty as object
(toolname varchar(25))

Type created.


create or replace type tools_va as varray(5) of varchar(25)

Type created.


create table borrower
(name varchar(25),
tools tools_va,
constraint borrower_pk primary key(name));

Table created.


SQL> desc borrower
Name Null? Type
------------------------------- -------- ----
NAME NOT NULL VARCHAR2(25)
TOOLS TOOLS_VA


insert into borrower values('abc',tools_va('hammer','sledge','ax'))




select * from borrower


NAME
-------------------------
TOOLS
----------------------------------------------------------------------------------------------------
abc
TOOLS_VA('hammer', 'sledge', 'ax')


*********************************************************
nasted table

create or replace type lib_ty as object
(bk_name varchar(25),
bk_issue_date date)
create type lib_ty as table of lib;

create type lib_nt as table of lib_ty;

create table student
(no number(3),
name varchar(30),
lib lib_nt)
nested table lib store as lib_nt_tab

insert into student values
(1,'abc',
lib_nt(lib_ty('c++','31-mar-10'),
lib_ty('java','12-feb-2010')))

PHP file upload

To store files in project no need to store whole file in database just upload that file on server and store only location (path) of that file in the database

To upload file on server and store it on particular path code is :

First.php

<html>

<head>

</head>

<body>

<form method="POST" action="sub.php" enctype="multipart/form-data">

<input type="file" name="fileup">

<input type="submit" name="abc">

</form>

</body>

</html>

---------------------------------------------------------------------------------------------------------

sub.php

if(move_uploaded_file($_FILES['fileup']['tmp_name'],"../image/p.jpg"))

{

echo "File uploaded ";

}

?>

on other side you have to use $_FILE[] it s two dimension array

when you upload any file to server apache store it on temp location i.e. ‘($_FILES['fileup']['tmp_name']’ from their you can move that file on any location using

‘move_uploaded_file()’ function