teleren/devto huggingface dataset:
6. Expressions, Statements, if-then-else , Methods, Method Overloading
Tags: java
Published: 2020-12-10 05:48:30

#1. Expressions
Example: 
```
int score = 100;
if (score > 99){
    System.out.println("You got the high score!");
    score = 0;
}
```
In the above code `score = 100`, `You got the high score!` and `score = 0` are expressions only.


#2. Keywords
Java has 52 reserved key words


#3. if-then-else
Example: 
```
if(score>100) {
    return "Grade A";
} else if(score > 50) {
    return "Grade B";
} else {
    return "Grade C";
}
```


#4. Method
Example: 
```
public static String greetUser(String username) {
        return "Welcome" + username;
}
```
#5. Method Overloading
Example 1:
```
    public static int loggedIn(int a, int b) {
        return 0;
    }
    public static int loggedIn(int a) {
        return a + 5;
    }
    public static boolean loggedIn(int a) {
        return true;
    }
    public static String loggedIn(String name) {
        return name + " is dancing";
    }
```
All of the above are valid method overloading, but the example below is not valid:
```
    public static int loggedIn(int a, int b) {
        return 0;
    }
    public static boolean loggedIn(int a, int b) {
        return true;
    }
```
This is an error.

Another example of method overloading:
```
    public static int sum (int a, int b, int c, int d) {
        return sum(a,b,c) + d;
    }
    public  static int sum (int a, int b, int c) {
        return sum(a,b) + c;
    }
    public static int sum (int a, int b) {
        return a + b;
    }
```
Method overloading is a feature that allows us to have more than one method with the same name, so long as we use different parameters.
It is the ability to create multiple methods of the same name with different implementations.
Calls to an overloaded method will run a specific implementation of that method.
```
public static void main(String[] args) {
    System.out.println("Hello!");
    System.out.println(5);
    System.out.println(10.75);
}
```
`println` method is a great example of method overloading in the Java language. There are actually 10 methods with name **println**. We can print an integer, double, string, and so on...
Collaboration web designer/graphic designer with front end developer? 
Tags: react, sass, css, bootstrap
Published: 2020-12-10 05:47:07

Hi ! I'm a newish front end developer , who isnt the best at web design 🙃 but would like to collaborate with a web designer to make one of thier designs an actual website!🥳 I will host it through AWS s3 and even put credit where it's due as a collaboration in both git and in the footer and a contact section within the page itself! I of course will use it as a project to put in my portfolio. I will be using React, CSS/SASS, and HTML (and any other libraries needed). I would love to work with you 😁!
Flowtr Panel
Tags: typescript, programming, showdev
Published: 2020-12-10 05:30:32

Hey everyone,
I wanted to share a project that I am currently working on that I am calling Flowtr Panel. It is going to be a web interface for managing your homelab/servers. As of now, I only have the basic structure of the panel, but not a complete web interface. Below you can find more information about the project. 

## Project Info

