teleren/devto huggingface dataset:
Object preventExtension vs seal vs freeze
Tags: javascript, preventextensions, seal, freeze
Published: 2019-10-11 15:02:28

---
title: Object preventExtension vs seal vs freeze
published: true
description: Comparations between the new Javascript Object protection methods
tags: javascript, prevent-extensions, seal, freeze
---

ECMAScript 5 introduced new `Object` methods to Javascript. Among them `preventExtensions`, `seal`, `freeze` methods will be compared to each other.

## `preventExtensions`

An object called by this method can't have _any new properties_ being added.

#### Example

```javascript
let person = {
  name: "Agustin",
  age: 27,
};
Object.preventExtensions(person);
Object.isExtensible(person); // return false
person.surname = "Ramirez";
console.log(person.surname); // return undefined
person.name = "Maria";
console.log(person); // return { name: "Maria", age: 27 }
delete person.age;
console.log(person); // return { name: "Maria" }
```

## `seal`

An object called by this method can not have _any new properties_ being added or _current properties deleted_.

#### Example

```javascript
let person = {
  name: "Agustin",
  age: 27,
};
Object.seal(person);
Object.isSealed(person); // return true
// In strict mode this will throw a `TypeError`
person.foo = "something";
console.log(person.foo); // return undefined
person.name = "Maria";
console.log(person); // return { name: "Maria", age: 27 }
delete person.age;
console.log(person); // return { name: "Maria", age: 27 }
Object.defineProperty(person, "name", {
  get: () => "Juan",
}); // Throw TypeError
console.log(person); // return { name: "Maria", age: 27 }
```

## `freeze`

An object called by this method can not have _any further changes_ done to it.

#### Example

```javascript
let person = {
  name: "Agustin",
  age: 27,
};
Object.freeze(person);
Object.isFrozen(person); // return true
person.name = "Maria";
console.log(person); // return { name: "Agustin", age: 27 }
```

### shallow only

All of these methods only work on object properties _shallowly_, meaning that just work with the direct property references.

```javascript
let person = {
  name: "Agustin", // Prevented, Sealed and Frozen
  age: 27, // Prevented, Sealed and Frozen
  address: {
    // Un-prevented, un-sealed and un-frozen
    country: "Argentina", // Un-prevented, un-sealed and un-frozen
    city: "Corrientes", // Un-prevented, un-sealed and un-frozen
  },
};
```

## Feature matrix

| Feature                             | default | preventExtensions | seal | freeze |
| ----------------------------------- | :-----: | :---------------: | :--: | :----: |
| **add** new properties              |    ✓    |                   |      |        |
| **remove** existing properties      |    ✓    |         ✓         |      |        |
| **change** existing property values |    ✓    |         ✓         |  ✓   |        |

