Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/default-filters.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/default-filters.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/class-wp-theme.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/class-wp-theme.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/class-wp-styles.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/class-wp-styles.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/class-wp-rest-request.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/class-wp-rest-request.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-revisions-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/block-supports/duotone.php on line 1

Warning: Uninitialized string offset 0 in /home/ujjal/public_html/blog/wp-includes/block-supports/duotone.php on line 1

Warning: Cannot modify header information - headers already sent by (output started at /home/ujjal/public_html/blog/wp-includes/default-filters.php:1) in /home/ujjal/public_html/blog/wp-includes/feed-rss2.php on line 8
Web development – Diary of Ujjal https://blog.ujjal.net Software Development Lead, Very good listener, Tech enthusiastic, Movie & Series freak Sat, 14 Feb 2015 10:38:34 +0000 en-US hourly 1 https://wordpress.org/?v=6.2.6 UploaDrop [A Dropbox based File Uploading Solution of large files] https://blog.ujjal.net/?p=275&utm_source=rss&utm_medium=rss&utm_campaign=uploadrop-a-dropbox-based-file-uploading-solution-of-large-files https://blog.ujjal.net/?p=275#respond Sat, 01 Feb 2014 12:21:42 +0000 http://ujjalruet.wordpress.com/?p=275 Continue reading "UploaDrop [A Dropbox based File Uploading Solution of large files]"

]]>
What is it?
UploaDrop is a dropbox based upload script which is used for uploading files and folders to dropbox instead of server storage.

Motivation
Most of the time, we, the developers, must have to manipulate large files on the website like videos, audios or other documents. If the unit size of files is small, then its okey. There is no big deal to handle these files of small size. But when the application requires to upload files of large size like 5GB on each upload, we need to consider the reliablity of the upload script. We need to consider the maximum size of files which can be uploaded. We need to consider the maximum bandwidth we can use at a time. We have to take the burden of server optimization.

To get rid of these headache, we can handle this file manipulation tasks to other 3rd party who is already established with the service of file manipulation.

Dropbox is cloud based file hosting server in which users can upload their files and can download when needed. Dropbox has provided lots of features including large file uploading with optimized way.

Dropbox has also provided an api which is highly user-friendly so that any developer can use that.

Objective
To develop a script in which visitors/users of the application can upload file via drag drop or choosing. Instead of the hosting space, these files will be uploaded on dropbox space of the owner of the application. Then these files can be used for different purposes.

Features
1. Multiple files uploading at a time
2. File uploading to owner’s dropbox storage
3. No need to have headache about file manipulation, storage, bandwidth of file uploading.
4. Recrsively finds every files from all folders and uploads to dropbox

Acknowledgements
First of all I would like to thank the Dropbox Team for providing this awesome service.

Then I thank Mr. Nuhil Mehdy (nuhil.net) to give me the idea.

Lets start the development of an simple application called UploaDrop by which end user will upload something to your website, and instead of your host, it will be uploaded on dropbox.

When you are a Developer
The first task is to create an app on your Dropbox account using developer account.

1. Go to https://www.dropbox.com/developers/apps and Click on “Create app” button.

2. Fill these given fields as the picture shows.

3. After completing the creation of your app you will see the details of your app by going https://www.dropbox.com/developers/apps and click on the App Name ‘UploaDrop’.

See the rounded area which provides app key and app secret. These two key defines the access of your dropbox account for uploading from outside.

4. Now open composer.json for editing and set these keys on this like the picture shows.

5. OK, In this step you are all set. Now lets get the access key. Execute getAccesskey.php on the browser which returns a url like
https://www.dropbox.com/1/oauth2/authorize?locale=&client_id=12ab34vd&response_type=code

6. Copy this url and paste on the browser. It will ask for permission to create a folder named app name on the dropbox account.

Click on “Allow”

7. An access key will be displayed like the given screenshot.

Save the Access key on some secured place.

8. Open index.php and and edit the $accesskey field on line 10.

Open processupload.php and do the same task on line 5.

Here, developer’s work is finished. All configuration is finished.

Front End behavior
1. Hit “index.php” on the browser, the front end page will be arrived.

2. In the drag&drop area, user can drag&drop their files and folders. A progress bar will be shown for each of the files when uploading. After completation of uploading of all files click on “Finish Uploading”.

This is the simple app. Actually, It is a brief instruction of how to use Dropbox Core Api.

Future Works
1. In the top area, all existing files are being displayed in recursive structure which is coded by me. In dropbox core api, there are options to create download link of each files, Editing, Deleting etc. These 3 features can be achieved in future.

2. If any compressed file is drop on the drag&drop area, it doesnt extract the compressed file. In future, it can be an issue.

