fabiochiu/medium-articles huggingface dataset:
What To Expect When You Look At The Future
By: Rasheed Hooda
Tags: Future, Pandemic, Self, Life, Wisdom

“No man ever steps in the same river twice, for it’s not the same river and he’s not the same man,” said the Greek philosopher Heraclitus.

If there is a constant in the Universe, it is the fact that everything changes.

And we are in the midst of massive changes, whether we like it or not. Even the prospect of small personal changes creates discomfort because we don’t like change.

People prefer to stay comfortable in a predictable way. But life is unpredictable. Who could have predicted the current circumstances? No one. Oh, sure, we all knew that it was a possibility that sooner or later, something like this could happen. Yet, we face unpredictable circumstances.

Even now, we cannot predict how things will turn out. We don’t know what life will be like when all is said and done. All we can do is hope for the best and mentally prepare ourselves to face the worst.

I would like to share some perspectives put forth by some brilliant and knowledgeable people on what we can do now, and in times to come knowing what we know, and given the unpredictable nature of life.

First, Ryan Frawley talks about the futility of worry, and how “Coulda, Shoulda, Woulda” never make any sense. We don’t know how or where the roads we didn’t take would’ve ended. So why not acknowledge where we are and look at what’s ahead and decide which way to go from here.

Next, Rosennab shows us why we don’t need to worry because the Universe always has our back. There is an intelligence that can see and know what is up ahead and can mold the circumstances to help us tread through any challenges we may face, regardless of what choices we make in the present times.

Finally, Bill Abbate shows us how we can expand our world and continue to grow. He says,

There is a direct link between your ability to broaden your perspectives and your Intellectual growth.

Through intellectual growth, we can see more solutions to our challenges and have the ability to choose the ones that suit us best from where we find ourselves.

I love Medium. I can find many brilliant and thought-provoking stories that expand my perspective, and then I share those with others, enabling me to be of service. It’s a win-win-win situation.

As always, thank you for reading and responding.

More about me:
Working with the .NET CLI. C# From Scratch Part 2.0
By: Ken Bourke
Tags: Software Development, Csharp, Dotnet, Learning To Code, Programming

Welcome to another part of the series C# From Scratch, a course dedicated to teaching you everything you need to know to be productive with the C# programming language.

In the previous part of the series, we learned what .NET does for our applications and why we need it to run applications we write in C#. That part of the series is available here.

In this part of the series, we’ll get hands on with the .NET Command Line Interface, a tool that is installed as part of the .NET SDK to make developing .NET applications easier.

Accessing the .NET CLI

The .NET Command Line Interface is installed on your machine as part of the .NET SDK installation.

Once the .NET CLI is installed on your machine, you can access it through a Command Prompt window (also known as a terminal or shell depending on your operating system).

On a Windows machine, you can launch the command prompt by going to the Start menu and typing ‘cmd’. Press enter to launch the Command Prompt app.
The Venture
By: Valori Maresco
Tags: Contemporary Haiku, Dreams, Haiku, Creativity, Poetry

I have a love/hate relationship with writing. Love writing and hate that I don’t have time to do more of it. Wife, mom, grandma(!), accountant … and writer.

Follow
Intro to @ngrx/component
Tags: Angular, JavaScript, Typescript, Ngrx, Programming

Intro to @ngrx/component

A comprehensive guide to improving your NGRX projects (part 2)

Image provided by the author.

New features are coming into NGRX, one of which is ngrx/component. It brings plenty of opportunities to make our programming easier & faster. Apparently, it appears onto the scene to help us get rid of the async pipe in templates. But also, under the hood, it takes maximum advantage for Angular life cycles.

We will explore it briefly, and in the meantime, you will see the base of some concepts to understand why we should use this. Finally, we are going to apply it to an easy project done with NGRX, getting the benefits of this feature.
I Was Doing Fine Until
By: Harper Thorpe
Tags: Humor, Poetry, Words, One Line Poetry Prompt, Music

OK — Your Turn

THEME: But — that little 3-letter word that changes the direction in which the sentence seemed to be headed.

Now, share your own one-line poem on the theme as a response to this post or write a stand-alone piece if you prefer. Tag your piece “One Line” or “Chalkboard Espresso” if 15 words or less. If you have a stand-alone poem, be sure to leave a link in the response section below.

Want to get notified about the weekly prompts? Complete this form.

Have a question about the One Line project? Read our submission rules! Thanks to Kathy Jacobs and the entire Chalkboard team.
Three Different Things: November 15, 2019
By: Sean O'Brien
Tags: AI, Policy, Healthcare, Data Science

Three Different Things: November 15, 2019

Speaker Verification To Speech Synthesis, Google Putting Medical Data at Risk, and Your Data

Photo by jesse orrico on Unsplash

Click on the reference links and then compare to the generated speech. Pretty astonishing stuff from Google.



2. I’m the Google whistleblower. The medical data of millions of Americans is at risk

