teleren/devto huggingface dataset:
Day 330 : Keep On
Tags: hiphop, code, coding, lifelongdev
Published: 2021-03-16 22:01:59

_liner notes_:
- Professional : No meetings today so I was able to work on my demo application. Added some more logic to the game. I was getting a weird bug, but it was a check I forgot to put in. Everything looks to be working good now. I tried to fix another bug with the AR, but I think it's something to do with the Web Component and I can't find a way around it. Just need to work on some styling of buttons.

- Personal : Last night, I worked on admin section of my side project. Think I got it as far as I can with the data I'm able to create now. I need to be able to do some other stuff elsewhere in the project to change the data in the database so that the admin panel can reflect the changes. One last thing I was thinking about for the admin before I move on is to create the upload directory when an event is created so that it's already there when people upload their parts. Also got to watch the latest episode of "Attack on Titan". Took way longer than normal because the video kept buffering because my cell reception wasn't great.

![Very tall waterfalls in the middle of the jungle in Sewu Waterfall, Indonesia](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p9c6bbgff0xcol9xzkw6.jpg)

Last month when I would write these blog posts around this time, it would be starting to get dark outside. Since the time shift on Sunday, it's been super sunny and I forget that it's getting late. haha. Been backing up tracks from last year to the cloud. Doing it now while I'm on the park WiFi. haha I want to finish up what I can with the admin section and maybe start the dashboard section where things will be uploaded for the events created in the admin panel. The dashboard section will show different things depending on roles and what is assigned to each user. This is the biggest project I've ever worked on. Hopefully it all works out. Want to take my time to make sure it's quality. Just got to keep on working on it a little at a time.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube E5WrhD-Q47g %}
100 Bytes Of Wisdom: Day 27
Tags: career, journey, advice, engineering
Published: 2021-03-16 21:37:29

---
title: 100 Bytes Of Wisdom: Day 27
published: true
description: Bytes of Wisdom is a new project by Sam Jarman that brings together snippets of advice for software engineers
tags: career, journey, advice, engineering
//cover_image: https://direct_url_to_image.jpg
---

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

Bad engineering is going into a problem-solving phase with a bias towards your favourite potential solution. This is absolutely absurd yet it happens all the time, especially in software engineering and especially online. This is becoming too common online, and it’s super, super sad to see.

I want to go even further than this. I want to say its bad engineering to even like a technology or tool. If you like it, you'll have a bias towards it when it comes to problem-solving, and you'll be a worse problem solver (aka engineer) for it. 

Heads up: As with any terse bit of advice, there will be exceptions of course, and subtleties and nuance that can't possibly be captured in a Byte of Wisdom. This has been what I've experienced, I'd love to hear yours in the comments too!

You can catch up with all the other bytes at http://bytesofwisdom.com/
Are you involved in hiring or interviewing for your company?
Tags: discuss, career, startup
Published: 2021-03-16 21:32:39

I'm working on an open source recruitment product to help match devs to roles using their detailed stack analysis.

**We seek input from team leaders and senior devs who are involved in hiring or interviewing candidates.**

I'd like to understand if a tool that improves the quality of the applicants would help you recruit better team mates faster. The YES-answer seems obvious, but there are many nuances that may turn it into a NO.

If you are involved in hiring/interviewing, we'll be forever grateful for 5 minutes of your time and will be more than happy to give you early access to our product.

If you are not, but know someone who is, we'd really appreciate an intro or at least the name.

Cheers,
Max
Nevertheless, Pikachu! Coded in 2021!
Tags: wecoded
Published: 2021-03-16 20:59:34

**My most recent achievement was…** I will be speaking at Microsoft Reactor TelAviv. It's not an achievement yet, but that's how I view my achievements; my next big thing!

**Advocating for myself looks like…** creating. Building and breaking code or designs or communities gives me confidence and (re)builds up my self-esteem.

**My biggest goal is…** my mission. Recreating stories, enhancing lives. We'll definitely need another blog post to dive into this.

**My advice for allies to support underrepresented folks who code is...** create. Create the space you want to be. Create the future you want to see :).
PentesterLab: File Include
Tags: security, ctf, codenewbie, vuln
Published: 2021-03-16 20:41:51

A lot of applications need to include files to load classes or to share some templates between multiple web pages. A File Inclusion Vulnerability allows an attacker to access unauthorized or sensitive files on the web server or to execute malicious files by making use of the `include()` functionality.(2)

