Monday, June 8, 2020

Microsoft Office Graphic Features

ClipArt
Chart
New Chart
Organization Chart
SmartArt
Equation
New Equation
Icons / Scalable Vector Graphics (SVG)
3D Model / 3D images
WordArt
---
Sort and Filter
Advanced Filter
Slicer

Easy Ways to Overline Text in Word

You shall already know the method to underline text in Microsoft Office Word. But addition to this, you may also have the demand to overline or overbar specified characters sometimes. For example, if you want to enter an average number in a mathematical document, a short line above a given variable is necessary.

In this post, you will get several simple methods based on Microsoft Word.
  1. Insert Shapes

The most direct way is to draw a line over the specified text.
  1. Click Insert – Shapes. Find the icon of straight line in Lines.
  2. Select it. Drag your cursor to draw a straight line over the text.
  3. Then you can choose the color and effect of the line you drew.
  4. The bright spot of this method is the high degree of freedom. You can draw any kind of line in anywhere you want.
  5. Finish.
  1. Borders

You can also regard the overline as a part of a border.
  1. First, select the text and find the icon of Borders in Home tab.
  2. Click the small triangle beside it to see the drop-down list, choose Top Border.
  3. Then a overline is added to the whole row.
  4. Adjusting the width of it requires you to use the horizontal Ruler. You can enable it by checking Ruler in View tab.
  5. Put your cursor at the row of the text you want to overline. Then drag the small triangle on the ruler to adjust the length of the line.
  6. Finish.
  1. Equation Editor

You can also use Equation Editor to insert overline to your text.
  1. Click Insert – Equations to enable the Equation Tools in Design, and a textbox will be added to your document.
  2. Click Accent in Design (Equation Tools) tab, select Bar in Accent or Overbar in Overbars and Underbars.
  3. Then the underline will be inserted in the equation textbox. You can click the dotted pane to input any text you want.
  1. Using a Field Code

  1. First, we’ll show you how to use a field code to apply overlining to text. Open an existing or new document in Word and place the cursor where you want to put the text with overlining. Press “Ctrl + F9” to insert field code brackets, which are highlighted in gray. The cursor is automatically placed in between the brackets.
  2. Enter the following text between the brackets.    EQ \x \to()
    • NOTE: There is a space between “EQ” and “\x” and between “\x” and “\to()”. “EQ” is the field code used to create an equation and the “\x” and “\to” are switches used to format the equation or text. There are other switches you can use in the EQ field code, including ones that apply bottom \bo, right \ri, left \le, and box borders to the equation or text.
  3. Put the cursor between the parentheses and enter the text you want to overline.
  4. To display this as text rather than a field code, right-click anywhere in the field code and select “Toggle Field Codes” from the popup menu.
  5. The text you entered into the field code displays with a line above it. When the field code displays as normal text, you can highlight it and apply various formatting to it, such as font, size, bold, color, etc.
    • NOTE: To display the field code again, simply right-click in the text and select “Toggle Field Codes” again. When you put the cursor in text generated from using a field code, the text is highlighted in gray, just like the field code.
  6. If you want the line to extend beyond either end of the text, add spaces when entering the text into the field code inside the parentheses. This is useful for creating lines with names under them for signing official documents.
    • NOTE: Field codes work in all versions of Word, for both Windows and Mac.
  7. Finish.
referensi:
https://www.howtogeek.com/ 
https://bettersolutions.com/

Related Topics:

JavaScipt String function and features


String

String Quotes

Strings can be enclosed within either single quotes, double quotes.


Backtick quotes

  • process expression

  • process function

  • multi line


Special characters



Accessing characters

Notes:
The only difference between them is that if no character is found, [] returns undefined, and charAt returns an empty string.

iterate character by character



String length



Changing the case




Searching for a substring

str.indexOf

  • returns the position where the match was found
  • -1 if nothing can be found.

str.lastIndexOf(substr, position)
There is also a similar method str.lastIndexOf(substr, position) that searches from the end of a string to its beginning. It would list the occurrences in the reverse order.