Above all: why was the information being handed over in a form that had not been “de-identified” — the term the industry uses for removing all personal details so that a patient’s medical record could not be directly linked back to them? And why had no patients and doctors been told what was happening? I was worried too about the security aspect of placing vast amounts of medical data in the digital cloud. Think about the recent hacks on banks or the 2013 data breach suffered by the retail giant Target — now imagine a similar event was inflicted on the healthcare data of millions.

I think EMR data ultimately has to live in the cloud to drive more effective outcomes… and as a consequence this data breach is likely going to happen. When it does, it’ll change the game — for the worse — for insurance companies and providers alike… not just the citizens who’s privacy is violated.





3. Andrew Yang wants you to make money off your data by making it your personal property

“By implementing measures to increase transparency in the data collection and monetization process, individuals can begin to reclaim ownership of what’s theirs,” Yang said in the plan.

In the example above, if we simply owned our own health data it would likely foster a much more competitive provider market. Providers would have better information to provide better care. Maybe Apple will figure this one out with Apple Health as a beachhead.
A Simple React Hook to Prompt iOS Users to Install Your Wonderful PWA.
By: Michael Lisboa
Tags: JavaScript, Web Development, React, iOS, UX

The Hook

The whole point of this hook is to load a notification only for Safari on iOS, so we’re going to create a new file called useIsIOS.js . In this code we’re going to do a few things:

Check if someone is viewing our app on an iOS device.

Are they using mobile Safari?

Have they not been prompted to install the app before?

If all of the above is true , then we’ll send them a prompt to install the app and, in the background, store a hasBeenPrompted item in browser localStorage with a timestamp.

We’ll start with creating a state for isIOS with useState .

This is pretty simple:

const[isIOS, setIsIOS] = useState({}); initializes a state — similar to setState in class function. On init, the state is an empty object by setting useState({}) .

initializes a state — similar to in class function. On init, the state is an empty object by setting . Then we use useEffect to do our checks from above.

At the moment, this does nothing except for try to run the checkForIOS() function. So let’s update our file to make it work!

We’ll install moment.js npm install --save moment , then import moment into our hook. We’re using moment to set & check timestamps to see if and when a user has been invited to install our app.

Getting into our checkForIOS() function, we’ll start by setting some variables, using moment, including a timestamp for today , lastPrompt (if it exists), and finally, the number of days since we last prompted our visitor to install the app.

A quick sketch of Astro turned logo, turned splash screen.

Looking at lastPrompt , you’ll see we’re trying to get an “installPrompt” key from the browser localStorage. If it exists, we use moment() to convert it into a Date object, otherwise it returns undefined . Perfect!

Next, have a look at days . This is where we’re checking the time difference, in days, of today compared to the last time the user was prompted to install our app. If they haven’t been prompted before, then we prompt them now!

Check for devices, browser, and OS

I tried a few different options, but this seems to be the most reliable method for identifying Safari and device types on iOS. We’re updating our checkForIOS() function with some old-school, pedantic JavaScript.

Typical JS.

It’s important to ensure that our iOS visitor is using Safari because iOS doesn’t permit other browsers to install our awesome PWA’s!

Do we prompt?

Now that we have our timestamp and device info, we can check if we should send our website visitors a notification to install our PWA.

Looking at our prompt variable, we’re saying:

“if our visitor has no stored timestamp — isNaN(days) — or we haven’t notified them to install our PWA in over 30 days,

— or we haven’t notified them to install our PWA in over 30 days, “and, they’re viewing our website on an iOS device,

“and, they’re using the Safari browser,

then set prompt to true”

Depending on whether our visitor meets all the criteria, prompt will return true or false.
How Olafur Eliasson uses art to drive conversations on climate change
By: Michelle Chiu
Tags: Culture, UX, News, Design, Art

As creatives, it’s undeniable that we propagate ourselves into our work. Our backgrounds, experiences, and beliefs help shape our decisions regarding the projects we take on and the messages we amplify. There’s no doubt that with the presence of an audience comes great responsibility — especially in leveraging mediums to stir conversations we find important.

In the case of Olafur Eliasson, a Danish-Icelandic artist known for his installation pieces, art is seen as a platform to share ideas and inspire change. His creations, centered around a theme of transience and elemental materials, motivate viewers to focus on the imminent future — one dependent on the actions and choices we make today.

Image credit: Olafur Eliasson

The Weather Project (2003)

Olafur Eliasson’s The Weather Project is arguably the most iconic installation built for the Turbine Hall in London. Over the course of six months in 2003, this hazy mirage attracted over 2 million visitors — labeling it as one of the most visited contemporary art pieces in history.

With its vivid imagery, this project influenced collective awe and commotion for its powerful imprint on both the eyes and mind. By mimicking the realistic appearance of a sun and sky with illusory elements, Eliasson created a new world inside of the Tate Modern to remind viewers we only have one.
Grid-based game with Unity: dev-log day 2
By: Taylor Coon
Tags: Game Development, Unity, Coding, Programming, Development

Sorting out the order of operations

