teleren/devto huggingface dataset:
Optimistic opinion: Microsoft actually ❤️ Linux?
Tags: microsoft, opinion, opensource
Published: 2020-04-12 04:01:37

---
title: Optimistic opinion: Microsoft actually ❤️ Linux?
published: true
date: 2020-03-19 08:40:00 UTC
tags: microsoft,opinion,oss
canonical_url: https://2kabhishek.blogspot.com/2020/03/optimistic-opinion-microsoft-actually.html
---

[![](https://lh3.googleusercontent.com/-nKSH-vSYids/XnMvx4HehLI/AAAAAAAAREY/E9BEFUoJ3j8KLsOm2ALbxO1EvzEEM6lKQCLcBGAsYHQ/s1600/1584607172371010-0.png)](https://lh3.googleusercontent.com/-nKSH-vSYids/XnMvx4HehLI/AAAAAAAAREY/E9BEFUoJ3j8KLsOm2ALbxO1EvzEEM6lKQCLcBGAsYHQ/s1600/1584607172371010-0.png)
  

Any of you who use npm should have received a mail and that is the reason behind this post.  

Microsoft has made a lot of progress in between Steve Ballmer's "Linux is a cancer" and Satya Nadella's "Microsoft ♥ Linux" in the Open Source world. Most of what microsoft has been doing recently is very inclusive of OSS. Things from the top of my head include WSL, VS Code, GitHub, Dot Net Core, Powershell and now npm and the list is [very long](opensource.microsoft.com). Although one can argue that Microsoft is doing all this to push it's Azure platform but still getting quality cross platform open source software is always welcome. Hopefully Microsoft will keep the ball rolling in the right direction and we'll hear more good news in the future. 😄

What do you think?
DeepCode's Top Findings #12: Integer Promotion on Bitwise Operations in C
Tags: deepcode, staticcodeanalysis, c, cpp
Published: 2020-03-19 08:14:22

[DeepCode](https://deepcode.ai) offers an AI-based Static Program Analysis for Java, JavaScript and TypeScript, C/C++ and Python. As you might know, DeepCode uses thousands of open source repos to train our engine. We asked the engine team to provide some stats on the findings. On the top suggestions from our engine, we want to introduce and give some background in this series of blog articles.

*Language:* C
*Defect:* Integer Promotion on Bitwise Operations
*Diagnose:* Cast the result of shift left to unsigned short to avoid unexpected behavior because of integral type promotion. The shifted expression is promoted to unsigned int, which may introduce a number of unknown bits.

This example is sponsored by Linux in the Alpha architecture (see [here](https://www.deepcode.ai/app/gh/torvalds/linux/fb33c6510d5595144d585aa194d377cf74d31911/_/%2Farch%2Falpha%2Finclude%2Fasm%2Fdma.h/cpp%2Fdc%2FBinaryOperationTypePromotion/358/code/) ). Obviously, you can load them also in your own dashboard.

So, here is the code:

```c
static __inline__ int get_dma_residue(unsigned int dmanr)
{
	unsigned int io_port = (dmanr<=3)? ((dmanr&3)<<1) + 1 + IO_DMA1_BASE
					 : ((dmanr&3)<<2) + 2 + IO_DMA2_BASE;

	/* using short to get 16-bit wrap around */
	unsigned short count;

	count = 1 + dma_inb(io_port);
	count += dma_inb(io_port) << 8;
	
	return (dmanr<=3)? count : (count<<1);
}
```

What we should observe is there `count` variable which type is `unsigned short`. The function returns the type `int` and in the return statement, we have a conditional that either returns `count`(which would need a typecast to `int`) or a bitwise shift left of `count`.

The type conversion rules for bitwise operations in C are actually not that straight forward. The long explanation - as pointed out by DeepCode with the link _More Info_ - is [here](https://wiki.sei.cmu.edu/confluence/display/c/INT02-C.+Understand+integer+conversion+rules). Under the hood, C converts operants oftentimes to `int`, applies the operation, and truncates the result to fit into the target variable. Bitwise operators are such an example.

Given the specific architecture, the implicit typecast between `unsigned short` and `int` might just work out perfectly. I would argue it is hard to follow the intent of the developer and he was aware (therefor the comment). Still, following the best practices, he should do explicit type conversions (see also the link above).
The set and get methods from lodash
Tags: javascript, lodash, shortcuts
Published: 2020-03-19 08:18:27

**What is lodash?**
 - Lodash simplifies our work by providing lots of methods to handle arrays and objects.

**_.get()**

 - The get method gets the value from the path that’s been provided as an argument. The first argument is the object, the second is the path of the object and the third is the optional argument discussed which returns the default value

 {% gist https://gist.github.com/DashingDaniel/f93ebd11cf4c83c0ba72b44ea74749e7.js %}

 - So, What if the path doesn’t exist or the path returns ‘undefined’. No worries Lodash allows us to pass an optional third argument which is the default value. In those situations, the default value is returned.

{% gist https://gist.github.com/DashingDaniel/7c84bedc98830500a1fff53c5a63e5aa.js %}

**_.set()**

 - The set method as the name suggests sets the value to the path of the object. There are three arguments. The first is the object itself, second is the path and the third one is the value.

{% gist https://gist.github.com/DashingDaniel/e2ae94f38ddc14754a5f9d290f87dc1c.js %}

 - So, What if the path doesn’t exist. The set() automatically creates a path for us. Here the ‘c’ path doesn’t exist but its automatically created.

{% gist https://gist.github.com/DashingDaniel/fa0b498a8e6b76221a943fee51b1be5d.js %}
How I've demonstrated growth mindset recently
Tags: growth
Published: 2020-03-19 07:37:09

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/akzp4fxs7ptbb18rqpw0.jpg)
In life, we daily meet constantly challenges that shape our personality either in a good or bad way but at the end day something considerable changes in us. One's with a growth mindset believes that their most basic abilities can be developed through dedication and hard work, brains and talent are just the starting point.

I have recently been able to experience a growth mindset in my software developer career. In February, I decided to apply in the 5-month stack up program provided by Andela which consists of learning and working on a different project that helps acquire technologies knowledge and tools to be a job-ready developer in the tech industry. During the roll phase of the program, we had to develop a full-stack application in only two weeks those were the two intensive weeks I have had for a long time. We had to Implement a lot of features in a short time and that's where I learned to be flexible and keep up with the pace of challenge I was facing. Sometimes I would have to stay awake up to 1 AM in the night to fix a bug or come up with a solution to implement a certain feature of the application.

This experience though many things but the one I found help and an example of mindset growth I will state will collaboration. I meet teammates in my group and we would discuss errors we meet and what better solutions we can come up with I found it very helpful since we were both benefiting from those discussions it was quite a great experience and valuable lesson I learned. Before I mostly loved working solo in most of my projects I wasn't a fan of collaborations in software development because I always believed one alone can accomplish a lot of work but that was before I know teamwork collaboration.

In short, The Andela stack-up program specifically the roll-up phase gave me an opportunity to learn new things and also from my teammate which helped me grow my mindset.
Joining new company, What should I do in first few weeks?
Tags: discuss, newjob, companyswitch
Published: 2020-03-19 07:22:33

---
title: Joining new company, What should I do in first few weeks?
published: true
tags: discuss, newjob, companyswitch
---
Hi All,

I will be joining a new company soon as a senior Java developer. Any suggestions on what I should be doing right for the first few weeks after joining to sail smoothly in the company? 
Please feel free to comment on any aspects such as job expectations, culture, etc..
Node.Js Architecture
Tags: discuss
Published: 2020-03-19 07:20:56

Hi, I have been asked in interviews regarding how NodeJs works and its architecture. I for the most part have been unable to explain how it handles lots of request and respond too by using its asynchronous nature. I would like to understand how does Node performs handling of request asynchronously even though JavaScript is synchronous. I know about event loop but would be interested it to know from libuv perspective. Thanks.
Got a 'git' conflict and just want to blow away your local changes and take 'theirs'?
Tags: git
Published: 2020-03-19 07:01:40

I just did a 'git merge' with another branch and I have a merge conflict.  I'm happy to lose my changes in preference to the changes on the other branch.

Well, as with all things, there is a simple git command for this...

```javascript
git checkout --theirs path/to/file
```

Too easy.
What is recommended way to set up a web server?
Tags: webdev, discuss
Published: 2020-03-19 06:51:56

I have a server and I am designing some web applications. I use React as frontend framework and Rust Actix as backend framework. The backend program listens at 8000 port, and can be reached by `my_domain:8000/api/xxxx`.

I think I can use a web server listening at 80 port, such that if client is requesting `/`, then returning the frontend page, if client is requesting `/api`, then redirect the request to 8000 port of localhost.

My problems are:

1. Is the above way recommended in the modern web application design? Are there any other ways of hosting both frontend and backend application in the server?
2. What web server can I use? Apache, Nginx, or manually write a web server?
3. I use two docker containers to contain the frontend and backend app. Do I need to dockerize the web server as well?
HR Tools Development: Types of Recruitment Software
Published: 2020-03-19 06:07:53

Full article: https://yalantis.com/blog/types-of-recruitment-software/

There is no business without human resources. No matter how big or small, all companies have HR teams. Talent professionals and hiring managers in all industries work hard to find, hire, and retain employees. Recruiting is about communication. So there’s no chance that technology can completely take over the process. But the right software eases and speeds up human resources management.

That’s why recruitment software is trending. Top HR platforms provide features both for small and big customers, offering both desktop and mobile apps to attract more users. HR tech solutions are increasingly in demand.

Since recruiting and hiring are complex processes, there are various types of recruiting technologies on the market. Let’s take a look at some problems that different types of recruitment software solve.

**Finding candidates**

The problem of finding candidates is essential in recruiting. There are millions and millions of job seekers online. But where can recruiters find the right candidates for open positions?

**Job aggregators – places where recruiters post jobs**

Recruiters post jobs online so that candidates can find them and apply. To post jobs, recruiters use job boards and job aggregators. A job aggregator works like a search engine. It’s a piece of software that collects job postings from different job boards so job seekers can easily find jobs by keyword and location. [50% of job seekers today](http://www.jobboarddoctor.com//wp-content/RsrchD/Final-Survey-Results-2016-Global-Job-Seeker-Survey.pdf) use job aggregators. That’s why job aggregators are a significant part of the recruiting ecosystem.

No doubt the number one job aggregator is Indeed. It delivers more hires than any other site. More than 200 million people search for jobs each month on Indeed. What makes this platform so popular?

Indeed is international. It had great success in the US and later launched in other countries. Now it’s present in more than 50 countries and 28 languages. To customize their platform, Indeed worked with professionals who understand the local markets and needs of each specific country. It took a lot of effort to make job searching global. And of course, it wasn’t launched in 50 countries at once. Step by step, Indeed grew into markets outside of the US. In 2014, they stated that 58% of unique visitors to the platform were from outside the US.

Indeed works on different platforms: there are desktop, mobile, and tablet versions of the app. Multi-platform availability is essential for a recruitment platform, as statistics show that over 65% of job searches are done on mobile devices.
Laravel Auth | Laravel 7 Authentication Example
Tags: laravel, laravel7, auth
Published: 2020-03-19 06:01:12

Hey Artisan 

Do you know how to make authentication in Laravel 7 ? If you don't know then you are a right place. I will help you to create auth using laravel ui package in Laravel 7. In this tutorial i will show you simple authentication in laravel 7.

https://www.codechief.org/article/laravel-auth-example-laravel-7-authentication-example
Django Development Company
Published: 2020-03-19 05:49:28


Django is the one of the generally utilized python web system that is utilized to build web application with less coding included. Get your thoughts transform into reality with the assistance of Ameotech Informatics - well-know Django Development Company. Hire python django developers from us who have many years of experience with making most powerful web applications.
https://www.ameotech.com/service/django-web-development
I don't like React Hooks
Tags: react, lifecycle, hooks, class
Published: 2020-03-19 05:21:00

---
title: I don't like React Hooks
published: true
description: Hooks are not intuitive, whereas Classes lifecycle is. So I will still use classes whenever I can.
tags: React, lifecycle, hooks, class
---

Let's go strait to the point : I don't like Hooks because they are not intuitive to me. 

Classes are *so* intuitive that I love them.

```
class App extends React.Component {
  state = {  }
  componentDidMount() {}
  componentDidUpdate(prevProps, prevState) {}
  componentWillUnmount()
  render(){
    return()
  }
}
```

It's almost if there is a README to understand what's going on there.
I became a developer at 30, two and a half years ago, and I started directly by learning [#JavaScript30 by Wes Bos](https://javascript30.com), then [React for Beginners](https://reactforbeginners.com). I knew nothing about programming : classes, whatever... but React was so straightforward to embrace that it was a pleasure.

I can't say the same with hooks.

```
const App = () => {
  const [someState, setSomeState] = useState(initState)
  useEffect(() => {
    return () => {}
  }, [])
}
```

OK, much less code I have to admit.
`useState` is easy to get, I also have to admit. For a simple functional component which needs a state, this is great. But for more complex component, actually I would say as soon as an equivalent of `componentDidMount` is needed, I much prefer classes.

After two projects and two months full time on hooks, I am still not confident how to clear a timeout, how to use an effect only on mount. I start to be confident on fetching async data in an effect, but that's it. OK, refs are quite straight forward, I also have no problem with them.
But what about the `useCallback` ? Sometimes, quite often, but not always, when I call a callback in my effect, I am forced by my linter to use `useCallback`, and I couldn't tell you why some times yes and why some other times no. Maybe I need a few more weeks to be fluent in Hooks, but as I don't like them it might be more...

I am working for the first time with a friend, on a hooks project for the last two months. My friend is chasing the code lines, to reduce them at max, and he is also chasing code readability. He is quite an experienced programmer, so I learn quite some stuff from him. He doesn't like redux, so I had to think without it, it was great. And he loves hooks, so I had to deal with them, no choice.

And I'll remember two philosophical principles out of my bad experience with Hooks :

- if a piece of code with less lines is less understandable than a piece of code with more lines, use it with more lines
- a good API is an API where the README is as small as possible, and the number of times the need of going back to the README is as little as possible.

Sorry Dan, but from now on, I'll keep hooks for stateful simple functional components, like forms. But whenever I can, I will use classes.
Phalcon Framework Php Htaccess for Apache and CORS Blocked
Tags: php, phalcon
Published: 2020-03-19 05:10:52

.Htaccess file on phalcon index folder :
  
  <IfModule mod_rewrite.c>
	RewriteEngine on
	RewriteCond %{HTTP:Authorization} ^(.*)
	RewriteCond %{HTTP:Authorization} ^(.)   
	RewriteCond %{HTTP:Authorization} ^(.*)$ 
    RewriteRule .* - [e=HTTP_AUTHORIZATION:{HTTP:Authorization}] 
    RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule  ^$ public/    [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
	RewriteRule  (.*) public/$1 [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
</IfModule>



.Htaccess file on phalcon public folder :

AddDefaultCharset UTF-8
<FilesMatch "\.(ttf|otf|eot|woff|woff2)$">
    <IfModule mod_headers.c>
        SetEnvIf Origin "http(s)?://(www\.)?(google.com|staging.google.com|development.google.com)$" AccessControlAllowOrigin=$0
		Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
        Header merge Vary Origin
	    Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
        Header set Access-Control-Allow-Headers "Authorization, X-Requested-With, Content-Type, Origin, Accept, client-security-token"
        Header set Access-Control-Expose-Headers "Content-Security-Policy, Location"
		Header set Access-Control-Allow-Credentials "true"
    </IfModule>
</FilesMatch>
<IfModule mod_rewrite.c>
	SetEnvIf Origin "http(s)?://(www\.)?(google.com|staging.google.com|development.google.com)$" AccessControlAllowOrigin=$0
	Header set Access-Control-Allow-Origin %{AccessControlAllowOrigin}e env=AccessControlAllowOrigin
    Header merge Vary Origin
	Header set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
    Header set Access-Control-Allow-Headers "Authorization, X-Requested-With, Content-Type, Origin, Accept, client-security-token"
    Header set Access-Control-Expose-Headers "Content-Security-Policy, Location"
	Header set Access-Control-Allow-Credentials "true"
	
	
	RewriteEngine on
	RewriteCond %{HTTP:Authorization} ^(.*)
	RewriteCond %{HTTP:Authorization} ^(.)   
	RewriteCond %{HTTP:Authorization} ^(.*)$ 
    RewriteRule .* - [e=HTTP_AUTHORIZATION:{HTTP:Authorization}] 
    RewriteRule ^index\.php$ - [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
    RewriteCond %{REQUEST_FILENAME} !-f
	RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
    RewriteRule ^(.*)$ index.php?_url=/$1 [E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L]
</IfModule>
Video: .NET Unit Testing Libraries
Tags: dotnet, csharp, testing, techtalks
Published: 2020-03-19 05:08:12

---
title: Video: .NET Unit Testing Libraries
published: true
date: 2020-03-19 05:04:18 UTC
tags: dotnet, csharp, testing, techtalks
series: .NET Fundamentals
cover_image: https://i2.wp.com/killalldefects.com/wp-content/uploads/2020/03/BigBallOfMud.png?fit=768%2C323&ssl=1
canonical_url: https://killalldefects.com/2020/03/19/dotnet-unit-testing-libraries/
---

The post [Video: .NET Unit Testing Libraries](https://killalldefects.com/2020/03/19/dotnet-unit-testing-libraries/) appeared first on [Kill All Defects](https://killalldefects.com).

---

I’ve uploaded a technical talk on unit testing .NET code and some strategies and .NET unit testing libraries that can be helpful when working with C# code.

Take a look and see what you might learn.

{% youtube SxSEW4CAHn8 %}

A number of the articles on this site are related to content in this video, most notably content on [Scientist .NET](https://killalldefects.com/2019/12/08/experimental-csharp-with-scientist-dotnet/).

If you’d like me to write more on a specific topic mentioned here (or one not covered in this talk), let me know!
JTBD is a lie
Tags: jtbd, marketing, development
Published: 2020-03-19 04:58:44

Many people think that all persons want to develop themself, or improve the world around, and therefore they need tools, and we sell these tools. It’s like a JTBD-centered view of the world.

IMHO, just as many need to be left alone. So you can calmly poke into YouTube, having fun and killing time. Or so you can curl up on the couch and sleep, sleep, sleep … There are no jobs to be done left. Or at least nothing you want to do.

Changing and developing something is unpleasant (even if life later reaches a new level), it’s better not to even try to do it, if there is an opportunity to stay passive.

And there is an opportunity. This is completely normal. Therefore, there are a huge number of TV programs, YouTube streams and games (consisting of one or two buttons with a choice like “ok or ok?”). This is completely normal and good.

A computer game, movie, or any other activity is not required to guide someone from point A to point B in order to be good. It’s enough that some positive emotions would come from them, or at least that they could kill time.
Firebase Function current user update Phone Number
Tags: firebase, serverless, node
Published: 2020-03-19 04:54:26

Firebase Function current user update Phone Number

AngularFireAuth update profile of the current user does not support phone number that why we need to firebase callable function for an update phone number after the update you log in from that number as well 

<h2> 1. Setup function for update phoneNumber </h2>

<pre>firebase init functions</pre>

   Now, in index.ts file import function and admin
<pre> 
import * as functions from 'firebase-functions';
import * as admin from 'firebase-admin';
const serviceAccount = require('../serviceAccountKey.json');

admin.initializeApp({
    credential: admin.credential.cert(serviceAccount),
    databaseURL: "your-database-url"
});
 </pre>

   Now, function for update user phoneNumber
<pre> export const updateUserPhoneNumber = functions.https.onCall(
    async (request, context) => {
      try {
        const userUpdate = await admin.auth().updateUser(request.uid, {
          phoneNumber: request.phoneNumber
        });
        return userUpdate;
      } catch (e) {
        return e;
      }
    }
  );
 </pre>

  The function is ready to deploy
<pre> firebase deploy --only functions </pre>

<h2> 2. Call Function from Ionic v5 </h2>

 You Need to import firebase function module in app.module.ts
<pre> import { AngularFireFunctionsModule } from '@angular/fire/functions';
 imports: [AngularFireFunctionsModule] </pre>
  
   In your page inject dependency in the constructor

<pre> import { AngularFireFunctions } from '@angular/fire/functions';
 constructor(private functions: AngularFireFunctions) </pre>

  Now callable function call 

<pre>const callable = this.functions.httpsCallable('updateUserPhoneNumber');
const obs = callable({ uid: user uid, phoneNumber:  user phone number});
          obs.subscribe(async res => {
            firebase.auth().currentUser.reload(); 
            firebase.auth().currentUser.getIdToken(true);}); 
// after update the user's phone number token refresh to contain the update phone number
</pre>

  That's it now arrange all things according to your requirement

 <h3> Source code </h3>https://github.com/badalpatel6534/firebase-function-update-user-phone-number
My first 7 days in the 100 Days of Code challenge
Tags: 100daysofcode, react
Published: 2020-03-19 04:44:38

I had a bit of a rocky start with the challenge but with everything that's going on and life in general, yeah.  XD  

I'm working on a React app that I started in Lambda School, called Better Professor.  It's a mentoring app that helps mentors keep track of their students and the projects they're helping with.  I'd already done the reminders portion before.  Now, I've finished up the student portion for the most part and will be moving onto the projects.  

The app still needs a ton of work but I have a hundred days to get it looking good and working well. :D