includes

The more modern method str.includes(substr, pos) returns true/false depending on whether str contains substr within. It’s the right choice if we need to test for the match, but don’t need its position

str.startsWith and str.endsWith


Sunday, June 7, 2020

JavaScript Quiz Game 1

Requirement:

quiz.html
quiz.js
quiz.css

quiz.html file code:

<div id="quiz"></div>
<button id="submit">Get Results</button> 
<div id="results"></div>

quiz.css file code:

body{
font-size: 20px;
font-family: sans-serif;
color: #333;
}
.question{
font-weight: 600;
}
.answers {
margin-bottom: 20px;
}
#submit{
font-family: sans-serif;
font-size: 20px;
background-color: #297;
color: #fff;
border: 0px;
border-radius: 3px;
padding: 20px;
cursor: pointer;
margin-bottom: 20px;
}
#submit:hover{
background-color: #3a8;
}

quiz.js file code: 

var quizContainer = document.getElementById('quiz');
var resultsContainer = document.getElementById('results');
var submitButton = document.getElementById('submit');

var myQuestions = [
    {
        question: "What is 10/2?",
        answers: {
            a: '3',
            b: '5',
            c: '115'
        },
        correctAnswer: 'b'
    },
    {
        question: "What is 30/3?",
        answers: {
            a: '3',
            b: '5',
            c: '10'
        },
        correctAnswer: 'c'
    }
];


generateQuiz(myQuestions, quizContainer, resultsContainer, submitButton);
 
function generateQuiz(questions, quizContainer, resultsContainer, submitButton){   
  function showQuestions(questions, quizContainer){ 
	// we'll need a place to store the output and the answer choices
	var output = [];
	var answers;

	// for each question...
	for(var i=0; i<questions.length; i++){
		
		// first reset the list of answers
		answers = [];

		// for each available answer to this question...
		for(letter in questions[i].answers){

			// ...add an html radio button
			answers.push(
				'<label>'
					+ '<input type="radio" name="question'+i+'" value="'+letter+'">'
					+ letter + ': '
					+ questions[i].answers[letter]
				+ '</label>'
			);
		}

		// add this question and its answers to the output
		output.push(
			'<div class="question">' + questions[i].question + '</div>'
			+ '<div class="answers">' + answers.join('') + '</div>'
		);
	}

	// finally combine our output list into one string of html and put it on the page
	quizContainer.innerHTML = output.join('');
  }   function showResults(questions, quizContainer, resultsContainer){ 
	// gather answer containers from our quiz
	var answerContainers = quizContainer.querySelectorAll('.answers');
	
	// keep track of user's answers
	var userAnswer = '';
	var numCorrect = 0;
	
	// for each question...
	for(var i=0; i<questions.length; i++){

		// find selected answer
		userAnswer = (answerContainers[i].querySelector('input[name=question'+i+']:checked')||{}).value;
		
		// if answer is correct
		if(userAnswer===questions[i].correctAnswer){
			// add to the number of correct answers
			numCorrect++;
			
			// color the answers green
			answerContainers[i].style.color = 'lightgreen';
		}
		// if answer is wrong or blank
		else{
			// color the answers red
			answerContainers[i].style.color = 'red';
		}
	}

	// show number of correct answers out of total
	resultsContainer.innerHTML = numCorrect + ' out of ' + questions.length;
  }   // show the questions 
 showQuestions(questions, quizContainer); 

 // when user clicks submit, show results 
 submitButton.onclick = function(){ 
   showResults(questions, quizContainer, resultsContainer); 
  } 
}
Reference:
https://simplestepscode.com/
http://w3schools.com/
https://codewithawa.com/

PHP CRUD dengan MySQL database

Aplikasi: Daftar Kontak Sederhana, Buku Alamat

CRUD (Create, edit, update and delete) posts