Flowtr Panel is made with typescript and [tinyhttp](https://github.com/talentlessguy/tinyhttp). I plan to have a module/plugin loader so anyone can contribute in making plugins for the panel. Currently, there is a proxy module built-in which acts like Apache or Nginx but with a web UI. It will let you serve your websites (html/php) and proxy your services to external domains. An example of a idea for a module/plugin could be a minecraft server manager.

## Demostration

Since there is currently no documentation yet, I have created an example configuration of what it might look like in action.

![Configuration File](https://i.imgur.com/5H62jhH.png)

Below is the php loader demo:
![PHP Loader](https://i.imgur.com/UYIBPJm.png)

## Github Repository

If you are interested in checking out the source code, or are even wanting to contribute, [here is the link to the github repository.](https://github.com/flowtr/homelab-panel/)

## Wrapping Up

Thank you for reading this article about my new project! Please let me know if you have any ideas for this panel.
RUBY ON RAILS IN 2020
Tags: ruby, rails, webdev
Published: 2020-12-10 05:23:15

So hey guys , do you think of starting with ror in 2020 ? than this blog is for you guys it's just a beginner blog !

What is ror ?
- A web-application framework that includes everything needed to create database-backed web application according to the MVC (Model-View-Controller).

Should you learn ror in 2020 ?
- Despite almost 15 years since the first release of ror , the framework is still widely used among professional developer. Ruby is something far away from just fun and easy to learn programming language for those starting their software engineering career, although i found it similar to python programming.

Companies using ror :
Airbnb 
Ask.fm
Bloomberg
Dribble
GitHub
Fiverr

SO , IF YOU WANT TO KNOW MORE ABOUT RUBY AND ROR COMMENT BELOW ! HAVE A GOOD DAY 😊
Text highlighting using HTML and CSS
Tags: html, css, webdev, ux
Published: 2020-12-10 04:21:28

Web devs,

Looks like some of you are using background images for text highlighting. There is a simple and better way to do that using **CSS**.

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

So here is the **html** and **css** code for highlighting text.

**HTML**
```
<h1>
   <mark>Detect and report bugs</mark> in iOS & Android mobile apps, watchOS apps.
</h1>
```
**CSS**
```
mark, strong {
  padding: 0.2em;
  background: linear-gradient(to bottom, #d6ffff 0%, #d6ffff 100%) no-repeat;
  background-size: calc(100%) calc(50%);
  background-position: bottom;
}
```

This **CSS** works with most text tags including `<span>`, though I prefer using `<mark>` or `<strong>` to indicate the importance of the highlighted text.

BTW you need to use **calc** for **background-size** only if more calculation needs to be done. No need to use for this particular example though. Just added here for highlighting what all can be done.
What happens when you run PSQL slash commands?
Tags: postgres
Published: 2020-12-10 04:21:03

Running `\?` within a psql database gives a whole list of commands that come in handy when performing various kinds of tasks.

```sh
$ psql
psql (13.0)
Type "help" for help.

wangonya=# \?
General
  \copyright             show PostgreSQL usage and distribution terms
  \crosstabview [COLUMNS] execute query and display results in crosstab
  \errverbose            show most recent error message at maximum verbosity

  .....
```

But what are the queries executed when these commands run?

I was recently tasked to write a bash script that loops through every schema on a database and does a `pg_dump` on it for backup then uploads the backups to an external server.

Running `\dn` gives a list of schemas but it also gives the owners, which I didn't need in my case.

```sh
wangonya=# \dn                                                             
  List of schemas
  Name  |  Owner   
--------+----------
 public | wangonya
 x      | wangonya
 y      | wangonya
(3 rows)
```

I only needed the schema names so I had to look for a way to edit the query run by `\dn` to only return names.

From the psql [docs](https://www.postgresql.org/docs/13/app-psql.html):

> `-E`
> `--echo-hidden`
>
> Echo the actual queries generated by `\d` and other backslash commands. You can use this to study psql's internal operations. This is equivalent to setting the variable ECHO_HIDDEN to on.

Running psql with the `-E` flag then running the `/dn` command gives this result:

```sh
$ psql -E

wangonya-# \dn
********* QUERY **********
SELECT n.nspname AS "Name",
  pg_catalog.pg_get_userbyid(n.nspowner) AS "Owner"
FROM pg_catalog.pg_namespace n
WHERE n.nspname !~ '^pg_' AND n.nspname <> 'information_schema'
ORDER BY 1;
**************************

  List of schemas
  Name  |  Owner   
--------+----------
 public | wangonya
 x      | wangonya
 y      | wangonya
(3 rows)
```

With the underlying query executed on running the slash command, I was able to edit it get the desired result.
Dockerizing a Node.js application [2024 revised]
Tags: docker, node
Published: 2020-12-10 04:15:09

For this tutorial, I will assume you are starting a brand new Node.js application. If you already have a Node.js application you want to Dockerize, head over to Step 3.

<i>*Before starting this tutorial, please make sure you have <a href="https://www.docker.com/">Docker</a> downloaded.</i>

### Step 1
Initialize a new node.js app with
```js
npm init
```
This will give you a `package.json` file that looks something like this
```js
// package-lock.json
{
  "name": "sample_app",
  "version": "1.0.0",
  "description": "My First Dockerized Codebase",
  "author": "Your Name",
  "main": "app.js",
  "scripts": {
    "start": "node app.js"
  },
  "dependencies": {
    "express": "^4.17.1"
  }
}
```
then run `npm i` (previously `npm install`) which will generate a `package-lock.json`.

### Step 2
Next, we will create an `app.js` file

```js
// app.js
const express = require('express');
const app = express();

const PORT = [Your-port-here];

app.get('/', (req, res) => {
  res.send('Hello World');
});

app.listen(PORT, '0.0.0.0' () => {
  console.log('Server listening on Port ${PORT}');
});
```

### Step 3
Here comes the fun part...
First, create a `Dockerfile`
```
touch Dockerfile
```

Inside the Dockerfile, you will need to define the following:
```
# you can find your node version with: node --version
FROM node:15

# Create app directory
WORKDIR /app

# Install app dependencies
COPY package*.json ./

# Install dependecies
RUN npm install

# Bundle app
COPY . .

# Define your port
EXPOSE 3000

# Tell Docker how to run your app
CMD [ "node", "app.js" ]

```

### Step 4
Additional files are needed for Docker to successfully build your app.

`.dockerignore`

```
node_modules/
# anything else you want for Docker to ignore
```
`docker-compose.yml`
```
version: '3.7'   # you can find yours with python --version
services:    
    web:
        image: [your-image-name]
        build: .
        command: node app.js
        ports: 
            - "4040:4040"
        volumes: 
            - ./[your-image-name]/app
            - /app/node_modules
        depends_on:
            - mongodb
    mongodb:
        image: "mongo"
        ports:
            - "27017:27017"
```

### Step 5
Now that we have all the files, we can build and run the container.

Build a Docker container
`docker build -t [your-app-name] .`

Run the Docker container
`docker run -it -p 3000:3000 [your-app-name]`

<strong>Congratulations 🥳 </strong>
If you have made it this far, you have successfully Dockerized your Node.js app.

### Addition Docker Commands
`docker ps`
Check for running containers

`docker-compose run [app-name] npm run migrate`
Run migration and create table

`docker pull`
Pulls an image or a repository from a registry
殘影空間線上看
Tags: shadow
Published: 2020-12-10 04:13:23

名稱:殘影空間 (Shadows)片種:犯罪,懸疑編劇:–導演:陳志文主演:鄧麗欣, 姜皓文, 謝君豪, 袁富華, 凌文龍, 余香凝, 蔡瀚億, Babyjohn Choi, 伍允龍片長:1小時34分級別:待定語言:粵語上映:2020年10月27日, Tue (公映

◉ 🎬 在线观看 :|✮☛ https://tinyurl.com/yxjvrw38

香港發生一宗駭人聽聞的血案，社工虐殺家人後被捕。法醫精神科醫生徐曉靜(鄧麗 欣 飾)天生擁有特殊能力，在殺人犯的潛意識空間發現案中有案，懷疑另一精神科醫 生仁重光(謝君豪 飾)教唆病人謀殺，遂與警察阿發(姜皓文 飾)展開調查。這時另 一宗命案又起，老人被兇手剝皮掛起，手法凶殘。敎唆殺人難以搜證，令調查陷入僵 局，阿靜更被警方懷疑。金像獎演員傾巢而出，在錯綜複雜的案情下比拼演技。究竟 在人前，他們是好人，還是扮好人的壞人?
導演陳志文
演員	鄧麗欣、姜皓文、謝君豪、袁富華、凌文龍、余香凝、蔡瀚億、張建聲

殘影空間線上看
殘影空間 線上看
殘影空間 bt
殘影空間線上看小鴨
殘影空間 下載
殘影空間下載
殘影空間線上看小鴨影音
殘影空間 torrent
殘影空間bt
殘影空間 線上
殘影空間 线上看
殘影空間線上看kubo
殘影空間小鴨
殘影空間 小鴨
Shadows殘影空間小鴨
殘影空間线上看
殘影空間 下載 bt
殘影空間線上看繁體
殘影空間線上看完整版小鴨
Shadows殘影空間 小鴨
殘影空間Singapore观影

https://sites.google.com/view/jkamnskklaf/
https://sites.google.com/view/hk-2020/home
https://sites.google.com/view/kahudhhjasndergy/
Is there any direct alternative to Docsify to use React component instead of Vue?
Tags: discuss, documentation, react, webcomponents
Published: 2020-12-10 03:52:57

I'm using Docsify to document a web component library. For that I need to render those UI components, pass data, attach events etc., For this purpose, I'm using Vue components inside .md files as Docsify support those. 

Is there any plugin or other generators which does the same using React with the simplicity of Docsify (dropping in a script tag in an existig index.html will work seamlessly)?
Is an anonymous inner-type (AIT) the equivalent of creating a class instance from a class that implements an interface?
Tags: java, help, watercooler
Published: 2020-12-10 03:50:40

If I had:
```java
interface Wibble {
    public void speak();
}
```
And did:
```java
Wibble test = new Wibble() {
    @Override public void speak() {
        System.out.println("Hello!");
    }
};
test.speak();
```
would that be the same as if I did:
```java
class Wobble implements Wibble {
    @Override public void speak() {
        System.out.println("Hello!");
    }
}

class Main {
    public static void main(String[] args) {
        Wibble test = new Wobble();
        test.speak();
    }
}
```
?

###TL;DR Is making an AIT the same as making an instance of the interface, or an instance of a class that implements it, OR is it more similar to making a new class entirely?
Shorcuts in python
Tags: python, tutorial, dev
Published: 2020-12-10 03:49:04

## How to use Shortcuts 
 most of the time we come accross some codes which are similar and sometimes too long. won't it be nice if we have some shortcuts for writing our code? here are some easy shortcus use in python.
**__1. Shortcut operators:__** Operations like sum=sum+1 occur so often that there is a shortcuts
for them. Here are a couple of examples:
  *addition and subtraction Shortcuts*
```python
count=count+1 # we will rewrite it as 
count+=1

decreasing=decreasing-2 # is the same thing as
decreasing-=5
```
  *multiplication and Division*
```python
product=product*2 #can be shorthand as
product*=2
divide=divide/4 # is change to
divide/=4
```
  *Modulus,Floor and Power:*
```python
remainder=remainder%5 # this is similar to
remainder%=5
floor=floor//3 #its shortcuts form is
floor//=3
Power=Power**2 #its shorthand form is
power**=2
```
so each pairs of the statement above means the same thing and the most amazing part is that the shortcuts above work for almost all languages.
**__2. An assignment shortcut__**
Let assume we have the following codes.
```python
a = 2
b = 2
c = 2
```
A nice shortcut is :
```python
a = b = c = 2
```
**__3. List assignment shortcut__**
Say we have a list L with three elements in it, and we want to assign those elements to variable
names. We could do the following:
```python
a = L[0]
b = L[1]
c = L[2]
```
Instead, we can make it short to:
```python
a,b,c = L
```
Similarly, we can assign three variables at a time like below:
```
a,b,c = 1,2,3
```
And, as we have seen once before in my post [swapping](https://dev.to/maxwizardth/find-substring-in-string-python-13dn) , we can swap variables using this kind of assignment.
```python
a,b,c = a,b,c
```
**__4. conditional shortcuts__**
Here are some examples: 
let say we have the following stamentement
```python
if a==1 and b==1 and c==1: # first one

if 0<x and x<6:# second one

```
the shortcuts of the above statement is below:
```python
if a==b==c==0: #this is the first short form

if 0<x<6:# this is the second short form
```
another one 
```python
if 1<x and x<y and y<10: #same as
if 1<x<y<10:
```
hope you enjoy this!like and comment below.
GitHub Dark mode is Here 🎉
Tags: github
Published: 2020-12-10 03:30:57

I am really excited for this.
## The new GitHub darkmode is here.
With start of GitHub universe-2020.Github announces some pretty great features for developer like auto-merging Pull request,Big can sponsor developers with GitHub sponsor. including dark mode.

## Here are some pretty cool pics of dark mode
![GitHub dark mode](https://dev-to-uploads.s3.amazonaws.com/i/96zasihgahhbc73cb9pk.jpg)

![GitHub dark](https://dev-to-uploads.s3.amazonaws.com/i/tol3sz2mt43nob5m24vr.jpg)


## How to enable GitHub darkmode

1. Go to github.com/ <your profile name>"
2. You will now see an dark-mode toggle button with some cool svg graphics in top of your repository pin.
3. Just turn it on now dark mode is yours 😎

#### or

Goto https://github.com/settings/appearance
To enable dark mode
![GitHub enable darkmode](https://dev-to-uploads.s3.amazonaws.com/i/zzv600infg7g5e1a9q4q.jpg)
> Also you can use customized emoji skin tone

# Now Enjoy your dark mode 😍
I've noticed my skills are very limited in every language I know
Tags: python, javascript, css, php
Published: 2020-12-10 03:23:14

I was recently looking at some code I wrote a few months ago and realized that I haven't really improved much, I feel in every language that I'm familiar with I'm at about the same skill level.

Anyway my question is, Is it better to be well versed in many languages or is it better to know 1 or 2 languages very well? Thank you all in advance! 😁
Code Smell 48 - Code Without Standards
Tags: oop, webdev, codenewbie, tutorial
Published: 2020-12-10 03:12:19

*Working on a solo project is easy. Unless you go back to it after some months. Working with many other developers requires some agreements.*

# Problems

- Maintainability

- Readability

# Solutions

1. Automate your styles and indentation.

2. Enforce agreed policies.

# Sample Code

## Wrong

*Correct sample taken from Sandro [Mancuso's bank kata](https://github.com/sandromancuso/Bank-kata/blob/master/src/main/java/org/craftedsw/domain/Account.java)*

{% gist https://gist.github.com/mcsee/ef87aec745f654878ce71c844f786f17 %}

## Right

{% gist https://gist.github.com/mcsee/55ade1bd7d835ef3804e86b55ec3abaa %}

*The Right example has several other smells, but we keep it loyal to its GIT version in order to show only code standardization issues.*

# Detection

Linters and IDEs should test coding standards before a merge request is approved.

We can add our own [naming conventions](https://maximilianocontieri.com/what-exactly-is-a-name-part-i-the-quest) related to Objects, Classes, Interfaces, Modules etc.

# Examples

- [PSR2](https://www.php-fig.org/psr/psr-2/)

# Tags

- Standardization

# Conclusion

Use coding standards in your projects.

A well-written clean code always follows standards about naming conventions, formatting and code style.

Such standards are helpful because they make things clear and deterministic for the ones who read your code, including yourself.

Code styling should be automatic and mandatory on large organizations to enforce [Collective Ownership](https://wiki.c2.com/?CollectiveCodeOwnership).

# Relations

{% post https://dev.to/mcsee/code-smell-06-too-clever-programmer-37lb %}

# More info

[Naming Conventions](https://maximilianocontieri.com/what-exactly-is-a-name-part-i-the-quest)

* * *

> The nice thing about standards is that there are so many to choose from. 

_Andrew S. Tannenbaum_
The weird substring quirk
Tags: java, programming, computerscience
Published: 2020-12-10 02:58:12

Every once in a while have you ever come across a quirk in a programming language, which you quite do not understand, but yet come to terms with it.

One such quirk is the substring API which is present in Java. For starters, substring is an overloaded function - the result; there are 2 different forms of the same function.

```java
public String substring(int beginIndex)
```
Returns a new string that is a substring of this string. The substring begins with the character at the specified index and extends to the end of this string. 

```java
public String substring(int beginIndex, int endIndex)
```
Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1. Thus the length of the substring is endIndex-beginIndex.

```java
String str = "Hello, World";
String substringOne = str.substring(7);
String substringTwo = str.substring(0, 5);
```

We can quite confidentally say that the output for substringOne will be "World". But we would be wrong if we were to say the output of substringTwo would be "Hello,".

The reason being the endIndex is exclusive. The inclusion/exclusive model is standard for ranges of the Java API. One of the main advantage is that the length of the string can be used as the end point without subtracting the "-1" from the length.

```java
String apollo13 = "Houston, we have a problem";
String normalPeople = apollo13.substring(9, apollo13.length());
```
But, is this really necessary? Java already provides an overload to the substring method which captures exactly this behaviour. All I’m trying to say is that I’ve seen many coders get tripped up. I have seen most people forget about exclusion when providing the endIndex.

Let me know if you feel the same or if I am totally off base here...
Why did you decide to study software engineering?
Published: 2020-12-10 02:45:07

My first experience with coding was not the hottest. It made me feel like I didn't have the aptitude for software engineering. Many years later, though, I found myself in the office wanting to solve problems that could only be solved with coding. I decided to try my hand it again. And to my surprise, I now found the process totally enjoyable! More than just the complete satisfaction of successfully running my program, but also the iterative process of building it, the continuous learning that would feed into improving it, the consideration of all users (front end and back end), and the incredibly resourceful community online. I absolutely loved the full experience!

The only problem was that I had already begun on an economics career path and I wasn't sure if I should drop it all to start on a new career.

I struggled with the decision for over a year. But I've now decided to take the risk and embark on this journey. And I'm honestly over the moon for it!

I'm excited to eventually meld my experience in economics with software engineering to pursue a career in either the FinTech or eLearning industries.

Let's do this!