teleren/devto huggingface dataset:
Ordering the blog posts
Tags: webdev, beginners, rails
Published: 2019-02-13 15:51:54

---
title: Ordering the blog posts
published: true
description: Towards the end of my first rails project now. 
tags: webdev, beginners, rails
---

I have to say now, I have come to the end of my first project of building a blog app with Rails. Whilst there are features that can be added to the site, my enthusiasm in this project is wearing off. Therefore, I intend to hold this project for the time being and move on to my next project idea starting tomorrow.

However, there was one more thing I wanted to implement before moving on to the next project. This feature was sorting the blog post by showing the newly created post on top. After having hacked through the solution, this one seemed pretty straightforward, and one line of changed code did the trick.

```
  def index        
        @post = Post.all.order('created_at DESC')
   end

```
In the post controllers function index, all I needed was to do was add the `order` method. The order method would look at the created_at column at sort order the posts in descending order.

With this done, I did also implement a feature that allows the user to press tab when typing inside the textbox while creating a new or editing a blog post. 
I hacked my way through this and used vanilla Javascript for this. 
```
var myInput = document.getElementById("textbox");
    if(myInput.addEventListener ) {
        myInput.addEventListener('keydown',this.keyHandler,false);
    } else if(myInput.attachEvent ) {
        myInput.attachEvent('onkeydown',this.keyHandler); 
    }
    function keyHandler(e) {
        var TABKEY = 9;
        if(e.keyCode == TABKEY) {
            this.value += "    ";
            if(e.preventDefault) {
                e.preventDefault();
            }
            return false;
        }
    }

```
I did for a little while encounter difficulty in getting the javascript included in Rails but was finally able to do it. 

I included the `main.js` the js file I had created in the `app > javascripts` folder, and then on `application.js` in the app folder, I added the following lines `//= require main`. This I thought would work, but it did not. I got the following error in my browser console.

```
Uncaught TypeError: Cannot read property 'addEventListener' of null
```
I had to search for a solution and to be honest I haven't done a lot of javascript, so I could not really follow along. Something, that I did get was that the javascript `addEventListener` was running even before there was any text on the body textbox of my blog. 

For a solution that is working currently for me, I copy pasted the following code

```
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
```
at the end of the `application.html.erb` document.

With that, I was able to get the tab working on my textbox. I am yet to understand what my issue with javascript was? Or If I am including the js file correctly to my rails app? 

All in all, it has been a great learning experience for me. However, I must move on from this app, and start fresh.
How to import and export admin users on Magento 2?
Tags: magento, database
Published: 2019-02-13 15:51:02

---
title: How to import and export admin users on Magento 2?
published: true
description: Check how you can move your admin users from one to another Magento 2 installation without decrypting the password or change it.
tags: Magento, Database
canonical_url: https://blog.rafaelcg.com/how-to-import-and-export-admin-users-on-magento-2
---

Your admin users data are on the tables **admin_user** and **admin_passwords** in your Magento 2 database, you can use these commands to export and then import in your second store:

**Export**

```
$ mysqldump -p --user=username dbname admin_user admin_passwords > myAdminUsers.sql
```

**Import**

```
$ mysql -u username -p -D dbname < myAdminUsers.sql
```

> **Important**
>
> If you use a database prefix, don't forget to use on these commands above.
On Job Interviews
Tags: career
Published: 2019-02-13 15:36:08

Just imagine what would they ask a published novelist, if they wanted to hire one:

- do you know what a comma is?
- please, tell me something about words.
- how do you write a word using letters? you know about letters, do you?
- could you please write a question? just any question.

And after he politely pointed out that he obviously knows all of that stuff and much more, they switch to "advanced" questions:

- have you ever heard of an "oxford comma"? (in a very suspicious voice)

...

That's my very recent experience with one very large international investment bank. Almost literally.
Factory Design pattern [Creational]
Tags: blog, concepts, designpattern, designpatterns
Published: 2019-02-18 18:12:56

---
title: Factory Design pattern [Creational]
published: true
tags: blog,concepts,Design Pattern,Design Patterns
canonical_url: https://itscoderslife.wordpress.com/2019/02/13/factory-design-pattern-creational/
---

