teleren/devto huggingface dataset:
The terrifying mongoDB sintaxe
Tags: mongodb, sql
Published: 2019-06-07 08:00:38

The main responsibility of experienced Sw Developers is help others and use the gained experience to overcome issues always teaching, learning and sharing.

I want to share a simple thing that make me think about complexity and trade-offs. I co-worker came to me asking for help on a MongoDB aggregate query:

> How would I aggregate the data that I need since I am using a NoSQL database?

> Can I use my previous SQL knowledge to make it happen?

Well, I think the things could be simpler but not. Look at the example bellow.

I have a series of events happening in my application where a particular event seems to be happening more often than expected. I would like check how often that event happens.

On mongo:

```
mongo-client-shell> db.orders.aggregate([ 
  { $match: {"event": "order.event.OrderPickedEvent"}} ,
  { $group : { _id: {"event": "$event", "orderNumber": '$orderNumber'}, count: { $sum: 1 } } }, 
  { $sort: {count: -1}}
], 
{allowDiskUse:true}
)
```

On Postgresql:

```
psql> select count(*) as total 
  from order 
  where event = "order.event.OrderPickedEvent" 
  group by orderNumber 
  order by total desc;
```

The question on my mind: Why Mongo make things so weird to not say complex? 

Its not natural to the reader.
We are always talking about code clearness, readability and making things simpler. But seems that big player not thing in the same way.

I hope this mini post can help others and maybe sensitize the tool's suppliers to make life easier*.

* I find a SQL translator to NoSQL which could help in that case https://studio3t.com/
#PureCSS - Responsive Sandwich
Tags: codepen, css, purecss
Published: 2019-06-07 07:31:47

---
title: #PureCSS - Responsive Sandwich
published: true
tags: codepen,css,purecss
---