Source Code (Github)
Watch Demo

]]>
https://blog.ujjal.net/?feed=rss2&p=275 0
Removing index.php from url of CodeIgnitor project | Using .htaccess file https://blog.ujjal.net/?p=228&utm_source=rss&utm_medium=rss&utm_campaign=removing-index-php-from-url-of-codeignitor-project-using-htaccess-file https://blog.ujjal.net/?p=228#respond Mon, 12 Aug 2013 18:29:55 +0000 http://ujjalruet.wordpress.com/?p=228 Step 1 : Edit the configuration file to give the permission to override default settings.
command: sudo nano /etc/apache2/sites-available/default
Change the value of AllowOverride to ‘All’ from ‘none’

sample:


    ServerAdmin webmaster@localhost

    DocumentRoot /var/www
    
        Options FollowSymLinks
        AllowOverride All                                 <- HERE
    
    
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All                                 <- HERE
        Order allow,deny
        allow from all
    

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    
        AllowOverride None
        Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
        Order allow,deny
        Allow from all
    

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

    Alias /doc/ "/usr/share/doc/"
    
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    


Step 2: Enable module rewrite
command: sudo a2enmod rewrite

Step 3: Restart apache server
command: sudo service apache2 restart

sample .htaccess:

RewriteEngine on
RewriteCond $1 !^(index.php|images|robots.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

N.B: Don’t forget to press Enter once at the end of the htaccess file.Because Newline represents the end of file.

SELF NOTE

]]>
https://blog.ujjal.net/?feed=rss2&p=228 0
Top X rated products for Virtuemart Joomla 2.5 https://blog.ujjal.net/?p=219&utm_source=rss&utm_medium=rss&utm_campaign=top-x-rated-products-for-virtuemart-joomla-2-5 https://blog.ujjal.net/?p=219#respond Fri, 17 Aug 2012 18:17:27 +0000 http://ujjalruet.wordpress.com/?p=219 Continue reading "Top X rated products for Virtuemart Joomla 2.5"

]]>
As one of my client upgraded his site from joomla 1.5 to 2.5 .Everything was ok but top rate product module was for only joomla 1.5/1.7 version. So, He told me to find a suitable module for Display top rated products. I have searched a lot but didn’t get any working module for solving this.So, I have decided to create a module. So ,I learn’t how to create a simple module for joomla 2.5 from here converted the code(top rated module for 1.5) for Joomla 2.5. As database structure in 2.5 is changed from 1.5/1.7 I had to play with SQL queries. Here is the module .You can use this and let me know reviews.

Feature:

  1. Its easy to use
  2. Can be defined the number of top products to display

Download this module from here .
send email on ujjal.ruet@yahoo.com

Thank you.

Example :

]]>
https://blog.ujjal.net/?feed=rss2&p=219 0
Creating AutoBack Up of MySQL Database using JAVA OR PHP ( পিএচপি অথবা জাভা তে কিভাবে মাইএসকিউএল ডাটাবেজ এর অটোমেটিক ব্যাকআপ করতে হয় ) https://blog.ujjal.net/?p=170&utm_source=rss&utm_medium=rss&utm_campaign=creating-autoback-up-of-database-using-java https://blog.ujjal.net/?p=170#comments Wed, 02 May 2012 15:35:55 +0000 http://ujjalruet.wordpress.com/?p=170 Continue reading "Creating AutoBack Up of MySQL Database using JAVA OR PHP ( পিএচপি অথবা জাভা তে কিভাবে মাইএসকিউএল ডাটাবেজ এর অটোমেটিক ব্যাকআপ করতে হয় )"

]]>
It is usual that we need to backup the database in software development (specially in Enterprise Software,web applications ) Database is very important which contains all the information about the organization. Last night I have coded a auto backup script in both JAVA and PHP. Here I am gonna post them below with comment.

Code Written in JAVA

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
import java.sql.*;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
 *
 * @author Ujjal Suttra Dhar
 */

class create_backup{

    String database = "your_database_name",  user = "root", password = "pass";
    Connection m_Connection = null;
    Statement m_Statement = null;
    ResultSet m_ResultSet;
    String m_Driver = "com.mysql.jdbc.Driver";
    String m_Url = "jdbc:mysql://localhost:3306/" + database;

