teleren/devto huggingface dataset:
#SQL30 Day 14: UFO Sightings
Tags: sql, database, postgres, challenge
Published: 2019-10-16 11:06:03

Welcome to the SQL showdown series!  

### What is this and how does it work?

I'm committing to publishing a SQL challenge every day for 30 days.  In each post I'll describe **my** solution to the last day's challenge.  I'll follow that up with a full description of the challenge for the next day.

Write your own solution in the comments!  Let's see who can come up with the most creative solutions.

### Challenge #14: UFO Sightings

For a bit of fun I decided to load an [open data-set of UFO sightings](https://www.kaggle.com/NUFORC/ufo-sightings#scrubbed.csv) into PostgreSQL.  Each row represents a reported sighting, including the date, shape of the object, and the duration of the sighting.

Let's see if we can deduce some kind of seasonal pattern to UFO sightings.  Here's the challenge itself: 

**Given UFO sightings from 1906 to present day, can you produce a monthly count of sightings by shape?**

Here's an example of the output we should get:

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/ozc1hfrsnr30yoszng6c.png)

### Sandbox Connection Details

I have a PostgreSQL database ready for you to play with.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/zpoed03yjhvjosbii3z7.png)

The password is the same as the username!  To query the **ufo** table:

```sql
SELECT * FROM day14.ufo;
```

### Solution to Challenge #13: Permutations

This was the challenge from yesterday:

**Can you generate all of the permutations of a given set in SQL?**

Specifically, we wanted all of the permutations from the set {1, 2, 3}.  My first thought here was to use a **CROSS JOIN**, as that kind of join will produce every possible pairing between two tables.  

That's not quite what we want, however, because we'd like each item in the permutation to be distinct.  In other words, {1, 1, 1} is not a valid permutation.  Luckily, that's not too hard to enforce by means of a **WHERE** clause.

Let's take a look. 

```sql
WITH v AS (
  SELECT generate_series(1, 3) AS n
)
SELECT * FROM v AS v1 
CROSS JOIN v AS v2
CROSS JOIN v AS v3
WHERE 
v1 NOT IN (v2, v3) AND
v2 NOT IN (v1, v3) AND
v3 NOT IN (v1, v2);
```

The **WHERE** clause checks that each element of the permutation does not equal any other element, thus ensuring that there's no repetition.

You would need to add more joins to account for a larger set.  Can anyone think of an approach that works no matter the size of the input set?

### Good luck!

Have fun, and I can't wait to see what you come up with! I'll be back tomorrow with a solution to this problem and a new challenge.
Developer Api Telegram
Tags: telegram, php, devops, laravel
Published: 2019-10-16 11:05:27

DonTouch Sagl è una Digital Company, sviluppiamo soluzioni di marketing creativo, integrando competenze specifiche e ricercando idee non convenzionali. La nostra missione è aumentare ed incrementare il Business attraverso strategie di marketing digitale.

Ricerchiamo per la Sede di Chiasso (Svizzera):

Developer Api Telegram

Il candidato si dovrà occupare dello sviluppo di applicazioni basate sulle API di Telegram .
È richiesta competenza di minimo 1 anni in :
- Sviluppo di BOT Telegram e gestione tramite chiamate ad API .
- Creazione e mantenimento di canali Telegram .
- Configurazione ambiente per fornire i servizi API di Telegram .
- Integrazione con ambiente di sviluppo Active server pages, IIS .  
- Integrazione con ambiente di sviluppo PHP Laravel, Apache/nginx   .
Fra gli obiettivi oltre alle chat e canali, la gestione di gruppi, il log degli eventi,.

Prevediamo possibilità di:
- Contratto di collaborazione in libera professione con disponibilità di 2/3 gg a settimana per almeno 2 mesi
- Contratto di lavoro a tempo indeterminato secondo C.O. svizzero con compenso commisurato al livello della candidatura, la parte economica sarà oggetto di attenzione nel primo contatto telefonico.

I candidati selezionati verranno contattati per un colloquio telefonico o Skype preliminare e per un successivo appuntamento presso la nostra sede, nel processo di Selezione sono previsti colloqui e test tecnici.

Inviare la candidatura a: hr@dontouch.ch o rispondendo all’annuncio.

**********************************************************************************************
Il candidato prescelto sarà dedicato ad una property operante nel settore "adult entertainment", se ha obiezioni al settore, nessuna familiarità od impedimenti morali verso il settore, la invitiamo ad astenerti dalla candidatura. 
**********************************************************************************************
How to ace coding interviews; and scaling tips from Netflix & Shopify
Tags: todayilearned, career, sql
Published: 2019-10-16 11:00:28

