teleren/devto huggingface dataset:
pysirix Alpha Release
Tags: python, database, opensource
Published: 2020-05-06 23:48:19

---
title: pysirix Alpha Release
published: true
description: Alpha release of the SirixDB python SDK
tags: python, database, opensource
---

I am really excited to announce, that we have released a python client SDK for interacting with the SirixDB database.

SirixDB has many important technical features, but its outstanding feature is the persistency of every _version_ of your data (JSON or XML).

This means that even should your data be tampered with, you can see what the original data was.

Also if you accidentally stored incorrect information (say, a wrong address), and then changed it, you can also check what you stored before the data was corrected (in case you need to know why the package was shipped to the wrong address :wink:).

SirixDB stores all your data, past and present, but there is still much work to be done. Among them, an easy way to interact with the database. And that is why the new `pysirix` library is a big deal; it makes it easy to connect to the database, without needing to write custom queries and calls to the REST API.

`pysirix` is still in its early stages, with lots of features missing (especially from the higher level abstractions), but we hope you'll try it out, and file bug reports of course :smile:.

You can download the package from [PyPI](https://pypi.org/project/pysirix/) and find the API documentation on [Read the Docs](https://pysirix.readthedocs.io/). There is a tutorial on the [SirixDB website](https://sirix.io/python-sdk.html).
Falladin Algorithm?
Tags: Algorithms, android
Published: 2020-05-06 23:41:14

Soo I found an app (because of my girl) that's called falladin it's an app that telling you about the future every day. And I thought. How it works? And how his algorithm works. 
I tried  to search something about it and the only usefull data I found is this= " Faladdin offers individual analysis about life by combining its deep learning skills and ancient knowledge of mystical disciplines like Tarot, Astrology, Clairvoyance and Coffee Cup Reading.". Soo yeah does anyone knows anything more about that?
How to Create a Simple Interactive Calculator with just 20 lines of code
Tags: html, javascript, codenewbie, tutorial
Published: 2020-05-06 23:34:14

Hello, I created a simple interactive calculator with just 20 lines of Javascript code and I will be sharing it with you in this post. 

This code can be implemented in your Javascript beginners’ project, so in case you don’t have an idea of what to build after tons of tutorials on Javascript? 

Why not try this out? In a few minutes, your calculator will be running perfectly.

First of all, I guess you must have designed your graphical user interface (buttons and screen) with HTML and CSS.

If so, yes! let’s begin;

In this project I made of use of the div tag as my screen and my buttons were styled and were made interactive with hover and media query for responsiveness.

![Simple Javascript Projects](https://dev-to-uploads.s3.amazonaws.com/i/u70yy5vg8hakb4jg8j6m.jpg)


Now, to the JS code:

let display = document.getElementById('screen');

Here, I created a variable ‘display’ and with use of DOM, I linked my div with its id ‘screen’; this is where my output is shown. After this,

function isclicked(value) {
        if(display.innerText === 0) {
            display.innerText = value;
        } else {
            display.innerText += value;
        }
        return display.innerText;
}

Above, I declared a function ’isclicked’ which is linked to all my operations and numbers button (except the equal-to button) with the onclick attribute. 

The function takes in the value of the button as its parameter (string) and show the value of button on the screen when clicked. 

let equals = document.getElementById('equalto');
const equalClicked = () =>{
    if(display.innerText !== "") {
        display.innerText = eval(display.innerText)
    } else {
        display.innerText = "";
    }
}

Next, I created a variable ‘equals’ that is linked to my equal-to button via its id. The function then evaluates the text on the screen by the use of the ‘eval’ keyword.
![Javascript Calculator Project](https://dev-to-uploads.s3.amazonaws.com/i/oq13wrwf3natczwpnzd5.jpg)

const clearClicked =() => {
    display.innerText = "";
}
Lastly, this function is linked to my CLEAR button, the screen is empty when the button is clicked

Wow! You made it! By now, your calculator should be working perfectly. 

You may also want to check the full project [HERE](https://codepen.io/arshadayvid/pen/qBOpGqd)

Also, make sure you follow me here, on [Codepen](https://codepen.io/arshadayvid/) and [Medium](https://medium.com/@asaoludavid234)  for more exciting projects.
Thank you for reading!
Lesson note sharing application. My own labor🚀
Tags: django, webdev, python
Published: 2020-05-06 23:18:55

Greetings to all my friends. I review my website that I have just published 2 days ago and leave it here for you to return. I will be waiting for your positive comments and feedback.

The overall purpose of the site is lecture notes sharing and question and answer platform.
Each entered grades correspond to certain points on the site and offers various gifts to students.

www.airkampus.com
How To See If Your Resume Was Viewed When Applying For A Job
Tags: career, codenewbie, resume, beginners
Published: 2020-05-06 23:04:15

Being in the market for a new developer position I cold email recruiters, hiring managers and engineers all the time but I never know who to follow up with if they don't respond.

__UPDATE: As one [reader](https://dev.to/jep) pointed out that a bitly in a cold email might get your email in the spam folder, my greatest success with this was actually on Linkedin. Guess now I know why :)__

This what I came up with to see if my resume was viewed:
- Put your resume on google docs and get a public link.
- Use http://bitly.com to generate unique links for every outreach email etc.

Bitly will now show you if the link was clicked on!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/o2dh794tuw5wto3cz6m2.png)

P.S. I'm still looking for a position in NYC if you know of anything or if you'd like to hire me you hit me up at 4hbrody@gmail.com!
A simple way to build your JavaScript tests data
Tags: javascript, refactoring
Published: 2020-05-07 20:30:58

---
title: A simple way to build your JavaScript tests data
published: true
date: 2020-05-06 23:00:00 UTC
tags: JavaScript, Refactoring
canonical_url: https://gsferreira.com/archive/2020/05/a-simple-way-to-build-your-javascript-tests-data/
---

When writing Unit Tests, you will need to create test data objects for sure. Usually, those objects have tiny differences between different test cases.

There's a pattern that I especially like when I'm doing this is C#. [The Builder Pattern](https://ardalis.com/improve-tests-with-the-builder-pattern-for-test-data).

The builder pattern is an elegant solution to the problem and I really like it. But, is it a simple solution for JavaScript?

Let's see how it would look like using the builder pattern in JS:

![Builder pattern](https://gsferreira.com/images/a-simple-way-to-build-your-javascript-tests-data-builder.png)

As you can see, there's a lot of code needed to implement it. 

**How can we do it more simply?**

The basic idea is to **use the [Spread Operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax) to customize a default object**.

Let's see how:

![Spread Operator](https://gsferreira.com/images/a-simple-way-to-build-your-javascript-tests-data-spread.png)
Future of backend development
Tags: serverless, career, microservices, computerscience
Published: 2020-05-06 22:47:45

Here are some of my thoughts on the future of backend/server-side development. Feedbacks welcome!

## Proposition 1 - Thin Server, Rich Platform
Now that scalability and security are mostly handled by the infrastructure and database layers themselves, the backend code is becoming more vanilla than ever. The complete decoupling of the front-end, native-like performance on the client-side platforms and modern frameworks and cloud services are allowing us to keep our backends thin. Serverless, microservices, containerization, and asynchronous data processing are a few latest big changes in server-side development. Rich infrastructures on top of these technologies are going to make traditional style backend development obsolete in the near future.

## Proposition 2 - Dynamic Language or DSL
One common conception of object-oriented programming or programming, in general, is that our code should resemble the real world to make it easy to develop and manage. However, this particular philosophy leads to a deep coupling of the business logic and the code and makes it unnecessarily hard to make fast changes. The computing world is way more flexible and dynamic than the real world. So using real-world constructs in programming makes it artificially limited. The 1:1 modeling approach used to work really well when the software did not really need frequent changes. In the new world, where specs pivot every day, we should aim for dynamicity. This is already repopularizing the usage of newer dynamic languages for backend development.

## Proposition 3 - CMS and Simulation
Decoupling the business rules from the code is super important. Everything that’s configurable should be coming from some sort of configuration management system (CMS). The code should interpret the configurations and work like simulators. Softcoding is not an anti-pattern anymore. The CMS can handle the versioning of configurations. The same configuration can be shared amongst multiple micro-services and client applications. Product managers would get an intuitive interface to make quick product changes. Coupled with an A/B testing framework with some gradual rollout mechanism we can release simple changes pretty quickly across all applications.

## Proposition 4 - Resiliency via Technical Intelligence
Instrumenting the code as important as unit testing or any other quality assurance measures. Build a culture of build-measure-learn from the engineering perspective. Modify the platform to automatically log all important metrics like exceptions, API execution time, queue size, etc. Log all unusual situations by default, over-logging is better than under logging. The worst feedback loop is waiting for your customers to complain about what’s not working. Have real-time technical/operational insights, be proactive at discovering and fixing problems, and make your system resilient by automating your runbooks.

Now that you know my take on this, please share your opinion.
Is there a way to prevent certain posts from syncing to Stackbit-integrated blog?
Tags: help, discuss, blog, stackbit
Published: 2020-05-06 22:36:03

I just posted a different question related to dev.to/stackbit integration and realized that post synced to the Stackbit-integrated blog website. Is there a way to prevent certain posts (maybe tag filtering) from syncing? Personally, I don't think it makes sense to sync #help type posts, or even #discuss type posts. Or at least include an option for users to make their own choice.

Feel free to chime in with your own opinion.

Thanks!
PHP Splice into an associative array
Tags: php, webdev, tutorial
Published: 2020-05-06 22:16:37

---
title: PHP Splice into an associative array
published: true
date: 
tags: php, webdev, tutorial
canonical_url: https://nimblewebdeveloper.com/blog/php-splice-associative-keyed-array
cover_image: 
---

For those of use with maybe more experience in nicer (don't @ me 😎🙉) languages like Javascript, splicing into an associative array in PHP may seem a little challenging.

In javascript, we could simply call `array.splice` and specify our index and offset and it would work. Javascript doesn't care that it's an associative array (object) or and indexed array, it just works.

PHP is a bit more complicated. Indexed arrays and associative arrays are fundamentally different.

It's ok though there's a pretty easy way to do it. And I've made a little helper function to wrap it up;

```php  
<?php  
  
/\*\*  
 \* array\_splice\_assoc  
 \* Splice an associative array  
 \* Removes the elements designated by offset & length and replaces them  
 \* with the elements of replacement array  
 \* @param $input array  
 \* @param $key string  
 \* @param $length int  
 \* @param $replacement array  
 \*/  
function array\_splice\_assoc($input, $key, $length, $replacement=array()) {  
  // Find the index to insert/replace at  
  $index = array\_search($key, array\_keys($input));  
    
  // How do we handle the key not existing in the array?  
  // Up to you. In my case I'm going to return the original array  
  // But you might want to return false, throw an error etc  
    
  if($index === false) {  
    return $input;  
  }  
    
  // We're going to create 3 slices of the array  
  // the 'before' slice, before our $key  
  // the $replacement slice  
  // the 'after' slice, after our $key  
    
  //This could easily be done all in 1 line, but I've split it out for readability  
    
  $before\_slice = array\_slice($input, 0, $index);  
  $after\_slice = array\_slice($input, $index+$length);  
    
  return array\_merge($before\_slice, $replacement, $after\_slice);  
}  
  
```

## How it works

I've modelled this helper function on the built in `array_splice` method, with the key difference being the second parameter which is now a string key rather than a numeric index.

With the given string key, we can then search the keys of the associative array for the index corresponding to this key.

If we don't find the index in the array, simply return the original input array. (This part is sort of a choose-your-own-adventure. You might want to return false or an error instead.)

With the index in hand, we can now effectively slice up our associative array into 3 pieces;

- The "before" slice, before our key's index
- The replacement slice
- The "after" slice, after our key's index, plus the length

Finally, all that remains is to merge the three elements together, in order, using `array_merge`.

And that's it!

Note that in the built in array\_splice method, the **$length** and **$replacement** parameters are optional. This could be replicated, but let's be honest it's not really valuable.
My notes from DHH's RailsConf keynote interview
Tags: rails, ruby
Published: 2020-05-06 21:31:34

---
title: My notes from DHH's RailsConf keynote interview
published: true
description: Ruby is great because you can know a little JavaScript and then jump to Ruby, understand it, and own the full stack.
tags: Rails, Ruby
---

For those of you who haven't had the chance to watch yet:

https://www.joshuawood.net/notes/2020-railsconf-dhh-keynote

One of the parts I liked best was this comment:

> Ruby is great because you can know a little JavaScript and then jump to Ruby, understand it, and own the full stack.

What do y'all think about the state of Ruby and Rails in 2020?
Help: Security per record - is it possible to make optimal solution ?
Tags: help, security, oidc
Published: 2020-05-06 21:31:18

So I have a case where data structure looks more like a graph so lets say (object)->(another one)->(yes, antoher)->(even more). And this is stored in graph DB but there's "piled" data which is stored in different engine as pile of things referenced by some filed to vertex/node in graph one.

My problem is that I need security "user per object" where each user can have different access rights, and no role will help in this case as most of the users have different access rights even when they work at same position. So this is what I would call access grant per record or per object.

Now if someone has access to particular object he automatically has access to parent objects. But for example lets say I have (A)->(B) and (A)->(C). If I can access B I should be able to get A but not necessarily C.

I do plan to integrate something like HashiCorp Consul or if there's another similar thing which is easy to use but I don't think this can help at all. I also do have SSO but as any other it mainly relies on roles and such.

BTW, system is multi tenant so adding a new record to a specific user should be visible only for that particular client users, and Admin should decide who get's to see what.

So couple of ways to do it:
1. Have enormous amount of custom queries which filter out data - slow, hard to maintain and possible to leak data when new features are added or changes are introduced.
2. Middleware that handles access per object only - also slow due to a lot of network calls like Client -> load balancer -> API -> DB -> API -> middleware -> DB of the middleware -> middleware -> API -> load balancer -> Client. This could be used with some form of in memory cache which would speed up thing to some extent.
3. Have in-memory filter where each record stored and modified by admin has it's access towards each user cached - extra expensive to have huge amounts of RAM for such a cache 
4. Have SSO deal with it through roles - now I have no idea how would I automate adding roles for each new object inserted to the system, and why would I have so much roles. Users have single access for SSO, so the actual roles would have to spill all over place as there's things like user from one tenant can be added to access some of the data of another tenant...

Anyone have ideas on how to deal with this in optimal way? I really do need help, maybe some software for this I didn't know exits or using SSO or Consul properly somehow for this?
publicRuntimeConfig undefined when using Storybook with Next.js
Tags: nextjs, storybook
Published: 2020-05-06 21:26:48

`publicRuntimeConfig` is setup for us automatically in a Next app, but that doesn't happen when our code gets bundled into Storybook so we need to do it ourselves.

Developers have previously seen [this issue in jest tests](https://github.com/zeit/next.js/issues/4024), so we'll borrow our solution from them by manually setting the config ourselves. We'll add the following code to `.storybook/preview.js` (create the file if it doesn't already exist):

```js
// Allow us to use `publicRuntimeConfig` in stories
import { setConfig } from 'next/config';
import { publicRuntimeConfig } from './next.config';
setConfig({ publicRuntimeConfig });
```

That works fine if your `next.config` file is simple, but if you do any imports (such as for setting up [Next Bundle Analyzer](https://github.com/zeit/next.js/tree/canary/packages/next-bundle-analyzer)) then you might run into new errors in Storybook caused by it trying to bundle this imports. In that case, you can the runtime config to a separate file and importing just the runtime config into the storybook setup:

```js
// runtimeConfig.js
module.exports {
  // Add your config here
};

// next.config.js
const runtimeConfig = require('./runtimeConfig');
module.exports = {
  publicRuntimeConfig: runtimeConfig
};

// storybook/preview.js
import { setConfig } from 'next/config';
import publicRuntimeConfig from '../src/config';
setConfig({ publicRuntimeConfig });
```
Accessibility for React Developers (Tutorial)
Tags: react, a11y, webdev, techtalks
Published: 2020-05-06 21:23:28

> This video is a talk from [*Byteconf React 2020*](https://www.bytesized.xyz/react-2020), a free, live-streamed React conference that aired on May 1st-2nd, 2020. Join our newsletter at the [conference website](https://www.bytesized.xyz/react-2020) to stay in the know about future conferences, videos, and more!

UI frameworks/libs are very good for the developer experience. We as developers are focusing on and achieving the checklist of the best web application:

- Code architecture
- Clean code
- performance & best of everything (almost)

But we are forgetting the accessibility. When was the last time you or your testing team tested against the accessibility and raised the issues? In this talk, I will take you through a non-accessible react site and will do the following:

- How to know accessibility is broken
- How to debug it (& you can advocate your testing team)
- How to fix the issues
- Tips for making sure accessible components/app is getting created
- Tools
- Trade-offs

Thanks to [Neha Sharma](https://twitter.com/hellonehha) who presented this talk at [Byteconf React 2020](https://www.bytesized.xyz/react-2020)!

{% youtube E4Di8Xi9LUA %}

If you enjoyed the video, give it a thumbs-up, and [subscribe to our channel](https://www.youtube.com/channel/UC046lFvJZhiwSRWsoH8SFjg?sub_confirmation=1) for more web dev content every week. We also have a newsletter where we send out what's new and cool in the web development world, every Tuesday – [join here](https://www.bytesized.xyz/newsletter)!
What’s your alternative solution? Challenge #36
Tags: challenge, javascript, codenewbie, learntocode
Published: 2020-05-06 21:09:31

# About this series

This is series of daily JavaScript coding challenges... for both beginners and advanced users.

Each day I’m gone present you a very simple coding challenge, together with the solution. The solution is intentionally written in a didactic way using classic JavaScript syntax in order to be accessible to coders of all levels.

Solutions are designed with increase level of complexity.

## Today’s coding challenge

```
Create a function that will return the number of words in a text

```

(scroll down for solution)

## Code newbies

If you are a code newbie, try to work on the solution on your own. After you finish it, or if you need help, please consult the provided solution.

## Advanced developers

Please provide alternative solutions in the comments below. 

You can solve it using functional concepts or solve it using a different algorithm... or just solve it using the latest ES innovations.

By providing a new solution you can show code newbies different ways to solve the same problem.

## Solution

```javascript
// Solution for challenge31b

function countWords(text)
{
    var words = 0;
    
    if (text.length > 0 && !isSeparator(text[0]))
        words++;
    
    for(var i = 1; i < text.length; i++)
    {
        var currChr = text[i];
        var prevChr = text[i - 1];
        
        if (!isSeparator(currChr) && isSeparator(prevChr))
        {
            words++;
        }
    }
    
    return words;
}

function isSeparator(c)
{
    var separators = [" ", "\t", "\n", "\r", ",", ";", ".", "!", "?"];
    return separators.includes(c);
}

println(countWords(""));
println(countWords("            "));
println(countWords("JavaScript!!!   "));
println(countWords("     JavaScript"));
println(countWords("    JavaScript is cool      "));
println(countWords("I like to learn JavaScript with codeguppy"));

```


To quickly verify this solution, copy the code above in this coding [editor](https://codeguppy.com/code.html) and press "Run".

> Note: The solution was originally designed for [codeguppy.com](https://codeguppy.com) environment, and therefore is making use of `println`. This is the almost equivalent of `console.log` in other environments. Please feel free to use your preferred coding playground / environment when implementing your solution.
My favorite tool in programming.
Tags: showdev
Published: 2020-05-06 21:03:02

Developers usually have an array of development tools under their belt for the different tasks they have to perform, but my absolute favorite would have to be visual studio code. 

It is easily customizable using themes that can be downloaded within vs code. In addition, vs code has extensions that can enhance the usability of the text editor. 

Most of the things that a developer needs to develop quality software and websites are just a click away including git.