Alright, so I made my character sprite into a game object and then into a prefab in my resources folder. I used the same technique that I used in my grid_manager to load my prefab and then give it a position on the screen using its transform.

But this is where I hit my first hurdle. I wagered that the easiest way to position my character on the grid was to label one of the floor tiles as the “start_tile” and then find the start tile and position my character equivalently.

But both my character instantiation and placement and my grid generation are called in the built-in start method.

This creates a problem because my character placement is dependent on my grid, and I want my grid to be generated explicitly before my character Is placed.

My solution to this might not be ideal, but I found a way that is pleasing for me by reading through a bit of the unity scripting docs.

My solution was to create a master_manager that would act similar to how the kernel acts for your operating system. It’s a master game object that will call methods from other scripts in such a fashion that it can manage the generation flow of the game.

In a similar fashion, I have a game object that is the manager for any given process, so the grid has a managing script and the character has a managing script so on and so forth.

Here is what that looks like inside my master_manager:

I’ve elected to put this generation process inside of the built-in Awake function because the unity docs tell me Awake fires before the first frame of the game which seems to be an appropriate place to load up the initial state.

I’m absolutely convinced that I will find a more elegant way to achieve this, but for now, his approach is general and effective and has the capacity to solve many future problems I may have with the development.
Is Deno a Threat to Node?
By: Kapil Raghuwanshi
Tags: JavaScript, Startup, Technology, Nodejs, Programming

Is Deno a Threat to Node?

Deno 1.0 was launched on May 13, 2020, by Ryan Dahl — the creator of Node

Image copyrights Deno team — deno.land

It’s been around for two years now. We’re hearing the term Deno, and the developer community, especially the JavaScript community, is quite excited since it’s coming from the author of Node, Ryan Dahl. In this article, we’ll discuss a brief history of Deno and Node along with their salient features and popularity.

Deno was announced at JSConf EU 2018 by Ryan Dahl in his talk “10 Things I Regret About Node.js.” In his talk, Ryan mentioned his regrets about the initial design decisions with Node.

JSConf EU 2018 — YouTube

In his JSConf presentation, he explained his regrets while developing Node, like not sticking with promises, security, the build system (GYP), package.json and node_modules , etc. But in the same presentation, after explaining all the regret, he launched his new work named Deno. It was in the process of development then.

But on 13th May 2020, around two years later, Deno 1.0 was launched by Ryan and the team (Ryan Dahl, Bert Belder, and Bartek Iwańczuk). So let’s talk about some features of Deno.
Optimization: The Intuitive Process at the Core of AI
By: Aidan Gould
Tags: AI, Optimization, Machine Learning, Generative Design, Gradient Descent

Artistic Representation of a Neural Network

Multi-dimensional optimization problems are at the core of many computer programs set to revolutionize several industries. One important use for this type of problem is with neural networks, a prominent type of AI. In this case, the current elevation of the explorer is how well the AI performs a task, and each input is how active a given neuron or neuron connection path is in the neural network. The structure of the network is complex, but the principle is still to find the best possible combination of inputs. The activations of each neuron and connection changes slightly every time the program runs, and the network performs its task better and better. This is just like how the explorer got progressively closer to the summit, but the summit here is a well performing neural network. AIs trained in this way will do tasks all the way from recognizing handwritten text to being the brains of self-driving cars.

Airbus Titanium Seat Bracket Made with Generative Design

Another important use is in generative design AI. Generative design software takes in several requirements from an engineer such as how strong a part needs to be and what material it will be made out of. For example, the part above is a bracket to hold an airplane seat to the floor, and will be made out of titanium. The computer is then tasked with designing the part to meet the requirements, but be as lightweight as possible. Again, from a starting geometry, the part becomes progressively lighter with each small change. Once no small change could possibly make the part better, then it is considered optimized. The parts made with this method take on strange alien-like shapes like the seat bracket, but are often 30% lighter, or more, than conventional parts which is a big deal in a lot of applications. This will mean lighter, faster cars, bridges that need less material to build, airplanes that can carry more weight, and mostly likely enable some new inventions that were not possible without it.

In addition to the two types discussed above, AI has many other forms, almost all of which rely on optimization. Even with all of the impact that AI is poised to have on our lives, it is almost comforting to know that, fundamentally, it is just a computer solving the problem of the blind explorer.
Three Different Things: April 7, 2020
By: Sean O'Brien
Tags: Social Media, Advertising, Digital Transformation, Facebook

Three Different Things: April 7, 2020

Social Media in Isolation, Tech Bubbles, and Digital-Only Business

(FTA)

Now — and I mean this in a careful way — I’m thinking synthetic opioids, narcotics, have relevance here. Opioids in a medical context are incredibly important for pain management after surgery. You would not want a world that did not have opioid-based pain killers. They can help your grandmother with her hip replacement. They can also destroy your life in another context. These technologies are life-giving and powerful, and we wouldn’t want to not have them. At the same time, if you’re spending your day on Twitter right now, it’s shredding your psychological health. It’s the physical equivalent of sitting here with drain cleaner, taking shots every hour. But if you’re on a Zoom call with your parents or cousins or something, it could be giving you the exact opposite effect!

