teleren/devto huggingface dataset:
Using Feature Flags to troll our competitor without a line of code 😃
Tags: opensource, webdev, javascript, showdev
Published: 2022-02-14 20:40:26

---
title: Using Feature Flags to troll our competitor without a line of code 😃
published: true
description: Having fun with our competitor when they signed up to our platform
tags: opensource, webdev, javascript, showdev
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jcqv6btsnss4pxl6k5kz.jpg
---

#The back story

📖 When we built [Flagsmith](https://flagsmith.com), we decided early on to power the admin dashboard with our own Feature Flags. As well as following a methodology we truly believed in, this meant we could be super flexible in how our admin panel behaves.

This proved very useful in the story I'm about to share.

#How it began

🕒 It's Monday 6 pm and I'm just about to wrap up for the day. 

Early on during product development, we wrote a crude SlackBot that alerted us to signups from new email domains we haven't seen before. At 6:38 pm UK Time, we saw a new domain, it was our biggest feature flag competitor.

![Flagsmith Slack](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/76u49lfzqakoergyp2hg.png)

# Laying the foundations

The first step was to make sure this prank wasn't going to affect anyone else, I may have been caffeine depleted but I wasn't going to go full-on cowboy.

![Feature Flag Segments](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7g5j2so2gs8klh29f1su.png)

💡 I created a segment to match any user from the company's domain, users are given a trait of their email address when they log in so I was easily able to target that trait with a regular expression. 

😇 In the interest of privacy I've hidden said domain from the post. If someone from there is reading this, you're welcome. 

🕵️‍♂️ I also added in my email so I could see what they see, think of it as testing in production.

🤔 At this point I had quite a few options.

# A simple butter bar

I felt like off starting off lightly, just a simple hello to let them know we know.

Thankfully this was really easy, we have a butter bar messaging feature to send out suitable messaging to segments of users. 

😃 Our cheeky user segment should definitely get a personalised message.

![Feature targeting](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d4s0rmd4pbp2bo4ptrhc.png)

That was easy, now they see a lovely message on every page they take a look at!

# A more bespoke experience

This was nice but I felt like I could do more for them.

⭐ I decided they deserved their very own SDK integration on our platform. I'm sure this is something they'd enjoy.

![Remote config is great](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4npf49q5li1kf5k6h7xx.png)
 
# The result

This bit of remote config leads to a much more personalised user experience for our new users.

![Perfect](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qnq5szi5qtpgc2m93uh5.png)
 
👌 In the end there can only be one feature flag platform.

![Flagsmith](https://recordit.co/3UzDNP00pb.gif)
Using Candy to Test and Develop with Local Custom Domains
Tags: go, testing, softwaredevelopment, software
Published: 2022-02-14 20:38:53

---
title: Using Candy to Test and Develop with Local Custom Domains
published: true
date: 2022-02-14 20:36:29 UTC
tags: golang,testing,softwaredevelopment,software
canonical_url: https://anaptfox.medium.com/using-candy-to-test-and-develop-with-local-custom-domains-64b5494316fc
---

![](https://cdn-images-1.medium.com/max/1024/0*5eCAB_B6193vfRZq)

When developing locally, you may find yourself needing to test with an actual domain and not localhost.

[Candy](https://github.com/owenthereal/candy) is a reverse proxy server written in Golang. It contains an HTTP, HTTPS, and DNS server 🚝. It’s simple and powerful.

Using candy we can start our local application on a port, and then run:

```
# addd candy configuration

echo "8080" > ~/.candy/myapp 

# curl local domain

curl [http://myapp.test](http://myapp.test)
```

Now you can use myapp.test locally to access your application.

In this article, I’ll walk you through getting a simple environment spun up.

### What is a reverse proxy server?

A reverse proxy server is a server that forwards requests from clients to other servers. This is often used to protect the privacy of clients by hiding the true identity of the server.

But, we can use that same feature locally to give you custom domains during development.

### Getting started with Candy

For MacOS, you may run:

```
brew install owenthereal/candy/candy
```

See [Installation Instructions](https://github.com/owenthereal/candy#installation) for other operating systems.

Then, we need to run candy’s setup command:

```
sudo candy setup
```

Because you should always know what commands are doing to your machine, here is what it’s doing behind the scenes:

```
sudo mkdir -p /etc/resolver
cat<<EOF | sudo tee /etc/resolver/candy-test > /dev/null
domain test
nameserver 127.0.0.1
port 25353
search_order 1
timeout 5
EOF
```

### Starting Candy

First, start candy:

```
brew services start candy
```

Second, start your local app.

Third, add port to candy as myapp:

```
echo "8080" > ~/.candy/myapp
```

Forth, restart candy:

```
brew services restart candy
```

Lastly, curl 😎:

```
curl http://myapp.test
```

For more configuration options, please see [candy’s README](https://github.com/owenthereal/candy#portip-proxying).

Now you have a local domain to develop against.

☕ Enjoy!

_Originally published at_ [_https://blog.taronfoxworth.com_](https://blog.taronfoxworth.com/using-candy-to-test-and-develop-with-local-custom-domains)_._
Introduction to Javascript
Tags: javascript, beginners
Published: 2022-02-14 20:34:16

## **INTRODUCTION**
This language is the popular language in web developments.
javascript is mainly used to decide how web pages will behave.

**Syntax**

- statements are separated using semicolon (;)
_example_
`x= 5;
 y=3;
 let a =x+y ;
`

- comments doesn't allow execution of unnessary statements. they are shown with (//)
_examples_

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pq7gdlxwvwv7rrjyrhdu.jpg)

1. variables in Javascript
variables are containers for storing data or data values.
 ways to declare variable include;

 - using the keyword **var** 
commonly used and it does not have the restrictions that other keywords have.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cqk9o4d7ir9u810drju0.jpg)
- using the keyword **let** 
 used for declaration of block-level variables. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/een8z3ezmmkshc4rlru1.jpg)
- using the keyword **const** 
used for declaration variables whose values are might change
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/71lrnzj6tvl904tflxm0.jpg)
- using nothing
 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/55b9697f410nl207poi0.jpg)

2. Data types of Javascript

- **String**- the data type is mainly used to represent textual data and is created using single or double quotes surrounding one or more characters.
example

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rkt1awu7qw5c543391au.jpg)

- **Number** - used to represent positive or negative numbers with or without decimal place, or numbers written using exponential notation

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5358i7wdnpubpemeoep3.jpg)

