teleren/devto huggingface dataset:
Exit CircleCI jobs if changed files do not match specific pattern
Tags: circleci, devops, bash
Published: 2019-11-08 07:52:16

---
title: Exit CircleCI jobs if changed files do not match specific pattern
published: true
description: 
tags: circleci, devops, bash
---

As of Circle CI 2.1, we can define custom commands and new CircleCI CLI. 

I found the following code is useful to exit CircleCI jobs when some specific file/directory was changed in the latest commit:

```yml
# .circleci/config.yml

commands:
  check-changed-files-or-halt:
    parameters:
      pattern:
        type: string
    steps:
      - run: git show -m HEAD --name-only --pretty="" | egrep -q '<< parameters.pattern >>' || circleci step halt

jobs:
  test:
    executor: node
    steps:
      - attach-workspace
      - check-changed-files-or-halt:
          pattern: ^(src|test)|(.js|ts)$
      - run: yarn install
      - run: yarn test
```

However, the command `git show -m HEAD --name-only --pretty=""` only shows the latest commit's change, so use with merging Pull Request with tasks such as deployment.

Ref: https://discuss.circleci.com/t/ability-to-return-successfully-from-a-job-before-completing-all-the-next-steps/12969/7
How do you define technical debt?
Tags: opendiscussion, technicaldebt, softwareengineering
Published: 2019-11-08 07:43:37

---
title: How do you define technical debt?
published: true
description: What are your parameters or mindset or mental model to figure out a technical debt? How do you deal with the tech debt? How do you prioritize the tech debt severity? How to justify a tech-debt to product and business?
tags: open discussion, technical debt, software engineering
---
- What are your parameters or mindset or mental model to figure out a technical debt? 
- How do you deal with the tech debt? 
- How do you prioritize the tech debt severity? 
- How to justify a tech-debt to product and business?
how do you know when to quit?
Tags: discuss, career, movingon
Published: 2019-11-08 07:06:19

---
title: how do you know when to quit?
published: true
description: questions about when to throw in the towel
tags: discuss, career, moving on
---

I've been in software dev for over 40 years. For the most part, it's been an exciting, challenging, fun, and rewarding adventure.

But it hasn't been so for a while. The past year has been a real struggle. And it's gotten worse and worse until now I'm feeling quite awful.

How do you know when it's time to quit, get out?
Instead of using column alphabets while formatting, can I use column headers in xlsxwriter
Published: 2019-11-08 06:51:07

{% stackoverflow 58761345 %}

Can I use column header names instead of column alphabets for editing in pandas xlsxwriter?

This is for python 3.x using pandas and latest xlsx writer

worksheet.set_column('F:H', 30)
I want something like

worksheet.set_column('colname1:colname2', 30)
Metro Pulsa
Published: 2019-11-08 06:30:16

Bukan Cuma Pulsa Elektrik

Bersama kami, anda hanya bisa jualan pulsa? TIDAK. Kami juga mempunyai produk - produk yang tak kalah besar prospeknya antara lain Paket Data Internet, Paket Nelpon & SMS, Token Listrik, Voucher Game, Voucher TV, E-MONEY, dan Produk PPOB(pembayaran tagihan secara online). Semua produk terserbut kami kemas dalam sebuah bisnis yang bernama Bisnis Agen Pulsa dan Kuota All Operator Murah dalam satu layanan server kami.

Ambil saja contoh satu, Token Listrik. Pasti lah semua rumah membutuhkan yang namanya listrik tanpa kecuali. Listrik sendiri ada dua jenis, prabayar dan pascabayar. Namun belakagan ini banyak yang sudah meninggalkan listrik pascabayar ke listrik prabayar, sebab listrik prabayar atau sering disebut lisrik pintar mempunyai banyak kelebihan, contohnya si pengguna dapat mengatur/mengendalikan jumlah penggunaan listriknya sesuai kebutuhan dan keinginan mereka.

maka dari itu, bisnis agen token listrik juga sangat besar prospek untuk kedepannya. Ayooo tunggu apa lagi?

Semua sudah kami sebut dan jelaskan di atas, kalau memang masih ada yang kurang jelas bisa anda tanyakan di whatsapp customer service kami : 0812 3129 2888