[Visit Design Source](https://dribbble.com/shots/5312830-Sandwich)

<p>Responsive Sandwich using CSS</p>

{% codepen https://codepen.io/AsyrafHussin/pen/byPLQK %}
Why I learn Go and why I never regret
Tags: go
Published: 2019-06-07 07:20:09

# Background
Few months earlier, when i started to design on my final year project for bachelor degree, I needed a programming language that can handle concurrency well, and at the same time, with modern syntax. I looked into multiple programming languages, and [Go](https://golang.org/) stood out from my opinion list. 

# Learning process
### Pick up Go
When I decided to pick up Go, the first thing I do was looking for example project and read the source code. It turned out that was a bad move. Due to the syntax and the structure of Go. So I took a step back, by going through every slides of [A Tour of Go](https://tour.golang.org). Surprisingly, I took me one evening to complete it, and I was able to read Go code after that. The part that I took most of the time were topic on concurrency and channel. I used the old-fashion way, visualised by drawing out on paper, it really helped me. 

### Think like Go
One of the challenges that I faced was the design paradigm. Coming from object-oriented and functional programming background, Go does not make any sense to me at the first though. Imagine without the powerful functions like `map`, `reduce` that available to a lot of languages. Basically, in Go we have to write loop ourselves.  Imagine handle errors without `try` and `catch`. It took me awhile to get used to it. 

### Read more code
As I have picked up the basics, I continued my learning journey by reading more Go code. 
> The more I read, the more I realised how much I don't know about Go. 

Open source definitely helps. I read a lot of open source code. 


# Why I never regret
After several months working in Go, it does bring benefits to me

### Open up new opportunity
It increase the value of ourselves when we learn or know more things, especially in the technology industry where things are changing so fast. Go might not the most popular language out there, but it is growing. 

### Think from another perspective
As I mentioned earlier, in Go we do not have the powerful functions in most programming languages, it allows us to think the solution from the most basic programming structure. It might not be comfortable for some people, but it helps me to think the problem from another perspective. 

### Performance is awesome
Go's performance is awesome. I do not run any benchmarks to do comparison, for me I think is pretty good. The compilation time is really quick, and the CPU utilisation also quite low for my application. 

# Conclusion
Go is an awesome programming language, and I encourage all of you to give it a try. I will continue my journey in Go with different applications. 

*original publish at https://blog.yongweilun.me/why-i-learn-go-and-why-i-never-regret-cjwj3185s003rxts1gw16bwvc*
Friday Blast #73
Tags: fridayblast, links, post
Published: 2019-06-09 09:14:32

---
title: Friday Blast #73
published: true
tags: friday_blast,links,post
canonical_url: https://horia141.com/friday-blast-73.html
series: "Friday Blast"
---

[The Soviet license plate game and Kolmogorov complexity (2019)](https://www.johndcook.com/blog/2019/02/02/landau-kolmogorov/) - a fistful of awesome! Won’t spoil it, but it’s also a good example of the difference between something being possible and something being _possible and efficient_.

[Executing a sunset (2019)](https://codeascraft.com/2019/02/01/executing-a-sunset/) - about Etsy’s processes around removing products and their data and code. A rarely talked about subject, in this article you’ll get a feel for how Etsy sunsat their Wholesale, Studio and Manufacturing products.

[Apple car dreams (2019)](https://mondaynote.com/apple-car-dreams-b25b82997299) - or why Apple isn’t making a car anytime soon. There’s a bunch of good reasons articulated - for it being very different from their core business (in terms of object being produced, size, price etc), having low margins, self-driving being too far away etc. OTOH, the one thing which isn’t addressed is that this would be very in-line with the sort of products Apple is known for - status symbols more than anything.

[Presenting to executives (2018)](https://lethain.com//presenting-to-executives/) - a nice one from Irrational Exhuberance. Definitely counter-intuitive advice than regular _presentation_ ones.

[High availability and scalable reads in PostgreSQL (2018)](https://blog.timescale.com/scalable-postgresql-high-availability-read-scalability-streaming-replication-fb95023e2af/) - details of the streaming replication mechanism in PostgreSQL and how it impacts reads.
Hello, I'm a junior and I suck at organizing my work, how do you do?
Tags: discuss
Published: 2019-06-07 05:55:20

---
title: Hello, I'm a junior and I suck at organizing my work, how do you do?
published: true
description: 
tags: discuss
---

Hello, I have started a new job some months ago and it appears that I have serious difficulties to organize my work and speak about it. Often I can't give a reliable answer at the question "where are you at in your task?". Do you have any advise or method I could try to improve this aspect?
What was the config of your first computer?
Tags: discuss
Published: 2019-06-07 05:33:06

---
title: What was the config of your first computer?
published: true
description: 
tags: discuss
---

Mine was a Compaq PC with Celeron D processor, 256 MB Ram, 80 GB HDD accompanied with a Floppy and CD drive. And the only programming activity I did on that machine was writing C code to print one of them `*` patterns.
How and Why Do You Use GitHub Projects?
Tags: discuss
Published: 2019-06-07 03:41:28

---
title: How and Why Do You Use GitHub Projects?
published: true
description: I don't see myself using GitHub Projects, at least for now, but I'd like to know your thoughts on it, and how and why you use it.
tags: discuss
---

I'm used to using Trello for project management, and I'm using it for a new project I'm working on. I encountered GitHub Projects just yesterday, and I'm wondering what its use case is or advantage over Trello (aside from it being under the same roof as your repos).

For me, I see no significant advantage of it over Trello. The only scenario I would see that involves using GitHub Projects is when you would use Trello for general project management, with developer tasks delegated to GitHub Projects. However, I find that problematic since non-developers would not immediately know the progress and problems encountered during development, and devs would not be able to immediately know the progress and issues in non-dev-related tasks. You could duplicate items from GitHub Projects to Trello, but that would mean that there would be duplication of items, and additional work would be needed, unless there would be an integration between the two.

I'd like to know your thoughts on GitHub Projects, and how and why you use it.
Un vistazo a git: aliases
Tags: git, programming, development, beginnerfriendly
Published: 2019-06-07 03:14:16

---
title: Un vistazo a git: aliases
published: true
description: 'Un vistazo a git' es esa serie de publicaciones en las cuales aprenderemos desde lo básico de git a lo más avanzado de git. ¡Hoy toca el turno de aliases! 
tags: git, programming, development, beginnerFriendly
---

Si por alguna razón o determinación estamos en esto de la programación ya te habrás dado cuenta que mucho de lo que se hace en la industria es colaborar contrario a lo que malamente piensa, cuando de ello se trata una de las herramientas indispensables es [**git**](https://git-scm.com/). En esta ocasión toca el turno de escribir acerca de **git aliases**.

#### ¿Qué son los git aliases?

Los **aliases** o sobrenombres son acrónimos o 'apodos' los cuales asignas a los comandos que ya conocemos de git.

#### ¿Cómo lo hacemos?
Para configurar los acrónimos tenemos que hacerlos por medio del comando
 
`git config`
 
y para ello, tenemos la oportunidad de declararlos de manera global *(para hacer uso de ellos en cualquier carpeta versionada)* agregándole la bandera `--global` o de manera local *(aliases por carpeta versionada)*. 

> Si no queremos hacer uso del comando `git config` podemos configurar dichos aliases por medio de `.git/config` *local* o `~/.gitconfig` *global* 


##### Ejemplo

Queremos configurar un acrónimo para **commit** de manera **local**, la manera de hacerlo es:

~~~
git config alias.co commit
~~~
 
Si queremos configurarlo de manera **global** sería:

~~~
git config --global alias.co commit
~~~

*¿Recuerdan que les comenté de la bandera `--global`?*
:wink:


Ahora con ello ya podemos hacer uso de nuestro nuevo acrónimo así:

~~~
git co -m '¡nuevo commit utilizando aliases!'
~~~

**¿Qué pasa si también nos es molesto escribir el -m?**

Bueno, podemos tambien concatenar banderas de la siguiente forma:

~~~
git config alias.com 'commit -m'
~~~

![](https://media.giphy.com/media/s2qXK8wAvkHTO/giphy.gif)

Así de sencillo es hacer uso de dicha funcionalidad dejando a su imaginación los diferetes acrónimos que pueden crear con el fin de agilizar y ahorrar tiempo a la hora de programar. :call_me_hand: 


¡Espero les haya gustado y nos estaremos leyendo en el siguiente post que será publicado el día jueves!

**Feedback es bienvenido :sparkles:**
Weird browser behaviour?
Tags: help
Published: 2019-06-07 01:41:45

---
title: Weird browser behaviour?
published: true
tags: help
---

So I was playing with a search box, I wanted it to show/hide based on the content and whether it was focused or not, but I did not want to use width property for animation. Instead I went for `transform: translate` and tried to hide it behind the button when not needed.

I've noticed a weird behaviour though. When I hover over the element the box seems to render properly, but when I try to tab into it, the button starts to 'jump' and if you try clicking somewhere else on the page while the animation is running, the whole thing will just freeze, with the button staying in incorrect place.

Here is the code pen: https://codepen.io/anon/pen/vwqZxR
Building a tiny PWA for calculating depth of field for my film cameras
Published: 2019-10-30 00:20:25

---
title: Building a tiny PWA for calculating depth of field for my film cameras
published: true
date: 2019-06-07 01:13:21 UTC
tags: 
canonical_url: https://justinribeiro.com/chronicle/2019/06/06/building-a-tiny-pwa-for-calculating-depth-of-field-for-my-film-cameras/
---

My overall addiction to writing tiny progressive web apps only continues to grow. Since that addiction is growing I decided to mix it with another addiction of mine, film photography.

Yep, still shooting film. Look around the [archives](https://justinribeiro.com/chronicle/) and you will not doubt find other written pieces of my adventures [fixing film cameras](https://justinribeiro.com/chronicle/2019/04/22/repairing-a-busted-copal-0-aperture-and-custom-printing-a-lens-board/) and lens and [developing film](https://justinribeiro.com/chronicle/2019/04/08/developing-4x5-kodak-super-xx-film-pack-with-an-sp-445/). I even have a darkroom in my house…gasp!

Alas, I love mixing the old and the new. So I decided to do some math and fill a gap I often have, the [depth of field calculator pwa](https://dof-calculator.pwa.run/). I readily admit this is niche to say the least (then again, so are all my other tiny PWAs). If you’ve ever jumped between film formats and you’re not using a ground glass and you’re just trying to recall what the acceptable sharpness is for a given shot, then this is the PWA for you. Well, at least if you want the simple version.

This PWA weights in at just 3.4KB gzipped. It’s not particularly fancy; it allows you to define your own lens and film combinations (which many other online dof calculators don’t do which always frustrated me), and allows to find the most common numbers you’d need (such as hyperfocal distance). It is by no means is exhaustive. It won’t handle tilt or find the Scheimpflug wedge (I use a loupe on a ground glass, so I never calc that number which I find is not very useful in the field…a personal choice to be sure).

But, like many of my other tiny PWAs it does the one thing I need it to do, and only that. No cloud save. No 75MB download. Just me, a tiny bit of code running really fast, and a number that I need.

All the [source code is available on github](https://github.com/justinribeiro/dof-calculator-pwa) and you can use the PWA on [https://dof-calculator.pwa.run/](https://dof-calculator.pwa.run/). As always, pull requests and bug reports are welcome.

Now go shoot some film! Or digital! Just get out there and make some photographs with whatever you’ve got (remember: it’s supposed to be fun).
Performant infinite lists and accessibility.
Tags: discuss
Published: 2019-06-07 00:51:24

---
title: Performant infinite lists and accessibility.
published: true
tags: discuss
---

I read this article on medium:
https://medium.com/walmartlabs/infinite-scrolling-the-right-way-11b098a08815

The author says, that to keeps things performant, we can reuse existing `<li>` elements, instead of adding new `<li>` to `<ul>`. And to create an immersion of scrolling we can use padding on `<ul>`.

One question immediately came to my mind: since screen readers announce the size of the list, based on the actual number of `<li>` inside `<ul>`, screen reader users will be unable to find out how big that list actually is.

Non-screen reader users will fill the immersion, but screen reader users wont.
Hello, World!
Tags: discuss
Published: 2019-06-07 00:01:32

Since this is my 1st blog post here, I decided to "Hello, World!" Actually, I think the Kazakh version is better:

```python
print("Sälem, Älem!");
```

Anyways, you might object that I have two posts, so this is my second one. In other words, 1st. 

![Donald Knuth](https://imgs.xkcd.com/comics/donald_knuth.png)


The last time I was blogging was in the summer after my high school graduation. I had a lot of time before university and hands itching to type a lot of nonsense. Gradually I developed into a passive reader, not bothering myself with commenting, even if the duty called.

![Call of Duty](https://imgs.xkcd.com/comics/duty_calls.png)

My problem with blogging is that I don't know ~~how to write well~~ what to write. And because it would probably end up with me writing a couple of posts which no one would read, I never even began.

Now it's time to educate. Myself, first and foremost. I am about to start at a new place, where I'll be [paid twice](https://dev.to/charlesstover/are-you-under-qualified-to-apply-to-a-software-development-position-1kd4), so this blog is a kind of dedication from my side towards the second payment. I will direct a 12 post series about CSS Battle 1, first of which you might have already read.

{% link https://dev.to/pheeria/css-battle-1-simply-square-c19 %}

Initially, I wanted to post on Medium. You know how it works. 

1. Achieve something. Anything.
2. Declare yourself an expert in that field.
3. Write an enlightening Medium post to share your success.
4. Your life was not meaningless, everybody will admire you forever.

Then I read Kent Beck complaining about the paywall which prevents his readers from getting the knowledge. Then I heard from a friend of mine about freeCodeCamp and Hackernoon moving away to their own respective platforms and other developers coming hereto. Well, I thought to myself, it's still Medium, how would my life be accomplished without posting there? I could show solidarity with the community but still duplicate my posts both here and there. I tried to start a post, found out that Medium neither supports Markdown nor highlights code syntax and came straight to here. One should perceive the general mood seriously, after all.

So, that's me. And what about you?

By the way, is there a post scheduling feature planned? If I knew Ruby, I'd probably try to contribute, but I don't.


**P.S.** Did that semicolon drove you nuts, too?
Tests and types
Tags: programming
Published: 2019-06-11 12:30:04

---
title: Tests and types
published: true
tags: programming
canonical_url: https://stitcher.io/blog/tests-and-types
---

Imagine a simple function: `rgbToHex`. 
It takes three arguments, integers between 0 and 255; and converts it to a hexadecimal string.

Here's what this function's definition might look like in a dynamic, weakly typed language:

```
rgbToHex(red, green, blue) {
    // …
}
```

I think we all agree that "program correctness" is essential. 
We don't want any bugs, so we write tests.

```
assert(rgbToHex(0, 0, 0) == '000000')

assert(rgbToHex(255, 255, 255) == 'ffffff')

assert(rgbToHex(238, 66, 244) == 'ee42f4')
```

Because of our tests, we can be sure our implementation works as expected. Right? 

Well… We're actually only testing three out of the 16,777,216 possible colour combinations. But human reasoning tells us that if these three cases work, all probably do.

What happens though if we pass doubles instead of integers? 

```
rgbToHex(1.5, 20.2, 100.1)
``` 

Or numbers outside of the allowed range?

```
rgbToHex(-504, 305, -59)
```

What about `null`?

```
rgbToHex(null, null, null)
```

Or strings?

```
rgbToHex("red", "green", "blue")
```

Or the wrong amount of arguments?

```
rgbToHex()

rgbToHex(1, 2)

rgbToHex(1, 2, 3, 4)
```

Or a combination of the above? 

I can easily think of five edge-cases we need to test, before there's relative certainty our program does what it needs to do.That's at least eight tests we need to write — and I'm sure you can come up with a few others given the time.

Continue to read on [http://stitcher.io/blog/tests-and-types#read-on](http://stitcher.io/blog/tests-and-types#read-on)
What programming best practice do you disagree with? 
Tags: discuss, programming
Published: 2019-06-06 23:57:00

---
title: What programming best practice do you disagree with? 
published: true
description: Discussion about an unusual interview question
tags: discuss, programming
cover_image: https://thepracticaldev.s3.amazonaws.com/i/jfi4ipzo6rkxx6969kvs.jpg
---

I've been recently asked this question in an interview and this was my answer:

### Pure unit tests and shallow rendering idea
For ReactJS in particular, there are many testing libraries that allow you to do shallow rendering ([enzyme](https://airbnb.io/enzyme/) for example), that means that if you have a composed component, the test won’t actually render that inner component so you can’t make assertions on that. If you want to cover those internal components you need to write specific tests for each part.

For example:
```
<div>
   <Form>
      <Username />
      <Email />
   </Form>
</div>
```

With this structure, if you want to write a test for this component, the first `div` will be rendered but the custom `Form` component won’t, neither the `Username` and `Email` components, they will be mocked. You will have to test them individually, which follows the pure unit testing idea, but you can’t ensure that the components work ok together.
If you follow this pattern, you will soon end up with a set of pure unit tests that are really confusing and hard to follow.

{% twitter 965052178267176960 %}

**Tests should resemble the way the software is used.** Even though is not pure unit tests (technically you can call it integration test), at the end of the day the only thing that matters is that you can ship your app with confidence.

**Resources:**
- [@kentcdodds](https://twitter.com/kentcdodds)
- [Testing React Applications, v2](https://frontendmasters.com/courses/testing-react/)

Image by [Gerd Altmann](https://pixabay.com/users/geralt-9301/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3808487)from [Pixabay](https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=3808487)
Oops, my bed is too tall!
Tags: agile, devjournal, webdev
Published: 2019-06-06 22:31:42

Oh no! My new bed just arrived and it's 4ft off the ground, my partner convinced me to buy it online and now I have to jump literally out of bed and fall an unreasonable distance before I can start my day.

By now your probably thinking, what are you talking about? Beds.. this is 'dev.to' but hold on a moment, and no, there is no tldr, you should pay attention if you like metaphors. 

Oddly, beds are an awful lot like software, buying a bed involves a tremendous amount of research into the latest spring or foam technologies, you have to make a choice about your bed stack at the first hurdle, I choose foam several years ago, it's old and busted and I regret it, just like tech debt. Then what is going to power your new bed stack, some fancy shock absorber spring loaded slats, or some good old fashioned Java I mean planks of wood.

Your product owner really needs to be happy with your choice (my partner is my product owner), I mean, was a bed this high meeting requirements, did she like my choice? she's 5ft, the bed is as I remind you, 4ft off the ground!? So I put the thing together and showed the product owner the demo, sure she would fire me, but no, she thought it was fun! So there you go it's a feature not a bug. My son loves it because he can crawl around under it, and my dog, well she's figured out how to get comfortable with some training.

Normally I'd tell you what you can learn from stuff like this, but I think it's just funny this time, what reminds you of software?
Thank you notes after interviews 
Tags: interview, career, discuss
Published: 2019-06-06 22:27:38

---
title: Thank you notes after interviews 
published: true 
description: what’s the deal?
tags: interview, career, discuss
---

Hey,

I see old school advice about sending thank you notes after the interviews, but does this mentality still apply in our industry? Is it proper and well seen, or annoying and too pushy? Has it ever given you the edge in the process? Or killed an opportunity?

What is the consensus about it? Let me know your opinion\story