- **Boolean**- the data type can hold only two values: true or false. The Boolean values also come as a result of comparisons in a program.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zktqbzovhfydi6ikxbos.jpg)

- **Object**- they are variables which contain more than one value 
example of a person as shown.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/onlqc3394egnlwak9rjy.jpg)
Why PHP is the king of the web?
Tags: programming, php, webdev, laravel
Published: 2022-02-14 20:18:19

PHP is a good language... not good it is the best language when it comes to the web development, why I am saying that? Ok lets talk about why PHP is the best language for the web.

I saw developers making PHP as a dead language, when i ask them why? They told me that PHP is no longer using by big tech componies? Again i ask them is there is another reason that makes PHP a dead language? They said php is slower than others like node. 

> That is the way many junior developers and even some senior developers think about programming languages, they think if big tech componies dont use some languages then those languages are not great or even dead .. like humans die😅.

### The leader of the web

As we know PHP powers almost 80% of the web, and if Iam not wrong that means php is the leader, king 👑, chief, president of the web.

PHP also powers the most popular CMS in the world Wordpress, and in my opinion wordress is best CMS I ever used, its suitable for developers and non-developers. Its easy to use, easy to customize. I think everyone who wanted to create or do something related to the web someday heard wordpress.

> In my opinion PHP will not die soon or never becaus if PHP dies that means 80% of the web dies with it.

### PHP Frameworks

If you look the frameworks, PHP has a great and popular frameworks like Laravel, CodeIgniter and so many others, if you are PHP developer i promise you will never die lack of frameworks, you will find the framework that suits your need.

### PHP Community 

PHP has also large great community on the internet if you have any problems related to PHP iam sure that you will find a solution to your problem.

When it comes to the deployment of your app to the internet i think there is no host provider that does not provide php enviroment. 

### Disclaimer
 
