teleren/devto huggingface dataset:
Using SwiftUI in an existing code base
Tags: swift, design
Published: 2019-07-01 06:29:25

originally posted on [peterwitham.com](https://peterwitham.com)

SwiftUI might be the new kid in town when it comes to layout frameworks on Apple platforms. But, that does not mean you need to jump all in right away. You can use the new views in your existing Objective-C and Swift code bases, or vice-versa, add your old views to a new SwiftUI based application.

This enables developers to start using the new technology without having to commit to a complete rebuild/rewrite of the code base. This is an important point, rarely are companies or teams ever in a position to just start over without a large commitment of time or hiring another team to work alongside the existing team. The reason is simple, current production applications still have to be worked on and maintained.

If you are an independent developer then you certainly have a better opportunity to just switch, but this will often cause expected issues.

The ability to use SwiftUI alongside existing code bases is due to something called a _HostingController_, think of it as a way to contain your views in your application.

If you create a new application using SwiftUI in Xcode 11, you can see the HostingController in action. Just take a look in the _SceneDelegate_.

To utilize the HostingController you need to provide it just one argument, the name of the view you want to display. For example,

```swift
UIHostingController(rootView: ContentView())
```

Each of Apple’s platforms has its own version of the controller.

macOS uses _NSHostingController_ 
iOS uses _UIHostingController_
watchOS uses _WKHostingController_

It is worth noting that on watchOS you have to subclass _WKHostingController_.

If you want to do the reverse and host existing views in a SwiftUI based application then you take advantage of another new technology which is the _Representable Protocol_. Again, there is a different way on each platform but it is minor.

macOS uses _NSViewRepresentable_
iOS uses _UIViewRepresentable_
watchOS uses _WKInterfaceObject_

You are not limited to views, you can also use existing ViewControllers by using _UIViewControllerRepresentable_ or _NSViewControllerRepresentable_.

Interestingly, this is not limited to Swift, if you have an Objective-C code base you can integrate them by wrapping the HostingController in Swift using the _@objc_.

## The Wrap
So get to it, there is very little reason to not at least take a look at the new SwiftUI and see if it might be an option for you going forward.
Apart from Dev, Code and other technical stuff whats your hobby?
Tags: discuss
Published: 2019-07-01 05:53:10

Every developer has some personal things he/she loves to do in his/her leisure time. For example, I love to write poems and stuff. I created a website too for others feeling the same. Its called [Penit.ink](https://penit.ink). You can find all my writings [here](https://penit.ink/faiz)

Sometimes I also love watching TV series. Till now I have watched like 38 of them. You can find the [list here](https://codebysamgan.com/tv-series-i-watched). Any recommendations are more than welcome.

## What do you do?
Find iPhone, iPod touch or iPad’s Unique ID (UDID) for iOS Development
Tags: reactnative, android, ios, javascript
Published: 2019-07-01 05:00:10

---
title: Find iPhone, iPod touch or iPad’s Unique ID (UDID) for iOS Development
published: true
description: Find iPhone, iPod touch or iPad’s Unique ID (UDID) for iOS Development
tags: #reactnative #android #ios #js
---

Source : <a href="https://www.skptricks.com/2019/07/find-iphone-ipod-touch-or-ipads-unique-id-or-udid.html" >Find iPhone, iPod touch or iPad’s Unique ID (UDID) for iOS Development </a>

This tutorial explains how to find iPhone, iPod touch or iPad’s Unique ID (UDID) for iOS Development. Every iPhone, iPod touch and iPad has a unique identifier number associated with it, known as a UDID (Unique Device ID). Your UDID is a 40-digit sequence of letters and numbers that looks like this: 0e83ff56a12a9cf0c7290cbb08ab6752181fb54b. It’s common for developers to ask for your UDID as they require it to give you beta copies of iOS apps.

<img src="https://1.bp.blogspot.com/-hyeBWknoAJA/XRmM4b_KL2I/AAAAAAAADDE/ez9m1br3GO8kVsNUBhpn6HH0ANdQ_EPcQCLcBGAs/s400/find-iphone-ipod-touch-or-ipads-unique-id-or-udid.jpg" />

<a href="https://www.skptricks.com/2019/07/find-iphone-ipod-touch-or-ipads-unique-id-or-udid.html" >Click here to read more... </a>
React Native Generate Release APK through Windows Command Prompt Android
Tags: reactnative, android, ios, javascript
Published: 2019-07-01 04:58:41

---
title: React Native Generate Release APK through Windows Command Prompt Android
published: true
description: React Native Generate Release APK through Windows Command Prompt Android
tags: #reactnative #android #ios #js
---

Source : <a href="https://www.skptricks.com/2019/06/react-native-generate-release-apk-file.html" > React Native Generate Release APK through Windows Command Prompt Android</a>

This tutorial explains how to generate release APK file through window command prompt in react native application. Full form of APK is Android Package Kit. The APK file is a generated package file containing all the important files which is recommended to run android app on android mobile device. By default when we create react native project app and install that app on our device – Emulator then the app install as Debug Mode. But we cannot get the Signed Release Android APK and without the original APK file we cannot upload this file on Google Play Store.

<img src="https://1.bp.blogspot.com/-QD2NqQzjjuU/XRjNHFzD8oI/AAAAAAAADCs/M66YCeCxDUYJc79JvZEu8Iags8TwE6bPACLcBGAs/s400/11.jpg" />


If you want to submit your app on Google Play Store or want to run your final app on other android devices or want to generate release APK or run your app without development server on all android devices then your app must be digitally signed with a certificate. There is also a problem that all the react native beginners is facing that the Un-Signed APK cannot run without the JS server. So using the Singed APK we can run our react native android app to any android mobile device without running the JS Server and upload .APK file to Google Play Store. So in this tutorial we would going to Generate signed release android APK that run without JS Server in React Native in Windows PC using Key Store and lets follow the below steps one by one :

Summary in short : 
First of all, we have to generate a Signing key through command prompt.
Note: The command prompt must be run with administrator permission.
Place generated Signing key in android/app  ( under your React native project ) folder.
Make required entries in android/gradle.properties  file and android/app/build.gradle  file.
Run this command to switch directory to android.
Command to use : 
cd android
Then run the below command to generate signed version of APK file.
Command to use :  
 gradlew assembleRelease 

<a href="https://www.skptricks.com/2019/06/react-native-generate-release-apk-file.html" > Click here to read more...</a>
zsh / oh-my-zsh up and running
Tags: zsh, ohmyzsh
Published: 2019-07-01 04:45:10

While bash still powers most the *nix system, zsh offer better developer experience in dealing with terminal TUI.

Recently macOS announced that is moving from bash to zsh, and as consequence so many developers will have to re-learn a bit of what they do with bash to have better experience dealing with TERMINAL commands in mac.

As I have been using ZSH for more than 6 years now, I wanted to share an easy and fast way to start with ZSH that gets you great developer experience on your mac or linux.

[*Download and use iTerm2*](https://www.iterm2.com/)

The setup below gets you: 
- `zsh`
- `oh-my-zsh`
- `antigen` package manager
- config file with:
    - zsh-completion
    - autojump `j`
    - history `h`
    - zsh-autosuggestions
    - fast-syntax-highlighting
    - zsh-history-substring-search
    - and so many more with adding plugin as simple as editing 1 line in the config file!


**To get started:**

```bash
# install the dependencies with mac brew
brew install zsh antigen zsh-completions
```
Then copy - modify as you need - and paste this [gist file](https://gist.github.com/meabed/eb04ba3576e1ce93c80f4144a7884677) in your home as .zshrc "~/.zshrc"


{% gist https://gist.github.com/meabed/eb04ba3576e1ce93c80f4144a7884677 %}


Below is a screen that shows some of the great oh-my-zsh feature - history completion, syntax highlight, menu-auto-completion, jump etc...

![ZSH](https://meabed.com/content/images/2019/07/image-1.png)

If you love working with terminal and you looking for great DX, you definitely use iterm2, zsh, oh-my-zsh with this plugins above.

Need help in installing / configuring zsh plugins - Feel free to reach out :)
Blog post series on Vue.js
Tags: beginners, vue, javascript, frontend
Published: 2019-07-01 04:38:21

---
title: Blog post series on Vue.js
published: true
description: 
tags: #beginners #vue #javascript #frontend
---
We are writing a series of post to help people starting with vue.js to understand it from inside out. 

Checkout out part 1 on Getting Started with vue.js - https://overflowjs.com/posts/Vuejs-Getting-Started-2019-Part-1


Check out part 2 on Understanding structuring and creating a simple authentication (Register/Login/Logout/Dashboard) - https://overflowjs.com/posts/Vuejs-Structuring-and-Authentication-In-2019-Part-2

Thanks!
How do you find a missing number in a given integer array of 1 to 100 without using Loop
Tags: array, c
Published: 2019-11-13 17:20:53

---
title: How do you find a missing number in a given integer array of 1 to 100 without using Loop
published: true
date: 2019-07-01 04:16:00 UTC
tags: Array,C#
canonical_url: https://logeshpalani.blogspot.com/2019/07/how-do-you-find-missing-number-in-given.html
---

Let do simple C# Stuff  
  
  
<script src="https://gist.github.com/logeshpalani98/d4015f8b7db2bbef67ebb30782d36098.js"></script>  
Input: Given Array  
           1, 46, 34, 23, 26  

| |
|
| |

Output:  

[![](https://1.bp.blogspot.com/-TedaRQCMhkc/XRmEiQMrR3I/AAAAAAAAOXI/wpnJnip8lpErLDN8WBKFrfcERUwI6iSMQCEwYBhgL/s640/Screen%2BShot%2B2019-07-01%2Bat%2B9.20.59%2BAM.png)](https://1.bp.blogspot.com/-TedaRQCMhkc/XRmEiQMrR3I/AAAAAAAAOXI/wpnJnip8lpErLDN8WBKFrfcERUwI6iSMQCEwYBhgL/s1600/Screen%2BShot%2B2019-07-01%2Bat%2B9.20.59%2BAM.png)
Prefix vs Postfix When Using Increment & Decrement Operators.
Tags: javascript, beginners, webdev
Published: 2019-07-01 03:59:34

---
title: Prefix vs Postfix When Using Increment & Decrement Operators.
published: true
description: An overview on the intricacies of prefixing vs postfixing the increment and decrement operators on an operand.
tags: javascript, beginners, webdev
cover_image: https://images.unsplash.com/photo-1514880448122-7e417213b996?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1000&h=420&q=60
---
_Cover photo: [@markusspiske](https://unsplash.com/photos/4W5WWKaxsKs)_


Whether you've been using JavaScript for 10 days or 10 years, you've most certainly come across and have used the increment (`++`) and decrement (`--`) operators.

But were you aware that how you use these on the operand will differ when used prefixed as opposed to postfixed?

##The Difference

First, let's see what happens when we use a postfixed increment operator.

Given this statement, what would you expect the console to log?

```
let count = 0
console.log(count++)
console.log(count)
```

You may have been expecting it to log 1 for both, but this isn't the case. It will log 0 and then 1.

```
let count = 0
console.log(count++) // 0
console.log(count) // 1
```

Why? Because postfixed operators will return the value of the operand __before__ applying the operator.

Now, let's try the exact same code, but with a prefixed operator:
```
let count = 0
console.log(++count) // 1
console.log(count) // 1
```
As you can see, the operator is now first applied and then the value is returned __after__.

##Conclusion
So what's the take away here? I think really just to be aware of the intricacies of JavaScript. There's no harm in using these operators, but you should be aware of how it will affect your code. Sometimes it can even be better to go the explicit route: `count = count+1`.

Either way, I hope you learned something!

As always,
Happy Coding 🤓
Installing and using the CLI
Tags: react, javascript, node, webdev
Published: 2019-07-01 03:07:37

If you're anything like me, working in the Terminal (Command Prompt) can be a little intimidating sometimes, but boy is it super helpful when configuring all the tools you'll need before even writing the first line of your actual application code.

And now, thanks to some great React Engineers down at Facebook, we have the ever so helpful [create-react-app cli](https://github.com/facebook/create-react-app). So, let us jump into the basic installing and using of the create-react-app cli. A few things before we begin; I will be referring to the Terminal since I primarily work on Mac. We will also be working out of VS Code ([Visual Studio Code](https://code.visualstudio.com/download)) but you could use your preferred text editor.


- Open up the terminal. First, you will need to install [Node.js](https://nodejs.org/en/download/) onto your machine if you have not done so yet.

  - To check npm version - Type: **npm —version**

- Type: **sudo npm install -g install create-react-app**. The “-g” stands for global, this is to access this from anywhere on our system. Then press enter.

- To create your application Type: **create-react-app contactmanager**. “contactmanager” is the name of the application, this can be anything you would like (the name of your app). You should get a success screen like this:

![](https://thepracticaldev.s3.amazonaws.com/i/o5lcv3p3ldwe1d5m6qy3.png)

- Then navigate into the application folder “contactmanager” to navigate to your application folder - Type: **cd contactmanager**. Then to open up the files in Visual Studios - Type: **code .** (Make sure to include that period, it's code + space + period.)
  - If “code .” did not work, head into VS code and go to your command pallet and - Type: **Command+Shift+P** then - Type: **shell** and then select the one that says: **Shell Command: install ‘code’ command in PATH**

![](https://thepracticaldev.s3.amazonaws.com/i/15qcahv6nfnv8mj4j82u.png)

- Now to start the development server. - Type: **npm start**. This will open up the app in your browser. To stop the dev server - Type: **Press(control)c**.

- Type: **npm run build** to generate a build folder in your Visual Studios.

That's it! Now you're ready to start building out your React.js application. ✌️
Applied Justice in Blockchain 
Tags: blockchain, javascript, react, opensource
Published: 2019-06-30 23:50:16

# [Judge Contract](https://github.com/loaiabdalslam/Justice/)


A decentralized application of elections and opinion polls
Justice is a decentralized application aimed at holding fair elections without fraud on the visible and hearing of all.

I had had a lot of problems because I'm a principle in the field of Blockchain, especially Ethereum. Therefore, I decided to make the project opensource but on my own terms and rules to make a business deal with everyone who contribution in this project in the near future.

The whole idea is that governments are paying billions of dollars for elections and everyone is questioning their integrity as a result of the lack of independence of the judiciary in some countries and governments, so I decided to move my passion towards that point: Applied Justice on Blockchain network

From that point on, I prepared a plan to walk together:

- Preparation of electoral rooms where each room contains a number of numbers of voters (ID numbers)
- Connecting the voters' chambers to the voters and making sure they are affiliated with that room
- Use one of the front-end frameworks such as angular or react to complete the project
- Set up to start ICO for integrating the two systems together



### Installation

Justice requires [Node.js](https://nodejs.org/) v4+ to run.
 [Meta Mask](https://github.com/MetaMask/metamask-extension/releases/tag/v5.3.1)  Client Provider
  [Truffle](https://www.trufflesuite.com/) Blockchain Network

Install the dependencies and devDependencies and start the server.

```sh
$ cd Justice
$ npm install
$ truffle migrate
$ npm run dev
```
GAIA - Generic Artificial Intelligence Agent
Tags: ai, artificialintelligence, agent
Published: 2019-06-30 23:08:57

---
title: GAIA - Generic Artificial Intelligence Agent
published: true
description: Generic Artificial Intelligence For Interaction With Agents
tags: AI, artificial intelligence, Agent
canonical_url: https://github.com/victorqribeiro/gaia
---

# GAIA

Generic Artificial Intelligence Agent.  
An AI concept that can help game designers to create procedural quests.

![](https://thepracticaldev.s3.amazonaws.com/i/wkf4a1ty8c1jchasgqvz.png)
[Live version](https://victorribeiro.com/gaia)


GAIA is a concept, it aims to design a generic Agent that can be interacted with any time during the game. It uses finite state machines alongside attributes to give the Agent purpose. The player can alter this states with it's actions, turning the Agent into a enemy or a friend.


In order to be interacted with, the agent must have some attributes to be interesting.

In this example, the Agent has a **name**, a **title**, **age**, **affinity** with the player, **hit points** (HP), **hunger**, **food** and some **states**.

This attributes can be used to design quests, if the player choose to interact with the Agent, or just a ordinary dialogs.

The Agent could answer it's name, it's age, how hungry it is, how much food it have, how close it is to dying and what it's doing. 

This information be used to create a quest. For example, lets suppose that the NPC is a shop owner that has a item that the player needs. 
If the NPC is busy hunting (or cutting wood, or fishing, or anything else other the selling) it won't be able to sell the item to the player. So the player could either kill the NPC and still the item, or help the NPC, giving him what it need or completing the action that restores them to they selling state (back to the store, for instance).

This way, any NPC that the player encounters during the game could offer a somewhat interesting interaction. 

## Examples

The player needs to cross a river and asks for a NPC on a boat to take them. The NPC could be busy fishing, so the player could fish for the NPC or just give it some fish, restoring it to a state where it can cross the player to the other side.

The player encounters a NPC that is very hungry and decide to feed it. This NPC then become friends with the player and could  retribute the favor later on the game.

## Interaction

In this example the Agent has 3 states: idle, hunting and dead. If the Agent is hunting, it roams the map looking for food. When the Agent is younger than 10 or older than 50 years, it's change of huting with success drops to half.

You can help the Agent feeding it, increasing it's affinity towards you, by clicking **feed**.

You can also hurt the Agent, decreasing it's affinity towards you eventually killing it, by clicking **hurt**.

[Source code](https://github.com/victorqribeiro/gaia)
Linux by example - Creating test tooling
Tags: linux, testing
Published: 2019-06-30 23:31:34

---
title:Linux by example - Creating test tooling
published: true
description: We talk about building the test tooling we later will use to test the compiler and build systems.
tags: Linux, testing
cover_image: https://thepracticaldev.s3.amazonaws.com/i/dd512fga6qcjdvfobp86.jpg
---

{% youtube ZTPJUAacWBg %}
How I Used a Convolutional Neural Network to Classify Cricket Shots
Tags: deeplearning, technology, datascience, machinelearning
Published: 2019-07-11 14:23:41

---
title: How I Used a Convolutional Neural Network to Classify Cricket Shots
published: true
tags: deep-learning,technology,data-science,machine-learning
canonical_url: 
---

[![](https://cdn-images-1.medium.com/max/2600/0*KGV_CLuZOVfyj5XB)](https://medium.com/better-programming/how-i-used-a-convolutional-neural-network-to-classify-cricket-shots-d44197e79aff?source=rss-65edcdb268ba------2)

I have recently delved into the world of deep learning, more specifically, image classification. After completing the first lecture in the…

[Continue reading on Better Programming »](https://medium.com/better-programming/how-i-used-a-convolutional-neural-network-to-classify-cricket-shots-d44197e79aff?source=rss-65edcdb268ba------2)
What is your opinion on websites with dark themes?
Tags: discuss, design, ux, css
Published: 2019-06-30 23:21:04

For the longest time, I never liked websites, especially personal or blogging sites, that had a dark theme. They all looked terrible. Looking back I am sure they probably had way too high of contrast with white text with pitch-black backgrounds. But I can't pull them up so I don't remember details. 

All I remember for years was that dark themes were mostly terrible. Even more so for personal blogs.

Today, I feel like I could be swayed on that decision. I have been using the dark theme for DEV and I like it, despite the fact I think there could be some subtle improvements (I am not a designer so I may not be the right to ask what those would be). But with the changes in making editors dark themed, browsers, terminals, discord, and many more; I feel like dark themes could have a better chance. 

But that feeling is hard to shake.

Why do you think that dark themes are good (despite light text on dark background supposedly being easier on the eye)? Dark themes also have the problem of being harder to see in bright light, usually on phones/tablets when outside. 

So how would you change my mind on dark themes on sites being terrible? What are sites that have great themes with good visibility of the content? And why do they always feel so much worse for a personal blog, product, or marketing sites (I used to work for a company with a dark themed marketing site and nobody internally liked it)?