# How?
The File Include Vulnerabilities come from a lack of filtering when a user-controlled parameter is used as part of a file name in a call to an including function (require, require_once, include or include_once in PHP for example). 

If the call to one of these methods is vulnerable, an attacker can manipulate the function to load their own code which __can lead to:__
 - Local File Include: LFI. A local file is loaded, read, and interpreted, such as directory traversal to read arbitrary files.
 - Remote File Include: RFI. A remote file is retrieved and interpreted.
 - If the arbitrary code contains an opening PHP tag, the file will be interpreted as PHP code.(1)




## Testing
If you are on a website, such as PentesterLabs File Include Lab, and you can see an error message once you inject a special character (`"`) into the url parameter:
```
Warning: include(intro.php'): failed to open stream: 
No such file or directory in /var/www/fileincl/example1.php on line 7 
Warning: include(): Failed opening 'intro.php'' 
for inclusion (include_path='.:/usr/share/php:/usr/share/pear') 
in /var/www/fileincl/example1.php on line 7
```

If you read the error message carefully, you can extract a lot of information such as:
 - The path of the script: /var/www/fileincl/example1.php.
 - The function used: include().
 - The value used in the call to include is the value we injected intro.php' without any addition or filtering.

From here you can also use the methods used to detect directory traversal and to detect file include, such as applying the `../../../etc/passwd` technique in the URL.





# Mitigation
 - By default, modern PHP disables loading of remote files, thanks to the configuration option: allow_url_include but that doesn't mean that it's not exploitable if the PHP version is not current.
 - Applying proper filtering of user-controlled parameters or supplying users with specific parameter options.


<hr>

Happy Hacking
![](https://media.giphy.com/media/l3vRmVv5P01I5NDAA/giphy.gif)

#### References 
1. https://pentesterlab.com/
2. https://resources.infosecinstitute.com/file-inclusion-attacks/#gref
3. 
4. 



###### Please Note that I am still learning. If something that I have stated is incorrect please let me know. I would love to learn more about what I may not understand fully.
Just Enough CSS for Developers to Know!
Tags: css, webdev, showdev
Published: 2021-03-16 20:30:32

# How CSS works ?
**Selectors:**
CSS Selectors define the elements to which a set of CSS rules apply.
**Specificity:**
Specificity is the means by which browsers decide which CSS property values are the most relevant to an element.
**Cascade:**
The cascade is an algorithm that defines how to combine property values originating from different sources.

# How to render an element?

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wlk2oyg1zg4b5u75d1tq.PNG)

# How to render where I want ?
**Postioning**: The position CSS property sets how an element is positioned in a document.

**Float:** The float CSS property places an element on the left or right side of its container, allowing text and inline elements to wrap around it.

# How to render the entire row of elements?
**Flex:**
The flex CSS shorthand property sets how a flex item will grow or shrink to fit the space available in its flex container.

# How to render the entire page as I wish?
**Grid:**
The grid CSS property is a shorthand property that sets all of the explicit and implicit grid properties in a single declaration.
**Layout:**
A CSS Layout mode,sometimes simply called layout, is a algorithm that determines the position and size of the boxes based on the way they interact with their sibling and ancestor boxes.


# How to layout on different screen size ?
**Media Queires:**
Media queries let the presentation of content be tailored to a specific range of output devices without having to change the content itself.
**Responsive Design:**
Responsive Design is a team used to describe an approach to web design or a set of best practices,used to create a layout that can respond to the device being used to view the content.

# How to make it Beautiful?
- Font
- Colours
- Gradients
- Backgrounds

# How to make it more interesting?
- Animations
- Transitions
- Transform

# How to make Dev faster and Organised?
Using CSS Pre-processor:
Sass Less,Post CSS or any pre-processor.

# How to ease Teamwork and Seperation?
BEM(Block Element Modifier):
The BEM methodoogy is a popular naming convention for classes in HTML and CSS.It's goal is to help developers better understand the relationship between the HTML and CSS in a given project.

That was it for this little article. I got to learn so much from this. And I hope you also find this useful. Thank u so much! 😀
Elasticsearch as a primary database?
Tags: elasticsearch, database, bigdata, datascience
Published: 2021-03-16 20:13:14

A little thing about our dear Mr. ES.

