teleren/devto huggingface dataset:
LeetCode 281. Move Zeros
Tags: java, array
Published: 2019-04-11 14:40:45

---
title: LeetCode 281. Move Zeros
published: true
description: Solution + explanation for problem 281
tags: java, array
series: LeetCode in Java
---

```java
public void moveZeroes(int[] nums) {
    int count = 0;

    for (int i = 0; i < nums.length; i++) {
        if (nums[i] == 0) {
            count++;
            continue;
        }
        if (count > 0) {
            swap(nums, i, i - count);
        }
    }
}

private void swap(int[] nums, int i, int j) {
    int temp = nums[i];
    nums[i] = nums[j];
    nums[j] = temp;
}
```

The essence of this approach is to swap a non-zero element with the left-most zero.

We iterate through the array `nums` and increment `count` by one when we encounter a zero, i.e. we calculate the distance between the left-most zero and a non-zero element. Once we meet a non-zero element, we swap it with the zero at `i - count`. At the end of the iteration, the zeros have been moved to the end and the relative positions of non-zero elements remain unchanged.
Why don't websites allow users to create their own security questions?
Tags: security, discuss, question
Published: 2019-04-11 14:08:30

---
title: Why don't websites allow users to create their own security questions?
published: true
description: Question about account security challenge questions
tags: #security #discuss  #question
---

For those who are part of a team responsible for security on a web application, is there a reason why most sites don't allow users to choose their own challenge/security questions?
Non-profit projects: how to work with little to no finance?
Tags: html, database, sql, discuss
Published: 2019-04-11 13:33:02

---
title: Non-profit projects: how to work with little to no finance?
published: true
description: As the resident techie at my local animal shelter, I've taken on the challenge of helping them implement digital solutions. They've got a paper problem that I'd love to digitise into a database storage solution. The problem? I cannot guarantee any financial backing. Any advice?
tags: html,database,sql,discuss
---
I want to implement a database solution to store animal interest forms on. Their current system of sifting through papers is janky to say the least.

Does anybody know of any cheap, preferably free or open-source, database providers I could work with? I've looked at AWS etc but they're all incredibly pricey for a non-profit organisation.

EDIT: Extra points if I can connect the database back-end to an online web form.

FURTHER EDIT: Have decided to build a local MySQL database, with regularly scheduled backups. Thinking that the online form could return JSON data that I will allow to be parsed into the database. Any thoughts further to this?
[C++ CODE] Contains Close Nums
Tags: thetealpickle, algorithms, coding, challenge
Published: 2019-04-11 12:58:52

---
title: [C++ CODE] Contains Close Nums
published: true
description: Determine whether the array contains close nums
tags: #thetealpickle #algorithms #coding #challenge
cover_image: https://thepracticaldev.s3.amazonaws.com/i/fh900nmn92u3kep7f14m.png
---

THE TEAL PICKLE CODING CHALLENGE!! Determine whether the array contains close nums. I solved this problem using bae (C++). TRY IT 👀

<img src="https://thepracticaldev.s3.amazonaws.com/i/8i8qfb1lu25izuw6frmy.png" />


Check out my solution and share yours!! My solution has an O(n) runtime and uses O(n) additional memory. ~ 💻 💻 

<img src="https://thepracticaldev.s3.amazonaws.com/i/44ne3stdlq3go913ezjh.png" />
Reasons Why JavaScript is Omnipresent in Modern Development
Tags: javascript, webdev, beginners, react
Published: 2019-04-11 18:15:04

---
title: Reasons Why JavaScript is Omnipresent in Modern Development
published: true
tags: javascript, webdev, beginners, react
canonical_url: https://snipcart.com/blog/why-javascript-benefits
---

![Reasons Why JavaScript is so Important for Modern Development](https://snipcart.com/media/204260/javascript.png)

> This was written by one of our marketing guys at Snipcart. I, myself, am a developer. ;)

Look, I’m no developer. 

A few years ago, I couldn’t tell the difference between server and client-side development.

Vue.js, React, Node.js… what the hell?

