Subscribe Banner

Monday, September 18, 2017

Saturday, April 23, 2016

CKEditor export to pdf in PHP (using mPDF)

CKEditor (web editor) export (convert html) to pdf in PHP (using mPDF) - UTF-8 support









Full source code : https://drive.google.com/folderview?id=0B4fPeBZJ1d19RF9HdVI0THRNTTA&usp=sharing



Tools :



CKEditor : http://ckeditor.com/

mPDF (official site - version 6.0) : http://ckeditor.com/

mPDF (github - version 6.0) : https://github.com/mpdf/mpdf



Other tools :



HTML2PDF : http://html2pdf.fr

DOMPDF : http://pxd.me/dompdf/www/

TCPDF : http://www.tcpdf.org/

PHPTOPDF : http://phptopdf.com/


Friday, December 18, 2015

Send email using Java (in NetBeans)

How to send an Email using Java Mail API

This is a simple (standalone) Java Application in NetBeans.

Download the code (and the mail.jar - JavaMail API) from here;
https://goo.gl/rygvBF

OR you can download the mail.jar - JavaMail API from here;
http://goo.gl/u1b3uO

00:59 - add .jar file
01:33 - run the code
02:32 - code presentation

    public static void send(String to, String sub,String msg, final String user, final String pass) 
    {
        Properties props = new Properties();

        props.put("mail.smtp.host", "smtp.gmail.com");
        props.put("mail.smtp.port", "587");
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        
        Session session = Session.getDefaultInstance(props,new Authenticator() 
        {
            @Override
            protected PasswordAuthentication getPasswordAuthentication() 
            {
                return new PasswordAuthentication(user, pass);
            }
        });

        try 
        {
            Message message = new MimeMessage(session);
            
            message.setFrom(new InternetAddress(user));
            message.setRecipients(Message.RecipientType.TO, InternetAddress.parse(to));
            message.setSubject(sub);
            message.setText(msg);

            Transport.send(message);
            
            JOptionPane.showMessageDialog(null,"Email sended!");
            
        } catch (MessagingException e) 
        {
            JOptionPane.showMessageDialog(null,"Something happened!");
            
            throw new RuntimeException(e);
        }

Sunday, December 13, 2015

How to test internet connection using Java (in NetBeans)




Determine if internet connection is available using Java in NetBeans

Download the code :
https://drive.google.com/folderview?id=0B4fPeBZJ1d19ck52TUpNenBtLVU&usp=sharing

package application;

import java.net.*;

public class InternetConnection
{
    public static boolean InternetConnection ()
    {
        Socket sock = new Socket();
        InetSocketAddress addr = new InetSocketAddress("www.google.com",80);

        try
        {
            sock.connect(addr,3000);
            //JOptionPane.showMessageDialog(null,"You are connected!");
           
            return true;
        }
        catch (Exception e)
        {
            //JOptionPane.showMessageDialog(null,"Please check your Internet Connection!");

            return false;
        }
        finally
        {
            try
            {
                sock.close();
            }
            catch (Exception e)
            {

            }
        }
    }
}


►Facebook : https://www.facebook.com/TechWorld3g ►Twitter : https://twitter.com/TechWorld3g ►Youtube : https://www.youtube.com/user/TechWorld3g ►Blog : https://tech-world3g.blogspot.com ►Donate : https://imraising.tv/u/techworld3g



Thursday, December 10, 2015

PHP - Web Calendar with CSS


Create a simple web calendar with CSS (download the code for free).

https://drive.google.com/folderview?id=0B4fPeBZJ1d19TVRoRWVNdDFybHc&usp=sharing

There are two files (warning : in the same folder) :
►calendar.php
►style.css
The style.css is not necessary. I used it to make it prettier.

I used EasyPHP DevServer 14.1 CV11 to run the calendar.php(on localhost).