Elasticsearch is a distributed, free and open search and analytics engine for all types of data, including textual, numerical, geospatial, structured, and unstructured. Elasticsearch is built on Apache Lucene. Lucene is an inverted full-text index. This means that it takes all the documents, splits them into words, and then builds an index for each word. Everything here also applied to Apache Solr since both still use lucene library.


Great, now after these definitions, a few things we will like to point out so we use it properly. To start off:


1. Elasticsearch is not a transactional database – yes, it saves data but what you will need from a database is for it to be fully ACID compliant for multiple documents storage. For example, if you tried bulk indexing (bulk inserting) a document into Elasticsearch and for some reason due to space or red cluster or some other factor only a few passed, with Elasticsearch it won’t do “All or nothing”, which means it is supposed to roll back all in the transaction but here it would not. So I do not suggest you use it for things that are of transactional nature. For example financial record.


2. Elasticsearch under high load makes indexing a tough job making real-time searches hard this is because indexing and refreshing (making data available when indexed for reads) is an expensive process when documents during insertion are many (100,000+ per sec, sometimes less depending on Hardware and other factors). It’s a trade off, but some who use the lucene directly have figured some ways around, like twitter https://blog.twitter.com/engineering/en_us/topics/infrastructure/2020/reducing-search-indexing-latency-to-one-second.html


3. In terms of CAP Theorem, it does not fully meet the full requirement of strong consistency but that of a weak one. It a good AP system. It is distributed and makes sure it is highly available. If a storage system is not CP then DO NOT use it for financial records or things that are of transactional nature. Does not need to be relational for it to be a CP system. Some NoSQL databases are CP systems. https://www.ibm.com/cloud/learn/cap-theorem


###Recommendations


1. Elasticsearch must be used a derived storage system to take advantage of its speed. Here, data in a derived system is the result of taking some existing data from another system and transforming or processing it in some way. If you lose derived data, you can recreate it from the original source.


2. Elasticsearch should be used at places where you will need almost or near real time searches or record displays. It will easily do better than your standard database when it comes to reads.


3. Elasticsearch is great for analytics. I do not recommend that you perform expensive aggregate queries which can be done on ES on your live database, not to mention when you need to include joins to achieve that.
🧑‍💻 Getting session data in your Sapper server routes and components
Tags: svelte, sapper, express, api
Published: 2021-03-16 19:42:53

If you're building a non-trivial Sapper app, you likely need access to your current user in your Sapper server routes as well as your components. In this short article I'll show you how to do both, let's go! 🚀 

---

# Create a session middleware

Create a normal Express middleware that assigns your session data to `req.session` so we can use it in the Sapper middleware:

```js
// src/middlewares/session.ts
export function session() {
  return async (req, res, next) => {
    // Get your user somehow, maybe via cookies/JWT
    const user = await someMethodToGetUser();

    req.session = { user }

    next();
  };
}
```

---

# Add middleware to your server

In your `src/server.js`, add the session middleware right before your `sapper.middleware` and pass in the session data to Sapper:

```js
app.use(session());
app.use(sapper.middleware({ session: (req) => req.session }));
```

---

# Use in your Sapper server routes

Now you can use your session data in your server routes:

```js
// src/routes/api/me
export async function get(req, res) {
  res.json(req.session);
}
```

Now you can ping `/api/me` to get the current user session.

---

# Use in your Svelte components

You can also use the session store in your Svelte components:

```html
<script>
  import { stores } from "@sapper/app";
  const { session } = stores();
</script>

{#if $session.user}
  Logged in
{:else}
  Logged out
{/if}
```

---

# Bonus: Typescript support

To support Typescript, create a `src/types.d.ts` file and add the following:

```ts
interface User {
  id: string
  email: string
  // anything else you need...
}

interface Session {
  user?: User
}

declare namespace Express {
  export interface Request {
    session?: Session;
  }
}
```

---

# 🏁 Wrapping up

Thanks for making this far, hope this was helpful! 👋