![undertanding-why-javascript-important](https://media.giphy.com/media/a0FuPjiLZev4c/giphy-downsized.gif)

I couldn’t begin to understand why JavaScript was everywhere, why it was so important.

I know I’m not the only one with so many questions about these subjects. Whether you’re new to web development or you need to work closely with devs, it can all get pretty overwhelming.

Working with developers on a daily basis has been a reality of mine for a while now, and I’m starting to get a solid grasp on concepts that once puzzled me.

Therefore, I want to use this post to answer these questions:

- What is JavaScript?
- Why is it so important?
- Why we use JavaScript? (or JS benefits)
- What’s coming for JS?

Even for experienced developers, it’s nice to stop for a second and remember where the tools you’re using are coming from and why you’re using them.

So let’s do this!
  

→ Read the full post [here](https://snipcart.com/blog/why-javascript-benefits)
Dark (lang): built with OCaml/ReasonML/Bucklescript, inspired by Elm
Tags: language, functional, typing, ocaml
Published: 2019-04-11 11:06:42

---
title: Dark (lang): built with OCaml/ReasonML/Bucklescript, inspired by Elm
published: true
description: More info came out on Dark
tags: #language #functional #typing #ocaml
series: Dark lang
---

Dark is a not-yet-released language/platform/toolchain about which I wrote [a post](https://dev.to/nielsbom/dark-lang---removing-accidental-complexity-of-programming-con) before.

Paul Biggar, the founder of Dark wrote another [post](https://medium.com/darklang/tablecloth-a-new-standard-library-for-ocaml-reasonml-d29a73a557b1) in which he gave some details and shared open source standard library they use. ([Tablecloth](https://github.com/darklang/tablecloth))

Dark is using an [OCaml](https://en.wikipedia.org/wiki/OCaml)-based tech stack, with OCaml on the backend. OCaml is a not-that-well-known language from the [ML family of languages](https://en.wikipedia.org/wiki/ML_(programming_language)), with languages like Clojure, Elm, F#, F*, Haskell, Idris, Miranda, Erlang, Rust and Scala. This family of languages is very ["functional"](https://www.youtube.com/watch?v=e-5obm1G_FY).

On the frontend Dark uses an [Elm](https://en.wikipedia.org/wiki/Elm_(programming_language))-inspired architecture written in [ReasonML](https://reasonml.github.io/). ReasonML is some form of OCaml (same abstract syntax tree afaik) where [Bucklescript](https://bucklescript.github.io/) is the tool that can convert ReasonML code into JavaScript. Bucklescript can also convert OCaml into JavaScript but ReasonML looks more familiar to people that already know JavaScript.

Main points:
* OCaml is a great language, as far as I can tell
* the [Elm architecture](https://guide.elm-lang.org/architecture/) is a great idea, the Redux part of React copied  it
* ReasonML is open source, but heavily supported and stimulated by Facebook, which has certain drawbacks I think

Personally I've dabbled with ReasonML and ReasonReact but to me the tooling around it and the error messages through the 3 leaky layers of abstraction were a bit much. So I'm putting my money on pure Elm (which isn't without its disadvantages either).

I'm looking forward to see more of what Dark will share.
I'd also like to hear your thoughts.
.gitignore is not working
Tags: git, gitignore, github
Published: 2019-04-11 11:04:05

---
title: .gitignore is not working
published: true
description: 
tags: #git #gitignore #github
---

Even if you haven't tracked the files so far, git seems to be able to "know" about them even after you add them to .gitignore

NOTE : First commit your current changes, or you will lose them.

Then run the following commands from the top folder of your git repo:

```bash
git rm -r --cached .
git add .
git commit -m "fixed untracked files"
```
The development process of web application
Tags: webapp, webapplication, application, development
Published: 2019-04-11 10:04:15

---
title: The development process of web application
published: true
description: The software development process is divided into 5 steps so that requirements mismatching, work redoing can be eliminated and overall code quality can be improved. Web app (Web applications) development time is less because the overall code can be simultaneously developed by different developers on the backend frontend.
tags: web app, web application, application, development
---

<img src="https://thepracticaldev.s3.amazonaws.com/i/9bumjrw5ypgfkuk0yyqf.png" />

The software development process is divided into 5 steps so that requirements mismatching, work redoing can be eliminated and overall code quality can be improved. Web app (Web applications) development time is less because the overall code can be simultaneously developed by different developers on the backend frontend.

1. Product Management
Market research has to be done before the Web app (Web applications) development or standalone software application development as a product comes under product management. Product managers job responsibility is to find the answers of Why, when and what with respect to Market Competency Strategy, Roadmap, Marketing and Release of products.

Read the full article here: <a href="https://www.decipherzone.com/blog-detail/The-process-of-web-application-development">The process of web application development</a>
Apparel Design Software
Tags: apparelsoftware
Published: 2019-04-11 09:23:31

---
title: Apparel Design Software
published: true
tags: Apparel software
---

iDesigniBuy is one of the leading clothing design software providers offering end-to-end services to help you stay in tune with the ongoing trends and vibes. Opt for us to pave your way for the best custom tailoring software solutions. 

Vist us- https://www.idesignibuy.com/product/tailoring-software/
How to notarize macOS app
Tags: macos, app, notarize, gatekeeper
Published: 2019-04-11 09:18:18

---
title: How to notarize macOS app
published: true
description: 
tags: macos, app, notarize,gatekeeper
---

## New Notarization Requirements
https://developer.apple.com/news/?id=04102019a

> With the public release of macOS 10.14.5, we require that all developers creating a Developer ID certificate for the first time notarize their apps, and that all new and updated kernel extensions be notarized as well

## Signing Your Apps for Gatekeeper
https://developer.apple.com/developer-id/

> Unpublished Software. It’s easy to get unpublished software notarized with the Export process or xcodebuild. Custom build workflows are supported by the xcrun altool command line tool for uploading, and you can use xcrun stapler to attach the ticket to the package.

> Published Software. To submit software you've already published, upload it using the xcrun altool command line tool. Several file types are supported, including .zip, .pkg, and .dmg, so you can upload the same package you already distribute to users.

## Notarizing Your App Before Distribution
https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution

![](https://docs-assets.developer.apple.com/published/a857ce6120/e02fdecf-0018-46d8-a750-c0719d21e326.png)

> When you click Next, Xcode uploads your archive to the notary service. When the upload is complete, the notary service begins the scanning process, which usually takes less than an hour. While the notary service scans your software, you can continue to prepare your archive for distribution. For example, you can export the archive and perform any final testing that you require prior to making your software available to customers.

> When the notarization process finishes, Xcode downloads the ticket and staples it to your archive. At that point, export your archive again to receive a distributable version of your software that includes the notary ticket.


Original post https://github.com/onmyway133/blog/issues/203
Java math challenge
Tags: challenge, java
Published: 2019-04-11 09:03:53

---
title: Java math challenge
published: true
tags: challenge, java
---
##What should be printed?

```java
        int result = 0;
        result = result + (null != null ? 3 : 2);
        result += (1 & 2) == 1 ? 2 : 3;
        result += 1e5;
        result += 1e2;
        System.out.println(result);
```
Simple Idea for Improving Error Handling of Go
Tags: go, errors
Published: 2019-04-11 08:34:41

---
title: Simple Idea for Improving Error Handling of Go
published: true
description: 
tags: go, error
---

Following is normal code, repeat too much, not so good.

```go
_, err = fd.Write(p0[a:b])
if err != nil {
    return err
}
_, err = fd.Write(p1[c:d])
if err != nil {
    return err
}
_, err = fd.Write(p2[e:f])
if err != nil {
    return err
}
```

Improved code:

```go
type errWriter struct {
	w   io.Writer
	err error
}

func (ew *errWriter) write(buf []byte) {
	if ew.err != nil {
		return
	}
	_, ew.err = ew.w.Write(buf)
}

ew := &errWriter{w: fd}
ew.write(p0[a:b])
ew.write(p1[c:d])
ew.write(p2[e:f])
if ew.err != nil {
    return ew.err
}
``` 

It looks better now by adding another level.

Do you think so?

# End and Ref

[Repeat Error Handling in Go](https://huoding.com/2019/04/11/728), a Chinese post.
Create your own radio button component in react native easily
Tags: reactnative, customcomponents
Published: 2019-04-11 07:07:02

---
title: Create your own radio button component in react native easily
published: true
description: Radio Buttons in React Native
tags: React Native, Custom Components 
---

You can easily create your own radio button components in react native very easily. First you need to create an array of options for your radio buttons and pass it to your radio button component like so:

```
const options = [
	{
		key: 'pay',
		text: 'Most High Pay',
	},
	{
		key: 'performance',
		text: 'Most Perfomance',
	},
	{
		key: 'aToZ',
		text: 'A - Z',
	},
	{
		key: 'zToA',
		text: 'Z - A',
	},
];

{...}
<RadioButtons options={options} />
```

after this in your radio button component you can map all these options in your render method and create radio button views 

```
{options.map(item => {
    return (
        <View key={item.key} style={styles.buttonContainer}>
            <Text>{item.text}</Text>
            <TouchableOpacity style={styles.circle} />
        </View>
    });
}
```

this will create default radio buttons which looks like this -

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

Right now it is time to set the state when clicked on the radio button. First we declare our state ```state = { value: null }``` then inside out <TouchableOpacity> tag we define our checked button when clicked on any particular button. 

```
<TouchableOpacity
    style={styles.circle}
    onPress={() => this.setState({ value: key })} // we set our value state to key
>
    { value === item.key && (<View style={styles.checkedCircle} />) } // when value is equal to key
</TouchableOpacity>
```

So right now when clicked it looks like this - 

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

finally the styles -

```
buttonContainer: {
	flexDirection: 'row',
	justifyContent: 'space-between',
	alignItems: 'center',
	marginBottom: 30,
},
circle: {
	height: 20,
	width: 20,
	borderRadius: 10,
	borderWidth: 1,
	borderColor: '#ACACAC',
	alignItems: 'center',
	justifyContent: 'center',
},
checkedCircle: {
	width: 14,
	height: 14,
	borderRadius: 7,
	backgroundColor: '#794F9B',
},
```

Here is the snack link - https://snack.expo.io/@saad-bashar/radio-buttons
Teaching Yourself to Code (VII)
Tags: selftaught, beginners, discuss
Published: 2019-04-11 05:44:12

---
title: Teaching Yourself to Code (VII)
published: true
description: Things I'm learning as a self-taught developer.
tags: self-taught, beginners, discuss
---

**P**andas is rather outstanding! After around 18 hours of exerted efforts, the annual budget chart will now automatically update any new amounts. With respect to the spending about the type of purchase made
![annual budget](https://thepracticaldev.s3.amazonaws.com/i/g1efge81p5484nlzga40.png)
or how many of the type of purchase was made.
![occurrences by purchase type](https://thepracticaldev.s3.amazonaws.com/i/9guxjukjexysu50rkxdy.png)
As well as with respect to the spending at the merchant visited
![merchants](https://thepracticaldev.s3.amazonaws.com/i/d8xbkwg05st93q85tl8f.png) 
or how many times a merchant held the highest spending per data point
![occurrences by merchant](https://thepracticaldev.s3.amazonaws.com/i/z4emwqdtwe4buocwany4.png)
or even the type of merchant
![occurrences by merchant type](https://thepracticaldev.s3.amazonaws.com/i/62q1395pw51grrwwlfme.png)

All while allowing for analysis of spending amounts via linear regression
![regression](https://thepracticaldev.s3.amazonaws.com/i/lvfjguqjjo9cpn8x0xxi.png)

Now all that would be left is to tie up a few loose ends, like adding the geographical coordinate vectors so the geolocation isn't just a floating accessory, and then I can move on to working on packaging. 

And all of this starting from the data in a spreadsheet.
![spreadsheet](https://thepracticaldev.s3.amazonaws.com/i/rymeeb8jkvpvx4ue85be.png)

With a little help from [Google's APIs](https://developers.google.com), the documentation, and a fantastic slack community.
Why I don't built the cool "upload the file here" feature yet.
Tags: startup, showdev, maker, jobs
Published: 2019-04-11 05:51:10

---
title: Why I don't built the cool "upload the file here" feature yet.
published: true
description: 
tags: startup, showdev, maker, jobs
---

On my day job i'm always fighting for things like productivity, doing the right thing, focus, quality etc. It's just my job as leader of software development teams.

But earnestly, when it comes to doing side project, i did mostly the other side. At the end if was always more about fun, learning new stuff.

But now with #fullstackjob ( [https://fullstackjob.com](https://fullstackjob.com) ) and the underlying [](https://boardengine.io) I have other goals, which include do some money out of it. At then it's about what I listed above as my day job responsibility.

And that is now the point about the cool "upload the file here".

I planned a new small feature that occupied recruiters can upload they job subscriptions vs filling out a quiet big form, paying a reasonable fee. First I started to check existing Vue upload components, already did the yarn add some-thing and a first lines of code and then the biz voice told me "HEY MAN, STOP"... check first, if this feature will be used, if somebody is willing to pay for this service. Ok, I got some positive feedback when I talked with some recruiters, but that's never the 100% answer.

So I did a [simple version](https://fullstackjob.com/submitjobdescription). Just content plus Call to Action to send the Description via Email.

Cheers Stefan

![](https://thepracticaldev.s3.amazonaws.com/i/47i50hqowryxs6yee6fk.png)
How would look down your past programming journeys?
Tags: discuss
Published: 2019-04-11 05:41:20

---
title: How would look down your past programming journeys?
published: true
tags: discuss
---

As we know everyone does make mistakes and mistakes are the way to learn the things.

"If you are not making any mistakes then either you have done same thing many times before or you haven't done" 

It was quite hard when you really first started learning programming it took months, years for you to write code fluently. Now you have had so many experiences and felt that its all about how to see the problem and get solution. So what things should one consider before solving a problem (i.e learn to code / make app/ make project etc)/
Local Database in React Native Application
Tags: reactnative, webdev, android, ios
Published: 2019-04-11 04:59:25

---
title: Local Database in React Native Application
published: true
description: Local Database in React Native Application
tags: #reactnative #webdev #android #ios
---

Source : <a href="https://www.skptricks.com/2019/04/local-database-in-react-native.html" > Local Database in React Native Application</a>

In this post we are going to learn how to work with Local Database in React Native Application. More and more mobile applications need data to work, and databases have for quite a while been the most common way of storing and managing data. So, in some scenario, a mobile application uses a database that is hosted in the cloud, and connects remotely to it in order to access its data. This of course implies that, in order to be responsive, a mobile application needs an active and quite fast network connection. As a Mobile Application developer, we always search for a Local Database. A database which offers offline synchronization, reliable performance, security, and better integration with other stacks.

<a href="https://www.skptricks.com/2019/04/local-database-in-react-native.html" > Local Database in React Native Application</a>

<img src="https://4.bp.blogspot.com/-v8y4moEcTjg/XK7FjkyCA8I/AAAAAAAACps/KpGzUSUPYYgXIhbU39ZRXkyKyLOlAi86QCLcBGAs/s640/local.jpg" /> 


<a href="https://www.skptricks.com/2019/04/local-database-in-react-native.html" >Continue Reading...</a>
Style not remain (including font size, font weight, font color,...) after doing mail merge
Tags: aspose, java, word, template
Published: 2019-04-11 04:06:42

---
title: Style not remain (including font size, font weight, font color,...) after doing mail merge
published: true
description: 
tags: aspose, java, word, template
cover-image: https://thepracticaldev.s3.amazonaws.com/i/33i9tjy8op7dljyjua5j.png
---

I’m working with the Aspose and facing these problems:

Style applied on the merge fields all lost after merging:
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/r9t4grkk2mbq5la9ijr1.png)

Then, i tried with another approach by removing the MERGEFIELD keyword inside field code, the applied style retained properly but not so really. Merge fields that had been removed these keywords piled up on top of the document (Please ignore the copyright warning):
![Alt text of image](https://thepracticaldev.s3.amazonaws.com/i/33i9tjy8op7dljyjua5j.png)

This is my code to execute the mail merge process:

    public static void generateMailMergePdfFromJson(Document template, String json, String outputFilePath) throws ParserConfigurationException, SAXException, IOException, Exception {
        //Remove merge field with empty value and if the row are empty=> remove paragraph
        template.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS
                | MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS
                | MailMergeCleanupOptions.REMOVE_UNUSED_REGIONS
                | MailMergeCleanupOptions.REMOVE_CONTAINING_FIELDS);
        
        ObjectMapper objectMapper = new ObjectMapper();
        JsonNode jsonNode = objectMapper.readTree(json);
        
        ArrayNode arrayNode = objectMapper.createArrayNode();
        arrayNode.add(jsonNode);
        
        JsonNode rootNode = objectMapper.createObjectNode();
        
        ((ObjectNode) rootNode).set(Dictionary.ROOT_TAG_NAME, arrayNode);

        //To call custom merge data with html code
        template.getMailMerge().setFieldMergingCallback(new HandleMergeFieldInsertHtml());

        // Add main merge field based of main root tag name
        template.accept(new TableTagHandler(Dictionary.ROOT_TAG_NAME));
        // Merge fields
        template.getMailMerge().executeWithRegions(new JsonMailMergeDataSet(new JsonDocument(rootNode, Dictionary.ROOT_TAG_NAME)));
        
        template.save(outputFilePath, SaveFormat.PDF);
    }

Anyone who has been working with Aspose, please give me an advice on this one.