The factory method pattern allows callers to create instances of objects by only knowing the protocol or the top level base class and not the exact implementation classes.

- Callers will never know any details about the implementation classes. 
- The factory method incorporates the logic required to decide which implementation class to instantiate based on the criteria supplied by the caller. 
- Callers must not know all the implementation classes, just the protocol or the base class.
- Depending components must only know about the protocol or the base class and the class exposing the factory method. 
- This pattern allows changing the existing implementation classes or adding new ones without exposing these details to the components that rely on them. 
- _Factory Method: creation through inheritance._ Prototype: creation through delegation.

> The factory method selects the implementation class to instantiate based on the criteria supplied by the caller. The caller must know only a single type.

Example: Color Palette – User needs to mention the name of the palette and all colors with respect to that set will be populated and ready.

Color Palette – User needs to mention the name of the palette and all colors with respect to that set will be populated and ready.

**Summary** : The factory method pattern is a good choice if we want to prevent exposing all implementation classes to our callers.

_Note that the factory method design pattern cannot be applied when there is no common protocol or shared base class. _
Practical Binary Analysis Book Review
Tags: books, security, binary, reversenegineering
Published: 2019-02-13 15:21:55

---
title: Practical Binary Analysis Book Review
published: true
tags: books, security, binary, reversenegineering
---

