teleren/devto huggingface dataset:
Where to put the build and deploy scripts?
Tags: discuss
Published: 2019-07-23 14:30:49

---
title: Where to put the build and deploy scripts?
published: true
tags: discuss
--- 

Where do you store your build and deploy scripts? 

I've seen multiple ways of dealing with this: 

1. Keeping them within the Jenkins (or any other CI) Job.
2. Keeping them with the actual code all together.
3. Keeping them in a separate repository, as sort of a cookbook.


Whilst 1. is a complete no-go, as it is bypassing any kind of QC, 2. & 3. to my mind are valid options. I would probably lean more towards 2., as it is brings everything into one place. If everything is in one place, it is usually easier to maintain. 

The only thing that could be against the 2. option is that if you change the build and deploy scripts, you technically need to bump up your projects version, which triggers a release/redeploy, etc.

I believe that is a small price to pay, compared to having n different repos, but option 3. could solve this. 

What are your thoughts about this? Do you have a different strategy?
Execute Laravel Artisan commands from a desktop app!
Tags: laravel, php, node
Published: 2019-07-23 14:26:28

When I was learning Laravel and I almost finished the beginner level, I thought of a desktop application which can execute Laravel artisan commands. But I had no idea how to make a desktop app with web technologies. Suddenly I saw
[Electron](https://electronjs.org) and started learning it and I finally made the app that I wanted.

**Introducing [Laravel Kit](https://tmdh.github.io/laravel-kit/)**

Laravel Kit is a desktop application which can execute almost all Laravel Artisan commands without using any terminal.

![Laravel Kit GIF](https://github.com/tmdh/laravel-kit/raw/master/lk.gif)

Just click those buttons and execute Artisan commands without using any terminal.

Build something amazing!
How do you set up your application stack?
Tags: kubernetes, devops, discuss
Published: 2019-07-23 14:17:31

What tools do you use to provision your Kubernetes cluster?

I started with plain YAML files, but I find it a bit hard to keep them organized and make changes.

Right now, I try [Pulumi](https://www.pulumi.com/) but I am keen to learn other tools.

Do you have experience with any other tools? How does your workflow for creating applications, services, etc. in your cluster look like?

<hr />

If you like my content, you might want to follow me on Twitter?! [@fullstack_to](https://twitter.com/fullstack_to)

Cover Image by Photo by [Syed Hussaini](https://unsplash.com/@syhussaini?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/search/photos/helm?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
Reversing a string using an Iterator
Tags: javascript, programming
Published: 2019-07-23 14:01:34

---
title: Reversing a string using an Iterator
published: true
description: 
tags: javascript, programming
series: reversing a string
---
The problem with RTFM is that sometimes you find interesting things. So I'm reading through the documentation for the [String](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/@@iterator) object on MDN and discover how to instantiate an iterator. 
```javascript
function Bruce_IteratorReverse(string) {
  let iterator = string[Symbol.iterator]();
  let theChar = iterator.next();

  let result = [];
  while (!theChar.done) {
    result.unshift(theChar.value);
    theChar = iterator.next();
  }
  return result.join("");
}
```
Put it in the [test frame](https://dev.to/bugmagnet/testing-string-reversal-functions-8m6) and run it for a 1000 iterations and come up with an average speed in C# Stopwatch Ticks. Not as bad as RegExp but down that end, viz:
```
Sarah_ForOf                 1954.52 ticks
Sarah_SplitReverseJoin      2628.535 ticks
Bruce_CharAt                2835.333 ticks
Theophanis_SplitFor         3088.03 ticks
Bruce_Recursive1            3442.696 ticks
Sarah_Reduce                3515.563 ticks
Bruce_Recursive2            3616.804 ticks
Nathanael_SplitReverseJoin  3751.542 ticks
Theophanis_SplitFor_Bruced  3815.779 ticks
Sarah_Recursive             4024.06 ticks
Bruce_ArrayApplyMap         5590.934 ticks
Bruce_ReverseGenerator      8441.915 ticks
Bruce_MapSortMap            10974.299 ticks
Bruce_CharAt2               14908.46 ticks
Bruce_IteratorReverse       93875.974 ticks
Bruce_RegReverse            524215.91 ticks
```
A Weird Java Code and How It Works
Tags: programming, java, coding
Published: 2019-07-22 15:28:49

---
title: A Weird Java Code and How It Works
published: true
description: This is about how to write a weird java code that print a string
tags: Programming, Java, Coding
---

I discovered following strange Java code that print `Just another Java hacker` on your terminal.

{% gist https://gist.github.com/madushadhanushka/f852508378efe448bbf852b37d0bd77e.js %}

Obviously, that piece of code looks like mess. Even if you copy this code into your favorite IDE, IDE could not figure out the syntax of this code. Trust me, this piece of code works,  and this is how it works.

Obviously it has class name with main method. Let's clear out the code and format it. Now it look like this.

```
class Sig{
	public static void main(String...args){
		\u0066or(int\u0020$:"vÌÈÊ\"¤¾ÀÊ²¬Æ\"v¤Î¤\"²¤¨¸¬Æ".to\u0043h\u0061rArray()
		)System./*goto/*$/%\u0126//^\u002A\u002Fout.print((char)(($>>
		+(~'"'&'#'))+('<'>>('\\'/'.')/\u002Array.const(~1)\*\u002F)));
	}
}
```

Now you can see that there are some unicode characters in this code. Next we'll extract all unicode characters. Also I'm removing `/*goto/*$/%\u0126//^\u002A\u002F` and `\u002Array.const(~1)\*\u002F` section since those code sections are just commented line written in unicode characters.

```
class Sig{
	public static void main(String...args){
		for(int $:"vÌÈÊ\"¤¾ÀÊ²¬Æ\"v¤Î¤\"²¤¨¸¬Æ".toCharArray())
			System.out.print((char)(($>>+(~'"'&'#'))+('<'>>('\\'/'.'))));
	}
}
```

If you replace `(char)(($>>+(~'"'&'#'))+('<'>>('\\'/'.')))` expression with relevant ascii values then it would be something like `(char)(($>>+(~42&35))+(60>>(92/46)))`. This is equivalent to `(char)(c / 2 + 15)`. Final output of the simplified code would be something like below. 


```
class Sig{
	public static void main(String...args){
		for(int $:"vÌÈÊ\"¤¾ÀÊ²¬Æ\"v¤Î¤\"²¤¨¸¬Æ".toCharArray())
			System.out.print((char)($ / 2 + 15));
	}
}
```
Now the mystery has been resolved. For loop take each of the characters from the string change it value according to the equation and print it.

Why don't you give it a try to write such a code with your favaourite language and comment it down?

> Warning: Don't ever write this type of code in production repositories.
How to fix Angular HttpClient not escaping URL parameters
Tags: webdev, javascript, programming, softwaredevelopment
Published: 2020-02-12 21:36:04

---
title: How to fix Angular HttpClient not escaping URL parameters
published: true
date: 2019-07-23 13:37:28 UTC
tags: web-development,javascript,programming,software-development
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2426/1*Y-K4bpH1IXEua6hcshfESw.jpeg)](https://medium.com/better-programming/how-to-fix-angular-httpclient-not-escaping-url-parameters-ddce3f9b8746?source=rss-3a534b5053e6------2)

Creating a custom HttpParameterCodec to encode everything

[Continue reading on Better Programming »](https://medium.com/better-programming/how-to-fix-angular-httpclient-not-escaping-url-parameters-ddce3f9b8746?source=rss-3a534b5053e6------2)
Reversing a string using a Generator
Tags: javascript, programming
Published: 2019-07-23 13:35:29

---
title: Reversing a string using a Generator
published: true
description: Another in the reversing a string saga
tags: javascript, programming
series: reversing a string
---

So there's this [Michiel Hendriks](https://dev.to/elmuerte) who [says](https://dev.to/elmuerte/comment/da9e), "I'm looking for the next person to one-up this" and so here I am one-upping myself.

Here we reverse the string using a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Generator#An_infinite_iterator) to iterate backwards through the string and hand ball each character to an array that gets `.join()`ed at the end.
```javascript
function Bruce_ReverseGenerator(string) {
  function* reverseGenerator(string) {
    let str = string;
    let index = str.length - 1;
    while (true)
      yield str.charAt(index--);
  }

  let result = [];
  const gen = reverseGenerator(string); 
  var ch;
  while (ch = gen.next().value) {
    result.push(ch);
  }
  return result.join("");
}
```
Yep, decorated to run in the [testing frame](https://dev.to/bugmagnet/testing-string-reversal-functions-8m6) and giving surprisingly good results, viz:
```
C:\TMP>timer.ly /TIMES:1000
Sarah_ForOf                 1502.905 ticks
Bruce_CharAt                2646.537 ticks
Sarah_SplitReverseJoin      2715.699 ticks
Bruce_Recursive2            2786.771 ticks
Nathanael_SplitReverseJoin  3104.762 ticks
Bruce_Recursive1            3112.511 ticks
Theophanis_SplitFor         3208.017 ticks
Sarah_Reduce                3227.539 ticks
Theophanis_SplitFor_Bruced  3706.581 ticks
Sarah_Recursive             3810.085 ticks
Bruce_ArrayApplyMap         5318.65 ticks
Bruce_ReverseGenerator      7354.585 ticks
Bruce_MapSortMap            9637.046 ticks
Bruce_CharAt2               13913.316 ticks
Bruce_RegReverse            490151.264 ticks
```
Get feedback and adapt, in a loop
Tags: showdev, discuss, webdev
Published: 2019-07-23 13:32:27

Hi!

Imagine you have 5 users test your website (or a specific feature for your website) and you can repeat that e.g. 3 times. This would be a relatively simple service that helps you to iterate your development before you fully publish your project. Get feedback & adapt in a loop. Check it out at:

https://launchpropeller.com/#/?ref=dev
IOS Form Toolbar / Assistant - HELP?!
Tags: ios, webdev, help, react
Published: 2019-07-23 13:30:36

Hey,

I'm developing a PWA in ReactJS (Not ReactNative).

I've ran into a potential issue which I want to get your thoughts on. It's to do with the "Form Toolbar" or the "Form Assistant" which is shown above the keyboard on IOS devices.

Is there any way I can remove this or prevent this from showing without going Native? It's interrupting the flow of some of my select inputs and date inputs and I want to completely get rid of it.

I've searched around and not been very successful - Hopefully someone can help out, Thank you!

See screenshot
![](https://thepracticaldev.s3.amazonaws.com/i/1xlkwtpuy3eb8odsr30s.png)
FCC Product landing page | Breeze Bottles | Rohil
Tags: codepen, freecodecamp, html, css
Published: 2019-07-23 13:30:09

---
title: FCC Product landing page | Breeze Bottles | Rohil
published: true
tags: codepen, freecodecamp, html, css
---

Hey Guys, I just finished this project would love your feedback!
i worked on this for almost a week or two
 
 
{% codepen https://codepen.io/Rcrisp/pen/NZELZg %}
Fork, MR, Hack or Rewrite
Tags: packages, forks, mergerequests, discuss
Published: 2019-07-23 13:24:43

---
title: Fork, MR, Hack or Rewrite
published: true
description: the wonderful world of dependencies
tags: packages, forks, merge requests, discuss
---


So another day, another debate at work. Life goes on as usual. This one has to do with dependencies that nearly do what you need.

Let's say you need to implement a bespoke feature but

* you don't want to reinvent the wheel
* your extensive research have shown that existing packages only do some of the things you need

What's the next course of action?

* do you pick the package that satisfies most of your requirements, fork it, adjust it to your needs and move on?
* do an MR, be patient hoping that the package is still maintained and that your fix will eventually be merged
* do you try to use the that package by hacking your way around the it, until it satisfies the requirements
* do you write everything from scratch

If you do fork it

* do you feel the need to publish it on package manager (npm, nuget etc) with a different name for the slight chance that someone else might have similar requirements?

Personally 5-6 years ago I would try to hack my way around a package trying to do what I want it to do, trusting the developer that maintains that package entirely.

But nowadays, depending on the complexity of the package, I rather fork it, add my feature/fix and move on. And most of the times I don't even consider whether  the community will benefit from such bespoke (usually) features. So I don't bother publicly republishing the new package. Not to mention that who needs another variation of a package, its nearly pollution. 

Now if I see a benefit, and If I can afford spare some time (usually on my free time), I'll actually bother with an MR, if it concerns a well maintained package. Because let's be realistic there are a lot of packages out there (especially in JavaScript) that even if they are maintained, they are usually maintained quite poorly (I am including myself in that list, of poorly maintained packages), so your MR will probably either be rejected or take a long time to be merged.
Fuzzywuzzy and Python
Tags: python
Published: 2019-07-23 13:05:13

---
title: Fuzzywuzzy and Python
published: true
description: python
tags: python
---
What's fuzzywuzzy? 

<img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3XXcyZlvqo9tm%2Fgiphy.gif&f=1">

It's a string matching module. A string is <a href="https://pythonprogramminglanguage.com/variables/">variable</a> that can store (and modify) text. It uses <a href="https://en.wikipedia.org/wiki/Levenshtein_distance">Levenshtein Distance</a> to calculate the differences between sequences in a simple-to-use package.

Fuzzy string matching like a boss.
How to get started? First you should know <a href="https://pythonprogramminglanguage.com/">Python programming</a>. 

    pip install fuzzywuzzy

Then you can use it like this:

    #!/usr/bin/python3
    from fuzzywuzzy import fuzz
    from fuzzywuzzy import process

    r = fuzz.ratio("this is a test", "this is a test!")
    print(r)

    r = fuzz.ratio("fuzzy wuzzy was a bear", "wuzzy fuzzy was a bear")
    print(r)

This outputs the ratio:

    97
    91

You can run this from the interpreter:

    >>> fuzz.ratio("this is a test", "this is a test!")
        97

Another example of fuzzywuzzy:

    >>> from fuzzywuzzy import fuzz
    >>> fuzz.ratio("this is a test","a test this is")
    50


Related links:

* <a href="https://github.com/seatgeek/fuzzywuzzy">Fuzzywuzzy module</a>
* <a href="https://pythonprogramminglanguage.com/">Learn Python</a>
Daily Challenge #22 - Simple Pig Latin
Tags: challenge
Published: 2019-07-23 13:01:56

---
title: Daily Challenge #22 - Simple Pig Latin
published: true
series: Daily Challenge
description: Translate English into Pig Latin.
tags: challenge
---

The goal of today's challenge is to translate English into Pig Latin. This [challenge](https://www.codewars.com/kata/520b9d2ad5c005041100000f) comes from user2505876 on CodeWars.
>Write a function that moves the first letter of each word to the end of the word, then add `"ay"`. Leave punctuation untouched.

>Examples:
`pig_it('Pig latin is cool') # igPay atinlay siay oolcay`
`pig_it('Hello world !')     # elloHay orldway !`

This one is somewhat tricky. I bet it would be even harder to turn Pig Latin back to English, I'd love to see someone try it~!

Oodgay ucklay, appyhay odingcay!
***
_Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
You can write better jQuery
Tags: javascript, jquery, dry
Published: 2019-07-23 12:43:22

---
title: You can write better jQuery
published: true
description: A DRY approach to multiple configurations
tags: javascript, jQuery, DRY
---

While almost every new article mentioning it, talks about its demise, I’ve decided to write as about one of the most recurrent jQuery bad practices I came across and how to deal with it. Here it is:

#### Going from this:

```

$('.multiSelectOne').multiselect({
    buttonClass: 'btn btn-default',
    buttonWidth: '100%',
    ...
});
$('.multiSelectTwo').multiselect({
    buttonClass: 'btn btn-default',
    buttonWidth: '100%',
    nonSelectedText: '---',
    ...
});
```

#### To This:

```
<select class="js-multiselect" 
    data-include-select-all-option="true" 
    data-all-selected-text="All">
    <option></option>
</select>

$('.js-multi-select).each(function () {
    let options = {};

    Object.entries($(this).data())
        .map(property => options[property[0]] = property[1]);

  $(this).multiselect(options);

}
```

**And never go back for adjustments in the script file ever again.**
User directories
Tags: help, php, html
Published: 2019-07-23 12:34:20

<strong>Hello!</strong> My friend and I have been making a website and recently we created an account system where you can view other peoples accounts and follow them. You can view an account by going to <code>venatus.club/account?u=USERNAME</code> but we were wondering if there is a way to use <code>venatus.club/USERNAME</code> to redirect instead if that makes sense. Would we have to create a directory with just a header tag whenever you create an account? Thank you for any help.
Learning webpack Step By Step
Tags: webpack, javascript, webdev, showdev
Published: 2019-07-23 12:19:59

---
title: Learning webpack Step By Step
published: true
description: webpack bundler seems to feel really complicated to learn but it tend to be much more simpler now. I made up some workshops in order to learn concepts.
cover_image: https://images.unsplash.com/photo-1493995531129-0d199ecce0ca?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=2250&q=80
tags: webpack, javascript, webdev, showdev
---

If you need to use **webpack** for your project. You are very often forced by `CLI` who have done the Job for you.

You don't know what **webpack** is for, or even how it works. You also don't know where to start to learn.

That why I boostrapped some workshop in an open source project named: 

{% github Slashgear/webpack-workshop %}


## How to

Just go to https://slashgear.github.io/webpack-workshop/workshops/ and follow the instructions.


If you ❤️ these workshops, don't hesitate to share this post and put a little ⭐️ on the repository.

You could also help me by contributing new workshops, or by translating them into different languages.
Software Rot
Tags: javascript, webdev, motivation
Published: 2019-07-22 13:24:51

You've built the latest and greatest web application and users are signing up left and right. Now it's time to sit back and watch the money come in, right? 

Well maybe...  

## What is Software Rot?

Software Rot is when your software slowly "dies" overtime and becomes faulty, unusable and is hard to maintain. 

Our software doesn't actually rot away and start to smell every time we open our code editor. But over time if you don't treat it well, it will slowly become unusable.

## Preventing Software Rot

There are many ways that Software Rot can occur. But I wanted to cover one specific topic that we all can benefit from. 

### Leave Code Better Than You Found It

**The Broken Window Theory**
Research has shown that one broken window in a home can lead to a sense of abandonment. Before you know it all the windows are broken and litter is everywhere. 

Your code is that home, don't leave any broken windows in it. It doesn't matter if you wrote it or not, leave code in better shape than you found it. Constantly improve your code base even if it feels like a waste of time. Don't get lazy and just get it working, write every single line of code like it's your last.

There are tons of other topics I could cover, but we can start on this topic right now! Go forth and treat your code like it's your home :)
Read Exif tags with Python
Tags: python, image
Published: 2019-07-23 12:18:12

---
title: Read Exif tags with Python
published: true
description: python, image
tags: python, image
cover_image: https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3rgXBzEJUJdqoQ7P0I%2Fgiphy.gif&f=1
---
Images sometimes contain Exif tags. Many photos store date and geolocation in these tags. Did you know you can read  them in the Python programming language?

Of course, you need to know <a href="https://pythonbasics.org">Python programming</a>. 

<img src="https://proxy.duckduckgo.com/iu/?u=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3o7TKqz2KZ292uGFwc%2Fgiphy.gif&f=1">

But once you know that, there's a module to read the Exif tags.


Yes, there's a module for that!

    pip install exifread

The program then has a few steps. Load the image, grab the tags then output them. For simplicity I've put it in a function.

    #!/usr/bin/python3
    import exifread

    def process_img(path):
        f = open(path, 'rb')
        tags = exifread.process_file(f)
        info = {
            'Image DateTime': tags.get('Image DateTime', '0'),
            'GPS GPSLatitudeRef': tags.get('GPS GPSLatitudeRef', '0'),
            'GPS GPSLatitude': tags.get('GPS GPSLatitude', '0'),
            'GPS GPSLongitudeRef': tags.get('GPS GPSLongitudeRef', '0'),
            'GPS GPSLongitude': tags.get('GPS GPSLongitude', '0')
        }
        return info

    info = process_img('image.jpg')
    print(info)


Example output for the program:

    {'Image DateTime': (0x0132) ASCII=2002:11:18 22:46:09 @ 218, 
     'GPS GPSLatitudeRef': '0', 
     'GPS GPSLatitude': '0', 
     'GPS GPSLongitudeRef': '0', 
     'GPS GPSLongitude': '0'}

If the GPS data is not stored in the image, it will show 0 as value. So to test it, you need images with gps data.

You can find some <a href="https://github.com/ianare/exif-samples/tree/master/jpg/gps">test images here.</a>

<img src="https://raw.githubusercontent.com/ianare/exif-samples/master/jpg/gps/DSCN0010.jpg">

 However, if contains GPS data (many mobile phones have GPS). It could return something like this:

    {'Image DateTime': (0x0132) ASCII=2008:11:01 21:15:07 @ 248, 
     'GPS GPSLatitudeRef': (0x0001) ASCII=N @ 936, 
     'GPS GPSLatitude': (0x0002) Ratio=[43, 28, 1407/500] @ 1052, 
     'GPS GPSLongitudeRef': (0x0003) ASCII=E @ 960, 
     'GPS GPSLongitude': (0x0004) Ratio=[11, 53, 645599999/100000000] @ 1076}




Related links:
* <a href="https://en.wikipedia.org/wiki/Exif">Exif image tags</a>
* <a href="https://pythonbasics.org/">Learn Python programming</a>
* <a href="https://pythonbasics.org/exercises/">Python exercises</a>