Kebutuhan:

  • PHP
  • MySQL
    • database: crud.
    • table: info.
    • field:
      • id - int(11)
      • name - varchar(100)
      • address - varchar(100).
 index.php :

<!DOCTYPE html>
<html>
<head>
    <title>CRUD: CReate, Update, Delete PHP MySQL</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <form method="post" action="server.php" >
        <div class="input-group">
            <label>Name</label>
            <input type="text" name="name" value="">
        </div>
        <div class="input-group">
            <label>Address</label>
            <input type="text" name="address" value="">
        </div>
        <div class="input-group">
            <button class="btn" type="submit" name="save" >Save</button>
        </div>
    </form>
</body>
</html>
styles.css :

body {
    font-size: 19px;
}
table{
    width: 50%;
    margin: 30px auto;
    border-collapse: collapse;
    text-align: left;
}
tr {
    border-bottom: 1px solid #cbcbcb;
}
th, td{
    border: none;
    height: 30px;
    padding: 2px;
}
tr:hover {
    background: #F5F5F5;
}

form {
    width: 45%;
    margin: 50px auto;
    text-align: left;
    padding: 20px;
    border: 1px solid #bbbbbb;
    border-radius: 5px;
}

.input-group {
    margin: 10px 0px 10px 0px;
}
.input-group label {
    display: block;
    text-align: left;
    margin: 3px;
}
.input-group input {
    height: 30px;
    width: 93%;
    padding: 5px 10px;
    font-size: 16px;
    border-radius: 5px;
    border: 1px solid gray;
}
.btn {
    padding: 10px;
    font-size: 15px;
    color: white;
    background: #5F9EA0;
    border: none;
    border-radius: 5px;
}
.edit_btn {
    text-decoration: none;
    padding: 2px 5px;
    background: #2E8B57;
    color: white;
    border-radius: 3px;
}

.del_btn {
    text-decoration: none;
    padding: 2px 5px;
    color: white;
    border-radius: 3px;
    background: #800000;
}
.msg {
    margin: 30px auto;
    padding: 10px;
    border-radius: 5px;
    color: #3c763d;
    background: #dff0d8;
    border: 1px solid #3c763d;
    width: 50%;
    text-align: center;
}

Aplikasi To-do list Dengan PHP dan MySQL

Kebutuhan:

  • database MySQL: todo.
  • table: tasks.
  • Field: id - int(10), task - varchar(255).
  • File: index.php, style.css.

index.php file:

<?php
    // initialize errors variable
    $errors = "";

    // connect to database
    $db = mysqli_connect("localhost", "root", "", "todo");

    // insert a quote if submit button is clicked
    if (isset($_POST['submit'])) {
        if (empty($_POST['task'])) {
            $errors = "You must fill in the task";
        }else{
            $task = $_POST['task'];
            $sql = "INSERT INTO tasks (task) VALUES ('$task')";
            mysqli_query($db, $sql);
            header('location: index.php');
        }
    }
 
 
// delete task
if (isset($_GET['del_task'])) {
    $id = $_GET['del_task'];

    mysqli_query($db, "DELETE FROM tasks WHERE id=".$id);
    header('location: index.php');
}
?>
<!DOCTYPE html>
<html>
<head>
    <title>ToDo List Application PHP and MySQL</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
    <div class="heading">
        <h2 style="font-style: 'Hervetica';">ToDo List Application PHP and MySQL database</h2>
    </div>
    <form method="post" action="index.php" class="input_form">
<?php if (isset($errors)) { ?>
    <p><?php echo $errors; ?></p>
<?php } ?>
        <input type="text" name="task" class="task_input">
        <button type="submit" name="submit" id="add_btn" class="add_btn">Add Task</button>
    </form>