I started reading [this](https://nostarch.com/binary) book in november and it took me about two weeks to finish it. You should be a bit comfortable Linux and programming if you plan to give it a try. Here are my thoughts about it.

![BookCover](https://thepracticaldev.s3.amazonaws.com/i/4jg1oods6dq3dlig48wx.png)

What I like the most about this book is that it explains the subject in a straightforward and concise way! The author is a very knowledgeable security researcher and his work is state of the art! 

The book helped me fill a lot of gaps about how binary analysis is done, code obfuscation, linear disassemblers, recursive disassemblers, intermediate languages and lots of tools and libraries. It also helped me learn things that I didn’t know they exist, like: code injection, binary instrumentation, dynamic taint analysis and symbolic execution analysis.

Each chapter sets the foundation for the next one and at the end of each chapter you’re invited to solve the exercises which help you enforce and understand the information. The code and examples can be found on the book’s [website](https://practicalbinaryanalysis.com/).

There weren’t many books that I’ve found the appendixes very useful. This one is an exception! There’s one appendix that guides you on further reading and one that discusses the disassemblers and tools used in the book. Being a novice in the field I just love when I get recommendation from an expert like [Dennis Andriesse](https://mistakenot.net/).

I enjoyed the book a lot and I hope you will too! 🙂

[Twitter](https://twitter.com/denisnutiu) | [DORefferal](https://m.do.co/c/22f012126c25)
[Android] How to mock final class with Mockito2
Tags: android
Published: 2019-02-13 14:56:16

---
title: [Android] How to mock final class with Mockito2
published: true
description: 
tags: Android
---

In Android project, `data` class is `final`. So `final` class can't be extended.


## Issue
This error will be happen when `data` class is mocked by using `mock()`, `spy()`, etc...

```
org.mockito.exceptions.base.MockitoException: 
Cannot mock/spy class net.kikuchy.example.ComplexData
Mockito cannot mock/spy because :
 - final class
```

## Solution
Adding `mockito-inline`

```java
dependencies {
    testImplementation "org.mockito:mockito-core:$mockito_version"
    testImplementation "org.mockito:mockito-inline:$mockito_version"
}
```
Just finished my first app with Electron
Tags: electronjs, javascript
Published: 2019-02-13 14:47:00

---
title: Just finished my first app with Electron
published: true
description: Reading list app with Electron
cover_image: https://thepracticaldev.s3.amazonaws.com/i/i9q1h67p5ply85mqdsu5.jpg
tags: electron.js, javascript
---
These days I challenged myself to build an app using Electron. It wasn't so much of a challenge because it's still JavaScript but it's more of the idea of building a desktop app instead of a web one.

Many times I found myself in the following situation: *I find a very nice article or video online that I find interesting but I have no time to read/watch it at that moment*. 
I was dreaming of a simple app in which I could keep my findings for later but at the same time, I wanted something that stores data locally. Instead of searching for such an app, I woke up in the morning saying that it will be better to build one myself. So here I am with version 1.0.0, very basic and most probably very buggy but I am proud of what I made 😁

I'm leaving links to the [Product Hunt](https://www.producthunt.com/posts/read-it) page and to the [GitHub](https://github.com/The24thDS/read-IT) repository.
I would appreciate if you would give me an upvote or a star ⭐ or even try my app if you find it interesting.
I'm waiting for suggestions 🤔 on improving the app and for bug reports 😫. Help me make this better! 💻

Also, this is my first DEV post 🎉

P.S: I'm 0% artistic, so any suggestions on improving the UI are most welcome 😊
Link's House
Tags: gamedev, showdev, devlog, unity3d
Published: 2019-02-13 14:26:37

---
title: Link's House
published: true
description: Little project I've been working on
tags: gamedev, showdev, devlog, unity
---
![Link's House in 3D](https://thepracticaldev.s3.amazonaws.com/i/tjfv7sracl22aj4zkllh.gif)
Most Popular Development Posts Of The Week (13 February 2019)
Tags: webdev, productivity, datascience, css
Published: 2019-02-14 11:06:13

---
title: Most Popular Development Posts Of The Week (13 February 2019)
published: true
tags: webdev,productivity,data-science,css
canonical_url: https://medium.com/daily-now/most-popular-development-posts-of-the-week-13-february-2019-147483dd7f59
cover_image: https://cdn-images-1.medium.com/max/1024/1*-1mYG6qAi7WHYzDqv-VqkQ.jpeg
---

> The secret to successful hiring is this: look for the people who want to change the world

- [The Five Principles of Very Fast Organizational Transformations (VFOT)](https://app.dailynow.co/r/ffdf71c0ecc6a2d4778bb4cb040596de)
- [How to Deal with Intense Amounts of Stress](https://app.dailynow.co/r/ffba7392af82f700a4bc0c2dee75a950) by [Bere Blissenbach](https://medium.com/u/d66112d1ac1b)
- [Ship it like Honeybadger](https://app.dailynow.co/r/ffaac01acb87f750919770723927b37a)
- [Why Building Wealth is Hard](https://app.dailynow.co/r/ff6133486ddd4b51f56e67ef4fbbb14e) by [Tanya Menendez](https://medium.com/u/372515f58b80)
- [Gainers, Losers, and Trends in Gartner 2019 Magic Quadrant for Data Science and Machine Learning Platforms](https://app.dailynow.co/r/ff2abed37b62558030a8522f8e61843b)
- [Be careful when interpreting your features importance in XGBoost!](https://app.dailynow.co/r/feed476be4e13465df3c42a9a396bb16) by [Amjad Abu-Rmileh](https://medium.com/u/1e4dc39fa7e0)
- [20 Top IT Consulting Firms / Technology Consulting Companies In India/US | 2019](https://app.dailynow.co/r/fed32d0337268bf27699f94b476978e1) by [Samaira Sandberg](https://medium.com/u/1ebd2e859fb8)
- [AnzoGraph: A W3C Standards-Based Graph Database](https://app.dailynow.co/r/fed247aab66dda2778398ab93cfff1fd) by [Jo Stichbury](https://medium.com/u/49dd0198b639)
- [Regret Is Just Laziness](https://app.dailynow.co/r/feb692f3c116ab9994d189513a055d9a) by [Rosie Leizrowice](https://medium.com/u/8b59430563f5)
- [CSS Specificity — An overview](https://app.dailynow.co/r/fe74e94592ff100c355828243b07a459) by [Vaibhav Khulbe](https://medium.com/u/bf1c1e823ad4)

* * *

[_Thanks to Daily_](https://www.dailynow.co/) _developers can focus on code instead of searching for news. Get immediate access to all these posts and much more just by opening a new tab._

![](https://cdn-images-1.medium.com/max/1024/1*m8Uf-6F4Q5AOp_wW6tbKSQ.jpeg)
How to work with dbForge Studio for MySQL on MacOS by using Parallels Desktop
Tags: software, mysql, macos
Published: 2019-02-13 12:41:03

---
title: How to work with dbForge Studio for MySQL on MacOS by using Parallels Desktop

published: true
description: How to work with dbForge Studio for MySQL on MacOS by using Parallels Desktop

tags: software, MySQL, MacOS
---

Many database professionals use Mac for their daily work. Devart is going to develop its software products for Mac platform in future. But for now, our users owing macOS devices can face some issues with procuring high-quality and comfortable work. One of the best solutions to resolve such issues is a software called Parallels Desktop. This is a virtualization environment, in which you can run Windows or any other OS while remaining in macOS. Today, we will tell you about the intricacies of setting up the dbForge Studio for MySQL environment in this app.

Learn more at http://blog.devart.com/how-to-work-with-dbforge-studio-for-mysql-on-mac-by-using-parallels-desktop.html
Partnered Code Reviews
Tags: git, pullrequest
Published: 2019-02-13 06:58:43

---
title: Partnered Code Reviews
published: true 
description: 
tags: git, pullrequest
series: Git Communication
---

Are you familiar with code reviews? Do you do the review in person or through a change request tool (merge/pull)? What benefit do you get having someone stand next to as you talk through the changes you made?

Git conventional commits facilitates a partnered code review without the partner. When working to decide how to organize your changes, consider these questions/considerations 

* What am I changing, Why
* Will this help me tell someone what I just did
* Does this include all the needed changes such that the review can confirm all needed components (especially those which talk to each other) have been correctly modified.
* Would this be useful if reverted
* Do I need to group many commits together for reverting
* Should this commit go upstream

The first question is what a code review causes you to ask so it can be explained to your partner. 

# Reality

The actual results of your Commits will very, partially from disopline, accountability, and laziness. I believe there can be good reasons for making exceptions because dev work can be messy, but having a goal to get close will be beneficial because you'll first have to ask yourself, why is this an exception and be happy with that answer.
remove touch effect from tablayout
Tags: android, layout, ui
Published: 2019-02-13 08:32:58

---
title: remove touch effect from tablayout
published: true
description: T/O
tags: android,layout,ui
---
There is ripple and touch effect when you use Tablyout of Android.
You can remove the effect by following below.

inside of below tag
```
<android.support.design.widget.TabLayout
```

you should add below attribute
```
app:tabRippleColor="@null"
```

that it.
How Do I Start Giving Talks on Coding?
Tags: help, advice, beginners, discuss
Published: 2019-02-13 08:06:46

I don't consider myself an expert in just about any aspect of computer science / programming, but I'd like to start to share the bit of knowledge that I do have in a more public (meatspace) forum.

Anyone have any advice for getting started? I've reached out to my local Java Users Group and there are some Meetup coordinators I'm going to get in touch with. Do you have any general advice? Or particular websites for finding conferences / events which are soliciting speakers?

Any horror stories to make me less worried about my first talk?
Using Anaconda On Sublime Text (without installing any package)
Tags: python, anaconda, datascience, sublimetext3
Published: 2019-02-13 08:03:13

---
title: Using Anaconda On Sublime Text (without installing any package)
published: true
description: How to configure Sublime text to run the Anaconda version of python and ... enjoy the power behind.
tags: python, anaconda, data-science, sublimetext3
---


![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/2jgf1hcnqm3xjmfk2yii.png)


It was always a dream of mine to run python on sublime text. But a greater dream was to run Anaconda on sublime text. Here is how you do it on windows!

## First Step: Undertand Sublime Text Build

Sublime text provides build options by default. It's pretty intelligent in the sense that if you install python, it'll try to get the path to the executable.

To inspect how python configures build systems, let us try building a new one

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild.png)

A new file opens up with some configs

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild2.png)

But let us try saving it so see how and where it saves it

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild3.png)

Now let us open an original build file

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild5.png)

we see that it requires the path to an executable

## Second Step: Finding the Anaconda executable

we must find the anaconda executable but not any python.exe . to find that we go to the anaconda command prompt

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild6.png)

and we type the following

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild8.png)

next we go to the folder and find the name of the python executable

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild9.png)

then we build a new package and configure it then save it

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild10.png)

next time we choose in our menu

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild11.png)

then control + b to run

![Alt text of image](https://www.pythonmembers.club/wp-content/uploads/2019/02/newbuild12.png)

next we feel the power flowing in our veins ++_++_++__++

NOTE: This post gets A LOT of traffic. The author would appreciate some hearts if you are at it!
The Manager's Path by Camille Fournier
Tags: books, selfimprovement, management
Published: 2019-02-13 07:42:51

---
title: "The Manager's Path by Camille Fournier"
published: true
description: "Even if you want to keep being a coder, it's good to understand the dark, I mean the management side"
tags: [books, self-improvement, management]
---
Have you, Sandor, really read [that book](https://amzn.to/2FclW78)? - you might ask if you know me or you simply know what path I'm following. A hint: the technical path. Yet, my answer would be, of course, I had and it was great!

What it is about?


It's a map helping you navigate at the different positions on the way up to the top of the software teams management. So this book is not just about any type of managers, it is dedicated to managers working in software development. It covers position starting from the tech leads, through mid-management up to the position of CTO or VP of Engineering.

I'm not changing my mind. Even though I code so little nowadays at my job that maybe it would be more beneficial to convert into a manager and make more money while I'd have more authority on improving our engineering practices and developer environment that I'm most concerned about. 

But yet, I'm not reading this book to become the next superstar tech leader. I read it because I think one of the most important skill in order to succeed at a corporation - even (or mainly?) as an individual contributor is to know how to manage your manager. I don't mean it in a Machiavellian way. I'm a nice guy. I mean it in a way that if you understand what are the main concerns of your boss or those of the boss of your boss, you'll have a much higher chance to succeed in your goals. I'm generally quite good at this skill I think and I want to further improve it.

While this book serves as a guide for the managers, it helps you too to understand what tasks' they have to deal with, what are their main concerns. And let's not be blind, to become a senior engineer or software architect, you don't just have to be able to write good code, but you also need some leadership and management skills. This book can help you to steal some of their tricks and techniques.

How did I start to use what the book teaches? It also covers a bit of how to be a good mentor. As I started to mentor our latest newcomer, using this book, I try to guide or check-points which I started to organise. During the first two weeks, we only met sporadically.

It also helps me to understand what good management is and what I value in a manager. I also handed the book to my manager, maybe [The Manager's Path](https://amzn.to/2FclW78) will help him to further improve his skills. Not that he is the worst manager I ever had, not at all, but we are his first team, of course, he has a lot to learn. Like every one of us.

Happy learning and reading!

_This article has been originally published on [my blog.](http://sandordargo.com/blog/2019/02/13/the-managers-path)_
git-history
Tags: git
Published: 2019-02-13 05:05:26

---
title: git-history
published: true
description: Quickly browse the history of a git repository 
tags: #git
canonical_url: https://www.iamdeveloper.com/posts/git-history-20nh/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/ulidmgllcwzax0a6g4yl.jpg
---

Shout out to [Josh Comeau](https://twitter.com/JoshWComeau) for pointing me towards this repo. He popped it in my Twitter feed.

A really cool way to view git history for those that like a nice visual. Slide through the history and see previous changes elegantly slide in.

{% twitter 1095029354839588867 %}

"Quickly browse the history of any GitHub (GitLab and Bitbucket comming soon)"

{% github https://github.com/pomber/git-history %}

Thanks for the interesting project @pomber!

Photo by [Nathan Anderson](https://unsplash.com/photos/c7fShzYk4bA?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText) on [Unsplash](https://unsplash.com/?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText)
Angular Material Router Awareness
Tags: angular, firebase, firestore, webdev
Published: 2019-08-13 04:34:57

---
title: Angular Material Router Awareness
description: Make your Angular Material components more aware by using the Angular Router's Power
published: true
tags: angular, firebase, firestore, webdev
canonical_url: https://ajonp.com/lessons/angular-material-router-awareness/
cover_image: https://res.cloudinary.com/ajonp/image/upload/w_1000,h_420/v1550035555/ajonp-ajonp-com/14-angular-material-router-awareness/angular-material-router-awareness.jpg
series: angular_material
---

> Original Post: https://ajonp.com/courses/angularmaterial/angular-material-router-awareness/

{% youtube 3roNVbp3RPg %}