How do I insert unique random number into a column?

I am creating a table in SQL server with two columns (RowID and Value). I want to insert 500,000 unique random numbers into the value column which has no duplicate value.

My T-SQL is as follow:

CREATE TABLE dbo.Sorting
(
  RowID INT,
  Value INT, --UNIQUE,
  PRIMARY KEY (RowID, Value)
);

;WITH x AS 
(
  SELECT TOP (500000) s1.[object_id]
  FROM sys.all_objects AS s1
  CROSS JOIN sys.all_objects AS s2
  ORDER BY s1.[object_id]
)
INSERT dbo.Sorting(RowID, Value)
SELECT
    r = ROW_NUMBER() OVER (ORDER BY [object_id]),
    n = ROW_NUMBER() OVER (ORDER BY NEWID())
FROM x
ORDER BY r;

The problem I find with my solution is that there is duplicated values in the Value column.

Any help is appreciated.

All topic

Does having an ID while keeping the slug into the URL impact SEO? [duplicate]

This question already has an answer here:

  • Will having product ID in URLs hurt SEO compared to a URL with only keywords?

    3 answers
  • Does a unique ID and title in URL slug improve SEO?

    1 answer

Would the following URL, that doesn’t contain the ID of the question, be more SEO friendly:

https://stackoverflow.com/questions/why-do-web-sites-tend-to-use-random-ids-on-database-tables

than one that contains the ID before the slug?

https://stackoverflow.com/questions/11119690/why-do-web-sites-tend-to-use-random-ids-on-database-tables

If yes, what’s the value of keeping the ID inside the URL? I would imagine for allowing renaming URLs, but this can be fixed with 301 redirects.

All topic

What’s the sixth word in these sequences?

What’s the sixth word in these sequences?

  1. CLOUTS, OBERON, DANGER, PEOPLE, BEMOCK
  2. CLUMSY, BUCKET, BROKEN, JARGON, DIADEM
  3. ATRIUM, RENTAL, GLANCE, TRIPOD, SUNDAE
  4. KOSHER, OOMIAK, ENDING, ORPHAN, MISHIT

Source: The GCHQ Puzzle Book

All topic

Unityのネットワーク接続が上手くいかない

Unityが固有に持つネットワーキングシステムを利用して、他のクライアントから自分が用意したサーバーへと接続できません。
現状としては、Unityエディタでプレイしてもエラーは出ることはなく、ローカルでの接続ならば、UnityエディタとWindows用にビルドしたアプリではしっかりとデータが同期します。しかし、AndroidのアプリやWindowsのアプリからIPアドレスによるネットワーク接続を試みると、私のサーバーへと接続できません。
おそらく、IPアドレスを上手く入手出来ていないことが問題として挙げられますが、IPアドレスは複数のIPアドレス確認用のサイトから確認した自分のIPアドレスを使用しているので間違えはないはずです。
何か他にUnityのネットワーク接続が上手くいかない問題があるのでしょうか?

以下はIPアドレスを入手する際に使用しているスクリプトです。

開発環境
・OS windows10
・Unity 5.6.1f
・『UnityによるVRアプリケーション開発』

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.VR;

public class NetworkStart : NetworkBehaviour {
    public GameObject DiveCamera;
    public string hostIP="xxx.xx.xx.xxx";

    void Awake(){
        VRSettings.enabled = false; 

        #if(UNITY_ANDROID||UNITY_IPHONE)
        DiveCamera.SetActive(true);
        NetworkManager net=GetComponent();
        net.networkAddress=hostIP;
        net.StartClient();
        #else
        DiveCamera.SetActive(false);
        #endif
    }
}

All topic

UML, <> and <> from the same use case

UML Diagram

This is a use case diagram about the enrollment of students at a university. There are several flaws in it, and I have to find them.

I am wondering what is happening when you get to use case “Choose course”. Yes, you will also have to “Enroll”, but what happens if you choose a course that is not available? You will extend the use case, “Course not available”, but will you still enroll the course that isn’t available? It seems to me like you will.

It would have been different if the association between “Choose Course” and “Enroll” was an extend, because then you only sometimes would enroll in the course, most likely only when it is available.

I am assuming the same logic applies to the “Log-in” use case and the “Student not Identified” use case. You can choose a course without being identified as a student.

All topic

Examples of abstract proofs that turned out to be false

I found this question that discusses abstract theories that later found application. I am interested in accepted (at least at one point in time) abstract theories that:

  • was contradicted by attempts to apply and/or observed phenomenon (as currently understood).
  • are irreconcilable with another accepted and intersecting abstract theory

I am a licensed engineer by profession; but turning to philosophy. Some individuals point to the a priori or abstract nature of mathematics as justification that other a priori forms of knowledge exist. I hope to demonstrate that this dependence is unreliable by showing that mathematics requires a posteriori verification to acquire meaning.

I would be happy with 2–3 examples, or if someone could refer any texts that might document the history of such errors that would be helpful.

All topic

Sonoff Dual – Where to find GPIOs

I’m looking for the GPIO’s I can use in SonOff Dual ( after flashing my own software ).
In SonOff Basic – there are GPIOs to acess LED, Relay, and what is most needed for me – GPIO14 for external input as shown here

Since I need 2 Relays solution, I need 2 external inputs.
I’ll be happy to get some assistance in finding those “free GPIOs”

All topic

What is the song when Obito attacked Naruto and Sasuke in episode 378 of “Naruto Shippuden”?

Which song was played in Naruto Shippuden episode 378 at about 15:10, when Obito attacked Naruto and Sasuke?

All topic

คู่กรรม

คู่กรรม

คู่กรรม

All topic

Using React to post and update count in client component

Cannot seem to get this onClick button to work and update the “kudos given” number. Basically 3 .js files, while using this API to test. My code is:

app.js:

import React, { Component } from 'react';
import './App.css';

import KudoList from "./components/KudoList";

import axios from "axios";

class App extends Component {

  state = {
    contacts: []
  };

  componentDidMount() {
    axios
      .get("https://kudos-devtech8-yvbvpoek.herokuapp.com/users")
      .then(response => {
        const newContacts = response.data.map(c => {
          return {
            id: c.id,
            name: c.username,
            fname: c.first_name,
            lname: c.last_name,
            kgive: c.kudos_given_count,
            kreceived: c.kudos_received_count
          };
        });

        const newState = Object.assign({}, this.state, {
          contacts: newContacts
        });

        this.setState(newState);
      })
      .catch(error => console.log(error));
  }
  render() {
    return (
      

Welcome to our Kudo app

); } } export default App;

The Contact.js:

import React from "react";
import "./Contact.css";

class Contact extends React.Component {
    state = { kgive: 0,
              fname: '',
              lname: '',
              kreceived: ''
    };

    constructor(props) {
      super(props);

      this.incrementKudoCount = this.incrementKudoCount.bind(this);
    }

    incrementKudoCount(ev) {
      this.setState((prevState) => ({
        kgive: prevState.kgive+ 1,
      }));
    }

    render() {
      return (
        

Name: {this.props.fname} {this.props.lname}

Kudos Given: {this.props.kgive}

Kudos Received: {this.props.kreceived}

); } } export default Contact;

And then the KudoList.js:

import React from "react";
import Contact from "./Contact";

function KudoList(props) {
  return (
    
{props.contacts.map(c => )}
); } export default KudoList;

I get no errors, but the button binding event is not working correctly and not sure why. Should I have a separate component to give kudo or can’t it be as easy as I have it with a little modification?

All topic