*My TL;DR style notes from articles I read today.*

### [How to ace the coding interview, by an ex-Facebook interviewer](http://bit.ly/2BchSAK)

- Don’t rush to write code. Think about the problem first and think out loud. 
- Ask as many questions as you have about the problem before starting to solve it. 
- Don’t strive to impress with the right answer, talk about all approaches you can take and talk about the tradeoffs with each. 
- Plan your solution with a pseudocode.
- Talk out loud about what you are doing while implementing the solution.
- Write comprehensive test cases.

Pro-tip by the author in case you are stuck: Some of the best problem solving happens when you can align the strength of a specific data structure to a problem’s bottleneck.

*[Full post here](http://bit.ly/2BchSAK), 8 mins read*

--- 

### [Tips for high availability](http://bit.ly/2MLqXpG)

- Go for regional deployment, validate the change and then go for global deployment.
- Choose deployment windows during off-peak times for each geographical location.
- Any deploys triggered automatically should not be executed during off-work hours or weekends.
- Use testing & canary analysis to validate code before it is pushed to production.
- Deploy to production exactly what you tested.
- Know how to roll back any deploys quickly.
- Use preconditions to verify the expected state.

*[Full post here](http://bit.ly/2MLqXpG), 9 mins read*

--- 

### [How Shopify manages petabyte-scale MySQL backup and restore](http://bit.ly/2pqSZi0)

A few learnings from the post: 
- Use incremental snapshots of data for backup after one initial full snapshot to reduce both storage and recovery times.
- Save on storage costs by deleting all but the last two copies for recovery purposes.
- To ensure data integrity, verify these last two backup iterations daily.
- Compress, encrypt and transfer the backup to offsite storage to build further security. 
- Using snapshots this way is a more expensive process than more traditional backup technologies. But it reduces time and processing power for both the user and the service.

*[Full post here](http://bit.ly/2pqSZi0), 6 mins read* 

---

*I share these TL;DR versions of articles on software engineering that I read every weekday through my newsletter - [in.snippets(). Sign up here](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is) if you liked what you just read.*
The requirement to create React VR apps 
Tags: react, devops, career
Published: 2019-10-16 10:55:34

The only thing you need to make a React VR app is a headset and a compatible browser. If you are just viewing a web VR application then you don’t need even for a headset. React VR is a great framework to build VR websites or apps on JavaScript. It utilizes the same design as React Native and lets you make virtual reality tours and under interfaces with the provided components.


Technical Requirements

Before getting started with React VR, You required a proper setup for the dependencies that will be used to build and manage a React VR app. These are Node.js and the React VR CLI.

You need to install Node.js, ensure that the latest version is used. If not, do the following:

macOS: Install Node.js using Homebrew
Windows: Install it from the nodejs.org
Linux: Use sudo apt-get install nodejs command
Then you have to install the React VR CLI using npm:

1
npm install -g react-vr-cli.


Getting Started

Navigate to the directory where you wish to create a new project and run the react-vr init MyFirstReactVR command.

Change the directory name to something like MyFirstReactVR and run npm start .

Click and try to drag your cursor around. Also, in browsers that support WebVR, you’ll be able to explore this VR environment with a headset in full virtual reality mode.


VR Tour Sample Using React VR- https://codersera.com/blog/how-to-make-react-vr-apps-2/
-
CryptoKitties: An Early Application of the Blockchain That Led to Digital Cats Worth $100k+
Tags: ethereum, cryptocurrency, programming, blockchain
Published: 2020-01-15 00:01:06

---
title: CryptoKitties: An Early Application of the Blockchain That Led to Digital Cats Worth $100k+
published: true
date: 2019-10-16 10:46:03 UTC
tags: ethereum,cryptocurrency,programming,blockchain
canonical_url: https://medium.com/swlh/cryptokitties-an-early-application-of-the-blockchain-that-led-to-digital-cats-worth-100k-c21f7eee4dc7
---

[![](https://cdn-images-1.medium.com/max/2600/1*Q0yULKVKum3LRX7BO1zzRw.jpeg)](https://medium.com/swlh/cryptokitties-an-early-application-of-the-blockchain-that-led-to-digital-cats-worth-100k-c21f7eee4dc7?source=rss-5676ca6163ee------2)

The blockchain has promised us incredible new opportunities as a society. A decentralized banking system. Traceable food production for…

[Continue reading on The Startup »](https://medium.com/swlh/cryptokitties-an-early-application-of-the-blockchain-that-led-to-digital-cats-worth-100k-c21f7eee4dc7?source=rss-5676ca6163ee------2)
Godot Games Engine
Tags: godot, games
Published: 2019-10-16 10:44:13

I recently looked back to some of the old projects I worked on using Flash back in 1999 to 2003 or so. Some of those projects involved games development and generative art. I enjoyed programming in ActionScript 2 and 3 - and I enjoyed the creativity and freedom that Flash gave me for creating fun things.

I wanted to find something similar to Flash for creating some games and interactive experiences. Ideally it would be cross platform - and I stumbled across Godot Engine . As it's Open Source (MIT Licence - so actually Free Software) - a huge plus!

The UI for Godot is great, and the scripting language (GDScript) seems neat - it's python like. If you don't like that you can use C# and you can also extend it with other languages such as C++ and Go.

As a programmer, I wanted to first checkout the scripting language - and see what it was like. So, as I often do, I decided to write a simple 2d Cellular automata (See code below). From opening up the Editor for the first time, doing a spot of reading about how to set up a Scene and use it's Node system, it took me about 30 minutes to write a simple 2d Cellular automata. The built in IDE is great, with code highlighting, code suggestions and also a comprehensive debugging tool.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/89b6hpe7461khk3yx7ux.png)

```
extends TextureRect

# class member variables go here, for example:
# var a = 2
# var b = "textvar"
var imageTexture = ImageTexture.new()
var currentLine = 0;
var width = 1024
var height = 768
var dynImage = Image.new()
var onColour = '#ffffff';

func _ready():
	dynImage.create(width,height,false, Image.FORMAT_RGB8)
	dynImage.lock()
	for i in range(width):
		var rnd  = rand_range(0,10)
		if(rnd < rand_range(0,10)):
			dynImage.set_pixel(i,0, Color(onColour))

	dynImage.unlock()
	
	imageTexture.create_from_image(dynImage)
	self.texture = imageTexture
	
	imageTexture.resource_name = "The created texture!"
	print(self.texture.resource_name)
	
	pass

func _process(delta):
#	# Called every frame. Delta is time since last frame.
#	# Update game logic here.
	currentLine = currentLine + 1
	
	if(currentLine < height):
		for i in range(width):
			dynImage.lock()
			var currentPixel = dynImage.get_pixel(i, currentLine)
			var motherPixel = dynImage.get_pixel(i-1,currentLine-1)
			var fatherPixel = dynImage.get_pixel(i+1,currentLine-1)
			
			if(fatherPixel.to_html(false) == 'ffffff' && motherPixel.to_html(false) == 'ffffff'):
				dynImage.set_pixel(i, currentLine, Color(onColour))
			if(rand_range(0,10) > 7):
				dynImage.set_pixel(i, currentLine, Color(onColour))
			
			dynImage.unlock()
			
		
		imageTexture.create_from_image(dynImage)
		self.texture = imageTexture
	pass
```
Desktop Applications Development - what's out there!
Tags: gnome, gtk, node, vala
Published: 2019-10-16 10:24:51

I've recently been exploring (again) the creation of desktop applications.  I'm not overly bothered about them being available for multiple operating systems, for the projects I want to work on I'd be happy to focus purely on Linux and Gnome.

I started playing around with Vala and GTK - and I liked it.  Vala is a nice language to program in.  I've found plenty of resources online to help when I hit issues.  Also, as I've recently adopted elementary os - it works nicely with that.

I also wanted to try some other options.  A while ago I built a small tool using Lazarus IDE.  This was fine, it worked well and it had a nice visual environment for development.  My only issue was it felt clunky to go back to programming in Pascal - something I hadn't done for about 26 years.  I wasn't sure if I wanted to invest too much time relearning Pascal to become productive.

I recently looked into node-gtk.  This looks neat.  There is a big BUT.  when I use nexe to produce a self contained executable - we have a file that's a massive 56mb (and that's just for a hello world type app!) - that's not acceptable for me.

Neither is Electron for similar reasons.

I think I'll carry on with Vala and GTK for the time being.  If people have any other alternatives, I'd love to hear.
Agile back to basics with Robert C. Martin
Tags: agiledevelopment, agile, podcast
Published: 2019-10-18 11:12:36

---
title: Agile back to basics with Robert C. Martin
published: true
date: 2019-10-16 10:09:28 UTC
tags: Agile Development,agile,podcast
canonical_url: https://on-sw-integration.epischel.de/2019/10/16/podcast-agile-basics/?pk_campaign=feed&pk_kwd=podcast-agile-basics
---

<section>
<header>
<a href="https://cynicaldeveloper.com/podcast/125/">Episode 125 - Agile back to basics</a> <em>(<span>The Cynical Developer Podcast</span>)</em></header>
<blockquote>In this episode we talk to Robert C. Martin, many of you might know him as Uncle Bob, and we're here to talk Agile and taking it back to basics.</blockquote></section>

A great podcast episode with Robert C. Martin on “Agile – back to the basics”. So what are, in the time of Scrum, LeSS, SaFE etc., the basics of Agile?

Apparently, “Uncle Bob” has a new book in the works, “Clean Agile” (duh!), covering this subject.

 ![](https://www.epischel.de/analytics/piwik.php?idsite=3&rec=1&url=https%3A%2F%2Fon-sw-integration.epischel.de%2F2019%2F10%2F16%2Fpodcast-agile-basics%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dpodcast-agile-basics&action_name=Agile+back+to+basics+with+Robert+C.+Martin&urlref=https%3A%2F%2Fon-sw-integration.epischel.de%2Ffeed%2F)
Copy And Paste is violation law of DRY?
Tags: discuss, question, webdev
Published: 2019-10-16 06:52:01

---
title: Copy And Paste is violation law of DRY?
published: true
description: 
tags: discuss, question, webdev
---
Todays article doesn't push DRY exaggeratedly. The tendency I like that!

By chance I see below post that has good advise about DRY...
https://dev.to/mohanarpit/coding-practices-your-future-self-will-love-you-for-ohe

At the time, pulled trigger neuron connection belongs to my take on DRY!!🧠🧠🧠

# Copy And Paste is violation law of DRY?
Copy And Paste is make clone something written once.  
Human don't repeat first typing keyboard.

Honestly I like shared noting rather than traditional DRY practice that sharing code as mush as possible.

I'm Webdev JavaScript person but I'm curious your thought come from variety background!

And welcome simply Yes or No comments as a answer for `Copy And Paste is violation law of DRY?`

Thank you reading!😆😆😆
Be careful of Frameworks And Libraries, They Are Pure Evil!
Tags: programming, frameworks, javascript
Published: 2019-10-16 09:39:20

---
title: Be careful of Frameworks And Libraries, They Are Pure Evil!
published: true
description: A little deeper perspective on using frameworks. 
tags: #programming #frameworks #javascript
---

The title of the post may be a little scary, but in fact, it's so true **IF YOU FULLY DEPEND ON FRAMEWORKS OR LIBRARIES** in all of your programming career.


## **`DIY` Is your neglected friend** 

**Do It Yourself** concept is really missing a lot these days thanks to the too many frameworks that make your life much easier.

 
## **Are Frameworks And Libraries Pure Evil?**
 
Well, this is a tricky question, but to answer it we need first to check the following list of criteria to truly evaluate that theory.

- Do you know what happen behind scenes in these 3rd parties frameworks and libraries? 
- Can you reproduce same result by yourself?
- Do you really not have enough time to make whatever you want by your own self?
- Do you have that much amount of experience to depend on others's code to complete your task much quicker?


## **When to use frameworks**

Based on the previous list of criteria, we can conclude some points regarding using a framework or not as follows:

- Does the application really require a framework to be built it?
- You have a little time for your project?
- Want to gain some new experience from using that framework in the new project?
- Do you work in a team or solo?

In my opinion these points should be considered to determine if you're going to use a framework or not.

## **When not to use frameworks**

There could be some reasons to not use a framework in your project(s), but the most important reason for me is `your programming level will be much much much better when you try to code whatever thing by yourself`, this will leverage your experience to the next level, at least you know what you're doing and gets only what you want exactly the same way you want it to be done. 


I hope to think again about using frameworks or nay other libraries after you read this post

# **Conclusion**

Using frameworks or not is really up to you not to the market in the first place,  but you need to be smart to choose when to use a framework or not based on your current circumstances, DO NOT get rush NOR linger when to decide which path to take for your next project.
How to reduce your APM Cost with this one-liner
Tags: webdev, devops, rails, ruby
Published: 2019-10-16 09:36:45

---
title: How to reduce your APM Cost with this one-liner
published: true
tags: webdev, devops, rails, ruby
---

If the pricing of you APM is based on the number of transactions, it might interest you.

First, spot your most used transactions in the APM. In Scout, use "Highest throughput" (you will find the same in New Relic, Datadog, Librato, AppSignal, Skylight, etc) :

![screenshot of Scout select input](https://thepracticaldev.s3.amazonaws.com/i/expk8ot1w1mtosjjy8po.png)


Then, register only 1/10th of them for example. If you use ScoutAPM and Ruby on Rails, add this in the controller :

```
  ScoutApm::Transaction.ignore! if rand(10) > 0
```

done!


Obviously, the drawback is that you will miss some data, but the "mean response time per request" should still give an honest idea of the reality.


It will depend on your needs, maybe do not use it in your main home webpage, but it can be useful to use it on that little api request that is done each time after this home webpage is loaded.
Java lambda expressions recap
Tags: java, lambdaexpressions, recap
Published: 2019-10-16 09:43:42

---
title: Java lambda expressions recap
published: true
date: 2019-10-16 09:32:12 UTC
tags: Java,java,lambda expressions,recap
canonical_url: https://on-sw-integration.epischel.de/2019/10/16/java-lambda-expression-recap/
---

Lambda expressions in Java represent “functions”, something that take a number of parameters and produce at most one return value.

This could be expressed with anonymous classes but lambda expressions offer a more concise syntax.

## Syntax

Lambda expression consist of a parameter list, an “arrow” and a body.

```java
(String s1, String s2) -> s1 + "|" + s2
```

The parameter list is enclosed in round brackets. Types are optional. When the expression has exactly one parameter, the brackets can be omitted.

```java
s -> s!=null && s.length>0
```

The body can either be an expression (that returns a value) or a block. A block is a sequence of statements, enclosed in curly braces.

```java
n -> { if (n<10) System.out.println(n); }
```

## Lambda expressions and types

In the Java type system, lambda expressions are instances of “functional interfaces”. A functional interface is an interface with exactly one abstract method.

### Functional interfaces in java.util.function

The package java.util.function in the JDK contains a number of functional interfaces:

- `Function<T,U>`
  represents a function with one parameter of type T and return type U
- `Consumer<T>` represents a function with one parameter of type T and return type void
- `Supplier<T>` represents a function with no parameter and return type T
- `Predicate<T>` represents a function with one parameter of type T and return type boolean

Plus, variants with “Bi” prefix exists that have two parameters, like
`BiPredicate`. More variants exists for using primitive types like `DoubleToIntFunction` .

### User defined functional interfaces

Any interface with exactly one abstract method can be used as type of a lambda expression. You may mark this interface with `@FunctionInterface`:
```java
@FunctionalInterface 
interface SomeInterface { 
  int someBehaviour(String a, String b); 
} 

SomeInterface foo = (x,y) -> x.length + y.length;
```
but it is not required.

## Benefits

For me, the benefits of lambda expression are

- concise syntax for anonymous classes that represent functional code
- improved readability
- encouragement of a more functional programming style
An Introduction to Oracle SQL
Tags: sql, database, webdev, tutorial
Published: 2019-10-16 09:30:36

A quick tour of the six principal clauses of the SELECT statement.

This course is a brief presentation of Oracle SQL. We will install a version of Oracle Express Edition and Oracle SQL Developer for free. We’ll then look at the SELECT statement with its 6 main clauses (SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY). Following this, we’ll look at what else you need to know, and resources (which range from FREE to very expensive) which will help you to learn it…

What you’ll learn

Either Download and Install Oracle Express Edition and Oracle SQL Developer on your computer - for free
Write your own SELECT statements.
Learn the SELECT, FROM, WHERE, GROUP BY, HAVING and ORDER BY clauses.
Get an easy way to remember the order of these clauses.
Find out what more you need to know, and resources in how to learn it.

{% youtube 5fPP8WVNqCM %}
I applied for a job, now the wait begins 🤞🏾
Tags: career, discuss
Published: 2019-10-16 09:15:17

Ever since the [open source contractor job](https://jobs.dev.to/o/open-source-contractor) was posted, I've been having butterflies in my stomach every time I attempted to apply. I would feel like I am not ready for this position and just close the tab and move on.

But today I bit the bullet and spent my time carefully filling out the fields and writing my cover letter.

I feel better now that it is done and I have submitted my application. If I get the job, 🎉 it's all good and everything works according to plan, and If I do not get the job, still good this is a learning opportunity.


I'd love to know how some of you feel when applying for jobs