    public create_backup(){

        /*Eshtablishment of Connection of java code with MySQL using JDBC
         You must read my previous post to know further about this. 
         */
        try {
            Class.forName(m_Driver);
            m_Connection = DriverManager.getConnection(m_Url, user, password);
            //Create Statement object
            m_Statement = m_Connection.createStatement();

        } catch (Exception ex) {
            ex.printStackTrace();
        }

        try {
            //Database will be stored in filename.sql which can be import on MySQl as backup
            BufferedWriter  out = new BufferedWriter(new FileWriter(&quot;kernel_school.sql&quot;));


            //Now here is the informations about the database of which backup will be created
            String dump = &quot;C:/Program Files/MySQL/MySQL Server 5.0/bin/mysqldump &quot; //Path to mysql
                    + "--host=localhost" //Mysql hostname
                    + "--port=3306" //Mysql portnumber
                    + "--user=root" //Mysql username
                    + "--password=pass" //Mysql password
                    + "--add-drop-table" //Add a DROP TABLE statement before each CREATE TABLE statement
                    + "--add-drop-database" //Add a DROP DATABASE statement before each CREATE DATABASE statement
                    + "--complete-insert" //Use complete INSERT statements that include column names.
                    + "--extended-insert" //Use multiple-row INSERT syntax that include several VALUES lists
                    + "kernel_school";                  //Mysql databasename


            //executing the command through process.
            Process run = Runtime.getRuntime().exec(dump);


            /*resultant SQL informations are here on the br which can be read line by line .
            And at the same time it will be written on another sql file.*/
            InputStream in = run.getInputStream();
            InputStreamReader isr = new InputStreamReader(in);
            BufferedReader br = new BufferedReader(isr);
            String line = null;

            while ((line = br.readLine())!=null) {
                 out.write(line);
                 out.newLine();
            }

       out.flush(); // must flush or close the file after completing the task.
        // int exitVal = run.waitFor();//when exitVal is ,then the process is completed

        } catch (Throwable t) {
            t.printStackTrace();
      }

    }//constructor
 } // class



public class autobackup {
    public static void main(String a[]){
            new create_backup();
    }
}

Code Written in PHP

]]>
https://blog.ujjal.net/?feed=rss2&p=170 2
Sending mail from php https://blog.ujjal.net/?p=20&utm_source=rss&utm_medium=rss&utm_campaign=sending-mail-from-php https://blog.ujjal.net/?p=20#respond Fri, 01 Apr 2011 17:27:54 +0000 http://ujjalruet.wordpress.com/?p=20 Continue reading "Sending mail from php"

]]>
Today I am going to post a simple method to send mail from php code.To this we must use SMTP [Simple Mail Transfer protocol]which uses default port that is 25.Before sending mail,SMTP server name must be included in php.ini .To make our job easier I will use three php files.
They are
01: SMTPconfig.php
02: SMTPclass.php
03: index.php

01: SMTPconfig.php

//Server Address
$SmtpServer=”gmail.com”;
$SmtpPort=”25″; //default
$SmtpUser=”yourgmailid@gmail.com”;
$SmtpPass=”yourgmailpassword”;

Here,SMTP server setup is completed.

02: SMTPclass.php

class SMTPClient
{

function SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body)
{

$this->SmtpServer = $SmtpServer;
$this->SmtpUser = base64_encode ($SmtpUser);
$this->SmtpPass = base64_encode ($SmtpPass);
$this->from = $from;
$this->to = $to;
$this->subject = $subject;
$this->body = $body;

if ($SmtpPort == “”)
{
$this->PortSMTP = 25;
}
else
{
$this->PortSMTP = $SmtpPort;
}
}

function SendMail ()
{
if ($SMTPIN = fsockopen ($this->SmtpServer, $this->PortSMTP))
{
fputs ($SMTPIN, “EHLO “.$HTTP_HOST.”rn”);
$talk[“hello”] = fgets ( $SMTPIN, 1024 );
fputs($SMTPIN, “auth loginrn”);
$talk[“res”]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpUser.”rn”);
$talk[“user”]=fgets($SMTPIN,1024);
fputs($SMTPIN, $this->SmtpPass.”rn”);
$talk[“pass”]=fgets($SMTPIN,256);
fputs ($SMTPIN, “MAIL FROM: from.”>rn”);
$talk[“From”] = fgets ( $SMTPIN, 1024 );
fputs ($SMTPIN, “RCPT TO: to.”>rn”);
$talk[“To”] = fgets ($SMTPIN, 1024);
fputs($SMTPIN, “DATArn”);
$talk[“data”]=fgets( $SMTPIN,1024 );
fputs($SMTPIN, “To: to.”>rnFrom: from.”>rnSubject:”.$this->subject.”rnrnrn”.$this->body.”rn.rn”);
$talk[“send”]=fgets($SMTPIN,256);
//CLOSE CONNECTION AND EXIT …
fputs ($SMTPIN, “QUITrn”);
fclose($SMTPIN);
//
}
return $talk;
}
}
/////////////////////////////////

03: index.php

include(‘SMTPconfig.php’);
include(‘SMTPClass.php’);
if($_SERVER[“REQUEST_METHOD”] == “POST”)
{
$to = “to_mailid”;
$from = “from_mailid”;
$subject = “subject”;
$body = “message”;
$SMTPMail = new SMTPClient ($SmtpServer, $SmtpPort, $SmtpUser, $SmtpPass, $from, $to, $subject, $body);
$SMTPChat = $SMTPMail->SendMail();
}

Thanks for visiting this…
For more info Click Here

]]>
https://blog.ujjal.net/?feed=rss2&p=20 0