My point **is not** that php is better that other programming languages.

My point **is** PHP has a large influence when it comes to the web, and its not dirty or bad code language as many developere believe.

**PHP is popular, easy and flexible programming language.**

Finaly php wants to say.

```php
<?php
   echo "Hello world! Don't underestimate me";
```
Javascript 101:
Tags: beginners, programming, webdev
Published: 2022-02-14 20:09:53

Javascript is the world's most popular programming language. it is mainly used in the web-development. JavaScript is abbreviated as JS. It was invented by Brendan Eich of Netscape initially and was contributed to the ECMA script(Wikipedia). JavaScript is mainly used with HTML and CSS. JavaScript gives you more power to your webpage. It is easy to learn the language. 

Javascript is applied and is used to creative interactive website. It is mainly used for:

- Client side Validation

- Dynamic drop-down menu

- Displaying date and time

- Displaying pop-up window
__
**JavaScript Basics**
JavaScript Comments
Single-Line Comments
We use // and texts between // will be ignored.

```
//Heading
//Change Paragraph//
```
Multi-Line Comments
We us /* and end end with */

```
/*The family had a lot of staff going on
and chose to seek counselling */

```
**JavaScript Variables**
there are different ways to declare a variable
-using Var
-using let
-using const
-using nothing

```
var x = 3
var y = 4
```

```
let x = 1
let y = 2
```
```
const num1= sh.100
const num2 = sh.320
```
**Javascript operators**
JavaScript Arithmetic Operators
Arithmetic operators are used to perform arithmetic on numbers:

Operator	Description
+	         Addition
-	         Subtraction
*	         Multiplication
**	         Exponentiation (ES2016)
/	         Division
%	         Modulus (Division Remainder)
++	         Increment
--	         Decrement
_How to work with the operators_

```
let x = 1
let y = 5
let z = x+y
```
the Rest applies(subtraction, multiplication and division) as the example shown above.

_Javascript Data Types_

JavaScript variables can hold different data types: numbers, strings, objects and more:

```
let age = 16;                                 // Number
let firstName = "Christine";                  // String
let x = {firstName:"Levi", lastName:"Mbithi"};    // Object
```
_JavaScript Function_

```
function myFunction(p1, p2) {
  return p1 * p2;   // The function returns the product of p1 and p2
}
```
_Function Invocation_
The code inside the function will execute when "something" invokes (calls) the function:

- When an event occurs (when a user clicks a button)
- When it is invoked (called) from JavaScript code
- Automatically (self invoked)
Fully Responsive Documentation Page using Pure CSS.
Tags: webdev, javascript, beginners, css
Published: 2022-02-14 20:09:08

## Hey everyone⚡
 Here's my entry for the **Netlify Hackathon** !
