Codxplore.com

Latest news:

New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!

how to export mysql data to excel in java



Database class example

public class DB {

    Connection con = null;
    Statement st = null;
    ResultSet rs = null;
    ResultSetMetaData md = null;
    String dburl = "jdbc:mysql://localhost:3306/addressBook";
    String dbuser = "root";
    String dbpassword = "";

    public DB() {
        try {
            con = DriverManager.getConnection(dburl, dbuser, dbpassword);
            st = con.createStatement();
        } catch (Exception ex) {
            ex.getMessage();
        }
    }
}

 

//button action

DB db = new DB();

            try {
                FileWriter writer = new FileWriter("C:UsersPublicCompany List.csv");

                String sql = "SELECT companyId,companyName,companyAddress,companyPhone,companyMobile,companyEmail FROM tbl_address_list  ";

                db.rs = db.st.executeQuery(sql);
                db.rs = db.st.getResultSet();
                db.md = db.rs.getMetaData();
                int columnCount = db.md.getColumnCount();

                while (db.rs.next()) {
                    for (int i = 1; i <= columnCount; i++) {
                        writer.append(db.rs.getString(i)+',');
                    }
                    writer.append(' ');
                }

                writer.flush();
                writer.close();
                
                JOptionPane.showMessageDialog(rootPane, "Csv file is generated successfully and save into C:UsersPublic");

            } catch (Exception io) {
                System.err.println(io);
            }


Views: 693

Responsive css design techniques



Responsive css design techniques

Using the css media we can design a responsive template for all devices such as any smart phone or tablet.

there is no specefic width or heighr for responsive design , you can do it by your self . but there is some recommended width i will mention here.this will help you to create any responsive template

for example :

@media (max-width: 480px) {
    .row .left{
        padding-top: 2px;
        padding-right: 2px;
        padding-left: 2px;
    }
    .marketing .span4 {
        margin-left:0px;
        width:auto;
    }
    .exampleDivClass{
        top: 37%;
        right:10%;
    }
}

@media (max-width: 767px) {
    .marketing .span4 {
        margin-left:0px;
        width:auto;
    }
    .exampleDivClass{
        top: 37%;
        right:10%;
    }
}


@media (max-width: 767px) {
    .marketing .span4 {
        margin-left:0px;
        width:auto;
    }
    .row .left{
        padding-left: 15px;
    }
    .exampleDivClass{
        top: 37%;
        right:10%;
    }
}

@media (min-width: 768px) and (max-width: 979px) {
    .marketing .span4 {
        margin-left:0px;
        width:auto;
    }
    .exampleDivClass{
        top: 37%;
        right:10%;
    }
}

@media (max-width: 979px) {
    .marketing .span4 {
        margin-left:0px;
        width:auto;
    }
}

@media (min-width: 980px) {
   .marketing .span4 {
        width:280px;
    }
}
@media (min-width: 1200px) {
    .marketing .span4 {
        width:360px;
    }
}

thats all. thanks dude :D 


Views: 715

Installing and running the Zend Framework on XAMPP



4 Responses to “Installing and running the Zend Framework on XAMPP”

1) It is assume that XAMPP is installed on your windows system

a)Must have the mod_rewrite extension installed and configured
b)Must also ensure that Apache is configured to support .htaccess files.

AllowOverride All

2) Zend is easy to get up and running on XAMPP.

3) Download latest (Zend Framework 1.11.6) Full from link >> http://framework.zend.com/download/latest

a)Create folder named “ZendFramework” at C:\xampp\php path.

b)Uncompress “Zend Framework 1.11.6.zip” then go to library >> Zend folder copy all the content and paste
in above created ZendFramework folder at C:\xampp\php\ZendFramework

4) Then make sure to change the include path in

\xampp\php\php.ini

append include_path with new ;C:\xampp\php\ZendFramework

It should look something like this:

include_path = “.;C:\xampp\php\pear\;C:\xampp\php\ZendFramework”

>>re-start the server

Installing QuickStart Guestbook Example by zend

a) Download “ZendFrameworkQuickstart.zip” from http://framework.zend.com/manual/en/learning.quickstart.intro.html

b) For convenience create a project named “zendQuickStart” inside xampp`s htdocs folder, because apache serves files from there.

c) Uncompress “ZendFrameworkQuickstart.zip” and Copy content of project folder “zendQuickStart”

d) Create VirtualHost on XAMPP

For that make changes in below mention file

>> C:\xampp\apache\conf\extra\httpd-vhosts.conf

DocumentRoot “C:/xampp/htdocs/zendQuickStart/public”
ServerName *

Options Indexes FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all

>>re-start the server

e) Quickstart uses the sqlite database so make sure the below extension are enable in php.ini file

extension=php_pdo.dll
extension=php_pdo_sqlite.dll

>>re-start the server

f) now access http://localhost/

Creating zend project scaleton

a) Download “ZendFramework-1.11.6-minimal.zip” from path >> http://framework.zend.com/download/latest

a) Create folder named “ZendFrameworkCli” at path C:/Program Files

c) Uncompress above folder and copy “bin” and “library” folder and paste in “ZendFrameworkCli” at path C:/Program Files

d) Now Right click on “My Computer” click on properties >> Advance >> Enviroment Variables >>

select CLASSPATH under System Varibles click on Edit button and append ;C:\xampp\php to existing value.

f) Run “cmd” command and go to path C:\Progam Files\ZendFrameworkCli\bin>

g) Type below command to check zend verion

C:\Progam Files\ZendFrameworkCli\bin>zf show version

you will see

Zend Framework Version 1.11.6

h) Now Type below command to create project

C:\Progam Files\ZendFrameworkCli\bin>zf create project C:/xampp/htdocs/zfmyfirstproject

This will create a zend framework folder structure for you.

Copy tge Zend folder from ZendFramework-1.11.6-minimal/library and paste in C:/xampp/htdocs/zfmyfirstproject/library

 

 

Thats it


Views: 809

data table implimentation



$(document).ready(function() { $("a[id=showOpenList]").addClass("selected"); oTable = $('#example').dataTable({ "bJQueryUI": true, "sPaginationType": "full_numbers" }); });

Views: 649

Multiple file uploading php mysql



$path = "testUpload/";
        $maxsize = 2000000;
        $allowedType = array("image/jpg", "image/jpeg", "image/gif", "image/png");
        foreach ($_FILES as $key => $value) {
            //debugPrint($value);
            if (!empty($value['name'])) {
                $target = $path . basename($value['name']);
                $extension = $value["type"];
                if ($value['size'] < $maxsize) {
                    if (in_array($extension, $allowedType)) {
                        if (move_uploaded_file($value['tmp_name'], $target)) {
                            $filename = basename($value['name']);
                        }
                    }
                } else {
                    echo 'File size limit problem';
                }
            }
        }


Views: 686

single file upload



$path = "upload/";
        $target = $path . basename($_FILES['file']['name']);

        $allowedType = array("image/jpg", "image/jpeg", "image/gif", "image/png");
        $extension = $_FILES["file"]["type"];

        if (in_array($extension, $allowedType)) {
            if (move_uploaded_file($_FILES['file']['tmp_name'], $target)) {
                $data['image'] = basename($_FILES['file']['name']);
            }
        }


Views: 673

Subscribe Us


Follow Us