teleren/devto huggingface dataset:
Count occurrences of a character in string
Tags: python, tutorial, devops
Published: 2020-12-12 02:35:56

###How to count occurrences of a character in string
let say you were given a string and the task is to count the frequency of a single character in that string. This particular operation on string is quite useful in many applications such as removing duplicates or detecting unwanted characters. Here I am going to show you different ways of doing that.

###Method 1 : `Naive method`
just loop through the entire string for that particular character and then increase the counter when we meet the character.
###Example
you were given a variable test_string storing "allAlphabets" you were to count the number of 'l' in the string. 
Here is the codes:
```python
test_string = "allAlphabets"      
count = 0
for i in test_string: 
    if i == 'l': 
        count = count + 1  
print ("the number of l in allAlphabets is :", count) 
```
`Output :`
```
the number of l in allAlphabets is : 3
```
you can substitute with any other letter you like. you can read more on this method [here](https://dev.to/maxwizardth/counting-in-python-23mc)

###Method 2 : `Using count()`
Using count() is the easiest method in Python to get the occurrence of any element in any container or character in a string. This is easy to code and remember. the formular to count character in string with this method is 
`string.count('character')`
Let's try to use this method to solve the same problem.
```python  
test_string="allAlphabets" 
# Now we need to count the number of l
counter = test_string.count('l')   
print ("the number of l in allAlphabets is : ",counter) 
```
`Output :`
```
the number of l in allAlphabets is : 3
 ```
###Method3 : `Using collections.Counter()`
This method is not common but it also calculate the occurrence of the element across any container in Python. The way it works is similar to above two method. 
Let's see how to use it to solve the same question 
from collections import Counter#we need to import counter function.    
```python
from collections import Counter
test_string = "allAlphabets"
count = Counter(test_string)
#Counter() is a function that count from parameter in it.   
print ("Count of l in allAlphabets is : ",count['l'])
```
`Output :`
```
Count of l in allAlphabets is :  3
```
did you get it? this is the formula to illustrate it below
`from collections import Counter` 
`variableForCounting` = `Counter(container or string)`
`Num_ofCharacter` = `variableForCounting['character']`.
Now from the above method you can use any of the one you think the best. enjoy!
10 Reasons to Love React
Tags: react, javascript, webdev, html
Published: 2020-12-12 02:32:15

-> It is simple for beginners to learn
-> Part of MERN stack
-> Reusable components 
-> Huge Community
-> Scope of Jobs

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

-> Famous apps like Tinder, Spotify, TikTok can be done by learning React
-> Use of JSX (JSX : Mixture of HTML and JavaScript together)
-> Can be used for app dev
-> Even Netflix, IMDB, PayPal, Coursera use React
-> Import and export Rules(Too silly reason but syntax sentiment)
#VisualizeIT: How Sketchnoting is helping me perform better at work
Tags: visualizeit, sketchnoting, storytelling, beginners
Published: 2020-12-12 01:51:22

> *This is the first post in a multi-part series about my journey with #visualstorytelling through workshops hosted by Microsoft Reactor and LetsSketchTech communities. Join us and #VisualizeIT for yourself!*

✨ Quick plug: Creative Journaling for Technologists Workshop ✨✨✨
When: Dec 12, 1pm EST
Where: [Meetup Page] (https://www.meetup.com/Microsoft-Reactor-Toronto/events/274684784/)
✨

####What is Sketchnoting?
Sketchnoting is a form of visual notetaking, but it can be so much more than that. As someone who is a visual learner, doodling is a way I release stress. However, doodling has been proven to help you concentrate, be more creative, process emotions, alleviate stress, learn better, and think outside the box. Don't just take my word for it:

###Watch: {% youtube 7fx0QcHyrFk%} 

####A few ways doodling helps me _at_ work are:

#####1. Find the main points
Prioritizing has never been easier; Once you find the main point and doodle around it, it creates a hierarchy of tasks and keeps the focus on the key goal. Lists used to be scary, a big jumble of things that need to be done. I would feel dejected when I couldn't get through the day's tasks. Learning about fun ways to doodle out your day from the [Let's Sketch Tech](https://letssketchtech.com/) community has been a game changer.

#####2. Increase mindfulness
Even just drawing a continuous line that curves and twists across a piece of paper can be enough to relax us. Ever had one of those moments where you’re writing a note down and a totally unrelated idea comes into your mind? Work journals are an excellent way of composing, building and refining them. I find that happening more and more since keeping a visual work diary.

#####3. Recognize achievements
For one reason or another, many of us are programmed to criticize ourselves for getting things wrong, and not taking the time out to celebrate wins – however small. With doodling, I make little stars around the good things that happened in the week and give myself a little pat on the back.

**Try it out yourself! Learn all about journalling, working with impact and purpose for your role, and track your accomplishments on Dec 12 at 1pm EST at:** [**VisualizeIT: Creative Journaling for Technologists**] (https://www.meetup.com/Microsoft-Reactor-Toronto/events/274684784/)

Speaker: Brittney Braxton | [@mintiiB - Website] (https://brittneybraxton.com/)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3wx6n66qdm7x6499pq1b.jpg)

> _This free online virtual event series is being organized by the [Microsoft Reactor] (microsoftreactor.com) team in collaboration with [Azure Advocates] (https://dev.to/azure) the [Lets Sketch Tech] (letssketchtech.com) community._
Online Hash Calculator
Tags: security, hacking, hash, crypto
Published: 2020-12-12 01:45:53

Online Hash Calculator lets you calculate the **cryptographic hash value of a string or file.**

Multiple hashing algorithms are supported including MD5, SHA1, SHA2, also checksums like CRC32, and many other algorithms used in programming and hacking.

![Hash Calculator](https://dev-to-uploads.s3.amazonaws.com/i/se8bhukv4cxenvn7jtb9.png)

##Online hashing for programmers & hackers

Why use it? Because it's easy to use and does what it says, nothing more, nothing less.

You can hash a string, a binary file of any format and hex bytes (e.g. `0xDEADBEEF`).

Look at the example of how it calculates the hash for the **DevTo rocks!** string:

![Online Hash Calculator in action](https://dev-to-uploads.s3.amazonaws.com/i/jnf7ptghjbividjg9yze.png)

##Where is it?

You can find online hash calculator at our site, it's free, no ads, no logins, no bs - https://www.pelock.com/products/hash-calculator

## Update (02 Feb 2021)

* File drag&drop added
* Auto scrolling to the list of calculated hashes
Last Update for 2020
Tags: javascript, html, css, webdev
Published: 2020-12-12 01:32:44

---
title: Last Update for 2020
published: true
description: 
tags: javascript, html, css, webdev
//cover_image: https://direct_url_to_image.jpg
---

I started documenting my web dev journey in April of 2020. 
I am very glad that I decided to do so because it has really helped me stay on track because I always had something to go back to and read. It was also helpful to have somewhere to share my progress with others because like myself, there are many people that are learning interesting stuff about web dev as well. 

I am glad to read my comments when I have them because they always offer additional insight and improvements. 

The thing I learned about web dev and learning in general is that the more I learn, the more I learn how much I don't know. 

I had to restart my web dev course twice between April and December due to the updated course that got released as I was started another course. 

I am glad that I went back and looked over the updated information. Web dev is always changing and evolving even while I am trying to catch up and learn the basics. 

Sometimes it can be overwhelming and feel like I can never get started because as soon as I finished learning something I have to go back and relearn it because something has changed. 

I believe that is what makes technology and web dev interesting and challenging but also rewarding because it truly never stops. There is no end. You literally have to start somewhere and keep going no matter how much change occurs. 


Lastly, my current plans is to finish up the updated course of web dev before the end of the year, then in January jump into the data structures and algorithms course to build a foundation in computer science that will make me a stronger developer in the long-term.
And done! - Part3 of OSD0.4
Published: 2020-12-12 00:35:47

Let's start with the technical first, because my professor wants me to and it's dry ZzZ. But who am I to tell, I'm not the expert on Gatsby or NextJS or anything really. So [here](https://dev.to/jameesy/gatsby-vs-next-js-what-why-and-when-4al5) is the technical stuff about them, enjoyy!
My real work is on migration between them. The first big step was converting JS/JSX files to TS/TSX files, because they want to switch to TypeScript. And I agree, TypeScript is safer, and you can choose to be unsafe and write exactly in JavaScript way without problem. In this step, most of my work was writing interfaces and classes with data members with type-check. So later on, I can have safer type-check when use the variables of those types. And of course the process is never perfect. There are always some variables you have no clue what types the can be. The more difficult problem was converting JSX variable types check to TSX because they are not always the same. Some of them are deprecated, some of them don't have documentations support. And lastly I have to be careful about dependencies. Some of JS version don't have `@type` equivalent (90% do), and I really don't want to install random stuff on `package.json` just to getaway with compilation errors.
The second big step was converting Gatsby's libraries, functions to NextJS's equivalents. There are official documentation on how to migrate from Gatsby to NextJS, so it should be easy right? Ya, but it's only for simple components which were used the way they were documented. How many of us, and how much of the code were actually used in the way in documentation? As any project got bigger and more complex, the code will get more and more different from documentation (in my experience, I could be wrong). So it just take a lot of time to find the right way doing this. I guess that's why we have this job lol.
Is this CSS valid (does it work properly)?
Tags: help, css, webdev, html
Published: 2020-12-12 00:27:46

```css
body * {
    /* Styling */
    position:absolute;
}

body * * {
    position:relative;
}
```
Will this work the way I expect?

I don't know how many sub-elements I'm going to add yet, so I can't really try it, since I'm working on a project, blah blah.

Would this make all elements nested inside of body-nested elements `relative` positioned, or does `*` work in the way it works as the normal "universal selector", where it can only be overridden by `!important`?



Thanks in advance!
Cheers!
How to add tags and categories to your WordPress pages
Published: 2020-12-12 00:25:20

Have you created your website with the CMS WordPress or had it created? Then you will have noticed that you can only add categories and keywords to your posts, but not to your pages.

Unfortunately, the CMS WordPress does not provide for adding categories and keywords to pages. With a view to good usability, an orderly structure of your website, thematic search functions or SEO, it makes perfect sense to categorize pages as well as articles and to provide them with tags or keywords.

##**If you want to add categories and keywords to your WordPress pages, you can use this small code snippet or our free plugin for WordPress.**

If you are familiar with PHP and the creation and editing of WordPress themes, you can add the following code snippet to your functions.php. Please note, however, that the code snippet will be overwritten as soon as your theme receives an update.

**If you want to implement the snippet permanently in your functions.php, you should create a child theme with an unchangeable functions.php.**

If you are not very familiar with PHP or changing WordPress themes or creating child themes, we provide you with a small, free WordPress plugin for download here 🙂

[Download-Link: widilo®Cats4Pages, Plugin for WordPress, Version 1.0.1](https://widilo.de/downloads/goodies/widilo®cats4pages.zip)

Now add this code snippet at the end of your functions.php:

```php

/*
widilo®Cats4Pages // add tags and categories to WordPress pages
@see https://widilo.de/freebie-wie-du-schlagwoerter-und-kategorien-zu-deinen-wordpress-seiten-hinzufuegen-kannst/
@since 1.0.0
*/
function widilo_add_cats_to_pages() {
register_taxonomy_for_object_type( 'post_tag', 'page' );
register_taxonomy_for_object_type( 'category', 'page' );
}
add_action( 'init', 'widilo_add_cats_to_pages' );

/*
widilo®Cats4Pages // include all tags and categories in wp_query
@see https://widilo.de/freebie-wie-du-schlagwoerter-und-kategorien-zu-deinen-wordpress-seiten-hinzufuegen-kannst/
@since 1.0.1
*/
function widilo_add_cats_to_pages_query($wp_query) {
if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');
if ($wp_query->get('category_name')) $wp_query->set('post_type', 'any');
}
add_action('pre_get_posts', 'widilo_add_cats_to_pages_query');

```

After you have saved the changes in the functions.php, you will see two new columns in your WordPress page overview: Categories and Keywords. Congratulations you did it!

Happy Coding : )
Building a Web Application with Sinatra
Tags: ruby, mvc, flatiron, heroku
Published: 2020-12-12 00:03:42

Welcome to Recipe Freak, my first [web application](https://recipe-freak.herokuapp.com/).
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kxtk2vr4teujcnsv7y84.png)

My first web app, built in Sinatra, allows users to create, share, and do other fun things with recipes. It's essentially a social media for recipes. 

A video walkthrough can be found [here:](https://drive.google.com/file/d/1UA1V9tlh0dKzORnZs6XfSYd-My1EVbeu/view?usp=sharing)

This is my second Flatiron School project, and my first web application. I started my app with the gem 'corneal' which gave a very convenient template for a Sinatra/ActiveRecord based, application. From there, I tweaked things to what I wanted. I began by outlining my application, defining all the models and their relationships. It was tough to decide what should be attributes and what should be separate models, but I figured that making more models would give me more flexibility down the road. Though they weren't perfect at first, the relationships ended up being as follows: 

User: -has_many :recipes, has_many :likes

Recipe: -belongs_to :user, belongs_to :cuisine, has_many :steps, :has_many likes, :has_many bags

Cuisine: has-many :recipes

Ingredients: belongs_to :recipe

Steps: belongs_to :recipe

Likes: belongs_to :recipe, belongs_to :user

Bag(for a feature of adding a recipe to a grocery list): belongs_to :recipe, belongs_to :user

Once the relationships were created, it was time to create database migrations to fit these models. After that, it was time to work on views and controllers. I didn't feel like working on migrations or controllers was that difficult, but the views proved to be an excellent challenge. 

Using erb files was liberating since I could embed ruby code and send instance variables from the controllers to the views. I also included a few JavaScript functions for the front end to manipulate the DOM. I had to let the user dynamically add and delete ingredients, as well as adjust serving sizes for recipes. JavaScript was my only viable option for this. I also spent a long time with CSS styling, which was surprisingly difficult. I am sure once I start digging into CSS/JS fundamentals it will become more intuitive to organize my html elements for styling and DOM manipulation. 

I learned so much from this project. having learned the concepts of http and routing, MVC, user authentication, good object oriented design, and more - the past few weeks have been a tsunami of information. However, I am understanding it more everyday. I ended up pushing my app to Heroku, which was the most exciting part of the project. I am so excited for the future and projects to come. 

If you're interested in checking out the code, view it on github [here](https://github.com/nicklevenson/recipe_freak)
Day 275 : Run Back
Tags: hiphop, code, coding, lifelongdev
Published: 2020-12-12 00:00:45

_liner notes_:
- Professional : Pretty good way to end the week. Had a meeting with the team to talk about the coming year. Spent the rest of the work day learning React Native.

- Personal : During a break, I did a quick run back to my folks' place to pick up some things I have there. While I was there, I saw that I got an order for a shirt. Luckily I had the design and size still in stock at my folks' place. While I was there, I did my laundry. Great thing about being remote is that I was able to get back to work over there.

![A pine tree forest in the foreground and a mountain range in the background at sunset in Gold Creek Pond, WA, USA](https://dev-to-uploads.s3.amazonaws.com/i/ek70rwgqyz3jrpcmecva.jpg)

Last night, I got my application to take the link to the archive that sent by the Vonage Video API after the live stream is over and upload it to Vimeo. Thought I had to use FFMPEG to be able to download the video to server's local storag, then upload to Firebase storage and then upload to YouTube. Ran into some issues, but doing research, I may have found another way of getting the file, that won't require a huge space on the server's temporary storage. It involves using streams. I was working on it then fell asleep. Tonight, looking to work on it, but maybe after I finish putting together the radio show for tomorrow.

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube 6X_rmv02_FE %}
Deploy from CodePen to Netlify in less than 30 seconds
Tags: blogvent, netlify, codepen
Published: 2020-12-13 05:57:23

---
title: Deploy from CodePen to Netlify in less than 30 seconds
published: true
date: 2020-12-12 00:00:00 UTC
tags: blogvent, netlify, codepen
canonical_url: https://www.netlify.com/blog/2020/12/12/deploy-from-codepen-to-netlify-in-less-than-30-seconds/
---

Welcome to Blogvent, day 12!

[CodePen](https://codepen.io/) is one of our favorite places to experiment, prototype, and build fun web projects. Deploying a Pen to Netlify is super speedy, and a great way to get your projects live on your own domains for all to see!

It took longer to write this blog post than it took to take a Pen and deploy it to Netlify. It was so fast, in fact, that we recorded it:

{% youtube wo-n8kxEJMo %}

<iframe width="560" height="315" src="https://www.youtube.com/embed/wo-n8kxEJMo" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

First, export your Pen to a ZIP file. Then, go to [netlify.com/drop](https://app.netlify.com/drop?utm_source=blog&utm_medium=codependrop-cs&utm_campaign=devex), then drag the `dist` folder from your exported Pen onto the page, and click the resulting new website. Done!

That’s right, in less than 30 seconds, a Pen on Netlify. Woo!
Web Monetization chapter in the Kernel's Gaming Guild
Tags: gamedev, webmonetization, kernel, learning
Published: 2020-12-13 00:26:39

---
title: Web Monetization chapter in the Kernel's Gaming Guild
published: true
date: 2020-12-12 00:00:00 UTC
tags: gamedev, webmonetization, kernel, learning
canonical_url: https://end3r.com/blog/kernel-gaming-guild/
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/7u5umrcnow2jhbto9pc2.png
---

I’m happy to announce I’m supporting the efforts behind the [Kernel’s Gaming Guild](https://www.notion.so/Gaming-Guild-cd674c92bf9f4bd3ac0a736bae10f256) created by [Paul Gadi](https://twitter.com/polats) and the [Gitcoin](https://gitcoin.co/) folks - from both Web Gamedev and Web Monetization perspectives.

![End3r's Corner - Kernel Gaming Guild](https://end3r.com/blog/media/kernel-guild.png)

> Starting from the ground up - the **Gaming Guild** helps Web 3 projects build from the right foundations of trust, and working our way towards the nitty-gritty details of building not a game, but an experience of learning and growing through a game. The curated set of resources and guided learning workshops will lead a learner (or a team) through the journey of developing games and being mindful of the art that is game-design. It’s worth noting that every crypto project requires some thought into game design, as this is ultimately the best corollary to the token ecosystems we are creating in **Web 3**.

The [Kernel](https://kernel.community/) learning track will be split into eight modules, and those will touch on the intersection between games and Web 3, Ethereum, financial systems, attention economy, incentives, and growth - check the syllabus below for some initial details:

![End3r's Corner - Kernel syllabus](https://end3r.com/blog/media/kernel-syllabus.png)

You can expect a solid support from the experts in those fields, but also game development in general - including me. Beside the gamedev knowledge and experience I’ll be more than happy to share, I’m also going to support the **Web Monetization API** chapter in one of the modules.

The **Gaming Guild** is now [open to applications](https://apply.kernel.community/), but those have to be quick - you have time till Tuesday, **December 15th**. Accepted participants will be notified at the beginning of January next year, and the actual program will begin around the end of that month.
Change the plan, oops - Part 2 of OSD0.4
Published: 2020-12-11 23:58:52

Remember no tax on dreams? Cool huh. But reality, time and deadlines can still definitely hit you.
So I was reading, which is good, but I was distract to read more about AI than the code. And other classes' projects, exam, group works also took away my time. I know I would not make it to code a feature for the AI project. I rescaled my goal to be more realistic, which is working on three "family" issues (ya that is the name from requirements docs). And I went back to my good old friend Seneca/telescope repo.
This project is working on something pretty big to them, migrating to NextJS from GatsbyJS. There are many issues for this migration so it is really fit my need for "family" issues. I saw some students pick up 5-6 issues but I only took 3, because the requirement was 3, and if other student failed the planning like me, they should have a chance to pick some issue to pass the class. And the aspect of difficulty, JS and TS is easier than Python for AI for sure (Source: bros, trust me).
Finished adjustment, now I should finish these tasks/issues or I will fail the class.