Hat tip to @babeard on the [Svelte Discord](https://discord.gg/PNX5tQYa) for the suggestion of using a regular middleware to get the data to Sapper sessions.

---

_Thanks for reading! Consider giving this post a ❤️, 🦄 or 🔖 to bookmark it for later._ 💕

_Have other tips, ideas, feedback or corrections? Let me know in the comments!_ 🙋‍♂️

_Don't forget to follow me on Dev.to ([danawoodman](https://dev.to/danawoodman)), Twitter ([@danawoodman](https://twitter.com/DanaWoodman)) and/or Github ([danawoodman](https://github.com/danawoodman))!_
Helping Humanity via Project Universe
Tags: opensource, community, humanity, collaboration
Published: 2021-03-16 19:23:23

Project Universe's community is creating a free globally accessible school disguised as a sci-fi MMO preparing people for our interplanetary future

Here's a 3-minute video explaining how you can help us help Humanity:

https://www.youtube.com/watch?v=zXwEAgN68-Y
Spring boot properties file tips
Tags: java, spring, springboot
Published: 2021-03-16 18:44:50

Setting a variable with the value of a property from .properties file (note how spring does automatic type conversion to int)
```
	@Value("${some.property}")
	private int SOME_PROPERTY;
```

Use a default property value if the specified property is not present
```
	@Value("#{'${prop.val.specific:${prop.val.default:}}'}")
	private String PROP_VALUE;
```

Setting comma separated values to a List
```
	@Value("#{'${comma.separated.property}'.split(',')}")
	private List<String> COMMA_SEPARATED_PROPERTY;
```
De-duplicate arrays in Python, Perl and Ruby
Tags: perl, python, ruby, programming
Published: 2021-03-16 18:33:03

![Duplicate](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9bl8efyc0c6kllhtsx8c.png)

Today some short codes for the essential task that is de-duplication! :smile:

## Python
Starting with python, we use the properties of data containers. Here using an intermediate dictionary: 
```python
array = [1, 2, 1, 2, 1, 2]
array = list(dict.fromkeys(array))
```

Or similar approach using a `set`:
```python
array = [1, 2, 1, 2, 1, 2]
array = list(set(array))
```

## Perl
The elegant `uniq` method:
```perl
my @dups = (1, 2, 1, 2, 1, 2);
@nodup = uniq @dups;
```
You have to install and `use` [List::MoreUtils](https://metacpan.org/pod/List::MoreUtils) which is a VERY famous Perl CPAN module.

But if you want to do not use a module, here is my "go-to" (no-module) trick:
```perl
my @dups = (1, 2, 1, 2, 1, 2);
my @nodup = do { my %seen; grep { !$seen{$_}++ } @dups };
```

The idea behind is like the first Python (intermediate hash).

## Ruby
Ruby takes adventage of the "almost everything in ruby is an object" so it's simple with the [uniq](https://apidock.com/ruby/Array/uniq) method:
```ruby
array = [1, 2, 1, 2, 1, 2]
nodup = array.uniq
```

## It's your turn

Please comment yours :smile: in Python, Perl, Ruby or any other language!
[DON'T STAY BEHIND]Study these topics to see yourself becoming a confident Web devloper
Tags: webdev, html, css, javascript
Published: 2021-03-16 18:05:14

Note:This is not a roadmap.It's just a list of topics which i feel people tend to forget after studying web development.So here are some topics which could read and refresh them on the weekend.

## MUST know Browser Concepts:
- History
- Document
- Location
- Navigation
- pageXOffset
- Screen
- Alert
- Print
- resizeBy and resizeTo

## MUST know HTML Concepts:
- Attributes
- Base URI
- nth-child
- siblings
- appending child
- insert before and after
- remove child

## MUST know Javascript Concepts:
- mouseover Vs mouseenter
- keydown Vs keypress Vs keyup
- double click
- right click
- debounce
- throttle
- prototypal inheritance
- focus vs blur
- drag and drop
- try-catch-throw-finally
- error types

## MUST know TypeScript Concepts:
- Class Inheritance
- Interfaces
- Enums
- Type Assertions
- Generics
- Intersection Types 

> You can google out the topics mentioned above and get the resouces to read and watch.All the best 
Happy Learning!!
> Would be glad to know about the topics that you think should get added onto any of these list.
Comment down below 👇
Search engine building tutorial, that supports advanced search syntaxes
Tags: search, fts, webdev, database
Published: 2021-03-16 17:46:24

- It should support `AND`, `OR`, `NOT`; and perhaps brackets `()`.
- Another part of it, though, is about optimization and fuzzy searches.
  - Fast even for a large body of text.
  - Realizes pluralization.
  - Forgiving of minor typos.

## Advanced search syntaxes

I have thought about this a lot in the past.

- [Letting users search the database with a simple one-liner string (and let user decide which field to search)](https://dev.to/patarapolw/letting-users-search-the-database-with-a-simple-one-liner-string-and-let-user-decide-which-field-to-search-242n)
- [What features would you want for a `q` Querystring parser? (e.g. full-text-search, or more?)](https://dev.to/patarapolw/what-features-would-you-want-for-a-querystring-parser-e-g-full-text-search-or-more-370)

The easiest way is to use [lunr.js](https://lunrjs.com/guides/searching.html)'s syntaxes.

- Default connector is `AND`.
- To make an `OR`, use `?expression`.
- Search is normally case-insensitive, i.e. `a` and `A` means the same thing.
- `+expression` means exactly match, and case-sensitive.
- `-expression` means negation.
- Not only `:`, but also `>` and `<` is used to specify comparison. For example, `+foo:bar`, `count>1`.
- Date comparison is enabled.
  - Special keyword: `NOW`.
  - `+1h` means next 1 hour. `-1h` mean 1 hour ago.
    - Available units are `y (year)`, `M (month)`, `w (week)`, `d (day)`, `h (hour)`, `m (minute)`.

You can see my experiment and [playground](https://q2search.herokuapp.com) here.

{% github patarapolw/qsearch no-readme %}

## Full text search and fuzzy search

I made a list, here.

{% post https://dev.to/patarapolw/what-s-your-favorite-full-text-search-implementation-4659 %}

- Algolia
- Elasticsearch, Lucene, Solr
- Google custom search

How does it compare to search engines with web crawlers?

- Yahoo
- Bing
- DuckDuckGo
- Yandex
- Baidu

What about pure JavaScript implementations?

- js-search
- lunr, elasticlunr

RDBMS and NoSQL's feature?

- SQLite FTS4, FTS5
- PostgreSQL plugin
- MongoDB

Or, some other implementations, like Python's Whoosh?

## Implementing both together

It is easier if you use RDBMS and NoSQL's features. PostgreSQL, MySQL and MongoDB (but not SQLite) allows you to create an index on a TEXT column, and make a full-text index.

Furthermore, PostgreSQL also has [pgroonga](https://pgroonga.github.io/), that does not only have more language support than native tsvector; but also can index anything, including `JSONB`.

Now comes the algorithm for the syntax. [I made it for PostgreSQL in another project.](https://github.com/patarapolw/cjclub/blob/9f9c47260e7471d64e3def0c86cc3fea0ac36669/packages/server/src/util/token.ts#L16)
SQL tips that will make you productive from day1 at your job.
Tags: sql, database, devops, devjournal
Published: 2021-03-16 17:43:41

In this post,I'm going to write the SQL skills which i feel usually required in the day to day responsiblities of a developer.
### Topic1: Window Functions

### Topic2: CTE and WTH

### Topic3: Query Optimization 

### Topic4: Organized, Clean Syntax

### Topic5: User Defined Functions

But for the interview prep specifically you may not need the above 5 but you should have these ready:

### 1.) COALESCE and CASE WHEN
### 2.) Subqueries 
### 3.)COUNT DISTINCT
### 4.)Self Joins
### 5.)Different join types
## Here is a Bonus tip for you:
There are lot of keywords in SQL but do you know they follow up an order of precendence.
## From >Join> Where > Group By> Having> Select> Order By> Limit

Happy SQL Learning !
What is JAMstack (video)
Tags: javascript, react, netlify, database
Published: 2021-03-16 17:29:53

Hey internet and welcome to another one of my explainer videos, in which we are going to demystify JAMStack. What it is, why to use it and it's evolution over time.

In this video we discuss the technologies and services that can potentially be used in the JAMstack.

{% youtube hqG8hg2l03k %}

_______

Other links:
In most videos I use Tabnine as my A.I autocompletion tool. You can download it for free here: http://bit.ly/tabnine-free​

If you would like to buy me a coffee, well thank you very much that is mega kind! : https://www.buymeacoffee.com/aniakubow​

Sign up for weekly coding tips from my newsletter partnership: https://bit.ly/JS-tips​

You can also find me on:
Twitter: https://twitter.com/ania_kubow​
Instagram: https://www.instagram.com/aniakubow​

#codingbootcamp​​​ #coding​