### Category - Dev Tools / Productivity.
Here's the link to the project [PT's CSS Documentation](https://css-doc.netlify.app/)


### Insipiration and Idea💡
 Recently I was learning about responsive web-designing. So I thought of making something from scratch and with pure vanilla CSS only.

### The Project👨‍💻
- As it is a documentation page, it's in dark mode.
- Its made with colour-combinations that are good for reading and pleasant to our eyes as well.
- Website is fully responsive and works well on devices of all aspect ratios.
- Used some subtle animations, made using pure CSS.

### Some features that I implemented for the first time.
- Used VantaJS for the Welcome Banner Background Animation.
- Used custom curser, applied a svg icon on the cursor using the CSS `cursor` property.
- The script counts the number of elements in the NavBar, and hence animations will be added automatically to a new section in the NavBar.

Do have a look at the project, and comment down your suggestions for the same.

You can [connect with me here](https://linktr.ee/prakhartandon)
Counting XML elements with xmllint
Tags: xml, devtools, cli, xpath
Published: 2022-02-14 20:03:55

---
title: Counting XML elements with xmllint
published: true
description: Counting with xpath and xmllint
tags: xml, devtools, cli, xpath
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qw95wg4uf1pnd3c4h6na.jpg
---

This week I needed to validate the number of entries in an XML file.
After a short Google search I came across `xmllint`.
This handy little CLI tool looked like the perfect tool for this job, so I tried it out immediately.
Unfortunately it took me some time to figure out how I can use it with my XML file.

Here is why:
Counting XML entries in an XML file without a namespace is pretty straightforward.
Let’s assume our XML file has the following structure and we want to find the number of <record> entries.

```
<?xml version="1.0" encoding="UTF-8"?>
<dataset>
   <record>
      <id>1</id>
      <first_name>Dru</first_name>
      <last_name>Greenway</last_name>
      <email>dgreenway0@technorati.com</email>
      <ip_address>168.235.172.238</ip_address>
   </record>
   <record>
      <id>2</id>
      <first_name>Agnesse</first_name>
      <last_name>Janousek</last_name>
      <email>ajanousek1@unblog.fr</email>
      <ip_address>62.116.98.136</ip_address>
   </record>
</dataset>
```
One can simply pass a xpath expression to `xmllint` and make use of the `count` function:

`xmllint --xpath "count(//record)" example.xml`

For more information on xpath syntax checkout: [https://www.w3schools.com/xml/xpath_syntax.asp](https://www.w3schools.com/xml/xpath_syntax.asp)

In the example from above the result would be `2`.

Unfortunately my XML file looked a bit different since it had a default namespace defined.
If we change `<dataset>` to `<dataset xmlns="http://www.some-custom-namespace.org">`.
The same command:
`xmllint --xpath "count(//record)" example.xml`

returns `0` since the xpath expression does not match any element.
How can we solve this problem?
## Option 1

Use the interactive shell:

`xmllint --shell example_with_ns.xml`

Set the namespace to the referenced namespace in your file, in our example:
`setns x=http://www.some-custom-namespace.org`

Execute xpath command:
`xpath count(//x:record)` ... prints 2

Note the x prefix! 
This prefix must match the variable chosen in the `setns` command.

## Option 2

Make use of the `local-name` function:

`xmllint -xpath "count(//*[local-name()='record'])" example_with_ns.xml` ... prints 2

Sources:
[https://gist.github.com/bitsgalore/3e403b02f776f03444c0622cb3b08b56](https://gist.github.com/bitsgalore/3e403b02f776f03444c0622cb3b08b56)
[https://stackoverflow.com/a/8266075/3533210](https://stackoverflow.com/a/8266075/3533210)

Photo credit:
Photo by <a href="https://unsplash.com/@joshappel?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Josh Appel</a> on <a href="https://unsplash.com/s/photos/counting?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>
Python fundamentals
Published: 2022-02-14 20:03:53

Programming is creating a set of instructions which tell a computer or automated system how to perform a task .
Python is one of the languages, among many, used to create the instructions. A Python file is compiled into byte code which is then converted into machine code. The machine code directs the machine to carry out the task following provided commands.
It is an **object oriented programming language**. Almost everything created in the language is considered an object i.e. it has either properties or methods that they perform. This enables one to create a blueprint for creating other similar objects

**<u>Elements and Syntax</u>**
The style of writing code is based on indentations rather than parentheses and curly braces and such, to indicate “blocks” or “chunks” of code.

<u>Data Types</u>
**Numbers**
Numbers in Python must start with a number digit, (0-9); a dot (period), which is a decimal point; or a hyphen (-) used as a negative sign for negative numbers. A number can contain only one decimal point. It should contain no letters, spaces, dollar signs, or anything else that isn’t part of a normal number.

**String**
These are a string of characters, letters, spaces, punctuation marks.The string must always be enclosed in quotation marks

**Booleans**
A data type which exists in either of two states at any time.ie true or false

<u>Python Operators</u>
After receiving raw data, we can use these operators to manipulate the data to a format that is understandable

**Arithmetic operators**
As the name implies, arithmetic operators are for doing arithmetic; addition, subtraction, multiplication and division

**Comparative operators**
They are used to compare sets of data and the relation between them

**Boolean operators**
The Boolean operators work with Boolean values (True or False) and are used to determine if one or more things is True or False
<u>Variables</u>
A variable, in Python, is simply a storage place for information that can change at any time. But in your code it’s represented by a variable name rather than a place
<u>Function</u>
A function is a prewritten block of code that performs a specific task. These come in two flavors either built-in or user generated. You can specify methods as well as variables and arguments given to a function.
This are some of the major fundamentals of the python language.In the next article we will look at data structures.
dotnet is 20 years old
Published: 2022-02-20 23:28:22

---
title: dotnet is 20 years old
published: true
date: 2022-02-14 20:00:45 UTC
tags: 
canonical_url: https://www.funkysi1701.com/posts/dotnet-is-20-years-old/
---

Today Microsoft celebrated 20 years since the first version of dotnet was released with a special live stream event.

<iframe width="560" height="315" src="https://www.youtube.com/embed/67tCWKnweso" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

A lot has happened in the 20 years of dotnet (or .Net). It is my understanding that .Net was created to rival Java. When the .Net Framework was first created it was a windows only thing, but today modern .Net is a modern run anywhere platform, with .net applications running everywhere from PCs and Laptops, Raspberry Pi’s, Mobile phones and tablets (via Xamarin Forms), to Websites and Microservice APIs running on every Cloud platform out there.

If you want to celebrate this achievment tweet with the hashtag [#DotNetLovesMe](https://twitter.com/search?q=%23dotnetlovesme) or download some of the digital swag available from [github](https://github.com/dotnet-presentations/dotNET20th/tree/main/Swag)

On Thursday the 17th Feb the first preview of dotnet 7.0 is going to be released, with the latest version 6.0 only being released last November.

![History of DotNet](https://pbs.twimg.com/media/FLj8kj7XEAcW3ng?format=jpg&name=4096x4096)

The above graphic comes from the following tweet.

> This is 20 years of [#dotnet](https://twitter.com/hashtag/dotnet?src=hash&ref_src=twsrc%5Etfw) releases. [#dotNETLovesMe](https://twitter.com/hashtag/dotNETLovesMe?src=hash&ref_src=twsrc%5Etfw) [pic.twitter.com/Zxfe1SdWTq](https://t.co/Zxfe1SdWTq)
> 
> — Khalid 🎟 (@buhakmeh) [February 14, 2022](https://twitter.com/buhakmeh/status/1493220984916258817?ref_src=twsrc%5Etfw)

 <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

What do you like about dotnet? When did you first start using it? What are you going to build with it next?
PYTHON FOR NEWBIES
Tags: beginners, programming, python
Published: 2022-02-14 19:59:23


### GETTING STARTED
Python programming language is a high-level, general purpose language. It is written in human readable language and designed to solve a particular problem. 
Python is suitable for but not limited to:
- Web Development
- Data Science
- Machine Learning
- Game Development
- Data Engineering
- Robotics
- Automation

### INSTALLING PYTHON
To install python visit: [Python](https://www.python.org/downloads/), scroll down to active releases to see which version is secure for download. 
**NOTE:**
Python 2.7 is no longer in use.

Once you've settled on a specific version, select download to download
Take note of the operating system your machine uses before download.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kghlmpb45688434i76lv.PNG)


#### Python on visual-studio and pycharm:
To get started with Python on Visual Studio, follow [Getting Started with Python in VS Code](https://code.visualstudio.com/docs/python/python-tutorial) and pycharm [Get Started](https://www.jetbrains.com/help/pycharm/quick-start-guide.html)

### WRITING YOUR FIRST PROGRAM
Python uses **print** function to output text. Print must be followed by a parenthesis which encloses the output we want to generate. 


 **Arithmetic operators**
 
| Operator | Description | Syntax |
| ----------- | ----------- | ----------- |
| + | Addition| a+b  |
| - | Subtraction | a-b|
| *| Multiplication | a*b |
| /| Division| a/b|
| %| Modulus | a%b|
|//| Quotient | a//b|
|**| Exponent | a**b|

Example: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7y0cybig2ta0vj0pvkal.PNG)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xihutuqmrx9xo12ylu3.PNG)


**Logic Operators**

| Operator | Description | Syntax |
| ----------- | ----------- | ----------- |
| and | True if both operands result is true| a and b |
| or | True if either operands result is true| a or b|
| not| True if both operands result is false | a not b |


## REFERENCES
Python.org/downloads/
Jetbrains.com
visualstudio.com/docs/python/python-tutorial