teleren/devto huggingface dataset:
Useful tensorflow/keras callbacks for model training
Tags: deeplearning, machinelearning, tensorflow, python
Published: 2022-03-13 23:06:45

Here are some callbacks that I have found to be very useful when training machine learning models using python and tensorflow:

#### Number one: Early stopping

Keras early stopping (https://keras.io/api/callbacks/early_stopping/) has to be my favorite callback. With it you can define when the model should stop training if it is not improving. An example for usage is:
```
earlystopping = tf.keras.callbacks.EarlyStopping(
    monitor="val_loss",
    min_delta=0.001,
    patience=5,
    verbose=1,
    restore_best_weights=True,
)
```
This will stop the model's training once it does not improve at least 0.001 in loss for 5 epochs. It will then restore the model's weights to the weights on the best epoch. Just like any callback make sure to include it during training like
`model.fit(some_data_X, some_data_y, epochs=some_number, callbacks=[earlystopping, some_other_callback])`

#### Number two: Learning rate scheduler
Keras learning rate scheduler (https://keras.io/api/callbacks/learning_rate_scheduler/) can be very useful if you are having problems with your learning rate. With it you can reduce or increase learning rate during training based on a number of conditions. An example:
```
def scheduler(epoch, lr):
       return lr * tf.math.exp(-0.5)

 learningratecallback = tf.keras.callbacks.LearningRateScheduler(scheduler)
```
The scheduler function is where you can define your logic for how the learning rate should decrease or increase. `learningratecallback` just wraps your function in a `tf.keras.callbacks.LearningRateScheduler()`. Don't forget to include it in `model.fit()`!

#### Last but not least, number three: Custom callbacks
Custom callbacks (https://keras.io/guides/writing_your_own_callbacks/) are great if you need to do something during training that is not built in to keras + tensorflow. I won't go in depth as there is a lot you can do. Basically you have to define a class that inherits from `keras.callbacks.Callback`. There are many different functions that you can define that will be called at different times during the training (or testing and prediction) cycle. A simple example would be:
```
class Catsarecoolcallback(keras.callbacks.Callback):
    def on_epoch_end(self, logs=None):
        print('cats are cool!`)
callback = Catsarecoolcallback()
```
This (as you can probably tell) prints out `cats are cool!` every time an epoch ends.

#### Hope you learned something while reading this!
Do Re-entrant Node.js Functions have Unstable Arguments?
Tags: node
Published: 2022-03-14 00:06:40

I have code (kraken-grid on github) which makes requests to the Kraken API and `await`s the responses.  It runs periodically and I noticed that Kraken's API slowed down enough for a second run of the code to happen while the first run was `await`ing a response.  The code handles TIMEOUT from Kraken by trying again in 5 seconds.  It seems to me that a call to `order` (a function I wrote) from the first run got its arguments clobbered by the second run.  It passes an array [first element is a string, second is an object with properties for all the values the API is to use] to `kapi()` which calls itself again with the same array after waiting five seconds. The result is that when the API (`AddOrder`) was called the second time (5 seconds after a TIMEOUT response), it used (at least) two argument values that differed from those with which it was first called.

The code can be viewed at https://github.com/dscotese/kraken-grid/blob/main/index.js.

I'm trying to understand how it happened so that I can prevent it.  My suspicion is that nodejs creates an internal object for each variable and does not consider the arguments to a function call from one frame of execution to be different than the arguments when it's called from a different frame.  I see that three of the passed in arguments are re-assigned (`price = Number(price)` for example) and the two that are changing are among them.  I use the same names but perhaps the interpreter is creating new (implied `var`) declarations and that is why re-entrant calls alter their values.

I updated the code (not yet in github) so that new variables (let declarations) are used.  If someone can confirm that this will most likely prevent the problem (and why), I'd appreciated it!
File_get_contents('php //input') not working
Tags: restfularchitecture, curl, rest, json
Published: 2022-03-17 10:35:07

Problem:
I am unable to understand this problem ..

Please suggest me a better solution to solve it ..File_get_contents('php //input') not working

Solution:
First off, I was able to run this code and it worked fine:

--Terminal---------
//I ran this curl request against my own php file:
curl -i -X PUT -d '{"address":"Sunset Boulevard"}' http://localhost/test.php


--PHP--------------
//get the data
$json = file_get_contents("php://input");

//convert the string of data to an array
$data = json_decode($json, true);

//output the array in the response of the curl request
print_r($data);
If that doesn't work, check the console for errors and your php settings:

1. The curl url you used, make sure that url is actually working and

not returning errors.
2. open up another terminal / console window and run tail -f

/path/to/the/php/log/file so you can actually see the output of
these php calls.
3. often people get this error: file_get_contents(file://input): failed

to open stream: no suitable wrapper could be found which can
indicate either a typo of the "file://input" string or the fact that allow_url_fopen is disabled in php (see #5 if unsure)
4. make sure your code is correct, and by that I mean make sure you're

not typing in incorrect arguments and things... stuff that doesn't
necessarily get underlined in netbeans.
5. remember, file_get_contents only works when allow_url_fopen is set

to true in your PHP settings. thats something that is set in
php.ini, but you can also change settings at run time by writing
something along the lines of the following code before the other
code:
ini_set("allow_url_fopen", true);
Turn a single brand color into your own Complete Web Color System... in minutes!
Tags: javascript, typescript, showdev, webdev
Published: 2022-03-20 22:03:36

How many times have you neglected your app's UI just because you had a deadline, and you needed to focus on your app's functionality instead?

Color forms an important foundation of every UI. It enables **consistent** expression of your brand/identity and style, and **effective** communication of intent and meaning.

However, it can be quite daunting for developers like you and me to implement a proper color system, especially when this task has to contend with working on actual functionality of our app.

For Web developers, here's where **Simpler Color** could help. I wrote this small library so that we no longer have to sacrifice not having a cohesive, professional UI color system while focusing on the other important stuff. 

And all you need is **a single brand color**...

## Easy as 1-2-3

**Step 1:** Install simpler-color

```
npm install simpler-color
```

**Step 2:** Specify your brand color, and it generates the rest of the _base colors_!

```js
import { harmony } from 'simpler-color'

// Generate 5 harmonious base colors from your main brand color!
const baseColors = harmony('#609E3F')
```

(You can also define your own custom base colors if you prefer, or if you already have a set of brand colors)

**Step 3:** Create your _color scheme(s)_ by mapping UI roles to specific colors from the auto-generated palettes

```js
import { colorScheme } from 'simpler-color'

const scheme = colorScheme(
  baseColors, // 👈 From these base colors...
  // 👇 ...your color palettes are auto-generated
  colors => ({
    // 👇 which you then map to UI roles.
    primaryButton: colors.primary(40),
    primaryButtonText: colors.primary(95),
    surface: colors.neutral(98),
    text: colors.neutral(10),
    ...etc,
  }),
)
// Access various UI colors as `scheme.primaryButton` and so on.
```

Here's the complete range of colors that our example code generates from a single color value of `#609E3F`:

![Example color set auto-generated by Simpler Color library](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/70fu1r0bkibr3f5vd2u4.png)

It's that simple! (Plus the library can do quite a bit more.)

So why don't you give Simpler Color a try. Check it out on GitHub: https://github.com/arnelenero/simpler-color

> Please don't forget to give it a star ⭐️ on GitHub if you like the library, its concept and the simplicity.

If some terms used above sound a bit alien to you, check out the comprehensive README in the link above for more details.

Hope you find this library useful. With proper color, even an early prototype or proof-of-concept app would certainly impress!
2022 Memorable Moments
Tags: aws, leadership, womenintech, cloud
Published: 2022-12-28 13:21:00


When I shared [my journey 2021](https://dev.to/aws-heroes/look-back-and-relish-2021-bn4), I was wondering can I do any better in future and to my surprise, I could go above and beyond my own records in 2022. 

Everytime when I post in social media about the presentation in industry conferences, community sessions, or the honorary recognition received, 
I wonder, is it really needed ? Am I bragging too much?

But trust me, a WomenInTech made me realize that how invaluable these little posts are to inspire and motivate all those aspiring individuals with burning desire and dream about their career. 

> And the storyline is like this.. 

> A WomenInTech who was awestruck by what Bhuvana could accomplish in 2021 took a screenshot of my 2021 journey infographic and stored it on her phone as a reference.  
Six months later, she came and told me about her self-transformation which included
> - The discipline she has brought to her fitness routine and shed several kgs of weight
> - Upskilled in a couple of technologies
> - Become a blogger
> - Speaker at a few external events
> - Furthermore, she advanced in her career
> - Most importantly, the confidence level and energy went up

Yes, she proved it right that `if Bhuvana could do something and I can do much more.`

Thereafter I became #unstoppable to share every little success to those followers / aspirants

Here are my 2022 memorable moments  

- Industry Conferences, corporates & Community Events - 19
- Expert / Motivational Talk Educational Institutions - 8
- Hosting / Organizing - 2
- Featuring - article, poem, success story - 6
- Honours / Awards - 5
- Happily published poetry books written by my kids - 2

![2022](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ce1ii1xv7fog8ygken6.png)

My suggestion to the #awscommunity, #womenintech, please keep sharing your little progress and accomplishments. You never know it could be a game changer for someone. 

When you could inspire so many, its always heart-warming to give the credit to who inspired you. I drew-up inspiration from a good friend and best techie - Runcy Oommen and less he would know this fact because never discussed 😊.

Thanks a lot to AWS User Group Bengaluru, AWS User Group Madurai, Infor, #AWSCommunity, #AWSHeroes, BIT Sathy, KIT, KSRCT, Greenway Health, Dasken IT, Capco, Little Flower school, AWS User Group Madurai, AWS User Group Coimbatore, AWS User Group Mumbai for travelling with me in this journey.

And certainly not challenging myself to set any new record in 2023.

Let me continue to **Learn**, **Unlearn** and **Share** as always.

As we march into a new year, wishing you all loads of success on your way with good health and happiness taking the front seat 💐
POO - Abstracción
Tags: poo, oop, python, backend
Published: 2022-03-23 03:08:24

Según una definición que encontré en internet, abstraer algo significa: separar por medio de una operación intelectual(pensar)
un rasgo o una cualidad(en nuestro caso métodos y atributos) para 
analizarlos aisladamente. En palabras más simples aún, sería enfocarnos en eliminar o ignorar detalles de algo para obtener los puntos más relevantes para su funcionamiento.

**¿Pero como nos sirve todo lo de arriba?**
    
Bien, supongamos nuevamente que tenemos un celular moderno, este va a poder:
    
    - Llamar
    - Enviar SMS
    - Instalar aplicaciones
    - Sacar fotos
    - Grabar video
    
    Y para realizar todas estas cosas el celular necesita:
    - Batería
    - Placa wifi 
    - Camára de foto y video
    - Sistema operativo funcional(Android, iOS)
    
De esta forma vemos como se puede realizar una abstracción de un celular, así que ahora podemos crear nuestra clase:

```python
class Celular():
    
    def __init__(self, name, wifi_card, battery, camera):
        self._name = name
        self._battery = battery
        self._wifi_card = wifi_card
        self._camera = camera
    
    def call(self, number:int): print('Calling'+str(number)+'...')
    
    def send_sms(self, number:int, msg:str): print('Sending '+msg+' to ' +str(number))
    
    def install_app(self, app_name:str): print('Installing '+app_name+' app...')
        
    def take_a_photo(): print('Taking a photo...')
    
    def record_video(): print('Recording video...')
```
100 días de código: 91, conectando y creando el frontend de mi aplicación MERN
Tags: spanish, 100daysofcode, webdev, beginners
Published: 2022-03-27 04:31:35

¡Hey hey hey!

Pense que realmente seria complicado conectar el backend con el frontend pero en cuanto comencé a realizar el frontend de la aplicación y a utilizar axios para las peticiones me di cuenta que es muy sencillo comenzar a utilizar tu API REST una vez la hayas desplegado.

Me siento contento porque he conseguido realizar esta conexión y también he terminado de construir el frontend de [mi aplicación de agenda de teléfono global](https://github.com/Darito97/frontend-phonebook).

Tengo dudas sobre como funcionan las variables de entorno en producción de una aplicación de react hecha con vite y me da la sensación de que será un nuevo reto desplegarla en [Vercel](https://vercel.com/).

La duda anteriormente mencionada nace del hecho de que vite contiene un propio manejador de variables de entorno en la cual en lugar de ser obtenidas accediendo al `process.env` se obtienen accediendo a través de `import.meta.env.nombreDeLaVariable` y no se si es compatible con las variables de entorno que maneja Vercel.

Mi conclusión es que, si bien hacer una pagina con frontend y backend es sencillo tiene su dificultad en algunos momentos. 

¡Espero que tengan mucho éxito con sus proyectos y animo con todo!

Hasta la próxima.
I created twitter header using TailwindCSS
Tags: tailwindcss, css
Published: 2022-03-27 08:31:18

Checkout my new social media header made with TailwindCSS. Here is some facts 👇

- Only used SVGs for the logos and the curly brace at the right.
- No custom css or fancy javascript.
- I had fun for 3 hours making it.
- Code available on 👇

[TwilwindCss Play](https://play.tailwindcss.com/YpEyNjbSOF?layout=horizontal)


Wanna know how I have done it?
👉 Checkout [The Extensive Guide to Create Beautiful Social Media Headers Using Tailwindcss](https://dev.to/nagi/the-extensive-guide-to-create-beautiful-social-media-headers-using-tailwindcss-5e30)
RP2, the Privacy-focused, Free, Open-source US Crypto Tax Calculator, Is Growing Fast
Tags: crypto, tax, bitcoin, opensource
Published: 2022-04-05 05:40:54

[RP2](https://github.com/eprbell/rp2) and its sister data loader project [DaLI](https://github.com/eprbell/dali-rp2) are receiving more and more user engagement on Github, in terms of stars, issues and PRs. Here's a graph showing RP2 Github stars over time (courtesy of [star-history.com](https://star-history.com/#eprbell/rp2&Date)).

![RP2 Github stars over time](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ws4qeiyjc4r7z339ktu8.png)

Devs are needed! If you'd like to help out these exciting, fast-expanding projects, open an issue/PR on Github or contact me on Twitter (@eprbell).
Dev Log: Nuzlocke Tracker — Part Three — Promotion
Tags: react, webdev
Published: 2021-08-08 12:15:00

---
title: Dev Log: Nuzlocke Tracker — Part Three — Promotion
published: true
date: 2021-08-08 12:15:00 UTC
description: Third in the series of a developer blog chronicling my experience creating a React app. In this part I explain the way I went about promoting the app.
tags: react, webdev
---

As promised this is the third part where I worked on how to promote the app.

What motivated me most is knowing that people are using my app, so getting this app in the hands of other people was critical. Truth be told I’m a complete novice when it comes to promoting an app, however, I decided to dive headfirst.

## Where to?

I knew that I would have to begin to research SEO. Unfortunately from my research, I found out that React apps are typically at a disadvantage when it comes to SEO. This is because the crawlers that index the page look through the HTML however the HTML of a React app is dynamically generated.

There are several solutions to this such as SSG-type frameworks like Next.js or Gatsby. I decided to deploy with Netlify because they offer a plugin precisely to generate a SPA (such as React) to further help with crawlers. This would help initially with it appearing in searches.

Also, I figured I would show this to various Nuzlocke communities. I focused my efforts on Reddit as there is a fairly active community around Nuzlocking.

This is the original post. It was very successful! Not only was it very well received, but I also received a ton of feedback to make the app considerably better.

I also posted it to other Nuzlocke forums and various discord communities!

## The follow-up

As I continued to iterate over the app I posted it several times over the course of the past couple of months to show and detail the updates.

Every thread was fairly well-received but none of them were as successful as the first, however, every single time I gained critical insight into bugs and features people would appreciate.

## SEO

As for how the SEO went after all the posts, it was a mixed bag. For Google, it’s been a real struggle to get to the top page, although a majority of the links ahead of me seem to be illegitimate backlinks.

However, on bing and several other search engines, I am consistently within the top ten. Researching on how to exactly boost up the position on a google search definitely requires more research.

That’s it for now! I will most likely make another more detailed post on how to boost SEO from all the research I did on React apps.
About Kathmandu to Lukla Flights
Published: 2022-04-20 05:59:49

Our page [Kathmandu to Lukla flights](https://nepflights.com/domestic-flights-nepal/flight-from-kathmandu-to-lukla) is showing mixed content error of images, we removed that image, but still that image is displaying.

we build our website in 2 version both php and wordpress. what might be the solution for it?
Mother's Day Greeting in Augmented Reality (Shareable)
Tags: augmentedreality, 3d, appdevelopment, tutorial
Published: 2022-05-06 19:42:56

<center> 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wr7xl4lwdu6jpgf3lojr.gif)

Share this link https://go.echo3d.co/JJkU or scan this QR code to wish a mother in your life a Happy Mother's Day! 🌸🌹


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/m5yhat3j5spvqzqinwtm.png)</center>

***

To learn more about creating AR apps without code or downloading an app, visit the [echo3D docs](https://medium.com/r/?url=https%3A%2F%2Fdocs.echo3d.co%2F).

To make your own, sign up for echo3D for free [here](https://medium.com/r/?url=https%3A%2F%2Fconsole.echo3d.co%2F%23%2Fauth%2Fregister).

To recreate this, follow this [short tutorial](https://medium.com/echo3d/create-an-ar-experience-and-share-with-a-qr-code-link-f02e63114bbb).

Special thanks to [FreePik](https://medium.com/r/?url=https%3A%2F%2Fwww.freepik.com%2Ffree-vector%2Ffloral-mother-s-day-illustration_13757278.htm%23query%3Dhappy%2520mothers%2520day%26position%3D48%26from_view%3Dsearch) for the graphic!

**More Tutorials**
- [Get a Quarantine Dog…in AR!](https://medium.com/echo3d/get-a-quarantine-dog-in-ar-8383ea55376b)
- [How to Create 3D Content and See it in AR (FREE & NO CODING REQUIRED)](https://medium.com/echo3d/how-to-create-3d-content-and-see-it-in-ar-free-no-coding-required-369e5b4a4b3e)
- [Make a Valentine's Day Slideshow in AR](https://medium.com/echo3d/make-a-valentines-day-slideshow-in-ar-free-and-no-code-c1e35a4206d4)

***

>*echo3D ([www.echo3D.co](www.echo3D.co); Techstars 19') is a cloud platform for 3D/AR/VR that provides tools and network infrastructure to help developers & companies quickly build and deploy 3D apps, games, and content.*

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/e2xjkv26z7qpz9iet5nx.png)
Javascript Animation 24
Tags: javascript, webdev, css
Published: 2022-05-09 01:15:36

Whatever you do on Javascript, you have to understand the roots and focus on the basic knowledge.
# 1. Calculator  
{% codepen https://codepen.io/php-hacker/pen/oNGEoOP %}
# 2. Curve Animation    
{% codepen https://codepen.io/php-hacker/pen/LYzQOxO %}
# 3. Hover    
{% codepen https://codepen.io/php-hacker/pen/rNGJYML %}
# 4. Gradient Mesh 
{% codepen https://codepen.io/php-hacker/pen/oNGEoLo %}
# 5. Mouse Follow-Strange Creature     
{% codepen https://codepen.io/php-hacker/pen/WNZMXwq %}