Sekian penjelasan kami tentang Agen Pulsa bersama Metro Pulsa, server terpercaya sejak tahun 2015 dan lebih dari 25.000 member aktif bersama kami.
[Metro Pulsa](https://pulsa-lapak.blogspot.com)
When your hard-work pays off
Tags: bug, happiness, lifeofsoftwarengineer, song
Published: 2019-11-08 06:26:55

There will be obstacles, there will be mistakes, but with hard work there is no limit on what you can achieve. There are times when software developers' hard work pays off. You experience feeling of the happiness that words can't explain.

You have been assigned a critical production issue on Friday and you start thinking that your weekend will be at office now! You start understanding the root cause of the issue. And follow number of actions to get to the solution:

* You read through the issue description and get more details from the user.

* You then try and get hold of production environment (which you will not get).

* You try to replicate the issue on other environment where you have access. You use same artifacts which are deployed on production server.

* You try and get a copy of the production database.

* You try and follow exactly same steps as user to reproduce the issue locally, but no luck.

* You then try and find out whether there has been any change recently deployed to production server.

* You drill down commit details between two versions, and figure out if there has been any change in the area where bug is reported.

* You try and follow many other actions from your checklist and see if you can find the root cause of the issue. The actions listed here seems easy, but it can take days to accomplish them and one day you will be able to pin point the knock-on change.

* You then roll up your sleeves and try debugging the application and see what could possibly go wrong. Ah! It was a null reference exception at line 320! You start celebrating and want to explain your findings to someone. You feel like you should be awarded Kudos for this. However, it is 11 pm and you are only one in the office!

Finally, 2 weeks of hard work, no code review comments and your solution works on UAT and Production environment. That happiness can't be explained to anyone and then you start singing 'Bug Fix Hua'.

{% youtube kP5fKTRrjIY %}


What was your happiest moment while fixing bugs?
Avoid mutation of variables in ruby by extracting a function
Tags: ruby, rails, functional, beginners
Published: 2019-11-08 04:39:21

---
title: Avoid mutation of variables in ruby by extracting a function
published: true
description: This blog post takes you through avoid mutation of variables in ruby, which can be hard to reason about and understand
tags: #ruby, #rails, #functional, #beginners
---

Let's say you have the code something like this

```ruby
def something_else
  2
end

def do_something
  x = 1
  x += 2 if something_else.even?

  puts "#{x} is bla bla" # use x for some other operation
end
```

If you observe the above code, in the `do_something` method. We are mutating the variable x based on something_else. So what's wrong with this?

The code can become hard to reason about/understand once you start mutating the variables. It can lead to bugs and control flow is not so nice. Maybe we are unable to perceive that pain in this trivial example, but this could become complicated quickly, once you use this approach in something like rails


So can we make it better? Yes! By extracting the mutation into a function we can write something which is easier to understand and easier to test

```ruby
def do_something
  x = x_value

  puts "#{x} is bla bla" # use x for some other operation
end

def x_value
  initial_x_value = 1
  return initial_x_value + 2 if something_else.even?

  initial_x_value
end

```

By extracting the `x_value` method, we removed the mutation completely from `do_something` method and it's somewhat easier to follow than tracking what happened to variable x at this point. The bonus is you can easily test the `x_value` independently without depending on testing `do_something` method
How do you balance between doing things right and doing things fast
Tags: ask, discuss
Published: 2019-11-08 06:23:34

---
title: How do you balance between doing things right and doing things fast
published: true
description: 
tags: ask,discuss
---

Often as a SWE, we have to meet deadlines and to deliver on time the code quality can decrease. Or worse, it is much harder to refactor bad code later.

How do you balance between doing things right and doing things fast?
Checklist for the case of missing catalog entities in Content Editor
Tags: sitecore, commerce
Published: 2019-11-08 05:48:05

In Sitecore Commerce, catalog entities in the Commerce Engine database are displayed in Content Editor as an item. This behavior is implemented through the customized data provider.  

Sometimes, especially after the installation of Commerce, all or some entities are missing in Content Editor.   

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

When this happens, check the following information in your Sitecore.

## Commerce Cache
When a data-related problem occurs, the "Refresh Commerce Cache" command may help you. Try executing this in the Commerce tab on the ribbon.

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

## `Selected Catalog` field
To display entities in Content Editor, you need to configure which catalog is used in the `Commerce Catalog Folder` item. This item is in some location:

- `/sitecore/Commerce/Catalog Management/Catalogs`
- `<Storefront>/Home/Catalogs`

If no catalogs are selected in the `Selected Catalogs` field, its categories and sellable items aren't displayed.  

**Rechecking (uncheck and check) the selected catalog may be effective in some cases.** 

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


## Status of Commerce Authoring
Catalog entities are from the Shared Environment database via the Commerce Authoring server. So that the server needs to be working properly. Confirm the server is started and no errors in the log file. You can find the log in the following location.

- `<Commerce Authoring>\wwwroot\logs\SCF.<Date>.log.<Random ID>.txt`

An error I have encountered is Global.json (in `Commerce Engine\wwwroot\bootstrap`) has a non-escaped value in the SQL server name. This happens if you set the SQL server that has a backslash (like `.\SQLEXPRESS`) when installation.

## Parent category/catalog of an entity
Category and SellableItem entities have a property that indicates their parent category or catalog. So make sure the `ParentCatalogList` and `ParentCategoryList` property of a missing item is properly set. You can get the properties by executing the following query in the Shared Environment database.

```sql
USE Commerce_SharedEnvironments

SELECT
    Id,
    EntityVersion,
    JSON_VALUE(Entity, '$.ParentCategoryList') AS ParentCategoryList,
    JSON_VALUE(Entity, '$.ParentCatalogList') AS ParentCatalogList
FROM
    sitecore_commerce_storage.CatalogEntities AS CatalogEntities
    INNER JOIN sitecore_commerce_storage.CatalogEntity AS CatalogEntity
        ON CatalogEntities.UniqueId = CatalogEntity.UniqueId
WHERE
    Id = 'an entity ID of your missing item'
```

If the missing entities are imported from external data storage like PIM, check your code of pipeline about importing sellable items or categories.

## Conclusion
Almost cause is by a connection error to Authoring Engine or SQL databases, so you should check around there. If you find more causes, please tell me in a comment.
Migrating Data from Oracle to ElasticSearch
Tags: elasticsearch, oracle, migration, backend
Published: 2019-11-08 05:35:17

Environment : Windows 


#Prerequisites

1. Installing elasticsearch is very straight forward in Windows. Download the latest version of it and extract it in a folder. [link to download and run Elasticsearch as a service](https://www.elastic.co/guide/en/elasticsearch/reference/current/zip-windows.html)

2. In environment variables section, set the JAVA_HOME path. 

3. Now, if you go to [http://localhost:9200/] in the browser, you can see that elasticsearch is running.

4. Install [Logstash](https://www.elastic.co/guide/en/logstash/current/running-logstash-windows.html) for migrating data from Oracle to Elasticsearch. 

5. To extract the data, make sure your Oracle server is up and running. 


#Steps for Migration

1. Edit the file **logstash-ora.conf** under config folder in Logstash as below 

```
input {
 jdbc {
       jdbc_validate_connection => true
       jdbc_connection_string => "jdbc:oracle:thin:@192.168.1.2:1521/xe"
       jdbc_user => "user_details"
       jdbc_password => "tiger"
       jdbc_driver_library => "D:\elk\OJDBC-Full\ojdbc7.jar"
       jdbc_driver_class => "Java::oracle.jdbc.driver.OracleDriver"
       statement => "select * from search"
   }
}

output {
 elasticsearch {
   hosts => ["http://localhost:9200"]
   index => "rawsearchdata"
   #user => "elastic"
   #password => "changeme"
 }
}
```

#####Input
 
 > 'jdbc_connection_string' = connection string for Oracle

 > 'jdbc_user' = schema_name

 > 'jdbc_driver_library' = path to ojdbc7.jar (OJDBC is freely available for download)

#####Output

 > index = Index where the data is going to get stored


2. Save the file and run the command **logstash.bat -f ../config/logstash-ora.conf**

3. Once this is done, data will be loaded in the **rawsearchdata** index



#Check the data

1. First of all, lets check the index creation by running this in the browser [http://localhost:9200/_cat/indices?v]

2. We should see the **rawsearchdata** in the list of indices. 

3. Now, we can query the elasticsearch using CURL. 

```
curl -X GET "localhost:9200/rawsearchdata/_search" -H 'Content-Type: application/json' -d'
{
   "query": {
       "query_string": {
           "fields": [
               "search_column"
           ],
           "query": "customer data"
       }
   }
}'
```

> Pass the column name under the **fields**


Thanks for reading...
Create rclone remotes to backup up server files to and from GDrive
Tags: linux, serverless
Published: 2019-11-08 04:43:29

Step 1 : Login to your server
Step 2: Install RClone (https://rclone.org/install/)
Step 3: Create a rclone config (if not already present)
Step 4: Refer to docs to check connection process for different cloud storage services (https://rclone.org/docs/)
Step 5: command to copy to my gdrive/rclone/docker-compose-setup folder (already created, remote name is tf-server-backup, destination path is given following : after remote name, just put directory path where you want your files ):
sudo rclone copy -PL ./docker-compose-setup/ tf-server-backup:docker-compose-setup
 
Similarly, copy from remote to new server (logged in through ssh):
sudo rclone copy -PL tf-server-backup:docker-compose-setup ./docker-compose-setup/

Note: Flags: -P to check transfer progress
-L is to copy symbolic links as well and tf-server-backup is the rclone remote name, after : is destination folder name (here docker-compose-setup) put another name to create a new destination folder and not overwrite existing files (might be incompletely copied) 
 
Can add -v flag for copy progress, else to manually check, open backup and sync from google app and enable sync and choose folders from list, see the size beside folder name then cancel

Bonus: rclone listremotes -> lists all the remotes already present
365 Days of Coding Challenge: Day 6
Tags: codingphase, coding365challenge, bootstrap
Published: 2019-11-08 04:36:22

---
title: 365 Days of Coding Challenge: Day 6
published: true
description: Day 6 of my attempt to complete 365 days of coding
tags: #CodingPhase #Coding365Challenge #Bootstrap
---

<p>Today is the <strong>sixth</strong> day of my journey to complete <a href="https://codingphase.com">Joe Santos Garcia's (aka CodingPhase.com) Coding365Challenge</a>.</p>

<p>I was really pressed for time today but I started a project on how to more fully understand the use of <a href="https://www.w3schools.com/bootstrap/bootstrap_collapse.asp">Bootstrap collapsible classes</a>. My goal for today was really to get on the right track for using collapsible classes in Bootstrap navigation headers.</p>

<p>Feel free to see the CodePen for Day 6 and a screenshot below:
<a href="https://codepen.io/idrissalemairethiam/pen/eYYKOwK">https://codepen.io/idrissalemairethiam/pen/eYYKOwK</a></p>

<img src="https://dertathe.sirv.com/AwesomeScreenshot-2019-11-7-1573186949016.gif" width="3840" height="2160" alt="#CodingPhase #Coding365Challenge: Idrissa Lemaire Thiam's screenshot for Day 6" />
<p>
Right now, the quality of this work is really poor, but I am attempting to learn web development from the ground up.  I thank all of you for your patience and encouragement as I go this learning process--which is sometimes painfully slow.</p>
FireBug – Adding Your Own Debug Panels
Tags: php, debug, showdev, wordpress
Published: 2019-11-11 04:08:13

---
title: FireBug – Adding Your Own Debug Panels
published: true
date: 2019-11-08 04:17:21 UTC
tags: php, debug, showdev, wordpress
canonical_url: https://ua1.us/updates/firebug/firebug-adding-your-own-debug-panels/
---

In this tutorial, we will cover how to add your own debug panels to FireBug. This feature of FireBug is what really make it a useful tool for what you are developing! Since I recently integrated FireBug into a WordPress Plugin, we will be using this use case for our tutorial today. One goal we had when doing this integration was to add a custom debug panel that would give us all of the SQL Queries that WordPress makes when loading a page.

![](https://ua1.us/wp-content/uploads/2019/11/firebug-wp-queries.png)

## Start Creating Your Custom Panel

For this tutorial, we are going to assume you’ve successfully integrated FireBug into your project. To recap the simplest integration looks like this:

```
<?php
$fireBug = \UA1Labs\Fire\Bug::get();
$fireBug->enable();
echo $fireBug->render();
```

A custom FireBug debug panel consists of two parts. The class that represents the content of the panel. And the template that is bound to the class to render the results you are looking for. So let’s start by building out your class.

```
<?php
namespace UA1Labs\Fire\Studio\Feature\Debug\Panel;
use \UA1Labs\Fire\Bug\Panel;
class WpSqlQueries extends Panel
{
    const ID = 'wpsqlqueries';
    const NAME = 'Wordpress SQL {{count}}';

    public function __construct()
    {
        parent::__construct(self::ID, self::NAME,__DIR__. '/../templates/panels/sql-queries.phtml');
    }
}
```

Above you will find an example of the basic boilerplate code to start building out the data for your panel. Of course, there are so many ways to create the class. This is the way we do it at UA1 Labs. Other implementations are acceptable as well.

Notice, we have included a template file within our parent constructor. So let’s go ahead and get the boilerplate code prepared for that part of the custom panel we are creating.

```
<?php
// nothing to display yet ;)
```

Now that you have the basic boiler plate, we can go ahead and start adding the code that will display our queries.

## Our Custom Code For Displaying WP Queries

Before we get started adding our custom code, let’s first talk about how WordPress gives us the information about the queries it runs to load a page. WordPress has a configuration, that when turned on, will store the settings in its global $wpdb object. So for us to even get these queries, we can simply add define(‘SAVEQUERIES’, true); within our code.

The post [FireBug – Adding Your Own Debug Panels](https://ua1.us/updates/firebug/firebug-adding-your-own-debug-panels/) appeared first on [UA1 Labs](https://ua1.us).
Is it HARD to get into Blockchain as a web developer?
Tags: blockchain, ethereum, dapp, solidity
Published: 2019-11-08 04:14:56

---
title: Is it HARD to get into Blockchain as a web developer?
published: true
description: 
tags: Blockchain, Ethereum, Dapp, Solidity
original_url: https://www.youtube.com/watch?v=hnKeM2ilJ0k
---

If you are a web developer and want to learn Blockchain, is it hard or easy?  

There is a lot of misconceptions on this topic.  

Actually, Blockchain is based on web technologies and there are a lot of your current knowledge that you can leverage.  

Watch [this video](https://www.youtube.com/watch?v=hnKeM2ilJ0k) to find out if it's hard to to get into Blockchain as a web developer.

{% youtube hnKeM2ilJ0k %}
Immutably updating JavaScript objects in ReasonML (BuckleScript)
Tags: bucklescript, reason
Published: 2019-11-08 04:08:27

---
title: Immutably updating JavaScript objects in ReasonML (BuckleScript)
published: true
description:
tags: bucklescript,reason
---
BUCKLESCRIPT provides a type-safe OCaml programming environment that allows us to output and deploy JavaScript. ReasonML provides some syntax sugar to make working with JavaScript objects a bit nicer. However, it doesn't sugar over everything we can do with objects in JavaScript, like object spread syntax.

In JavaScript, you can use object spread syntax to immutably update objects:

```javascript
const bob = {id: 1, name: "Bob", age: 34};
const bob2 = {...bob, age: 35};
```

In Reason, there is no object spread syntax, but you can do it manually:

```ocaml
let bob = {"id": 1, "name": "Bob", "age": 34};
let bob2 = {"id": bob##id, "name": bob##name, "age": 35};
```

But this is _quite_ manual. There must be a more elegant way!

Well–in JavaScript before the advent of object spread, people used the [Object.assign](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) method. And BuckleScript ships with a binding [`Js.Obj.assign`](https://bucklescript.github.io/bucklescript/api/Js.Obj.html#VALassign), to exactly that method. This binding is effectively just a normal function from the Reason/OCaml point of view. So we can build a convenient, functional-style 'object spread' on top of it!

Here's the `update` function:

```ocaml
// JsObj.re

/** [update(~props, obj)] returns a shallow copy of [obj] updated with
    [props]. */
let update = (~props, obj) =>
  Js.Obj.(()->empty->assign(obj)->assign(props));
```

This effectively does an immutable update of `obj` with the given `props`. The input `obj` is unchanged. Perfect for React state updates, for example! Here's an example usage:

```ocaml
let bob = {"id": 1, "name": "Bob", "age": 34};
let bob2 = update(~props={"age": 35}, bob);

Js.log2("bob:", bob);
Js.log2("bob2:", bob2);
```

If you're familiar with JavaScript's `Object.assign`, you probably already understand how this works. If not, short explanation: it allocates a new, empty object, then shallow-copies all the props from `obj` into the new object, then sets the new props on the new object–leaving the old `obj` alone. The new props are also provided in the form of a normal object.

So, does this cover all the use cases of JavaScript's object spread? Probably not! But it's a demonstration of how Reason can have quite elegant, functional-style equivalents to JavaScript idioms.
web-extension starter
Tags: webextension, javascript, starter
Published: 2019-11-08 03:56:18

---
title: web-extension starter
published: true
description: Web Extension starter to build "Write Once Run on Any Browser" extension
tags: webextension, javascript, starter
---
Starter template to build cross-browser extension.

## Features

- Web-Extensions API)
- Browser Taylored Manifest generation
- Automatic build on code changes.
- Auto packs browser specific build files
- ES6 modules support
- SASS styling

GitHub Repo: https://github.com/abhijithvijayan/web-extension-starter
How to remove index.php from URL (Code Igniter) using IIS 8.0 server
Tags: codeigniter
Published: 2019-11-08 03:40:48

Index..php remove PHP remove and HTTP to https redirect in CodeIgniter. make  web.conig file and put the code.

Read more: https://realprogrammer.in/how-to-remove-index-php-from-url-code-igniter-using-iis-8-0-server/