teleren/devto huggingface dataset:
Best Ways to Convert a String to Number in Javascript
Tags: javascript, webdev, beginners, codenewbie
Published: 2020-05-20 16:33:44

Converting a string to number (*or a number to string*) might be one of the most common operations in Javascript. There are always several ways to convert a string to number, [what is the best one?](https://www.hadev.fr/blog/how-to-convert-a-string-to-number-in-javascript-JvFm9rzK-)

## parseInt()

The [parseInt()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseInt) function parses a string argument and returns an **integer** of the specified radix (the base in mathematical numeral systems).
```js
console.log(parseInt("42"));
// expected output: 42

console.log(parseInt("42abc"));
// expected output: 42
```
`parseInt()` can also convert non-decimal numbers by using the second optional parameter.
```js
console.log(parseInt("f", 16));
// expected output: 15

console.log(parseInt("0xf"));
// we don't need to pass the second parameter because parseInt
// detect the prefix "0x" which means the number is hexadecimal
// expected output: 15
```

## parseFloat()
The [parseFloat()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/parseFloat) function parses an argument (*converting it to a string first if needed*) and returns a **floating point number**.

```js
console.log(parseFloat(4.23));
// expected output: 4.23

console.log(parseFloat('4.23abc'));
// expected output: 4.23

console.log(parseFloat('abc'));
// expected output: NaN
```

## Number()

[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number) is a Javascript built-in object. It can be used to convert string to **integer** or **floating point number**.

```js
console.log(Number("42"));
// expected output: 42

console.log(Number("42.3"));
// expected output 42.3
```
However, it **cannot** handle trailing non-numeric characters like `parseInt` or `parseFloat` 
```js
console.log(Number("42abc"));
// expected output: NaN

console.log(Number("42.3abc"));
// expected output NaN
```

## Mutiply by 1
Using the *feature* of Javascript of assimilating data types, we can convert a string to  number easily.
```js
console.log("42" * 1);
// expected output: 42

console.log("42.3" * 1);
// expected output 42.3
```
Just like `Number`, this method **cannot** handle trailing non-numeric characters.

## Unary operator '+'
This might be the simplest way to convert a string to number in Javascript even though it's not very well-known.
```js
console.log(+"42");
// expected output: 42

console.log(+"42.3");
// expected output 42.3
```
Same as the 2 approches above, this approach **cannot** handle trailing non-numeric characters.

## Conclusion
All the methods have cons and pros, make sure to choose the one that fit your need, your team and your work environment.
WallBox -a photo app
Tags: octograd2020, kotlin, android
Published: 2020-05-20 16:33:37

## **WallBox**

### Demo SS
https://github.com/dilipsuthar97/WallBox/blob/search_using_searchActivity/README.md
 
### Code Link
https://github.com/dilipsuthar97/WallBox

### How I built it
I built this project for the Android platform using Android Studio and I used Kotlin programming language to build this project.
I pushed this project on GitHub as open-source so, that anyone can contribute to this project.

This app is a wallpaper app made using Unsplash API. In this user can explore thousands of HD photos, download and set photos to their device home screen wallpaper. Users can search for photos, collections and explore other user's profiles from Unsplash.

### Features
- Explore Photos
- Explore Collections
- Explore other user's profile
- Share profile
- Explore user's photos, collections
- Search for photos, collections, and user profiles
- Search by voice
- Download photos in different resolutions
- Set photos to their home screen wallpaper
- Sign in to their profile
Project : Humanoid human interaction
Tags: octograd2020, githubsdp
Published: 2020-05-20 16:33:01

During my graduation in 2020, I've built an AI with my friend that can take inputs from students and evaluate them based on Bloom's Taxonomy.
Bloom's taxonomy is a standard model used to evaluate the performance of students in academics on the basis of six categories. The six categories are as follows :
- Create
- Evaluate
- Analyze
- Apply
- Understand
- Remember

Knowing the exact scores in these categories, an instructor can quickly and efficiently help the student improve their understanding.
{% wikipedia https://en.wikipedia.org/wiki/Bloom%27s_taxonomy %} 

The project was deployed directly on a humanoid robot. The robot in question is "NAO" which is developed by [SoftBank robotics]
(https://www.softbankrobotics.com).
## Prototype demo of the project
{% youtube GN2vIu_WPw0 %}
In the video, the NAO robot is not using google assistance or Alexa, we had built our own parser to properly incorporate the features we needed.
## How we built it 
The project was built using Python and Java. 
We had also used Heroku cloud database to store information and host a frontend to quickly add/remove questions to the robot. Thanks to GitHub student pack, We had received credits from Heroku to afford the worker dyno. 
JetBrains' IntelliJ IDEA and PyCharm has been a HUGE! help throughout the project. 
SendGrid was used to email students their respective result cards.
We had also used IBM Watson's cloud and speech engines.

We've used several similarity and semantic indices to check for a question's exact meaning and evaluate it. example, if there is a question that states "What is Java?" and someone answers "Java is a programming language" or "Java is used to program cross-platform applications" then both of these will be evaluated as right and will be given grades. We are using a set of answers which are matched with the answer received from the student based on these indices. We are not doing a keyword match.

## Additional Thoughts
At the start of this project we never thought we would be able to do it but thanks to all the support from GitHub student pack it was possible. we had faced multiple obstacles while building this project but solving each of it one by one was very satisfying. It was a very research-oriented project which I think would definitely help us automate exams completely. we had to collect responses from students all over the university so that we can find an optimal threshold for similarity to work, finding proper weights for the questions and points etc. I would say it was a very fun project.
Unfortunately, the code was stored in the university's local computer and it is closed due to the pandemic so we were not able to upload it on GitHub.

Finally, I would like to give a huge shoutout to everyone who had helped me during the project and special thanks to GitHub student pack for providing such amazing tools for free.
Projects done as Bachelor/Masters Student
Tags: octograd2020, github, education, devgrad2020
Published: 2020-05-20 16:30:56

Hey, I am a computer science/software engineering student from Stuttgart, Germany. I am convinced that open source is the way to go, so I try to do my best to contribute my share to it.
Besides my studies, I also worked as a system operator, security administrator and lecturer at a college. During my bachelor's and master's program, I did some working-student jobs in the finance industry and a little social volunteering. Currently, I am in the last year of my study and work some hours per week as a freelancer in a german financial company.

In my student time I also created a few private projects which are, of course, open source...

---
**Smart-Home** related code in [Home-Assistant](https://www.home-assistant.io/) and in also some integration for it, like
* [Sure Petcare Integration](https://www.home-assistant.io/integrations/surepetcare/) 🐾 to support your connected pet or cat flap in Home-Assistant. ([Sure Petcare](https://www.surepetcare.com))
* [Horizon HD Recorder](https://www.home-assistant.io/integrations/horizon/) 📺 to control your Horizon via Home-Assistant (a receiver of german cable-tv provider Unitymedia)
* [PyGlow](https://github.com/benleb/PyGlow) 🌈 a Python library to control [PiGlow](https://shop.pimoroni.com/products/piglow), a small Raspberry Pi LED Hat

and also in [AppDaemon](https://github.com/home-assistant/appdaemon) itself and apps for it, like
* [AutoMoLi](https://github.com/benleb/ad-automoli) 💡 a fully automatic light management based on motion and other smart features.
* [EnCh](https://github.com/benleb/ad-ench) 👩‍⚕️ to ensure your Home-Assistant entities will not run out of battery, not have undesired states and other checks.
* [NotiFreeze](https://github.com/benleb/ad-notifreeze) ❄️ which reminds to close windows if temperature difference inside/outside exceeds a specified threshold
* [Healthcheck](https://github.com/benleb/ad-healthcheck) 🏥 a simple health check app that is providing an API to use as a docker-compose health check for AppDaemon or similar.

and standalone smart home tools, like
* [miblepy](https://github.com/benleb/ad-automoli) 🌴 🌡️ ⚖️ which fetches data from various (Xiaomi/Mijia/Mi) Bluetooth LE devices and push it to a MQTT broker in a coordinated, sequential manner

**Libraries** powering the smart home stuff
* [surepy](https://github.com/benleb/surepy) 🐾 Library for the Sure Petcare API. Used by the Sure PetFlap/CatFlap Connect smart flaps.
* [horimote](https://github.com/benleb/horimote) 📺 Library for controlling the Horizon HD-Recorder of Unitymedia Germany.

**Security**-related projects I contributed to include
* [Pwnagotchi](https://pwnagotchi.ai) 🐛
E7: How To Build A Design System
Tags: ux, ui, design, designer
Published: 2020-05-20 16:26:37

💪In this video we will find out:
- What is the design system?
- How to design a style palette
- About: Color, Shadows, TypeScale, Border radius, Spacing scale, Letter spacing
- How to make it work for all of your cases




⬇️Previous episodes:
- [Are You New to UX? Here Are The Best 5 Tips (And How To Actually Make Them Work)](https://dev.to/eleftheriabatsou/e2-are-you-new-to-ux-here-are-the-best-5-tips-and-how-to-actually-make-them-work-4id4)
- [Should Designers Learn To Code & Why It's Not A Good Question] (https://dev.to/eleftheriabatsou/e1-should-designers-learn-to-code-why-it-s-not-a-good-question-860)!
- [7 Practical & Effective Methods To Improve At Visual/UI Design](https://dev.to/eleftheriabatsou/3-7-practical-effective-methods-to-improve-at-visual-ui-design-3480)
- [To Be a Successful UX Designer Give up these 15 Things](https://dev.to/eleftheriabatsou/4-to-be-a-successful-ux-designer-give-up-these-15-things-j0c)
- [New to a UX workplace? Know these 22 things!](https://dev.to/eleftheriabatsou/5-new-to-a-ux-workplace-know-these-22-things-45gd)
- [A Brief Guide in Color Theory](https://dev.to/eleftheriabatsou/e6-a-brief-guide-in-color-theory-1hm5)


👋Hello, I' m Eleftheria, an app developer, master student, freelancer, public speaker, and chocolate lover.


This is a new series on my channel and I'm going to be talking about UX and UI.
This is the 7th episode out of 8.
If you have any feedback, please do share it with me. Thank you.



😎Top 3 list:
- How to stay motivated | A developer's edition | @BatsouElef: https://youtu.be/qMvEtb5OxNo
- How to be a Better Problem Solver | Tips and solutions: https://youtu.be/dELt7yKIxIA
- Simple Tips to Build a Personal Brand as a Developer (+ personal examples): https://youtu.be/7s0o1gi0iP0

🥰If you liked this video please share

🍩Would you care about buying me a coffee? You can do it here: [paypal.me/eleftheriabatsou](paypal.me/eleftheriabatsou) but If you can't that's ok too!


**************************************

🙏It would be nice to subscribe to my [Youtube](https://www.youtube.com/c/EleftheriaBatsou) channel. It’s free and it helps to create more content.

🌈[Youtube](https://www.youtube.com/c/EleftheriaBatsou) | [Codepen](https://codepen.io/EleftheriaBatsou) | [GitHub](https://github.com/EleftheriaBatsou) | [Twitter](https://twitter.com/BatsouElef) | [Site](http://eleftheriabatsou.com/) | [Instagram](https://www.instagram.com/eleftheriabatsou/)
Changes to project dependencies
Tags: discuss, javascript, npm
Published: 2020-05-20 16:03:35

### What do you do when your project requires you to make changes to code of one of the dependencies?

I'm a beginner developer and I've come across an issue in one of the packages I'm using. It was a pretty straightforward fix but it had lead me to wonder how to make the change clear and lasting. How do you deal with situations like this and what is the 'correct' way of going about it?

Two most common solutions I found were:
- fork it
- [patch-package](https://www.npmjs.com/package/patch-package)

I disliked forking the required dependency and building it myself. My github is already a mess and I feel like I don't need any more repos floating around, so I went with the other solution - [patch-package](https://www.npmjs.com/package/patch-package). it *'lets app authors instantly make and keep fixes to npm dependencies. It's a vital band-aid for those of us living on the bleeding edge.'* 


It's very simple to use:
 1. in package.json add a script: ``"postinstall": "patch-package"``
 2. ``npm i patch-package``
 3. make changes to the package
 4. run ``npx patch-package package-name``
 5. Et voilà! You're done. 

So what happened?

It created a ***patches*** directory and inside of it you can find a diff like file. You can now commit these changes and apply the small patch with a npm script.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/0a71lk9hvqckw4mqpkaf.png)






# Illustrated journey of what happened.

### Oh no, big error

![Console error code](https://dev-to-uploads.s3.amazonaws.com/i/r7712p9u3ue9lgo093j3.png)

### Sherlock mode activated 🕵️‍♂️
![Chrome debugger issue tracing](https://dev-to-uploads.s3.amazonaws.com/i/nqeszrvln6v2qwbbsnrj.png)

I found the ***issue*** (https://github.com/sveltejs/svelte/issues/2086). Some of my dynamically creating and swapping around components that also had a a few reactive, dynamically created components inside of them. 

I added a simple if statement to check if node.parentNode exists and that was it. 

```js
 function detach(node) {
    if (node.parentNode) {
        node.parentNode.removeChild(node);
    } else {
        console.warn('Error: patch-package: svelte detach failed')
    }
 }
```

Later I revisited this small tweak and added a ``console.warn`` to see when the error occurs in case it causes other issues down the line.

![Console.warn stack trace](https://dev-to-uploads.s3.amazonaws.com/i/5qqgn8y0uz0xskoif5ot.png)

## Now my first portfolio project is very close to being finished.
### I'm working on a webapp that applies shader filters to images. WebGL + Svelte 🥰
Making pixel art with shaders is the most fun I've had with it. Here's the [Giant's Causeway](https://en.wikipedia.org/wiki/Giant%27s_Causeway)

![Giant's Causeway](https://dev-to-uploads.s3.amazonaws.com/i/jufks9s0sb74wj9rfn5b.jpg)

And here it is after applying Color Palette limtier, Pixelate and Bloom shaders. [FullRez Link](https://imgur.com/AKEqx9O)
![Giant's Causeway Pixelart](https://i.imgur.com/AKEqx9O.png)
Kickstart to First Semester CS Project
Tags: django, react, opensource, cs
Published: 2020-05-20 16:24:57

---
title: Kickstart to First Semester CS Project
published: true
description: Kovidju - Web App that gives info about corona virus.
tags: Django , react,opensource, cs
cover_images: https://dev-to-uploads.s3.amazonaws.com/i/6z8gjv6r65mq9z82o0l1.png
---

Hello there, are you fighting with corona right? Yeah Everyone is. Stay safe and if you have time, you can welcome to read this short article. Currently, I am the first-semester student, learned a lot of things during my college time, and had a few awesome memories too. I haven't completed my semester and our exam canceled too. During this lockdown, I wanted to make my productive time so I am starting out my own opensource project to enhance my skills.

Well, my project name is Kovidju - Web app that gives the info about coronavirus which will be written in Django for Back-end stuff and React for front-end. It will be a simple one as I had started coding from my college time. Later, the project will be further built with Flutter App too. Kovidju will be hosted in Azure and it will definitely be helped to make hand dirty in cloud and DevOps stuff too. First of all, to initiate this project, I have done planning and system design too. Check it out.

![System Design](https://dev-to-uploads.s3.amazonaws.com/i/w09zuu9soqa80bn7z0yk.png)

I think rather moving directly to coding parts, planning, and designing the system that we are gonna build should be done. Otherwise, it would be difficult to scale the project later on. I will be sharing out my further blog of Kovidju Project. Thank you. Feedback is welcomed.
A TL;DR SEO Cheat Sheet for Developers
Tags: webdev, startup, beginners, tutorial
Published: 2020-05-20 16:21:27

Hi there!

Since I had a little bit of downtime at my company I sat down to create a technical SEO cheat sheet [1] with all the latest best practices in the On-Page SEO world.

I always wanted to have some kind of reference I can go to and easily find what I was looking for in that specific situation. I hope that this tool comes a little bit closer to that goal and can help a lot of people in navigating the complex SEO universe. 

And in a truly TL;DR fashion, I will keep this post short too and instead point you in the right direction: [SEO Cheat Sheet](https://9elements.com/seo-cheat-sheet/) [1]

Oh, and I hope you like our little astronaut and the corresponding wallpapers as well :)

For any questions or suggestions, don't hesitate to contact me.

Thanks!
My Great Project !
Tags: octograd2020
Published: 2020-05-20 16:14:40

[Comment]: # (All of this is placeholder text. Use this format or any other format of your choosing to best describe your project and experience.)

[Note]: # (If you used the GitHub Student Developer Pack on your project, add the "#githubsdp" tag above. We’d also love to know which services you used and how you used it!)

## Home Eats
Home Eats is our first Mobile Application ever! We had like only 2 weeks to learn android, firebase and deliver a working project, and that we did 💪

We are a team of Software Engineering students in Ain Shams university, Egypt. We had a project that is required to be built in android and have interactions with google services as Firebase, maps,..etc.

We had no idea about how to build a mobile application. We split ourselves into 2 teams, one team is responsible for building the UI of the application and user interactions, and the other team was responsible to build the firebase database and write the backend code that interacts with the database, maps and other services.

In the first week we had to learn many concepts and fundamentals on how to build a mobile application. and the second week was the coding part.

We built a library that we called **Firebase Dao**. It was responsible for handling all our interactions with the firebase database. you can find it here:
https://github.com/islammohsen/FirebaseDao

I am very proud of this project and I believe it was my best one!

You can find the project here:
https://github.com/polamokh/HomeEats-Android
ExoBoost: My Senior Year Research Project
Tags: octograd2020
Published: 2020-05-20 16:11:49


## My Project
Ever since I was in 3rd grade, the universe has been a source of curiosity for me. How does it work? And are there planets like ours? Growing up, I knew that astronomers were finding and collecting data on planets that were beyond our solar system but I wanted to know if there was an easier way to do find these planets called exoplanets. I wanted to see if machine learning could automate the process and I used my Python background to tackle this problem. I started in September and investigated all the current ways that we find exoplanets (traditional observation or other machine learning methods) I decided to create a machine learning tool that would return the number of planets based on radial velocity data which measures how fast a star moves away and toward our observation point on Earth. Looking back, it was definitely a challenging project, but I gained a lot a valuable experience and knowledge. I am still planning on working on it in the future. 
## Demo Link
Below is a link to the my website that has a detailed manuscript about the project. P.S. the website is still a work-in-progress!
`https://rndev2017.github.io/ExoBoostInfo/`

## Link to Code
`https://github.com/rndev2017/ExoBoost`

## How I built it...
- Python
- XGBoost
- SciPy


## Shout out to the rest of the Class of 2020! Congrats to all!

[Final Note]: # (CONGRATULATIONS!!! You are amazing!)
Bootstrap Custom Color Spinners
Tags: css, html, weeklyui, beginners
Published: 2020-05-20 16:11:23

As especially spinners are used on a heavy website like websites have large data and they don’t want a show empty screens. That time spinner is useful to show some awesome user-interface. So we used bootstrap 4 spinners elements but, we used custom classes with some attractive colors.



In this element, we used bootstrap 4 classes and also made custom classes. Here we also add our own class for small, medium, and for large spinners. following these classes we only used high and with CSS properties and also for right side spinner spaces we used margin properties.

Make it yours now by using it, downloading it, and please share it. we will design more elements for you.

[Download Source code](https://w3hubs.com/bootstrap-custom-color-spinners/)
ASAP: Pooling layer for Graph Neural Nets
Tags: octograd2020, devgrad2020, machinelearning
Published: 2020-05-20 15:57:49

## My Final Project
I am interested in Deep Learning and have been trying to keep pace with the rapidly evolving field. In my last internship, I worked on designing new pooling layers for Graph Neural Networks. My work finds application in tasks involving graphs, e.g., from finding toxicity of Molecule/Drug to learning attributes about users on a social network.

 

## Link to Code


{% github https://github.com/malllabiisc/ASAP %}



## How I built it (what's the stack? did I run into issues or discover something new along the way?)

The Machine Learning domain is quite lucky in the sense that the tools needed for research and deployment are open-sourced. Major libraries like `Pytorch`, `Tensorflow`, and `sklearn` are all maintained actively by the open-source community.

My research stack primarily includes `Pytorch` library. For the purpose of working in the graph domain, I had to use `Pytorch_Geometric` which is a library made on top of Pytorch. Its maintainer has done tremendous work in building and keeping it up to date. So whenever I ran into problems or implemented a new feature for my research work, I made it sure to package it properly and merge it to `Pytorch_Geometric` so that others can use it too. 

For managing sessions on the GPU server, I used `tmux` client so that if my personal machine turns off, the session is still alive on the server to which I can connect later.

To collaborate with my mentor I used `Github`.

## Additional Thoughts / Feelings / Stories
It took 3.5 months of consistent work and frequent iterations to submit our work which was accepted as a long paper at AAAI 2020 (a top-tier ML conference). This would not be possible without all the open-source tools available to me for research. I am grateful to the open-source community for sharing their work. Realizing the impact of open-source tools on my workflow motivates me to spend my free time in contributing to open-source projects.