I’d like to see a PSA/Health campaign that shares how certain online activity (Twitter, TikTok) can affect psychological health. It can be like inviting yourself to be gaslit. I think one-way, one-to-many communication (any service that allows anonymous posting with likes) is ultimately the culprit.

As the article mentions, I’m reminded that some tech is truly social. I used Facebook Messenger for the first time in years to have a video chat with extended family. Facebook is, well… Facebook… but video chat over Messenger was a great experience. I’m thankful Messenger exists at the moment.

2. So This Is How the Tech Bubble Finally Ends: Fully Charged

And just as in the aftermath of the last crash, the seeds of that next boom may already be being planted. Zoom Video Communications Inc., the video conferencing service, revealed this week that it had gone from 10 million daily active users to 200 million thanks to the crisis. Grocery delivery has become an essential service. Amazon.com Inc., is facing plenty of criticism for its treatment of workers, but the company is the backbone of the American way of life.

2020, the year digital was proven essential. Digital-only is now truly a way of life. It’ll be a way of business too.

With all this extra online activity, ad inventories must be overflowing. And with marketing budgets going way down, I expect CPMs to follow.

3. All Microsoft events will be digital-only until July 2021

As a company, Microsoft has made the decision to transition all external and internal events to a digital-first experience through July 2021.

Not surprised to see Microsoft taking the lead here and proclaiming events digital-only over a year out. Large conferences and events will never be the same.
Synapse Team Spotlight: Getting to know Matt Freeland, Product Engineer
By: Carla Mcmorris
Tags: Engineer, Engineering

What is your role at Synapse and what are some of your responsibilities?

Officially a Product Engineer. One of my main responsibilities is assisting our implementation and account management teams in onboarding platforms. I’m their direct SE while they’re in the process of using the sandbox to learn the products and start developing their applications to interact with it. I also do some reporting stuff, working in our databases to pull reports for our compliance & engineering teams and do some general support engineering stuff. Additionally, I contribute to our Backend codebase.

Did you always know you wanted to become an engineer?

Kind of. Even before I was in an actual engineering role, it might seem ridiculous but I’ve been using Excel and doing a couple of art projects in various graphics programs like Photoshop. I had been introduced to the world of scripting so I would script automated tasks in Excel, I’d make macro-enabled spreadsheets and stuff like that so I did a little bit of lightweight coding and I’ve been doing that for basically my entire working life. Anything I could create shell scripts for or make macro-enabled spreadsheets for, I would do it and when I started learning Python it just all clicked for me and I realized yep, Engineer is where I want to be.

Once you made that decision, how did you know what the next step would be from there?

I got laid off from an industry that is very cyclical and is prone to bulk layoffs and decided that I wanted better stability and I had plenty of time and runway to make a change. I decided the best way would be to go to a programming boot camp. So I did with the express idea of becoming a web developer not yet sure that I wanted to be a back-end engineer at that point but as I went through the courses I kind of gravitated towards Python and Flask specifically and that is where my focus is right now.

What drew you to joining Synapse originally?

Initially and before I knew anything about the product, it was a stack that I was comfortable with. I looked at the technical specifications in a listing and was like ‘Hey Flask! I can work in Flask’. From there when I was doing some research on the company and the product it was just super cool and I was pretty invested in getting the job. I did a lot of research on the public API, but it really cemented in when I came in for the interview and talk to you and Sankaet and Hillary, sitting there and watching Sankaet’s overview of how the product worked, I was completely hooked at that point.

Want to read more, please visit our blog.
A (Quick) Guide to Neural Network Optimizers with Applications in Keras
By: Andre Ye
Tags: Optimizer, Neural Networks, AI, Gradient Descent

SGD (Stochastic Gradient Descent)

Stochastic Gradient Descent, in contrast to batch gradient descent or vanilla gradient descent, updates the parameters for each training example x and y. SGD performs frequent updates with a high variance, causing the objective function to fluctuate heavily.

SGD fluctuation. Source

SGD’s fluctuation enables it to jump from a local minima to a potentially better local minima, but complicates convergence to an exact minimum.

Momentum is a parameter of SGD that can be added to assist SGD in ravines — areas where the surface curves more steeply in one dimension than in another, common around optima. In these scenarios, SGD oscillates around the slopes of the ravine, making hesitant progress along the bottom of the local optimum.

Momentum helps accelerate SGD in the correct direction, therefore dampening the redundant oscillations as seen in image 2.

Nesterov momentum is an improvement over standard momentum — a ball that blindly follows the slope is unsatisfactory. Ideally, the ball would know where it is going so it can slow down before the hill slopes up again. Nesterov accelerated gradient (NAG) can give momentum a prescience by slowing SGD down before it reaches an upsloping area, helping reduce unnecessary redundancy in convergence.
They all got crowns
By: Adauto Braz
Tags: Music, Pop Culture, Data Science

