How to send url to Intent in Android

This code will open the link in your Android browser. We suppose you have an Activity and you did the correct imports :


String url = "";
Intent intent = new Intent(Intent.ACTION_VIEW);


The necessary imports are:

import android.content.Intent;
import android.os.Bundle;


PHP MySQL example

This example shows how to connect to a MySQL database and browse data using PHP:

$host= "localhost";
$username = "user";
$password = "pwd";
$dbname = "dbName";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);

$sql = "SELECT id, firstname, lastname FROM users";

$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data
    while($row = $result->fetch_assoc()) {
        echo "id: " . $row["id"]. " - Name: " . $row["firstname"]. " " . $row["lastname"]. "<br>";
} else {
    echo "0 results";


What is new in Java 8

Java 8 is a major release of the java programming language. It introduces new features and enhancements. The most significant ones are the following.

Lambda expressions

New Date and Time API

Method references

Default methods

Repeating annotations

Type annotations

Stream API



new tools and utilities

HttpURLConnection example

HttpURLConnection allows to open an HTTP connection and get a response.

URL url = new URL("");
HttpURLConnection http = (HttpURLConnection)url.openConnection();
int statusCode = http.getResponseCode();
// if statusCode == 200, it means it's ok.
// other ways, it's an error you can deal with it.


How to convert Date into LocalDateTime in Java 8

Date to LocalDateTime

Date date = new Date();
Instant instant = date.toInstant();
LocalDateTime ldt = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());


LocalDateTime to Date

LocalDateTime ldt =;
ZonedDateTime zdt = ldt.atZone(ZoneId.systemDefault());
Date date = Date.from(zdt.toInstant());