teleren/devto huggingface dataset:
How to read Excel files in Java?
Tags: java, oop, programming
Published: 2020-11-27 20:34:30

In this article, we will learn how we can read data from an excel file.
In Java, read the excel file is not the same as reading a word file because of the cells in the Excel file. JDK does not provide direct API to read or write Microsoft Excel or Word documents. We have to rely on third-party libraries that Apache POI.

#What Apache POI?

Apache POI (Poor Obfuscation Implementation) is a Java API for reading and writing Microsoft documents in both .xls and .xlsx formats. It contains classes and interfaces. Apache POI library provides two implementations to read the excel file:
o HSSF (Horrible spreadsheet format) Implementation: This indicates an API that works with Excel 2003 or earlier versions.
o XSSF (XML spreadsheet format) Implementation: This indicates an API that works with Excel 2007 or later.
Interface and Class in Apache POI
interfaces
o Workbook: This is an Excel Workbook. This is the interface with HSSFWorkbook and XSSFWorkbook application.
o Sheet: This is the interface that represents an Excel worksheet. A sheet is the central structure of the workbook, which is a network of cells. Sheet interface extends java.lang.Iterable.
o Row: This is the interface that represents a row of the spreadsheet. Row interface extends java.lang.Iterable. There are two concrete classes: HSSFRow and XSSFRow.
o Cells: This is an interface. It is a high-level representation from a cell in a spreadsheet row. HSSFCell and XSSFCell implement the interface cells.
classes
[Read more](https://www.kodlogs.com/blog/2224/how-to-read-excel-files-in-java)
Why to learn Firebase as a Front end developer?
Tags: webdev, database, javascript, node
Published: 2020-11-27 20:32:57

### First, What is Firebase?

**Firebase** is Google Cloud platform developed by Google for creating mobile and web applications. It was originally an independent company founded in 2011. In 2014, Google acquired the platform.

It can be used as the backend for your project as it has a lot of great services like :

* __Cloud Firestore__ is a flexible, scalable database for mobile, web, and server development.

* __Real-time Database__ is a noSQL database and It's better used in smaller projects.

* __Hosting__ you can host your website like that www.example.web.com

* __Authentication__ provides ready Authentication backend for login and sign up, You can have a free database with millions of users.

* __Cloud Storage__ for storing images and files

* __Cloud Functions__ is a hosted, private, and scalable Node.js environment where you can run Backend JavaScript code.

There are a lot of more services for Firebase like Machine learning but we'll stick to what benefits a Frontend Developer.

So, let's go back to our question
### Why to learn Firebase as a Frontend Developer?

As a Frontend developer always wants to learn about consuming APIs and read, write, update and delete data so you search for free APIs to train on but you don't have Full Control on the API so Firebase will let you code whatever your idea to make a Full-Stack Application without learning backend.

Firebase has free and paid plans (except Authentication is free )but you can use the free plans for learning and making projects for your portfolio. [Here's a link for Firebase Pricing Plans](https://firebase.google.com/pricing/).

Here [The Net Ninja](https://www.youtube.com/thenetninja) you can learn Firebase Stuff from Shaun the owner of the channel.

---

[**Subscribe to my newsletter**](https://amrelmohamady.hashnode.dev/)

Twitter: [@Amr__Elmohamady](https://mobile.twitter.com/Amr__Elmohamady)
How to call javascript file in html?
Tags: javascript, programming, webdev
Published: 2020-11-27 20:32:49

Like Cascading Style Sheets - CSS (which allows the style to be embedded within the document with the style tag), JavaScript code can be embedded within an html document using the script tag.

```
<script type = "text / javascript">
// Code
</script>
```

The code can also be found in a separate document (with a js extension) that is called to include the functionality within the HTML document.

To include an external style sheet, the (link) tag is used. In JavaScript the same tag (script) is used but the src attribute is added with reference to the file to be added.


The reference to the file can be a relative path - that the file is in the same directory where the html is or in a folder within the same domain - or it can be an absolute path to a resource - http://example.com /mi-code.js

##Tip:

If you call a file using http: // but the page is viewed through https: // a warning will be generated (that you want to include non-secure content on a secure page). To avoid this, two diagonals are simply used and the protocol is not specified.

```
// File within the domain of the page / site
<script type = "text / javascript" src = "file.js"> </script>
// External file, the // are used so that the page
// can be viewed via http or https
<script type = "text / javascript" src = "// example.com/file.js"> </script>
```

[Read more](https://www.kodlogs.com/blog/2267/how-to-call-javascript-file-in-html)
JavaScript Syntax Highlighter 
Tags: javascript
Published: 2020-11-27 20:13:29

---
title: JavaScript Syntax Highlighter 
published: true
description: A simple JavaScript syntax highlighter
tags: javascript
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/uisjqifgf97sygbc3dda.png
canonical_url: https://github.com/victorqribeiro/syntax
---

# JavaScript Syntax Highlighter

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uisjqifgf97sygbc3dda.png)

[Live Version](https://victorribeiro.com/syntax)

## How to use it

Add the file `syntax.min.js` to the end of your code and it will automatically highlight every `<code>` tag that you have in your page. Or use the defer attribute:

```html
<script src="syntax.min.js" defer></script>
```

The script will create `<spam>` tag for every reserved word, variable, methods and numbers so you can target them with CSS.

```css
code {
  font-family: Consolas,"courier new";
  color: #EEE;
  background-color: #333;
  padding: 2px;
  font-size: 105%;
  display: block;
  white-space: pre;
  counter-reset: line;
}

code > div {
  counter-increment: line;
  display: block;
  min-height: 1em;
}

code > div::before {
  content: counter(line) '\A0';
  display: inline-block;
  width: 4ch;
  text-align: left;
  -webkit-select: none;
  color: #666;
}

.reserved {
  font-weight: bold;
  color: #55C;
}

.methods {
  font-weight: bold;
  color: green;
}

.variable {
  color: orange;
}

.comment {
  color: gray;
}

.number {
  color: red;
}
```

Fell free to change anything you like to better suit your needs.

Source code [here](https://github.com/victorqribeiro/syntax).
How to Catch a few exceptions?
Tags: java, oop, programming
Published: 2020-11-27 20:24:40

In this article, we will look at how to catch a few exceptions, and how to write them in the correct order so that users get meaningful messages for each type of exception.
Catching a few exceptions
**Let us take an example to understand how to deal with a few exceptions.**

```
class Example {
   public static void main (String args []) {
      try{
         int arr [] = new int [7];
         arr [4] = 30/0;
         System.out.println ( "Last Statement try block");
      }
      catch (ArithmeticException e) {
         System.out.println ( "You do not have to divide a number by zero");
      }
      catch (ArrayIndexOutOfBoundsException e) {
         System.out.println ( "Accessing array elements beyond the bounds");
      }
      catch (Exception e) {
         System.out.println ( "Some other Exception");
      }
      System.out.println ( "Out of the try-catch block");
   }
}
```

##Output
You do not have to divide a number by zero
Out of the try-catch block
In the example above, the first catch block gets executed as code we have written to the try block throws ArithmeticException (because we divided that number by zero).
Now let's change the code a bit and see the change in the output:

```
class Example {
   public static void main (String args []) {
      try{
         int arr [] = new int [7];
         arr [10] = 10/5;
         System.out.println ( "Last Statement try block");
      }
      catch (ArithmeticException e) {
         System.out.println ( "You do not have to divide a number by zero");
      }
      catch (ArrayIndexOutOfBoundsException e) {
         System.out.println ( "Accessing array elements beyond the bounds");
      }
      catch (Exception e) {
         System.out.println ( "Some other Exception");
      }
      System.out.println ( "Out of the try-catch block");
   }
}

```
[Read more](https://www.kodlogs.com/blog/2208/how-to-catch-a-few-exceptions)
Test your JavaScript skills
Tags: javascript, programming, codenewbie, 100daysofcode
Published: 2020-11-27 20:24:19

![test-javascript-knowledge](https://learn.coderslang.com/js-test-3.png)
Hey there! I've recently started posting colorful JS snippets that can be used to [test your JS knowledge](https://learn.coderslang.com/tags/js-test). Each post has an explanation that you can use to check if your thinking was right.

I vividly remember how I felt crushed and lost in my first interviews. I'd be very happy if I help someone avoid the feelings I had at that time. 

Looking forward to your feedback!

[Learn Full Stack JavaScript](https://js.coderslang.com)
FileZilla Basics
Published: 2022-08-16 21:11:29

---
title: FileZilla Basics
published: true
date: 2020-11-27 20:20:33 UTC
tags: 
canonical_url: https://blog.livialima.net/filezilla-basics
---

**[FileZilla](https://filezilla-project.org/)** is a free and open-source FTP client.

## Basic Connection

Using Quickconnect bar:

- Enter the remote _hostname_ or _IP address_ at **Host**.
- Enter the remote _username_ at **Username** and the _password_ at **Password**.
- **Port** : 21 for FTP, 22 for SFTP
- Click **Quickconnect**. Example: ![filezilla-quickconnect.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1657052694575/NrfMzkwjS.png)

Using Site Manager:

- On the **File** menu, click **Site Manager**.
- In the Protocol list box, select **FTP**.
- In the **Host** text box, type the _hostname_ or _IP address_.
- In the **Port** text box, type **21**.
- In the **Logon Type** list box, select **Normal**.
- In the **User** text box, type your _username_.
- In the **Password** text box type your _password_.
- Click **Connect**. ![filezilla-site-manager.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1657053565727/95XRqIDCJ.png)

## Add a private key for SSH authentication

- On the **Edit** menu, click **Settings**.
- Under Select Page, click **Connection** , and then click **SFTP**. A list of currently installed private keys appears.
- Click **Add key file**. Select the key, and then click **Open**. ![filezilla-publickey.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1657053591501/7Rr-eaUAT.png)

- On the **File** menu, click **Site Manager**.
- In the Protocol list box, select **SFTP**.
- In the **Host** text box, type the _hostname_ or _IP address_.
- In the **Port** text box, type **22**.
- In the **Logon Type** list box, select **Normal**.
- In the **User** text box, type your _username_.
- Leave the **Password** text box blank.
- Click **Connect**. ![filezilla-site-manager-sftp.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1657053613723/qp7k7j_OO.png)

After a few seconds, FileZilla establishes a connection to the server. FileZilla may display a message that the server's host key is unknown. To trust the server permanently, select the Always trust this host, add this key to the cache check box, and then click OK.

## Transferring files

Once a remote connection is open, you can navigate on the server almost like navigating on your local machine. The current local directory tree is displayed on the left side of the main window by default, the remote directory is displayed on the right side.

To transfer directories and/or multiple files:

- Select the files.
- Right-click the selection.
- Then you can click on Upload/Download in the popup menu.

Or drag the files from one side and drop them on the other side.

![filezilla-transfer.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1657053636134/gKPj6p3hM.png)

More about FileZilla can be found at the [manual page](https://wiki.filezilla-project.org/Documentation).
How to solve indentation error in python?
Tags: python, oop, programming
Published: 2020-11-27 20:15:09

All of your class contents (doc strings, methods, and class variable definitions) need to be indented to the same level.

#Currently either:
* The doc string above your def__init__ is indented too far or
* The __init__ method is not indented enough.

It is up to you to choose which one is right - but PEP8 would say that the doc string is indented too far.

##BTW - The normal format for a doc string is :

* 1st line is a one line summary
* then a blank line
* and the rest of the docstring is a more details description of the class.

OR

* 1st line is a one line summary
So may be your docstring should be:
'
Class for storing movie data

This class is for storing a large amount of movie
data such as:
- title,
- story summary,
- poster images,
- profits,
- ratings,
- links to trailers on youtube
`

[Read more](https://www.kodlogs.com/blog/2351/how-to-solve-indentation-error-in-python)
First unique character in string java
Tags: java, oop
Published: 2020-11-27 20:11:11

Find the initial unique char in string. For instance, string is “KodLogsforKodLogs”, then the outcome should be ‘f’ and if the given input  is “KodLogsTest”, then the outcome should be ‘K’.
#Find string's first unique char
##Technique 1: Hashmap and Two-string method traversals.

###Approach
A char is said to be unique if its incidence in the string is one. This challenge could be finished professionally using a hash_map which will plot the char to there particular incidences and in which we can concurrently bring up-to-date frequency of any char.

```
class KodLogs{ 
    static final int Number_OF_CHARS = 256; 
    static char count[] = new char[Number_OF_CHARS]; 
    static void getCharCountArray(String str1) 
    { 
        for (int i1 = 0; i1 < str.length(); i1++) 
            count[str.charAt(i1)]++; 
    } 
 
    /* returns index of first unique char */
    static int firstNonRepeating(String str1) 
    { 
        getCharCountArray(str1); 
        int index1 = -1, i1; 
        for (i2 = 0; i2 < str1.length(); i2++) { 
            if (count[str.charAt(i2)] == 1) { 
                index1 = i1; 
                break; 
            } 
        } 
        return index1; 
    } 
    // Driver function
    public static void main(String[] args) 
    { 
        String str1 = "kodlogsforkodlogs"; 
        int index1 = firstNonRepeating(str1); 
  
        System.out.println( 
            Index1 == -1
                ? " all char are repeating or str "
                      + "is empty"
                : "unique char is "
                      + str1.charAt(index1)); 
    } 
}
```
###Output
`unique char is "f"`

##Technique 2: Hashmap and single string traversal

###Approach:
Count an array inspite of hash_map of maximum number of chars(256)
[Read more](https://www.kodlogs.com/blog/2383/first-unique-character-in-string-java)
what is the default initial value of a string?
Tags: java, oop
Published: 2020-11-27 20:06:18

#Crude Data Types
The Java programming language is statically-composed, which implies that all factors should initially be announced before they can be utilized. This includes expressing the variable's kind and name, as you've just observed: 
`int geart = 1;`

Doing so tells your program that a field named "gear" exists, holds mathematical information, and has an underlying estimation of "1". A variable's information type decides the qualities it might contain, in addition to the tasks that might be performed on it. Notwithstanding int, the Java programming language upholds seven other crude information types. A crude sort is predefined by the language and is named by a saved watchword. Crude qualities don't impart state to other crude qualities. The eight crude information types upheld by the Java programming language are: 

##Byte:
The byte information type is a 8-bit marked two's supplement whole number. It has a base estimation of - 128 and a greatest estimation of 127 (comprehensive). The byte information type can be helpful for sparing memory in enormous clusters, where the memory reserve funds really matters. They can likewise be utilized instead of int where their limits help to explain your code; the way that a variable's reach is restricted can fill in as a type of documentation. 

##Short:
The short information type is a 16-bit marked two's supplement number. It has a base estimation of - 32,768 and a most extreme estimation of 32,767 (comprehensive). Likewise with byte, similar rules apply: you can utilize a short to spare memory in huge clusters, in circumstances where the memory reserve funds really matters. 

##int:
By default initial values of string , the int information type is a 32-digit marked two's supplement whole number, which has a base estimation of - 231 and a most extreme estimation of 231-1. In Java SE 8 and later, you can utilize the int information type to speak to an unsigned 32-digit number, which has a base estimation of 0 and a greatest estimation of 232-1. Utilize the Integer class to utilize int information type as an unsigned whole number. See the segment The Number Classes for more data. Static strategies like compareUnsigned, divideUnsigned and so on have been added to the Integer class to help the number juggling activities for unsigned whole numbers. 

##Long:
The long information type is a 64-cycle two's supplement whole number. The marked long has a base estimation of - 263 and a most extreme estimation of 263-1. In Java SE 8 and later, you can utilize the long information type to speak to an unsigned 64-digit long, which has a base estimation of 0 and a greatest estimation of 264-1. Utilize this information type when you need a scope of qualities more extensive than those gave by int. The Long class additionally contains strategies like compareUnsigned, divideUnsigned and so on to help math activities for unsigned long. 
[Read more](https://www.kodlogs.com/blog/2422/what-is-the-default-initial-value-of-a-string)
Java - Converting Between Numbers and Strings
Tags: java, oop, codenewbie
Published: 2020-11-27 20:01:40

In this post, you will learn how to convert from int to String, from float to String, and from String to int or to float. With this you can easily convert between Java data types.

For example, converting a string to an integer, or an integer to a string. For this we are going to use the methods:
* Integer.parseInt
* Double.parseInt
* String.valueof

Lets see how it is done.

#From number to string
To convert from double or int to String in Java, we are going to use the String.valueOfalready an overloaded method for various data types.
```
int integer = 123;
double double = 123,123;
// To convert from number to string:
String integerAsString = String. valueOf (integer);
// Same for the float
Floating StringAsString = String. valueOf (double);
```
And in this way we will have the number converted to a string.

#String to number conversion
For the opposite case, when we want to convert a string to double or int , we invoke Integer.parseIntor Double.parseDoubleto receive the string: [Read more](https://www.kodlogs.com/blog/2426/java-converting-between-numbers-and-strings)
How to read from file in java?
Tags: java, oop, computerscience
Published: 2020-11-27 19:57:38

In this article, I am going to make you learn how to read stuff from a file in java. This is simple to learn and I have placed three files for your reference.

#Approach

* So as you can already see I have created this Indian.txt file and I added three more records to it, you can see in the below file. So it has four records and a record is pretty much a row of data. So now let's go ahead and figure out. As we don't know how to access it from a Java program so that's what I'm going to be explaining you today.
* We can use scanner object to read from our keyboard using system.in but we can actually use scanner to read from a file as well so let's go ahead and first make a private scanner variable.
* So name scanner and just make a method to open the file first.  So public void open file () and put try to open the file so set scanner variable  and again put a new scanner just put new file and place Indian.text.
* Instead of reading from your keyboard it's actually going to read from this Indian.text file and if we get any errors place catch those errors exceptions e and print something like good nods fine file looks good enough so now we have a method to open the file easy enough
* Make a method to read the data from that file so public void just name it like read a file. The next thing we want to do is create a while loop, and put your file name which is X with hasNext() which is a built in method.
* Now each of these records has an ID number a first name and a last name in Indians.text file, so we're going to want three variables to hold those string a and let's go ahead and copy that actually we're going to put string = x .next(); and this is going to be b and c.
* It going to assign 20 equal to a then it's going to assign Buckey equal to B and Roberts equal to C and then print those out so system.out.printf, and print just three string variables are going to print it out.
* It's going to keep printing those out until it gets to the end of the file and then it's going to break out that while loop. So that's actually the only thing we need in this read file method. So now we just need that one last method and what this is going to do is close the file
* All we want this to do is close that file X and now looks like we got everything. Check for errors.
* Now start putting it in our main and put read file and now let's go ahead and put our open file r dot read file and r dot close file right there.
* To open it read the stuff from it and close it when we're done with it. So now let's go ahead
* and run this and we'll see what we got. We have got pretty much exactly what is in our text file. It just printed all this out it stored.  It got three new variables store this in a b c print out and the file and a broke out. [Read more](https://www.kodlogs.com/blog/2447/how-to-read-from-file-in-java)
Laravel Jetstream ကို Bootstrap နဲ့ တွဲသုံးမယ်။
Tags: myanmar, laravel, bootstrap
Published: 2020-11-27 19:56:58

> Laravel Jetstream မှာတော့ ui အတွက် [Tailwind css](https://tailwindcss.com) ကို default အနေနဲ့သုံးထားပါတယ်။ [Tailwind css](https://tailwindcss.com) ဆိုတာ utility-first framework ဖြစ်ပြီး တော်တော်ရေးလို့ကောင်းတာမို့ tailwind ကို သုံးစေချင်ပါတယ်။
  
Bootstrap ရဲ့ အသင့်သုံး components တွေ၊  ရိုးရှင်းတဲ့ layouts တွေ သုံးပြီး Admin Panel တည်ဆောက်ဖို့ ကျွန်တော်အသုံးပြုတဲ့ နည်းလမ်းကို ပြောချင်ပါတယ်။

အရင်ဆုံး laravel 8 project တစ်ခု create လုပ်ပါမယ်။

```bash
composer create-project --prefer-dist laravel/laravel blog
```

Jetstream ကို install လုပ်ပါမယ်။ Jetstream မှာ livewire နဲ့ inertia.js ဆိုပြီး frontend stack နှစ်ခုရှိပါတယ်။ ကျွန်တော်ကတော့ အခုပြမယ့် နမူနာမှာ inertia ကိုပဲသုံးပါမယ်။

```bash
composer require laravel/jetstream
php artisan jetstream:install inertia
```

Jetstream မှာ bootstrap ကိုသုံးဖို့အတွက် [Jetstrap](https://github.com/nascent-africa/jetstrap) ဆိုတဲ့ package ကိုသုံးပါမယ်။

```bash
composer require nascent-africa/jetstrap --dev
```

Jetstrap ရဲ့ အလုပ်လုပ်ပုံက jetstream သွင်းကတည်းက အသင့်ပါလာတဲ့ tailwind နဲ့ရေးထားတဲ့ class တွေကို bootstrap ရဲ့ class တွေနဲ့ အစားထိုးလိုက်တာပါ။

အခု tailwind ရဲ့ class တွေကို bootstrap ရဲ့ class တွေနဲ့ အစားထိုးပါမယ်။

```bash
php artisan jetstrap:swap inertia
npm install
npm run dev
php artisan migrate
```

ဒါဆို Laravel Jetstream ကို bootstrap နဲ့သုံးလို့ရပါပြီ။

[Jetstream Documentation](https://jetstream.laravel.com/1.x/introduction.html) နဲ့ [Jetstrap Documentation](https://github.com/nascent-africa/jetstrap) မှာ ထပ်မံ လေ့လာဖို့ အကြုံပြုလိုပါတယ်။