<table>
    <thead>
        <tr>
            <th>N</th>
            <th>Tasks</th>
            <th style="width: 60px;">Action</th>
        </tr>
    </thead>

    <tbody>
        <?php
        // select all tasks if page is visited or refreshed
        $tasks = mysqli_query($db, "SELECT * FROM tasks");

        $i = 1; while ($row = mysqli_fetch_array($tasks)) { ?>
            <tr>
                <td> <?php echo $i; ?> </td>
                <td class="task"> <?php echo $row['task']; ?> </td>
                <td class="delete">
                    <a href="index.php?del_task=<?php echo $row['id'] ?>">x</a>
                </td>
            </tr>
        <?php $i++; } ?>   
    </tbody>
</table>

</body>
</html>

style.css file :

.heading{
    width: 50%;
    margin: 30px auto;
    text-align: center;
    color:     #6B8E23;
    background: #FFF8DC;
    border: 2px solid #6B8E23;
    border-radius: 20px;
}
form {
    width: 50%;
    margin: 30px auto;
    border-radius: 5px;
    padding: 10px;
    background: #FFF8DC;
    border: 1px solid #6B8E23;
}
form p {
    color: red;
    margin: 0px;
}
.task_input {
    width: 75%;
    height: 15px;
    padding: 10px;
    border: 2px solid #6B8E23;
}
.add_btn {
    height: 39px;
    background: #FFF8DC;
    color:     #6B8E23;
    border: 2px solid #6B8E23;
    border-radius: 5px;
    padding: 5px 20px;
}

table {
    width: 50%;
    margin: 30px auto;
    border-collapse: collapse;
}

tr {
    border-bottom: 1px solid #cbcbcb;
}

th {
    font-size: 19px;
    color: #6B8E23;
}

th, td{
    border: none;
    height: 30px;
    padding: 2px;
}

tr:hover {
    background: #E9E9E9;
}

.task {
    text-align: left;
}

.delete{
    text-align: center;
}
.delete a{
    color: white;
    background: #a52a2a;
    padding: 1px 6px;
    border-radius: 3px;
    text-decoration: none;
}
Referensi:
https://codewithawa.com/
https://www.bitdegree.org/

Saturday, June 6, 2020

CSS left panel layout sample

HTML code:

<!--Force IE6 into quirks mode with this comment tag-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>CSS Left Panel Layout</title>
<link rel="stylesheet" href="index.css"/>

<script type="text/javascript">
/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish=["Ular melingkar di atas pagar.", "Satu Ribu, Dua Biru, Tiga Ribu, Empat Biru.", "Kelapa di Parut, Kepala di Garuk."]
function filltext(words){
for (var i=0; i<words; i++)
document.write(gibberish[Math.floor(Math.random()*3)]+" ")
}
</script>

</head>

<body>

<div id="leftpanel">
<div class="inner-content">

<h1>CSS Left Panel Layout</h1>
<h3>Sample text here</h3>

</div>
</div>


<div id="main-content">
<div class="inner-content">

<h2>Right Panel Title</h2>
<p><script type="text/javascript">filltext(125)</script></p>
<p style="text-align: center">Footer: <a href="#">CSS Left Panel Layout</a></p>

</div>
</div>


</body>
</html>

CSS code:

/* liquid layout with the left column being static, always in view. Tested and works in IE5+, Opera7+, and Firefox. */
body{
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
height: 100%;
max-height: 100%;
}

#leftpanel{
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 200px; /*Width of left div*/
height: 100%;
overflow: hidden; /*Disable scrollbars. Set to "scroll" to enable*/
background: #f0f0f0;
color: black;
}

#main-content{
position: fixed;
top: 0;
left: 200px; /*Set left value to Width Of Left Div*/
right: 0;
bottom: 0;
overflow: auto;
background: #fff;
}

.inner-content{
margin: 15px; /*Margins for inner DIV inside each DIV (to provide padding)*/
}

* html body{ /*IE6 hack*/
padding: 0 0 0 200px; /*Set value to (0 0 0 WidthOfFrameDiv)*/
}

* html #maincontent{ /*IE6 hack*/
height: 100%;
width: 100%;
}

Reference:
http://www.dynamicdrive.com/
https://trinket.io/