Link: [Today I Learned | Cybertec](https://til.cybertec-postgresql.com/post/2019-10-11-Object-preventExtension-vs-seal-vs-freeze/)
Mixing Kotlin and Java in a single module of a multi-module Maven or Gradle project
Tags: kotlin, discuss, java
Published: 2019-10-11 14:56:39

Hi,

does anyone have a multi module Maven or Gradle project in production? Basically I'm considering moving [SirixDB](https://sirix.io) to Kotlin and to write new classes in Kotlin.

However, I'm not sure. I've used Java from Kotlin but not the other way around. So, would you recommend adding Kotlin to the core module for instance or are there any pitfalls? I think Kotlin is just like a modern Java and I'm a bit resistent to write Java code in my spare time, now that I worked a bit with Kotlin ;-)

Kind regards
Johannes
Fun little easter egg I discoved on dev.to 😂
Tags: hacktoberfest
Published: 2019-10-11 14:52:07

Did you know that if you type [dev.to/💸](https://dev.to/💸) in the url bar you will see all the companies that are hiring on the platform?

I saw this line in [config.rb](https://github.com/thepracticaldev/dev.to/blob/master/config/routes.rb)

```ruby
get "/💸", to: redirect("t/hiring")
```

I like it when apps sprinkle easter eggs like these, and I think it's pretty neat.

---
Cheers 🥂
[@kudapara](https://twitter.com/kudapara)
Xamarin 101: Part 7 - Wrapping Up
Tags: xamarin, tutorial, beginners, mobile
Published: 2019-10-11 14:32:30

---
title: Xamarin 101: Part 7 - Wrapping Up
published: true
description: You made it - you got a fundamental understanding of Xamarin - sum it up with this video.
tags: xamarin, tutorial, beginners, mobile
series: xamarin101
---

# Xamarin 101: Part 7 - Summary

You made it! You now have a fundamental understanding of Xamarin, Xamarin.Forms, how XAML makes a UI, and a bit about MVVM and navigation between pages.

You should now be ready to take the next steps into your mobile app development journey!

{% youtube OgUrTaugxsw %}

## Learn More

* [There's a ton of self-paced courses to learn Xamarin from Microsoft Learn](https://docs.microsoft.com/learn/browse/?term=xamarin&WT.mc_id=xamarin101-c9-masoucou)
* [And don't forget Microsoft's best in class documentation](https://docs.microsoft.com/xamarin?WT.mc_id=xamarin101-c9-masoucou)
* [Plus a monthly Xamarin Developer's Podcast](https://www.xamarinpodcast.com/)

Happy mobile coding! And as always, if you have any questions - please ping me on Twitter at [@codemillmatt](https://twitter.com/codemillmatt).
About Steven Odzer
Tags: stevenodzer, aboutme, ceo, newyork
Published: 2019-10-11 14:21:26

Steven Odzer went to Yeshiva of Flatbush High School and then to the Brooklyn College Scholars Program. Steven Odzer started his first company at the age of 18 out of his parents' basement. Steven Odzer was named the Ernst and Young Entrepreneur of the Year in 2000 in the area of distribution.  Steven Odzer has been in the distribution business for over 30 years.
What was your worst decision ever as a Junior Developer?
Tags: beginners, discuss, career
Published: 2019-10-11 14:19:52

When I was in college, I took 3 courses in Data Structures and Algorithms. I scored well, but didn't quite realise it's importance at that time. When I started interviewing, I got a fair amount of interviews and job offers - which further made me believe that Data Structures and Algorithms aren't probably more important than my skills. So I filled myself up to the brim with different sorts of skills and ignored it for a significant amount of time. 

A bit more than one and a half years down the line, everyday I realise what a terrible mistake I made. I struggle in coming up with smarter and efficient solutions to real world problems. It's as if I can walk but something is grabbing onto my legs if I try to run. _Programmers Paradox_ is a real thing, but I am not satisfied even a bit of myself. Tried taking a few courses online, but it didn't work out that well. I also tried to solve problems on HackerEarth and LeetCode, but it seems I have totally forgotten how to even *think in a certain way to solve a problem*. Tried praying and throwing salt over my shoulders as well but oh well, didn't quite work out. I wish I didn't avoid it back then. But, I am hoping to improve everyday.

It would be great if you can drop your favourite list of books to learn DS and Algorithms. Language doesn't matter as long as it isn't Java. (Sorry, I am a Python guy and err.. you know) 

I would love to hear you rant about your worst decisions as a Junior Developer as well!
JavaScript typeof operator
Tags: javascript, webdev, beginners, tutorial
Published: 2019-10-11 14:14:58

This video covers what built-in types exist in JavaScript and how to perform type checking on those data types.

Get the code samples at https://gist.github.com/SuperBonsaii/...


**********Watch all JavaScript Tutorials**********

http://bit.ly/javascript-youtube

***************************************************
Deeksha on Twitter: https://twitter.com/deekshasharma25

Subscribe for more videos on JavaScript with Visualization: https://www.youtube.com/channel/UC0yZ...
Follow bonsaiilabs on Twitter: https://twitter.com/bonsaiilabs
Follow bonsaiilabs on Facebook: https://www.facebook.com/thebonsaiilabs
Visit bonsaiilabs at https://bonsaiilabs.com
DevOps/SRE Fulltime Dortmund, Germany
Tags: hiring
Published: 2019-10-11 14:09:36

## About Us

Hey! We're a nice little team devoted to consult and support our mostly e-commerce-focused developer teams with DevOps-related hot stuff like automation, containerization, orchestration and cloud technologies.

## About The Opportunity

We're searching for a new team member, that has either an ops background and dev interest or vice versa. It's a permanent, full time job offer located in Dortmund, Germany with partial home office possibilities.

We know that we probably can't find someone, who has all skills denoted below, but if you're open and interested in learning new things, you might as well fit in. 

## Skill & Qualifications

German and English language skills are required.

For the rest, please check out the official job offer [on our website](https://kps.com/de/jobs/support-services/system-administrator-focus-automation-devops.html).

## How To Apply

First, check out the official job offer [on our website](https://kps.com/de/jobs/support-services/system-administrator-focus-automation-devops.html) and then apply online right there.

_Please feel free to leave questions in the comments section._
HOW I DEMONSTRATED GROWTH MINDSET RECENTLY
Published: 2019-10-11 14:05:24

first of all growth mindset is when I understand that my abilities can be developed,I can start here by saying that people with growth mindset also show 7 habits of highly effective people.people with growth mindset see failure as opportunity and blockers as a fresh beginning of learning and long term success.
spirit which drive growth mindset people is they believe that path with no obstacles it does not lead anywhere,so on my side I have started studying IS thinking that I will not succeed in programming by thinking that its only for boys.



as I proceed with that fixed mindset until I learned a course called emotional intelligence after that i realized that I can develop my mindset from fixed to growth mindset,I learned that i don't have to fail trying today i may fail on that thing but after tomorrow I shall win.that was my beginning of developing growth mindset.having growth mindset does not mean you never fail in life , the reality is that you fail but never give up , you keep engaging yourself in learning until you won.


I joined Andela by  thinking that I am not going to rest , i was having spirit of developing my learning skills so that i should be able to face any challenge i met with, along the way i found that having courage in doing things you are not passionate about its really require much attention and also require hard working 
personally i felt that i wish to be a future software engineer in the future , currently I m not yet reached to my dream job because I saw that I am steel having a lot to learn. i cannot be discouraged because I know what i want i have to keep up a good work until I will reach to my future career.
How do you build momentum?
Tags: startup, bootstrapping, indiehacking
Published: 2019-10-11 14:00:43

---
title: How do you build momentum?
published: true
description: 
tags: startups, bootstrapping, indie hacking
---

Some people refer to the <a href="https://www.youtube.com/watch?v=bi7yB7wH3to">slight edge</a> - the little decisions that we make is all that matters as every action that is made is compounded over time.

Others often are familiar with the snowball effect - start small and build upon what you have.

More recently, on <a href="https://www.indiehackers.com/podcast/112-tommy-griffith-of-clickminded">an Indie Hackers podcast</a> (about 30 minutes in), I heard the term exit velocity - which is how much professional and entrepreneurial momentum you have when starting you new project or business. Typically when you are new to the world of business it is hard to gain any kind of traction as you most likely haven't had the chance to build up your contacts, relationships, knowledge, experience, capital, investment and so forth.

The slight edge, snowball effect and exit velocity are all important mental models to bear in mind when building your business. The more I see and learn how others are building successful business, the more I see these models have been crucial to their success.

Indie hackers newer to the game can quite easily miss this. They will look in from the outside, believe that they understand why said person has succeeded, but really the underlying factors are down to a million little things that have most likely happened over at least a <a href="https://rosie.land/the-1000-day-rule">1000 days</a>.
Javascript functions
Tags: javascript
Published: 2019-10-11 13:27:09

---
title: Javascript functions
published: true
description: Function declaration
tags: javascript
---

Javascript provides a few ways to define functions.

The way a function is defined influences when the function is available to be invoked and how it behaves as well as on which objects the function can be invoked.

## Function declarations

Function declarations must be placed on their own as a separate statement.
It start with the function keyword, followed by the function name and a list of optional arguments, enclosed in parenthesis.

Following the argument list, are brackets that enclose the function body.

```
function myFunction(a, b) {
  return a + b;
}
```

Function declarations can be nested inside another function, like this example:

```
function enclosingFunction() {   
                                 
  function inside() {            
    return "Hello world";        
  }                              
    
  return inside();
}                                
                                 
console.log(enclosingFunction()); // Hello world
```

Another common way to declare functions is using a function expression.

We are going to look at function expressions in detail in the next post.
Overcomming obstacles in the tech world:
Tags: overcome
Published: 2019-10-11 13:22:10





This week in class we were given the assignment of connecting our local git to GitHub on the internet via an SSH connection.  For someone who only figured out the difference between git and GitHub this week, it was a daunting task.  

Your ability to overcome obstacles is only as good as the tools you have on hand.  Thats why so many different people come up with a variety of solutions to the same problem in the tech world.  Its based on your personal experience, your ability to google/ask others, and perhaps most of all, your ability to ask the right questions.

I started out trying to work the problem until I came up against a command line I couldn’t get past.  Enter Google.  I pasted the failure message from the command line into google, and I researched SSH... nothing was working.  Others in class working the same problem started collaborating, and I began calling on my people, asking in the local tech community slack channel.  Several people piped in, for which I was grateful, but I wasn’t making progress even after studying their posted links.  I was trying to ask about something specific, but I wasn’t getting the right answers...  I must not be asking the right questions, but the exposure I got through studying their materials is what allowed me to recognize the right answer when an assistant teacher was helping me look at several things in my  computer!!  Okay,  I had the key I wanted... but still not the understanding of how to use it.  Another instructor posted a YouTube video which was finally the step by step help I needed to overcome the hold up I was experiencing in the command line.

I was able to continue with the assignment.  A few more speed bumps but nothing to stop me!  It was exhilarating spending hours trying to solve this puzzle.  The main thing that strikes me as I interact with others in the tech community is a certain air of engagement, and interest in their personalities.  I feel nearly certain that this comes from the nature of the job which involves a constant need to learn and overcome obstacles.
Does It Make Sense To Prefer A Text Editor?
Tags: emacs, vim, texteditor
Published: 2019-10-11 13:21:09

I've always had a preference for using a text editor like Emacs or Vim rather than a program like MS Word or Evernote. I'm not the only one; millions of others use text editors by choice and complain when it's not an option.

This confuses a lot of people. They just cannot wrap their minds around the idea that someone would prefer a primitive text editor over a fully evolved GUI program like MS Word. Someone even asked me once, with a disgusted/shocked look on his face, "Why would anyone use that?"

I have an answer to that question [on my website](https://lancebachmeier.com/tools/text-editors-why.html):

The vast majority of people do not use text editors like Emacs. They'll use MS Word, Google Docs, and the like. In contrast, I try to avoid those apps as much as possible. I'd much rather use Emacs in the terminal. This is not because, as many people might assume, I'm old and don't understand how to use technology. Over time my workflow has evolved in the direction that provides the greatest productivity, and for me that has been away from Google Docs and toward text editors. There are two reasons a text editor in a terminal makes me more productive. (I make no claim that this applies to others; you should use what works for you. This works for me.)

**Text editors are designed to support a full workflow without a mouse.** This is one that I never understood until I was trying to understand why I was so much more productive when I avoided using the mouse. Text editors allow you to do everything with the keyboard. A mouse distracts you every time you use it. No matter what you do, the mouse will be in a different position the next time you use it, the cursor will be in a different position on the screen, and you will be doing different things. You can never automate the use of a mouse no matter how many times you use it. You have to think about it every single time, every time you save the document, select text, or scroll to the start of the document. The keyboard never changes. You quickly adjust to the keyboard shortcuts associated with a task, and you can do it without thinking about it. I'm able to think much more clearly when I'm typing in a non-GUI text editor because I'm not subject to the constant distraction I'd have if using a mouse. Many writers have moved to markdown, and I think that's because you don't have to leave the keyboard to write a fully-formatted document.

**Text editors make it easier to focus.** A text editor is a minimalist app. You don't worry about formatting. You just write. There's no way to procrastinate when you're looking at a terminal with no formatting options other than what you put into the text. *The content is all you have.* You get it right if you can't make up for weak content by making your document look nice.

This doesn't say anything about the ability to customize the heck out of your text editor to do everything you want it to do. I haven't mentioned that because text editors vary in their support for customization.
Where to start with Git?
Tags: git
Published: 2019-10-11 13:17:59

---
title:Where to start with Git?
published: true
description: 
tags: git, 
---

I don't know much about git and I want to learn more. Over the past 4.5 years,  I have used Mercurial for all development projects, using the TortoiseHg Workbench tool. Please help me out here!
1. Where should I start for learning about git, with coming from a mercurial background?
2. What GUI tool/tools for git resemble TortoiseHg Workbench?
Make react svg component draggable
Tags: svg, react, d3, d3drag
Published: 2019-10-11 13:11:23

---
title: Make react svg component draggable
published: true
tags: svg, react, d3, d3-drag
---

# Create a Rect component

{% codepen https://codepen.io/nctaowen/pen/VwwvgdB %}

It does nothing special. Just a dummy wrapper of `<rect>`

# Add d3-drag

{% codepen https://codepen.io/nctaowen/pen/abbvXaV %}

We use ReactDOM to find out the dom node. And use d3-drag to respond to mouse enter and mouse move. Although svg does not have drag drop event, d3-drag simulated it by intercepting window wide mouse events. 

Setting x y attribute works. However, dragging will cause the rect "jump" to the position of mouse cursor. We would want it to stay there.

# Make dragging starts without "jump"

{% codepen https://codepen.io/nctaowen/pen/LYYpqKJ %}

The trick is to set the `subject` to have x y properties from the target rect. The relative position will be kept

# How about circle?

{% codepen https://codepen.io/nctaowen/pen/OJJyqby %}

For circle, we need to change x to cx, y to cy. And it seems working. The relative position is still kept. 

We noticed the code is nearly the same as Rect. Can we make it generic?

# Support both circle and rect

{% codepen https://codepen.io/nctaowen/pen/jOObJwm %}

Just like change from rect to circle, we changed from x to cx, y to cy. This time, we use `translate(x, y)` to set the x y coordinate transformation. This `transform` attribute is supported by both rect and circle, so we only need to make one makeDraggable.

# How about group?

{% codepen https://codepen.io/nctaowen/pen/zYYvbyy %}

It also works on `<g>`. However, we have to make the individual rect and circle undraggable, otherwise the dragged element will be rect or circle instead of the group.