Posts

HTML5: HTML Tags

The tags introduced in HTML5 are more descriptive such as: main , header , footer , nav , video , article , section , audio & many more.  These tags helps with Search Engine Optimization (SEO) and accessibility. The main tag helps search engine and other developers find the main content of your page.  Adding an image to your page: Using img element by pointing it to a specific image's URL using the src attribute. This img tag is self-closing. The img tag must come with alt attribute to help screen readers especially when the image is failed to load (might be due to heavy load, internet connection and whatnots). alt attribute should contain a description of the image to help screen readers understand it. Link to external pages: Using a (anchor) element to link to any external pages The a tag contains href attribute which contains the destination page's URL The tag should also contain anchor text to allow clickable text which will direct user to the destination page &l

What to code?

Here's for a bunch of ideas:  https://what-to-code.com/?order=POPULAR

Web Worker | Multithreading in Javascript

 1. Connect Web Worker to SQL Database. Web worker does not allow default JQUERY to be used. Alternatives: There's another alternative such as fake DOM JQUERY & importScripts() method (but unfortunately, this alternate method doesn't work for me - there were still some errors) Use fetch method: fetch('process.php').then(res => res.text())    //convert the above data (from the url) into text                 .then(body =>{                     self.postMessage(body);                 }) 2. Print all data from SQL database: After you have successfully connected to the PHP file (read no.1), you can continue step 2 which is to print all the data from the database by using for loop.  // if result is not zero, display result  if($result-> rowCount() > 0){     for($i = 0; $i < $result->rowCount(); $i++){         $row = $result-> fetch(PDO::FETCH_ASSOC);         print_r(json_encode($row));         // echo $row["user_email"] .="\n";    

How to: Display Data from Database in Pagination

1. Please refer to this post to display data in table 2. After displaying them in the table, follow the instructions attached on the comment section (//) :   //determine no of data to display per page $results_per_page = 10; //count all column from the database $sql = "SELECT COUNT(*) FROM test_user"; $res = $dbx->query($sql); $count = $res->fetchColumn(); // determine no of total pagination needed by dividing no of total columns ($count) with total data to display (10) $number_of_pages = ceil($count/$results_per_page); // determine which page number visitor is currently on if(!isset($_GET['page'])){     $page = 1; }else{     $page = $_GET['page']; } // determine the sql LIMIT starting number for the results on the displaying page $this_page_first_result = ($page-1)*$results_per_page;                          $sql = "SELECT id, user_email, user_fullname, user_address, user_city, user_zip, user_state, user_country, user_tel, user_fax from test_user

How to: Display Data from SQL Database in HTML Table - Bootstrap 5

Image
The above picture refers to the table displaying the information from an SQL database. *note: this tutorial is using Bootstrap 5 (CSS Framework) & PDO (PHP Data Object) 1. Set connection to the database <?php require_once('core.php') ?> 2. Write HTML <table>      <div class="data">              <div class="row">             <div class="col-lg-12">                 <div class="table-responsive">                     <table class="table table-striped table-hover">                     <thead>                     <tr>                         <th scope="col">ID</th>                         <th scope="col">Email</th>                         <th scope="col">Full Name</th>                         <th scope="col">Address</th>                         <th scope="col">City</th>

Errors Log: Android Studio Error I encountered & solved

 Android Studio problem [SOLVED]: [1] Error Inflate XML in activity Solution 1: 1. Remove <fragment tag from activity xml 2. Rather, replace it with a <FrameLayout 3. In activity class, simply setContentView(R.layout.fragment_register); //here, set the layout as the fragment id Solution 2 (turns out my error is actually this) 1. Check the fragment class 2. My error was I did not inflate the fragment class  ------------ *note: any button or function should be made inside onViewCreated [2] Error public void onComplete(@NonNull Task<AuthResult> task) { not succesful Solution: 1. Add "uses INTERNET" in androidmanifest.xml 2. Make sure all variables in class User are accesible (make them public) [3] Attempt to invoke virtual method 'void androidx.navigation.NavController.navigate(int)' on a null object reference Solution: 1. Change navigate method  from: navController.navigate(R.id.action_registerFragment2_to_logIn); to: Navigation.findNavController(v).navigate

Two ways to host a website on remote server (for static and dynamic website)

How to host a website on a remote server? First of all, remote server refers to server that can be accessed by a group of team which requires an URL. For example:  https://syahirahnsmn.github.io/  (this is static web page hosted on github) There are many ways to do so & there are many web hosting provider as well. One of the ways is by using github which need some simple steps: *note: this is only for static website (doesnt require database) (1) Host on github (url: username.github.io) Another way I found is by hosting the website on Heroku by connecting the Heroku profile to github. The steps are as below: *note: this is suitable for dynamic website that requires database connection [reference: https://www.youtube.com/watch?v=I4Ra-80O3R4 ] (1) Set up a Heroku account and connect to a github repository (2) Git commit project from any IDE (I am using VS Code) from github desktop -> push to github (3) Deploy the github repo manually on Heroku *note: usually the main page should b