They all got crowns

Debunking the dynamic of pitting pop divas against each other, with an exploratory data analysis on their strengths

If you, like me, are the kind of person that takes pop music seriously, chances are you have already been involved in heated discussions about pop divas. More often than not, arguments regarding this matter end up pitting women against each other and reinforcing the musical industry’s deeply rooted misogyny.

One of the reasons it may not be fruitful to engage in this discussion of trying to find the ‘best’ pop diva is that, just like everybody else, they all have their strengths and weaknesses. Using one’s strength to compare all others not only misses the point, but doesn’t give them enough credit for going through everything they went about to bring such an amazing body of work to us, the fans.

Thus, we’re not going to focus on such discussion.

We can’t argue with the fact that music revolves around our personal preferences and experiences. In so, what you’ll read below is not only a testament to each of these artists work, but a moment to reflect on what it is about it that resonates with you so much you're willing to fight to defend it.

By doing so, and being really open and curious, we’re not only gaining a more granular knowledge on our musical taste, but also rewriting this false narrative of comparison to a more respectful one, enhancing and lifting all these amazing women at the same time.

To do so, we collected data from Spotify and Genius, and we will dive into the full discography of nine pop divas (Beyoncé, Taylor Swift, Ariana Grande, Rihanna, Lady Gaga, Madonna, Mariah Carey, Britney Spears and Katy Perry), using twelve variables to analyze their songs (danceability, song duration, speechiness, energy, lyrics emotion, sound emotinal, among others). To this analysis, we just considered these artists solo projects.

Let’s go?
You’re Not a Child Anymore, So Why Are You Still Eating Like One?
By: Dr. Christine Bradstreet
Tags: Diet, Nutrition, Mindset, Weight Loss, Health

I can’t take credit for the title of this piece. In the height of my chiropractic practice many years ago, one of my patients said those words.

She was telling me about a birthday party at work. You know the type of party she was talking about: A conference room with stale coffee and a huge grocery store sheet cake.

Jennifer had been working hard to lose 40 pounds, but that big sheet cake brought back delightful childhood memories of frosting so sweet it makes your teeth hurt. Damn, that cake looked good and she was reaching for the biggest slice.

Suddenly a voice inside her said:

“You’re not a child anymore, so why are you still eating like one?”

Snapped out of her trance, she sampled one bite, then threw the rest in the trash.

I stared at the pie as I contemplated breakfast today.

I would say my diet is 80% wholesome, homemade, healthy food. But, I still love to snack, and I do love desserts. Pie for breakfast can sometimes seem reasonable 😉

Then I heard my dear patient’s words in my mind.

“You’re not a child anymore, so why are you still eating like one?”

Many of our associations with food are rooted in childhood. Foods can make us feel cozy and nurtured, like a plate from the Thanksgiving table. Others make us feel youthful and happy, like an ice cream cone or a slice of birthday cake.

It starts in your mind, not in your stomach.

Be aware of what’s motivating you as you make your food choices. Chances are you don’t even like that sugary sheet cake, so why do you reach for it?

Your inner child gets excited and jumps in to make your food choices for you. That little kid knows what it likes, and you’ve been letting it call the shots.

fast food

boxed macaroni and cheese

aversion to vegetables

sugary drinks

white bread

hot dogs

bags of chips or candy

breakfast cereals named after candy

sheet cake

But you don’t think whole grains or vegetables taste good?

Get over it. You’re not a child anymore.

Lots of things in life change when you outgrow childhood. You wear pants to work. You don’t leave your toys lying all over the flow. Temper tantrums are rejected.

Once you’re aware of what’s driving your food choices, you take back control.

Empower yourself. Remind yourself who you are. You’re a healthy, smart, reasonable adult. You love yourself enough to take care of yourself. You’re the image and likeness of your creator, after all, so live your life like it.

Learn to use the power of your thought to think yourself thin with my online course at Udemy.

You deserve genuine and lifelong happiness, the type of happiness that can’t be taken away from you no matter what sort of craziness is happening in the world. Read my book, Happy Ever After. We can all use that right now.

I made a free 5-day Mastering Happiness email course, and I want to share it with you! Visit me at christinebradstreet.com where you can get your course for free.

All images open source from pixabay.com
Sharing graphs has never been easier
By: Burak Arikan
Tags: Social Media, Data Science, Data Visualization, Social Network, Journalism

We are excited to announce the new sharing experience on Graph Commons.

Graph Commons is a collaborative platform for mapping, analyzing and publishing data networks. It empowers people and organizations to transform their data into interactive maps and untangle complex relations that impact them and their communities. Whether you use data mapping for investigative journalism, archival exploration, or content curating you’d want to have your audience engage with your published data. The goal of Graph Commons is to support quality data publishing, in addition to intuitive mapping and analysis of data networks, so we hope that this new sharing feature flourishes meaningful discussions around your work.

As of today, you can add visual annotations to any public graph, deep-link to your findings from rich social media posts, and make high resolution prints.

Comment with a view

