Move Zeroes

Code on Github

Advertisements

Migrating from wordpress.com to wordpress.org minutes

This is a placeholder for documenting how I’m going to migrate my site.

After chatting with wordpress online chat, I just realized that wordpress.com is different from wordpress.org
The latter was the one that I was always looking for that allows me to customize my site, here’s the link I’m going to follow.

  • Step 1 finished ,purchased a new host (1 year plan) with one of their recommended hosting provider: BlueHost, Good luck to me!
  • Step 2: Install WordPress:
    1. Watched this bluehost installation video
    2. download FileZilla (open source FTP solution) from here. You could either use your IP address or your domain as the host, fill port number with 21.
    3. Then I’m stuck at Step 5 of installing WordPress, my BlueHost server returns me 404: I’ve done these:
      • upload all the contents of unzipped WordPress to my web server, excluding the directory itself, then try to access this url: https://fishercoder.com/wp-admin/install.php, and it returns me 404.
      • Side knowledge: every domain has to be registered with some registrar company, in my case, I purchased my domain through WordPress.com, behind the scenes, my Registrar company is Wild West Domains.
      • Nameservers are just specialized servers that translate a domain name into an IP address that is understood by computers on the internet.

      it turns out that my nameservers are pointing to wordpress.com nameservers, not to the new nameservers that I just purchased on Bluehost, whois.net states that information very clearly!

  • Step 3:

Shuffle an Array



    //Note: the problem states that this is a set without duplicates which makes building all combinations easier
    
    private List<List> combinations;
    private int[] original;
    private Random random;
    
    public Solution(int[] nums) {
        original = nums;
        random = new Random();
        combinations = buildAllComb(nums);
    }
    
    //insert next value into all possible positions, I wrote this method myself, of course it could be simplified to not use a queue
    //but it just naturally came into my mind that I used a queue
    private List<List> buildAllComb(int[] nums) {
        List<List> result = new ArrayList<List>();
        if(nums == null || nums.length == 0) return result;
        
        List list = new ArrayList();
        list.add(nums[0]);
        Queue<List> q = new LinkedList();
        q.offer(list);
        for(int i = 1; i < nums.length; i++){
            int qSize = q.size();
            for(int k = 0; k < qSize; k++){
                List currList = q.poll();
                for(int j = 0; j <= currList.size(); j++){
                    List newL = new ArrayList(currList);
                    newL.add(j, nums[i]);
                    q.offer(newL);
                }
            }
        }
        while(!q.isEmpty()){
            result.add(q.poll());
        }
        return result;
    }

    /** Resets the array to its original configuration and return it. */
    public int[] reset() {
        return original;
    }
    
    /** Returns a random shuffling of the array. */
    public int[] shuffle() {
        if(original == null || original.length == 0) return original;
        int randomIndex = random.nextInt(combinations.size());
        List list = combinations.get(randomIndex);
        int[] result = new int[list.size()];
        for(int i = 0; i < list.size(); i++){
            result[i] = list.get(i);
        }
        return result;
    }


Code on Github