teleren/devto huggingface dataset:
Elixir AVETMISS library
Tags: avetmiss, rto, elixir
Published: 2020-02-26 02:05:27

---
title: Elixir AVETMISS library
published: true
description: Elixir library to generate AVETMISS NAT files
tags: AVETMISS, RTO, Elixir
---

In the extremely unlikely circumstances that you need to generate AVETMISS reports with Elixir, I have created a [library](https://github.com/ryan-senn/avetmiss) for it.
AVETMISS stands for "Australian Vocational Education and Training Management Information Statistical Standard". It is a report that any registered training organisation (RTO) that delivers vocational and education training (VET) have to report to the National Centre for Vocational Education Research (NCVER).
I happen to need it for my newly founded company, [Tradie Training](https://tt.edu.au/white-card-qld/brisbane).
It is the first time that I created an Elixir library, so it was a great way to learn about hex.pm, the package repository powering the Elixir and Erlang ecosystem.
I have to say that the experience was very positive. Almost everything was done via very simple and straight forward CLI commands. You can add comments in the code that will be interpreted by hex.pm to generate documentation for you, although I didn't really have the time to invest in it. Something to re-visit when things quiet down a bit. I did however create a [read the docs page](https://avetmiss.readthedocs.io/en/latest/) for the first time, I really wanted to figure out how it works. I didn't invest much time into it either, but knowing how it works is nice.
I love Elixir as a language, but to me what's even more impressive is the quality of everything else. Mix, ecto, hex.pm, great documentation, transparent leadership, quality libraries for just about anything, the list goes on. Ruby is known for developer satisfaction, and in my opinion Elixir takes this to another level.
Typing all this out really motivates me to improve the docs for the AVETMISS library, even knowing how unlikely it is that anyone but me will need it in the future.
For anyone on the fence of giving Elixir a try, just do it! The community and ecosystems are amazing.
To find out more about how AVETMISS works, I wrote a [technical guide](https://rtoadvisors.com.au/articles/what-is-avetmiss) on it.
How To Use The LibGDX GLProfiler
Tags: gamedev, libgdx, java, profiling
Published: 2020-02-26 02:02:21

When optimizing a LibGDX game's performance, sometimes you need to look under the hood.  Let's add the `GLProfiler` to a Screen and see how (in)efficiently we're rendering.

### Why?

In OpenGL, binding textures on the GPU can be an expensive operation.  For each texture switch, there is a draw call.  By minimizing these calls, you can improve rendering performance.

Thankfully, LibGDX has a built-in class to help us inspect the OpenGL calls: `GLProfiler` ([Docs](https://libgdx.badlogicgames.com/ci/nightlies/docs/api/com/badlogic/gdx/graphics/profiling/GLProfiler.html) | [Wiki](https://github.com/libgdx/libgdx/wiki/Profiling#opengl)).


### Profiler Code

Here's the code needed to set up the GLProfiler in a theoretical "GameScreen" and read the number of draw calls and texture bindings.

```java
  import com.badlogic.gdx.graphics.profiling.GLProfiler;
  
  public class GameScreen implements Screen {
    // Add this class member
    private GLProfiler profiler;

    public GameScreen(...) {
      // Your setup code

      // create & enable the profiler
      profiler = new GLProfiler(Gdx.graphics);
      profiler.enable();
    }

    @Override
    public void render(float delta) {
      // reset on each frame
      profiler.reset();

      // Do all your rendering here
      // ...
      
      // Check the profiler data.
      // You can view in debugger, log it, etc...
      float drawCalls = profiler.getDrawCalls();
      float textureBinds = profiler.getTextureBindings();

      // also handy
      float fps = Gdx.graphics.getFramesPerSecond();
    }
    
  }
```

### What should you look for?

Many factors can result in extra draw calls & texture bindings.

* Maybe you aren't using [TextureAtlases](https://github.com/libgdx/libgdx/wiki/Texture-packer#texturepacker)?
* Maybe you are, but there are more than needed?
* Maybe you're rendering things in whatever order was convenient 6 years ago while your baby was sleeping?
* Are you using Scene2D, and did not consider the textures when adding Actors to the Stage?
* Scene2D actors (like TextButton) with BitmapFonts that are not packed with the other UI graphics.
* Gremlins

The [LibGDX Wiki page on SpriteBatch, TextureRegions, and Sprites](https://github.com/libgdx/libgdx/wiki/Spritebatch,-Textureregions,-and-Sprites) is a great resource to learn more.

In general, use fewer texture files, and try to render your objects in texture-order as much as possible.

### Case study coming soon

I recently went through a profiling & optimization effort for [Santa Skate](https://skaterdad.dev/games).  Before release, I had not profiled it once!  Performance was still okay, but my engineering brain was not satisfied knowing there were still slowdowns.  In the coming days (weeks), I plan on writing another post explaining how I tamed the texture binds related to Scene2D widgets and the game world.
Programming first principles - 2. Audience - Who this series is for
Tags: programming, webdev, learning, development
Published: 2020-02-26 01:16:55

This post ([Programming first principles - 2. Audience - Who this series is for](https://www.sargalias.com/blog/programming-first-principles-audience-who-this-series-is-for/)) was originally published on [Sargalias](https://www.sargalias.com).

In this post we'll talk about who this series is for / who will benefit from this series.

## Table of contents

- [Beginner developers](#beginner-developers)
- [Intermediate developers](#intermediate-developers)
- [Advanced developers](#advanced-developers)

I would like to address three types of developers. Let's call them beginner, intermediate and advanced developers.

These are not intended as an insult to anyone. They're just a broad categorization of programming experience for the purposes of this post.

Let's get right to it.

## Beginner developers

In this post, what I mean by a beginner programmer is someone who is still struggling to get small projects working.

At this point it's probably more valuable to focus on overcoming those problems rather than applying programming principles.

Programming principles are more about code organisation, which begins to matter more as a project grows in size. Yes it's important to apply principles from the beginning, but if a project will stay small for its entire lifetime then it's less important.

Having said that, I highly recommend this series anyway if you have the time. While you may not be able to apply these principles immediately, you'll gain good early exposure on them. I really believe this will give you a great head-start and a natural aptitude for when you attempt to learn programming principles more seriously in the future.

## Intermediate developers

For this post, what I mean by intermediate developers is developers who can get small projects working and can successfully work on large projects but feel like their code structure and organisation could benefit.

I feel intermediate developers will benefit most from this series, particularly if they actively want to learn about programming principles.

## Advanced developers

For advanced developers, I think it depends. If you're already very comfortable with programming principles, there will be less value for you in this series.

However, there is probably something you'll pick up anyway. Also you enjoy the different angle I use to try to explain the principles.
Data we can collect from our brain
Tags: machinelearning, todayilearned, datascience
Published: 2020-02-26 00:59:17

The purpose of a [brain-computer interface](https://towardsdatascience.com/deep-learning-in-brain-computer-interface-f650d00268d0?source=friends_link&sk=d34b6f7371922cc55304fb70e33b7a45) (BCI) is to have a direct communication pathway between the brain and an external device. That enables its users to interact with computers by mean of brain-activity.

BCI isn’t a mind-reading device like a Cerebro. Instead, it detects the changes in the energy emitted by the brain. A human brain contains about 86 billion neurons, each individually linked to other neurons. Every time we think or move a muscle, these neurons are at work, activated with energy. A BCI recognises these energy patterns in the brain.

[Electroencephalogram](https://en.wikipedia.org/wiki/Electroencephalography) (EEG) is a popular technique for recording signals from our brain. It is non-invasive, so we don’t need to cut open our skull to collect our brain signals.

EEG records the energy generated by the brain using a series of electrodes placed on the scalp. This involves a person wearing an EEG cap with electrodes placed at specific points. These electrodes detect brain activity, which is electrical energy emitted from our brain.
Configure a Proxy in React
Tags: javascript, react
Published: 2020-02-26 15:50:26

---
title: Configure a Proxy in React
published: true
date: 2020-02-26 00:00:00 UTC
tags: javascript, react
canonical_url: https://www.jamesqquick.com/blog/configure-proxy-in-react
---

So you're working on a full-stack app, React on the frontend and...well anything else on the backend. Your Single Page Applications (SPAs) will have to interact with your backend through API/HTTP requests.

## The Problem

When you publish your app, you have two options.

1. backend serves your frontend
2. backend and frontend hosted separately (you will need to configure [COORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) for this to work)

However, in development, it's much much (did I say much?!) easier to run your frontend React app separate from your backend. For this to work, though, you'll need to make cross-origin requests since they are running on different ports. For example, by default Create React Apps run on port 3000, and your backend server might run on 8000. To allow this to work in development, you can set up a proxy in your React app.

## The Solution

To solve this problem, we can configure a proxy in the `package.json` file of the React project. This allows the app to "pretend" it is making requests from the same port of the server.

> [Official docs on proxying](https://create-react-app.dev/docs/proxying-api-requests-in-development/)

To configure the proxy, you'll need to add the following line to your `package.json`.

```
"proxy": "http://localhost:<SERVER_PORT_NUMBER>",
```

Then, in your React app, you can make API requests by using relative paths. For example, `http://localhost:8000/api/todos` becomes `/api/todos`.

Now, you should be able to run your frontend and backend separately during development, while making API requests using relative paths.
Codinators.XunitHelpers Nuget Package: Update 1
Tags: showdev, testing, xunit
Published: 2020-02-26 23:03:50

---
title: Codinators.XunitHelpers Nuget Package: Update 1
published: true
date: 2020-02-26 00:00:00 UTC
tags: showdev, testing, xunit
canonical_url: https://www.ankursheel.com/blog/codinators-xunit-helpers-nuget-package-update-1
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/ydq4vzv6aru5e2p4w247.jpg
---

I created [Codinators.XunitHelpers](https://www.nuget.org/packages/Codinators.XunitHelpers/)(a NuGet package) to add some useful unit testing functionality that is missing in xUnit.

This release adds support for reporting multiple assertion failures in one method in xUnit tests similar to how [Nunit does it](https://github.com/nunit/docs/wiki/Multiple-Asserts).

## Installation

Install it by using the following command

```
dotnet add package Codinators.XunitHelpers
```

## Usage

```csharp
[Fact]
public void MultiAssertTest()
{
    var result = 2 + 2;
    AssertHelper.AssertMultiple(() => Assert.IsType<double>(result),
                                () => Assert.Equal(5, result),
                                () => Assert.Equal(4, result));
}
```

## Screenshot

![Screenshot for Multiple Assert Failure](https://dev-to-uploads.s3.amazonaws.com/i/ydq4vzv6aru5e2p4w247.jpg)
Easy as a pie Big O notation. Part 2: Space.
Tags: beginners, webdev, algorithms, codenewbie
Published: 2020-02-25 23:30:10


###What?

When talking about space complexity, it's common that we hear the term 'Auxiliary space complexity'. This refers to the space required by the algorithm (not the space taken by inputs). 

###Why?

While it might be more pressing at some cases to look at time complexity, there will be times when you need to consider the environment in which your code will be executed and whether you will have the resources to do so. 

![AHA! moment](https://media1.giphy.com/media/3orieUe6ejxSFxYCXe/giphy.gif?cid=790b7611cd38c92499e0197aea868eb3cdcccde74f1b5041&rid=giphy.gif)
###Important tips to look out for

- Primitives are constant space (booleans, numbers, undefined, null)
- Strings require O(n) space (where n is the string length)
- Reference types are usually O(n) too, where n is either the length for arrays or number of keys for objects

In space complexity, we also use logarithms to express performance. So whenever you see _O(log n)_ it's safe to say we're talking about space, not time complexity.

###About logarithms

A logarithm is the inverse of exponentiation. The logarithm of a number roughly measures the number of times you can divide that number by 2 before you get a value that’s less than or equal to one.

###Where can we expect to see logarithms?
Certain searching algorithms have logarithmic time complexity.
Efficient sorting algorithms involve logarithms. 
Recursion sometimes might involve logarithmic space complexity.

###So, where does this leave us?

To sum it up, 
-Big O notation is used to analyze algorithm performance.
-It can give us a high level of understanding of the time or space complexity of it.
-It cares about general trends, not details.
-Time or space complexity depends only on the algorithm, not the hardware where it’s running.

![get-it](https://media2.giphy.com/media/xUOxfecWsLzAYSUP6w/giphy.gif?cid=790b76114b7e44a85be76724233f4f6386aa8352179a0b88&rid=giphy.gif)

Got something to add? Please feel free to [reach out](https://twitter.com/miss_elliev) for any question, comment or meme.
Feeling Bore? Play With Open Source WhatsApp Bot
Tags: showdev, whatsappbot, javascript, slimcoder
Published: 2020-02-25 23:22:42

---
title: Feeling Bore? Play With Open Source WhatsApp Bot
published: true
description: 
tags: showdev ,whatsappbot , JavaScript , slimcoder
cover_image: https://res.cloudinary.com/dwl34s9au/image/upload/v1582672614/Screenshot_20200226-035935_zitrx2.png
---

Hi Developer's Community around the globe.
I wrote a whatsapp bot by using node js , twilio and dialogflow .

I also uploded project video on youtube as prototype please check : https://youtu.be/-7ULYd8NR4A

If you want to contribute pull request is always welcome and github link is given below.

GitHub : https://github.com/Techistan/Whatsapp-Bot
Learning Reactjs
Published: 2020-02-25 22:45:35

As a beginner software developer, learning Reactjs is not something easy but worth learning language if one must stand out as a Frontend developer. e.g we have something like this.state.status. It is a funny write-up when I started late last year but today I am grateful because I am enjoying my learning. My advice for everyone is simple, "don't stop learning because no knowledge or skills is a waste". If those skills are not relevant today, it may be relevant tomorrow. Enjoy your learning in this great community.
Advent of Code 2019, Day5, Part2
Tags: adventofcode
Published: 2020-02-25 22:41:20

Hello! 

Can someone explain the various input programs provided for part 2. I see nothing is wrong with my logic in terms of implementing for part 2, but I am unsure how to check against the various input programs. It asks me to input 8 and I am supposed to obtain an output (1, if input is 8, 0 otherwise). I am not sure where this input is being checked, except for opcode 3 and 4. 
Also, would the first position  in memory contain the final output diagnostic code? 

Thank you
Day 87: Signs
Tags: hiphop, code, coding, lifelongdev
Published: 2020-02-25 22:29:34

_liner notes_:

- Professional : Went through a use case that was posted to our developer site about 4 years ago and updated it some. Pretty much converted over all the vars to lets and consts. Then I refactored the code to use the built-in Promise object instead of a third party library. Spent a good amount of time testing it to make sure it worked. Did a pull request and let the team know. We'll see if there's anything else I need to do.

- Personal : Got a quite bit done last night. Went through a bunch of tracks for this weeks radio show. I also started a new Web Component that I'll be using on my sites to say my current location. Nothing really specific, just whether I'm home or travelling with a link to check out https://dwane.in . Got a REST API endpoint working with Firebase Firestore. Now just to build a Web Component to make the call and display the info. All signs are pointing to it working pretty well.

![View of Rio de Janeiro from the mountains](https://dev-to-uploads.s3.amazonaws.com/i/hv0z012blyhi9x9i70hb.png)

Right now I'm in my van writing this post downtown waiting for the Google Developers Group to start. Before that happens, going to see if I can get some quick coding time in for a side project I want to finish up.

Have a great night!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube TEebboYJnsY %}
JavaScript type checking with typeof operator
Tags: webdev, javascript, node, javascripttips
Published: 2020-03-11 16:30:29

---
title: JavaScript type checking with typeof operator
published: true
date: 2020-02-25 22:06:01 UTC
tags: web-development,javascript,nodejs,javascript-tips
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/1920/1*14Ln2sMno7Ghk0Os173sGw.jpeg)](https://medium.com/@deeksha.sharma25/javascript-type-checking-with-typeof-operator-a2dcd74897ce?source=rss-4dc7d01b74e------2)

This video covers what all built-in types exist in JavaScript and how to perform type checking on those data types.

[Continue reading on Medium »](https://medium.com/@deeksha.sharma25/javascript-type-checking-with-typeof-operator-a2dcd74897ce?source=rss-4dc7d01b74e------2)
Sharing GIF via Intent from React Native
Tags: reactnative, android
Published: 2020-02-25 21:55:09

I had a GIF, loaded via a URL (the image is stored in a S3 bucket), that I wanted to be sharable from my (react-native) app, via WhatsApp for example. 

At first I thought I could simply use the URL in the Intent call to share the GIF, but that didn't work. Turns out you have to download and save the image locally. _Then_ you can share it via an Intent.

Our app uses the [Fresco](https://frescolib.org/) library, so the below code is based on that. The first step was to get a reference to the image pipeline and build an image request to download the GIF. 

```
//final Activity activity = ...;
//final Context context = ...;
//final String message = ...;
//final String imageUrl = ...;
//final String tempFileName = ...;

ImagePipeline imagePipeline = Fresco.getImagePipeline();
ImageRequest imageRequest = ImageRequestBuilder
     .newBuilderWithSource(Uri.parse(imageUrl))
     .setRequestPriority(Priority.HIGH)              
     .setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH)
     .build();
```

Next we start downloading the GIF and wait until the download is complete (you can also do this asynchronously).

```
DataSource<CloseableReference<PooledByteBuffer>> dataSource = imagePipeline.fetchEncodedImage(imageRequest, context);

CloseableReference<PooledByteBuffer> result = DataSources.waitForFinalResult(dataSource);
```

Assuming the GIF was downloaded OK, I had to save the image on the local file system and then create a URI to that file so it can be used in the share Intent. 

```
if (result != null) {
   final PooledByteBuffer buffer = result.get();
   if (buffer != null) {
      final byte[] data = new byte[buffer.size()];
      buffer.read(0, data, 0, data.length);
                    
      final File localFile = new File(context.getExternalFilesDir(null), tempFileName);

      try(OutputStream os = new FileOutputStream(localFile)) {
         os.write(data);
         os.flush();
      } catch(Exception e) {
         //handle error...
      }

      Uri contentUri = FileProvider.getUriForFile(activity, context.getPackageName() + ".provider", localFile);

      Intent intent = new Intent();
      Intent actionIntent = intent;
      intent.setAction(Intent.ACTION_SEND);
      actionIntent = Intent.createChooser(intent, "Select an app to share");
      //Add text and then Image URI
      intent.putExtra(Intent.EXTRA_TEXT, message);
      intent.putExtra(Intent.EXTRA_STREAM, contentUri);
      intent.setType("*/*");
      intent.setFlags(FLAG_GRANT_READ_URI_PERMISSION);
      activity.startActivity(actionIntent);
   }
}
``` 

And that's it. The above code requires (at least) the following permissions

```
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
```
Waarom Enumerate? (Dutch)
Tags: python, dutch, nederlands
Published: 2020-02-25 21:46:43

In deze post wordt de <a href="https://python.org">Python</a> <a href="https://pythonbasics.org/enumerate/">enumerate</a> functie snel besproken. Het is bekend dat Python de code leesbaar maakt en het gebruik van enumerate zal uw code nog beter leesbaar maken. 

## Eenvoudige lussen

Loops laten je regels code herhalen, de meest voorkomende zijn for loops en while loops. Als u ervaring heeft met <a href="https://pythonprogramminglanguage.com/for-loops/">for loops</a>, kunt u geneigd zijn om een index (i) op de array te gebruiken.

```python
>>> array = ['a','b','c','d','e']
>>> for i in range (len(array)):
...     print(array[i]))
... 
a
b
c
d
e
>>> 
```

Als u met het oude C++ hebt geprogrammeerd, bent u misschien zelfs geneigd om zoiets te doen:

```python
>>> i = 0
>>> while i < len(array):
...     print(array[i]))
...     i = i + 1
```

Dit is te gecompliceerd. Python is veel gemakkelijker

## Waarom enumerate?

Het bovenstaande werkte, maar het is niet Pythonisch. In plaats daarvan maakt `enumerate` dit beter leesbaar (het is ook makkelijker te coderen).

De functie 'enumerate' neemt een iteratable (<a href="https://pythonbasics.org/list/">array</a>) als parameter en geeft voor elk element de waarde en de index aan.

```python
>>> array = ['a','b','c','d','e']
>>> for index, item in enumerate(array):
...     print(item)
... 
a
b
c
d
e
>>> 
```

Veel beter! Je krijgt zowel de index als het element, zonder dat je de index variabele niet hoeft bij te houden.

De `enumerate` functie werkt op arrays (lists) of andere soorten sequenties zoals tupels, strings etc.

```python
>>> array = [ 1,3,2,6,3,9,4,12,5,15,6,18,7,21,8 ].
>>> for index, item in enumerate(array):
...     print(item)
... 
```

Dus `enumerate` is een zeer nuttige functie die het programmeren wat eenvoudiger maakt.