Select an area on the graph and add your thoughts. Give feedback, share links, and generate new discussions.

Tip: In a comment, use # to reference nodes and @ to mention members.
Where should we store the JWT for SPA? Memory, Cookie, or LocalStorage?
By: Sean Hs
Tags: Single Page Applications, Python, Django, Software Development, Jwt

3. Double tokens policy: HttpOnly Cookie + CSRF token

The HttpOnly tag for Cookie is one of solutions to defend XSS. The HttpOnly tag will restrict users to manipulate the Cookie by JavaScript.

It’s the reason people recommends us to save JWT in the HttpOnly Cookie instead of the localStorage.

Send response with JWT in the Cookie for Django/DRF

// Edit settings.py

JWT_AUTH = {

...

'JWT_EXPIRATION_DELTA': datetime.timedelta(seconds=300),

'JWT_ALLOW_REFRESH': True,

'JWT_REFRESH_EXPIRATION_DELTA': datetime.timedelta(days=7),

'JWT_AUTH_HEADER_PREFIX': 'JWT',

'JWT_AUTH_COOKIE': 'token'

} //Edit views.py ...

response = Response(serializer.data)

response.set_cookie('token', serializer.data['token'], httponly=True)

return response

And we won’t have to do other things in the client-side.

However, the HttpOnly Cookie causes another threat — Cross-site request forgery (CSRF). Attackers can retrieve Cookie by sending requests to the website.

Can we use CORS whitelist to protect Cross-site request forgery (CSRF)?

Can we use CORS whitelist to protect CSRF? That’s review the Same-origin policy.

Urls have the same schema, domain, and post The cross-domain requests from JavaScript are usually limited like XMLHttpRequest or Fetch API The cross-domain requests from HTML are usually unlimited like <script>, <img>, <link>, <iframe>, <video>

Copt right@A Layman

CORS does help prevent certain types of CSRF attacks from external sources. But it can’t prevent internal CSRF attacks.

It can restricts users to call endpoints from XMLHttpRequest(AJAX) and Fetch . But users still call endpoints in HTML tags(img, script, etc).

Set Cross-Origin Resource Sharing (CORS) in Django/DRF

// Install packages

pip install django-cors-headers //Edit settings.py

INSTALLED_APPS = (

...

'corsheaders',

...

) CORS_ORIGIN_WHITELIST = [

...

] CORS_ORIGIN_REGEX_WHITELIST = [

...

] MIDDLEWARE = [

...

'django.middleware.common.CommonMiddleware',

'corsheaders.middleware.CorsMiddleware' ]

Use CSRF token in Django/DRF

To defend CSRF, we can use the CSRF token with JWT. The server can response with CSRF token in the cookie.

REST_FRAMEWORK = {

'DEFAULT_PERMISSION_CLASSES': (

...

),

'DEFAULT_AUTHENTICATION_CLASSES': (

'rest_framework_jwt.authentication.JSONWebTokenAuthentication', 'rest_framework.authentication.SessionAuthentication'

),

}

The requests without the CSRF token will be rejected.
Starting a business isn’t hard
By: Ben Edwards
Tags: Personal Development, Personal Growth, Business, Startup, Improvement

So when I agreed to speak with Tim Enwall, Misty Robotics’ CEO, it really was as an advisor to what they were attempting to start. But as I learned of Misty’s products, mission, and team, the more I discovered overlapping interests and experiences that I could bring to bear to an exciting opportunity. In fact, it seemed like the role was tailored specifically to those interests and experiences.

But still, the idea of rejoining a startup wasn’t wholly appealing. I had a lot of questions. They were mostly about myself. Could I have a sense of ownership in an organization I hadn't started? Had my abilities atrophied from several years of disuse? Would I have sufficient motivation to participate fully in this type of endeavor again? Could I maintain a sense of balance between the life I now felt protective of and the demands an early stage company would place on my time and attention?

Now a year into this new adventure, I have answers to these questions. Yes. No. Yes. No.

Well, three out of four ain’t bad, as they say. But I’ll need to make adjustments on that last one if I’d like to enjoy any sort of longevity at Misty (or any other effort I undertake). My life with Jena is too important to slip into old patterns — to prioritize work ahead of us. I’ll need to take time off. Not just vacation, but evenings and weekends. That can be hard at a startup. It will just take awareness, discipline, and good habits. It will take growth—growth of a different kind.
Live Dashboards with Redash and Rockset
By: Igor Canadi
Tags: Analytics, Data Visualization, Sql, Data, Business Intelligence

Redash is a powerful open source query and visualization tool that helps you make sense of your data. It connects to variety of data sources and also includes a native connector for Rockset. In this post we will demonstrate how to use Redash to build live dashboards on Rockset data sets.

Configure

If you’ve never used Redash before, you need to set it up first. You have two options: either run it yourself or use the hosted version provided by Redash.

Once you have set up Redash, you need to create a new Rockset data source. Read about Redash adding Rockset as a supported data source in Redash v6.

Look for “Rockset” in the New Data Source view.

