teleren/devto huggingface dataset:
How do you measure security? Security Metrics
Tags: discuss, security, metrics
Published: 2019-03-03 16:20:32

---
title: How do you measure security? Security Metrics
published: true
description: Let's discuss ways or ideas on how we can measure security.
tags: discuss,security,metrics
---

Every few months, we see companies like Facebook and Google go in front of the Congress to answer questions like, "Have you ever had a data breach?"

If your stakeholders ask you this question today, what would you say?

As developers and engineers (I still don't get the difference), there are a lot of benefits on being data-driven. Perhaps we can use metrics to answer questions like, ”How secure are we today vs yesterday, last month or even last year?”

Here are just a few metrics I've seen people use to measure security:

* Number of resolved vs unresolved security risks
* Number of hosts running unpatched or outdated kernels
* Number of recalled or deprecated dependencies 
* Number of detected vulnerabilities through manual or automated code review (ex: static code analysis)
* etc.

I think having security metrics is one way we can raise the security bar for our team, company, and industry. It can help us drive actions to make our applications more secure in order to protect sensitive data and maintain our customers’ trust.

I understand that the security metrics you choose depends on the type of data or application you are trying to protect. For example, there is not a lot of value in measuring security for trying to protect access to data that is purposely made available to the public. 

So given an application that handles sensitive data, what are some ways you would measure its security? What security metrics would you implement?
What domain registrar do you use?
Tags: discuss, domains
Published: 2019-03-03 16:11:51

---
title: What domain registrar do you use?
published: true
description: Nowadays it feels like there's little difference between them all, but what is your favorite?
tags: discuss, domains
---

Since .dev domains are a hot topic right now, what site do you buy your domains through? 

I normally bought through Hover, but Gandi was allowing preregistering for .dev so I got one through them. Then Google Domains looked enticing to move everything to... As far as I can see, everyone does Whois Privacy these days, so I have no need to be tied to Hover other than their awesome UI.

Some hype about .dev:

{% link shafar/anyone-planning-to-register-a-dev-domain-4f4 %}

{% link david_ojeda/go-get-your-dev-domain-5hef %}

{% link sublimegeek/which-dev-domains-have-you-registered-so-far-175 %}

{% link dechamp/did-you-get-your-dev-domain--4d2b %}

(I'm at least hyped about .dev)
Python: what is the if __name__ == “__main__” ?
Tags: python, coding
Published: 2019-03-08 07:46:02

---
title: Python: what is the if __name__ == “__main__” ?
published: true
tags: Python,coding
canonical_url: https://rtfm.co.ua/en/python-what-is-the-if-__name__-__main__/
---


![Python](http://rtfm.co.ua/wp-content/uploads/2013/02/python_logo.jpg)In many Python modules you can find construction like:

```
if __name__ == "__main__": func()
```

Its main purpose is to dedicate a code which will be executed during calling code as a module, after importing it into another code – and when running module itself as a dedicated script.

_**Note**: this post initially was written on 09/12/2014 in my [Russian blog version](https://rtfm.co.ua/python-zachem-nuzhen-if-__name__-__main__/) so here is Python 2 used._

Let’s take a look at a couple of examples.

**Script 1** :

```
#!/usr/bin/env python

print('Script 1. My name is: %s' % __name__)
print('This is simple code from script 1')

def func():
    print('This is code from function from script 1')

if __name__ == "__main__":
    func()
```

And **Script 2** :

```
#!/usr/bin/env python

print('Script2. My name is: %s' % __name__)
print('Importing ifname1')
import ifname1
```

The execution result of the **Script 2**  directly:

```
$ ./ifname2.py
Script2. My name is: __main__
Importing ifname1
Script 1. My name is: ifname1
This is simple code from script 1
```

The execution result of the **Script 1**  directly:

```
$ ./ifname1.py
Script 1. My name is: __main__
This is simple code from script 1
This is code from function from script 1
```

Another example.

**Script 1** :

```
#!/usr/bin/env python

if __name__ == "__main__":
    print('I am running as an independent program with name = %s' % __name__)
else:
    print('I am running as an imported module with name = %s' % __name__)
```

And **Script 2** – no changes here:

```
#!/usr/bin/env python

print('Script2. My name is: %s' % __name__)
print('Importing ifname1')
import ifname1
```

Executing the **Script 2** will give us the next result:

```
$ ./ifname2.py
Script2. My name is: __main__
Importing ifname1
I am running as an imported module with name = ifname1
```

While running the **Script 1** – next:

```
$ ./ifname1.py
I am running as an independent program with name = __main__
```


### Similar posts

 
- <small>03/16/2018</small> [Python: pip – AttributeError: ‘module’ object has no attribute ‘SSL_ST_INIT’](https://rtfm.co.ua/python-pip-attributeerror-module-object-has-no-attribute-ssl_st_init/)<small> (0)</small>  
- <small>12/31/2017</small> [Python: boto3 и скрипт обновления AWS Security Group](https://rtfm.co.ua/python-boto3-i-skript-obnovleniya-aws-security-group/)<small> (0)</small>  
- <small>02/26/2015</small> [Python: PyLint – поиск ошибок и анализ качества кода](https://rtfm.co.ua/python-pylint-analiz-oshibok-i-kachestva-koda/)<small> (0)</small>  
- <small>01/02/2018</small> [Python: boto3 – примеры авторизации](https://rtfm.co.ua/python-boto3-primery-avtorizacii/)<small> (0)</small>
Explain Big-O with examples, beginners guide.
Tags: computerscience, beginners
Published: 2019-03-03 15:22:07

---
title: Explain Big-O with examples, beginners guide.
published: true
description: Big-O 
tags: computerscience, beginners
---
<h1>Overview</h1>
<p>Big-O notation is used to describe the Time Complexity(performance) and Space-Complexity(memory cost) of our programs. Think of each block of code as a task for your computer.
<br><br>
    We can use Big-O to evaluate each task with a notation. Much like a grading system for your code. A++, A, B , C etc. Big-O uses notations such as O(1), O(n), o(n²) etc.</p>

<h2>Constant Time - complexity O(1) - Grade: A++</h2>
When increasing or decreasing the value of the input has no impact on the output speed, Big-O uses complexity O(1) to describe the constant runtime, because this block of code always takes one execution step to complete.  O(1) is A++. Example:
{% replit @YongLiang/QuietSlateblueIntroductory %}

<h2>Note:</h2>
Even though the second example has multiple lines of code, but each blocks still has constant runtime. Therefore, unless the complexity changes, Big-O will keep it simple and call this method's complexity O(1), because Big-O only cares about complexity, not the number of lines of code.

<h2>Linear Time - complexity O(n) - Grade: A</h2>
O(n) is typically used to describe single loops operation. if input is the items I need to print out. Having 10 items means the loop will take 10 steps to print all; 100 items will require 100 steps in the loop. The computer needs to complete one task before moving to the next one, consider a loop is a single task. The complexity of this is linear O(n).
{% replit @YongLiang/StimulatingZigzagQuadrant %}

<h2>Note:</h2>
Notice in the above example, there are two loops, but they are not nested, there are two tasks here. Each loop is considered O(n), therefore the complexity of the method is still O(n).

<h2>Square Time - O(n²) - Grade: B</h2>
{% replit @YongLiang/WarpedTraumaticTransformation %}
O(n²) is typically used to describe nested loops. Any nested loops is just one single task. If 3 loops are nested, the complexity would be O(n^3) and so on.

<h1>Final Thoughts </h1>
<p>Big-O is mainly used to describe data structures and algorithms. Other Big-O notations such as O(2^n) is used to describe recursive calculation of Fibonacci numbers.
O(log N) is used to describe binary search.</p> 

Big-O also uses the same notations to describe space complexity. Instead of determining performance, space complexity focuses on how many times does your program allocates memory, such as create array, hash, variable etc. 

If a method uses a loop to just print 10 strings, the time complexity is O(n), but the space complexity is O(1) constant, because no memories were allocated.
Ride Receipts - Download your Uber and Lyft receipts automatically
Tags: showdev, productivity, launch, opensource
Published: 2019-03-03 15:16:54

---
title: Ride Receipts - Download your Uber and Lyft receipts automatically
published: true
description: Ride Receipts is a desktop app that automatically downloads and organizes Uber and Lyft receipts from your Gmail or Google Business email or Microsoft outlook email. It also generates an itemized expense report in Excel for all of your trips including the date, subtotal, taxes, fees, etc.. It’s ideal for business owners on the go, self-employed professionals, and anyone who gets reimbursed for travel.
tags: showdev, productivity, launch, opensource
---

### Why we made this?

Ride Receipts is essential for anyone who relies on Uber/Lyft for business travel. Whether you’re self-employed or get reimbursed by your employer for travel, you’ll likely need proper tax invoices for accounting purposes.

This was a major pain point for us every year around tax season. Since the current Uber website does not allow you to download all of your receipts for the year at once and Lyft doesn't have web dashboard, hence you have to manually download, rename, and organize each of your invoices. So you’re either doing it one by one or if you have a business profile, you still have to download them one month at a time. Uber’s or Lyft's monthly business travel report is great for keeping track of your trips, but these aren’t actual receipts.

We created Ride Receipts to address this painfully inefficient process, and now we’re sharing it with everyone who could benefit from this time-saving tool.

App has both paid and open source free version.

Website: [ridereceipts.io](https://ridereceipts.io)

**Technology**
- VueJS
- ElectronJS
- Puppeteer
- Gmail API
- Outlook API

**Repo**
{% github ridereceipts/ridereceipts %}
Which tools/language to use to build desktop apps in 2019?
Tags: discuss, desktop, tools, languages
Published: 2019-03-03 14:16:13

---
title: Which tools/language to use to build desktop apps in 2019?
published: true
description: What tools or language do you recommend for building a desktop app in 2019?
tags: discussion,desktop,tools,languages
---

Hey everyone,
I'm trying to decide on which tools/language to use to realize an idea I have for a desktop application which would include a GUI. Right now I have some JavaScript and TypeScript experience.
What tools and which language should I use to embark on this desktop app journey in 2019? Would you e.g. recommend sticking with JS/TS and build the app in Electron despite its performance problems or maybe I should learn Java, Kotlin, or Python?
Looking forward to an interesting discussion :)
Who is a team lead?
Tags: career, development, process
Published: 2019-03-03 09:48:20

---
title: Who is a team lead? 
published: true
description: What is the difference between Team Lead and Senior roles?
tags: career, development, process
cover_image: https://thepracticaldev.s3.amazonaws.com/i/bvodwfmw7ra75r2ogar3.jpg
---

On my current project, I'm playing the role of a Team Lead. It is one of those roles, whose responsibilities many people understand differently and often confused with a Senior role. In this post, I want to clarify this question and describe how I see the responsibilities of a Team Lead.

Let's start with the Senior role. Senior role in a team is closer to the technical side of the project -- they are some kind of a **gurus** who deeply understand the project (its development stack, its architecture), they help to solve arising technical issues, teach newcomers, share their experience and build high-level solutions (sometimes they try on the role of a Software Architect).

Team Lead is a role which implies not only a **deep understanding of the technical side** of the project but also **team management**. Team Lead solves problems and deals with blockers of team members on a much higher level and contributes to the project growth. They act as a shield - protect their team from managers and customers allowing the team to stay focused and motivated. Also, they are responsible for team activity monitoring, time reporting, and controlling the phases of the project development. And of course, they are some kind of bridge from management(delivery manager, project manager, customer) to the dev team and vice versa.

The difference between Senior role and a Team Lead is that a **Team Lead is a managing role**. It implies process control but not the execution process, which is the responsibility of developers. However, it's still a technical role and the real Team Lead should deeply understand technical decisions which were made by his team. Besides, developers are pack animals -- they can't be properly managed as long as they do not recognize technical skills in their Team Lead. If they see in their Team Lead only a manager then credibility is quickly running out, but if they can learn something from their Team Lead, for example, in a used framework, then they accept the leadership of the Team Lead.

Typical Team Lead's working day:
- consideration of new tasks and their delegation
- standup with a team
- meetings
- programming
- solving architecture questions
- code review

Practically, in healthy organizations, in my experience, the Team Lead role was usually taken by developers, who more than others feel responsible for the fate of the product being developed. They often demonstrate hyper-responsibility, which is used by management.

------

**Thank you for reading!**

Any questions? Leave your comment below to start fantastic discussions!

Check out [my blog](https://luminousmen.com/) or come to say hi 👋 on [Twitter](https://twitter.com/luminousmen) or subscribe to [my telegram channel](https://t.me/iamluminousmen).
Plan your best!
How static is a static inner class in Java?
Tags: java
Published: 2019-03-02 22:24:34

---
title: How static is a static inner class in Java?
published: true
tags: java
canonical_url: https://on-sw-integration.epischel.de/2019/03/02/how-static-is-a-static-inner-class-in-java
---

Answer: not static at all. A static inner class behaves like a normal class except that it is in the namespace of the outer class  (“for packaging convenience”, as the official Java tutorial [puts it](https://docs.oracle.com/javase/tutorial/java/javaOO/nested.html)).

So as an example:

```java
public class Outer { 
  private int x = 0; 
  static class Inner { 
    //... 
  }
}
```

As opposed to a true inner (nested) class, you do not need an instance of Outer to create an instance of Inner:

```java
Outer.Inner inner = new Outer.Inner();
```

and Inner instances have no special knowledge about Outer instances. Inner class behaves just like a top-level class, it just has to be qualified as “Outer.Inner”.

## Why I am writing about this?

Because I was quite shocked that two of my colleagues (both seasoned Java developers) were not sure if a static inner class was about static members and therefore global state.

Maybe they do not use static inner classes.

## When do I use static inner classes?

I use a static inner class

1. when it is only of use for the outer class and it’s independent of the (private) members of the outer class,
2. when it’s conceptionally tied to the outer class (e.g. a Builder class)
3. for packaging convenience.

Often, the visibility of the static inner class is not public. In this case there is no big difference whether I create a static inner class or a top-level class in the same source file. An alternative for the first code example therefore is:

```java
public class Outer { 
  // ...
}
// not really inner any more
class Inner { 
  // ... 
}
```

An example for (2) is a Builder class:

```
public class Thing { 
  //... 
  public static class Builder { 
    // ... many withXXX methods 
    public Thing make() // ... 
  }
}
```

If the Inner instance needs access to (private) members of the Outer instance then Inner needs to be non-static.

 ![](https://www.epischel.de/analytics/piwik.php?idsite=3&rec=1&url=https%3A%2F%2Fon-sw-integration.epischel.de%2F2019%2F03%2F02%2Fhow-static-is-a-static-inner-class-in-java%2F%3Fpk_campaign%3Dfeed%26pk_kwd%3Dhow-static-is-a-static-inner-class-in-java&action_name=How+static+is+a+static+inner+class+in+Java%3F&urlref=https%3A%2F%2Fon-sw-integration.epischel.de%2Ffeed%2F)
Clash Of ClassLoaders
Tags: apacheignite, springboot, classloaders, firstpost
Published: 2019-03-03 05:56:36

---
title: Clash Of ClassLoaders
published: true
description: 
tags: #apache-ignite,#spring-boot,#ClassLoaders,#first-post
---
In the world of code sometimes situations are like you are trying to build a Burj Khalifa but stuck at first basement only recently I came across with a similar situation where I was working on an OAuth project where I was dealing with all complex security-related stuff and assuming that soon I will inaugurate my Burj Khalifa but I was stuck between Clash of ClassLoaders .


In this article, I will explain about spring boot and apache ignite integration and how spring will override default java class loaders.
you can find spring-boot ignite implementation code on [GitHub](https://github.com/Earth-43/spring-boot-ignite)
I was caching one of the user object and its properties like roles in ignite cache as an object, so at the time of retrieval I am getting an exception like

```java.lang.IllegalStateException: Cached value is not of required type [cacheName=boot_ignite_cache, key=user_data, val=com.boot.ignite.bootignite.dto.User@1ae2cec9, requiredType=class com.boot.ignite.bootignite.dto.User]
 at org.apache.ignite.cache.spring.SpringCache.get(SpringCache.java:77) ~[ignite-spring-2.7.0.jar:2.7.0]```

After spending ample amount of time I realized there is something serious problem and I have forgotten my basics and started reading about classloaders and soon I diagnosed the problem that spring is way more friendly then we thought . Spring is using something called restart classloaders The restart technology provided by Spring Boot works by using two classloaders.

> Classes that do not change (for example, those from third-party jars) are loaded     into a base classloader.Classes that you are actively developing are loaded into a restart classloader . When the application is restarted, the restart classloader is thrown away and a new one is created. This approach means that application restarts are typically much faster than “cold starts”, since the base classloader is already available and populated.

So my **user object** loaded by spring boot **restart class loader** and ignite object is loaded by **default class loader** both the class are different. 
The solution is either not to use [spring dev tools](https://docs.spring.io/spring-boot/docs/current/reference/html/using-boot-devtools.html) which nobody wants or either create a **spring-devtools.properties** file and exclude the classes.

Thanks for reading !!!  Keep growing Keep Going !!!
Train own image classifier with one line command
Tags: python, machinelearning, keras
Published: 2019-03-03 05:22:41

---
title: Train own image classifier with one line command
published: true
description: 
tags: #python #machinelearning #keras
---

Recently, I released a python module, icTrainer that allows users to train image classifier easily.

icTrainer has 3 functions.

## Collect images
This function allows users to collect images easily. However, there are a couple of issues on this function. First one is to collect zero byte image(but zero byte file is removed after finishing download process) and The images collected by this function isn't the best one for training image classifier, so users need to select images manually. However, I think still this function is useful when people want to download iamges from the internet quickly.

```
$ ictrainer --mode collect --keyword dog -n 250
$ ictrainer --mode collect --keyword cat -n 250
```

## Resize images
ImageResizer offers an image resizing function. This function is for iamges which are downloaded by ImageCollector(the first function), so need to follow the `dataset/image_folder_name` structure. (This issue will be fixed soon)
 
```
$ ictrainer --mode resize --target cat --image_width 480 --image_height 320
```

## Train image classifier
Then, the last function is to train a keras image classifier.
The output is `.h5`. Users can try own classifier with test script(https://github.com/koji/icTrainer/tree/master/check_model).
This function is using fine-tuning with vgg16.

```
$ ictrainer --mode train --classes "cat" "dog" --mname "dogAndcat_"
```

I plan to add face detaction and face cropping function for training people's face classifier. 

Details are here
https://github.com/koji/icTrainer
https://pypi.org/project/ictrainer/
What is the difference?
Published: 2019-03-03 02:23:08

---
title: What is the difference?
published: true
description: 
tags: 
---

What is the difference? What is the fundamental difference?

For about a week I was on this huge (high adrenaline) run. It started when I heard the ABA coordinator talking about something. I realized I needed to support my son.

I have been grumpy with my son since he was born. I didn't want to deal with him. I didn't. I just didn't. I needed to sleep to go to a demanding job that demanded perfectionism. I'm a perfectionist anyway. And my mom had just committed suicide the year before. And I was/am codependent, I couldn't stay in bed when my wife had to get up every time my son woke up (which felt like 10 times a night, maybe it really was) - I always went in to help in some way.

I'm tired. I'm resentful. I didn't sleep well last night. I'm so anxious and angry and tired. Please help me. Someone some version of me somewhere in my head. Please help me.

So the ABA coordinator made me realize I needed to be the strength for my son. I needed to show him what love and strength and patience was. And then I listened to this TEDx talk about attention - where we must focus our attention. And I thought Yes, I must focus my attention on the good. I must finally - once and for all - hoist myself out of this glen of anger and anxiety and pity. I must be a source of strength and love, not a source of self-hatred, criticism, exhaustion.

I started in with the affirmations. I started in hard. It made a difference. I must not stop. I must affirm to myself that I am adequate, that I am enough. Because it is the opposite of this thought that brings in all the impatience, the fear, the anger, the insomnia.

I screamed at my son today, my innocent son. We are all innocent though. We all do the best we can with what we have. We literally cannot, could not do more. How could we?

I did the best I could with what I had.

And now in that strange purgatory of free will and determinism I say: I am determined: I am dogged: I insist on being a source of strength. I am turning this ship around right now.

I must accept the things I cannot change. Sometimes what I need to accept is that I have needs I must get met: space, peace, time to rest.