To configure the data source, you should give it a name and an API key that you can create in the Rockset console. In most cases you can leave API Server as is, using https://api.rs2.usw2.rockset.com .

Query

Create the data source and you are ready to query Rockset! On the first load you might need to give some time for Redash to preload the schema of all Rockset tables. Once that’s done, you should see a list of all Rockset collections in your account and you can start executing SQL statements. Click Create in the nav bar and then Query to start your SQL query.

Live Dashboards and Visualizations

By default, Redash shows you a table with results of the query. However, you can also build rich dashboards and visualizations based on your results. Click on New Visualization , and from there you can select many different visualization options, such as Bar charts, Pie charts, Scatter plots and others. You can also add the visualization to a dashboard that will automatically refresh as new data comes in.

Find more info on the Rockset-Redash integration in our docs. Give it a spin and let us know what you think!
Convergence
By: Alok Tyagi
Tags: Accounting Solutions, Software Development, Erp, Agile, Business Intelligence

We live in a time of convergence where examples are littered show casing various technologies or products converging to enhance end user experience. One case in point digital media and home entertainment serving to improve everyday experience. Just pick one category of your liking and you will soon find someone is pushing the envelope either bringing adjacency services closer or building one if it doesn’t already exist.

Same is true for the business software community. It remains an emerging trend to converge and deliver enhanced experience for business users.

I usually put the convergence in three categories that overtime gets delivered as one unified solution. These are:

1. Improve a person’s productivity in the workplace.

2. Improve the ability to make decision easier based on historical or projection based heuristics

3. Improve an individual social standing in the peer community

There are multiple ways this convergence is getting accomplished. People who observe business software see how the dots are getting connected — be it through an acquisition in the marketplace or the kind of releases introduced in the marketplace.

One big plus is the maturity (and availability) of technology infrastructure — particularly around web based computing model — which helps converge and deliver combined user experience feasible.

It is an exciting time being in this space and next decade is going to be much better than the past decade — as far as the overall business solutions are concerned.
Managing Multiple Environments in Terraform
By: Gaurav Agarwal
Tags: Terraform, AWS, Technology, DevOps, Programming

Managing Multiple Environments in Terraform

How to use Terraform workspaces to manage multiple states

Photo by John O'Nolan on Unsplash.

Terraform has revolutionised the way we look at infrastructure, and with Cloud, it is a stepping stone toward “everything as code.” That is a quantum leap in the history of computing where everything — including hardware and operating systems — is virtualised and can be defined as code.

Terraform has simplified the lives of infrastructure architects, admins, and organisations alike, and it helps in building a computing infrastructure that is ever-changing as well as more scalable and elastic than ever before.

Terraform uses a declarative, high-level, and immutable set of code to define infrastructure. Infrastructure admins would typically just declare what infrastructure they would like to have without worrying about the internal API calls.

Terraform is cloud-agnostic and can help you manage multiple cloud configurations using a single setup. You can also declare dependencies between components spread across the cloud.

One challenge with IaC is reusability. Terraform recommends you keep your code DRY (Don’t Repeat Yourself). That is especially true if you are managing multiple environments.
Thoughts on building software models
Tags: Software Engineering, Project Management, Coding Style, Software Development

Photo by Uwe Hensel on Unsplash

I recently taught a course on how to build software models for beginner to intermediate coders. As part of that I tried to distil the general ideas that underpin good modelling practice.

So beyond the basics of syntax and how to write a function, what is it that really matters when we’re designing and writing software? What makes the difference between a good model and a bad model, and whether we deliver comfortably on schedule or if it’s a hectic last week with 16-hour days?

Everyone does things differently and there are few absolutes; this is what works for me:
Video: On a Highway to Scale — Machine Learning as a Platform (Hebrew)
By: Riskified Technology
Tags: Machine Learning, Videos, Spark, Apache Spark, Engineering

On a Highway to Scale: Machine Learning as a Platform — Ben Amir (Hebrew)

When you’re handling lots of data, you come across many issues and problems, including ones associated with model training. At Riskified, we also handle lots of data and face problems, which forced us to scale up our ML platform.

In this talk, Ben Amir covers how we speed up to the process of handling massive amounts of data and shorten the way to production using our new machine learning platform orchestration. Ben shares our insights from the process of building it up from scratch and how we leveraged Apache Spark and Kubernetes as key infrastructural players.

Ben is the ML Platform team lead at Riskified. After serving 12 years in the 8200 unit, he joined Riskified and fell in love with fighting fraud. He is a real fan of new technologies, trying new stuff, innovation and hard work. When Ben is not near his laptop, you can find him watching (or playing) basketball, walking around the city with his dog and probably grabbing some good food.

*Talk is in Hebrew
Warrior Rising
By: Edie Tuck
Tags: Poetry, Future, Warriors, Prince, Change

In his mother’s footsteps, the unlikely sheltered chosen

A disallowed controversial path forged, spuriously blessed

Tortured, perhaps, his crystal eyes haunted, subdued, saddened

Smoke and mirrors, a shattered facade of illusions

Fabricated realities altered, upheld in false truths, secrets

Publicly resigned, obedient, diligence befittingly executed

Behind fractured doors, slivers, splinters, ancient echos

Though the hand he holds may be human and flawed, it is loved

To draw first sword, first blood, critics take heed, away

Humble strides beneath the world’s judging gaze

Unrelenting, a desire for more, for better, simpler, quiet

The jewels reduced to dust in his wake

A new dawn, a revolution of change unfolds

Twenty-three years bereaved, growing, flourishing

A man, husband, father, captain, veteran, warrior

Oceans crossed, a great divide, symbolism does not escape

Loyalty reinforced, examined, proclaimed

Stepping back to stand forward, bravely

Strong and free in this colonial land, a new genesis

Emergence of evolved sovereignty, a warrior rising
React 2020 — P8: Class Props Destructuring
By: Dino Cajic
Tags: JavaScript, Web Development, React, Reactjs, Programming

If you’ve looked at React code before, there’s almost a 100% chance that you’ve seen destructuring. If you look at most import statements for class-based components, you’ve more than likely seen something like this:

import React, { Component } from 'react'; class ClassName extends Component { ... }

The { Component } is an example of destructuring. If we didn’t use destructuring, we would have had to use the following syntax in our class declaration:

import React from 'react'; class ClassName extends React.Component { ... }

What exactly is destructuring? It’s just a way to extract multiple keys from an object or an array and assign them to a variable. You might have seen the following syntax at one point in your career:

The variable a is assigned 10 and the variable b is assigned 20. This code just took the elements out of an array and placed them into variables.

In this example, we have an object user. The user object contains two properties: id and name. We can destructure and extract those properties into individual variables, or constants, as is done on line 6. Fun Fact: everything that we looked at so far is just JavaScript.

Let’s look at how we would destructure the props object inside of a class component. If you’re not familiar with the props object, take a look at my article on Class Component Props.

Create a new file inside of src/components and name it DinosFavoriteCar.js.

Create the class component and name it DinosFavoriteCar, but this time destructure the Component when importing React. Let the render() lifecycle method return a JSX element that contains the string Year Make Model. Import it into the App component and render it.

Now that we’ve verified that there are no errors, let’s pass some props to the DinosFavoriteCar component and use them like we’ve done before. Pass the 2020 Nissan GT-R by using the year, make, and model props.

<DinosFavoriteCar year="2020" make="Nissan" model="GT-R" />

You can use the props object inside of the class component DinosFavoriteCar to display the year, make, and model.

There it is. Nothing new so far. If you look at the DinosFavoriteCar component, you’ll notice that we use this.props for each attribute. Wouldn’t it be nice to extract the year, make, and model from the props object? Yes it would. So let’s do it.

Inside of your render() method, type the following:

const { year, make, model } = this.props;

We already saw an almost identical example with our user object above. The props object contains year, make, and model. We’ll extract those properties and assign them to the year, make, and model constants. When we do that, we can get rid of this.props.

In the next article, we’ll look at destructuring props inside of functional components.
How to Build and Deploy a Jamstack Website Fast With Next.js
By: Dev Rayray
Tags: JavaScript, Jamstack, Netlify, Programming, React

How to Build a Website With Next.js

1. Installation

You should have Node.js and Git installed on your computer. If you don’t have Node, downloading the installer is the easiest way.

2. Create a project

It’s as simple as running this command in your terminal:

npx create-next-app

First, it will ask you this question: “What is your project named?” Type in the name of your project and it will generate all the needed files.

In your terminal, go to the directory of your project. The script will show you the folder when it has installed all the dependencies.

When you open this folder via your favorite editor, it should look something like this:

3. Add content and styling

If you check the pages folder, you will see two JavaScript files and one folder.

The index.js is your homepage. The _app.js is the wrapper for all page components. Here, you can add all kinds of global styling.

Run npm run dev and open your browser on localhost:3000 . Now you can see your new Next.js website.

If you want to get content from Markdown files, an API, or a CMS, I recommend checking out all the starter projects from Next.

Running it locally is cool, but eventually, you want to show it to the world.

4. Create a GitHub project

Before we can deploy it, create a project and host your code safely there.

We want to host it for free on Netlify. For Netlify, you should add a config file to get your site running in no time.

Create a netlify.toml file and copy this code in it:

[build]

command = "npm run build"

publish = "out"

With this code, you tell Netlify what your build command is and in which folder it needs to serve that build version.

5. Deploy on Netlify for free

Log into Netlify and create a new project based on your GitHub account.

Select the repo your website is in and click next. The next step should be configured for you because of the netlify.toml file.

When everything goes as planned, you should see that there is a deployment running.

When that build and deployment process is finished, you can visit your site by clicking on “Preview deploy.” Now your website is alive and you can share it with the world.

Of course, I recommend spending a reasonable amount of time adding content and styling so it is very pleasing to your visitors’ eyes. I wish you good luck!