usability testing – How do you know what to test at the right time on a product?

Really good question! I used to have this conundrum for a while and then I found the solution in the Google Design Sprint.

You can find more information about it online but basically, the methodology answers your question exactly : “What is the the next step right now?”

It was created by Google Ventures (the company that acquires new startups for Google and helps them get on the right track) and now the methodology is open to use by anyone.

In a nutshell: In 4 days you bring in all your stakeholders and you run a series of exercises: Monday – Mapping and Sketching, Tuesday – Decisions and Storboarding, Wednesday – Prototyping and Thursday – Testing. In one week you can clarify the vision of your organization and know what the next step is.

You should try it! It works wonders and it saves so much time!

python – My code is passing only few test cases [Trie data structure]

I have tested my code against all possible test cases. Ex: word present, not present in dictionary; given word is prefix of existing words, upper case, lower case. They passed. But not sure what I missed. 2 test cases are failing

Question:

Peter found a digital dictionary which is far better than normal
dictionaries. The digital dictionary has an input field in which one
can search any string and the dictionary displays all the words whose
prefix is that input string in lexicographical order. Now you are
given a task to make your own digital dictionary. You will be given
words that you can store in your database and then you need to design
the search functionality. And if no such words are available for a
given search word, add this word to your dictionary.

Input Format Single integer N which denotes the number of words which
are to be stored in the database of the dictionary. N lines of input,
where in each line there is a string made up of lowercase/uppercase
letter Single integer Q which denotes the number of queries. Q number
of lines describing the query string on each line given by user.

Constraints 1≤N≤30000 sum(len(stringi)) ≤ 2∗10^5 1≤Q≤10^3

Output Format If word with prefix exists in the database, then you
need to print all the words with the given prefix in lexicographical
order in separate lines else you need to print “No suggestions”
without the inverted commas.

Sample Input

4
pet
peter
rat
rack
5
pe
pet
r
rac
rat

Sample Output

pet
peter
pet
peter
rack
rat
rack
rat

Explanation

For query 1 : Input = “pe”
We print “pet” and “peter”.

For query 2 : Input = “pet”
We print “pet” and “peter”.

For query 3 : Input = “r”
We print “rack” and “rat”.

For query 4 : Input = “rac”
We print “rat.

For query 5 : Input = “rat”
We print “rat”.

import sys
from collections import deque

class TrieNode:
    def __init__(self, character):
        self.character = character
        self.children = dict()
        self.is_word_end = False


class Trie:
    def __init__(self):
        self.root = TrieNode('$')

    def insert(self, word):
        ctn = self.root  # current trie node
        for i, char in enumerate(word):
            if ctn.children.get(char) is None:
                ctn.children(char) = TrieNode(char)
            ctn = ctn.children(char)
            if i == len(word) - 1:
                ctn.is_word_end = True

    def find_super_strings(self, given_prefix_str):
        ctn = self.root  # current trie node
        prefix_list = ()
        for char in given_prefix_str:
            if ctn.children.get(char) is None:
                self.insert(given_prefix_str)
                print('No suggestions')
                prefix_list.clear()
                return
            ctn = ctn.children(char)
            prefix_list.append(char)
        prefix = ''.join(prefix_list)
        suffix = deque()
        # print('given_prefix_str: ', given_prefix_str, 'prefix: ', prefix_list)
        self.dfs(ctn, prefix, suffix)

    def dfs(self, pnode, prefix, suffix_deck):  # parent node
        if len(pnode.children) == 0:
            print(prefix, ''.join(suffix_deck), sep='')
            if len(suffix_deck) > 0:  # remove char while backtracking
                suffix_deck.pop()
            return
        elif pnode.is_word_end:
            print(prefix, ''.join(suffix_deck), sep='')
        for key in sorted(pnode.children.keys()):  # sorted used for chronological order
            cnode = pnode.children(key)  # child node
            suffix_deck.append(key)
            self.dfs(cnode, prefix, suffix_deck)
        if len(suffix_deck) > 0:  # remove char while backtracking
            suffix_deck.pop()


n = int(input())
trie = Trie()
while n > 0:
    trie.insert(input())
    n -= 1
q = int(input())
# print()
while q > 0:
    # print('###',str,'###')
    trie.find_super_strings(input())
    q -= 1

Selling Test bitcoin

I have a random and maybe crazy question. Can I sell test coins? Someone recently told me that Advanced Market Terminal is buying them. It is strange to me Since they should hold no value.

design – Java: Splitting a large unit test class

The project (Java/Spring) I currently work on has a rather large unit-test class for one of its services : more than 1000 lines, several Nested class (one per big functionality), some tests without a Nested class, …

Finding this file rather difficult to read, and to manage (a modification in the service, and you have to take time to find the corrects tests to fix/update), I proposed to split the class to have one test file per Nested Class, each one linked to a “principal” test file, which will be managing the Mock & the tests without Nested Class. All the tests files would be put into a specific package.

I am wondering if this would be a good thing to do? or if it was something to avoid to do ?

I hope i was clear enough.
Have a nice day

javascript – Unit testing multiple features in one test

I’m writing a small utility class to create an abstraction for addEventListener (JavaScript/DOM)

Let’s say I have to test for these features:

  1. Single event target with a single event
  2. Multiple events
  3. Multiple event targets
  4. Delegated events
  5. Once

Now if I understand unit testing properly, I should create a test for each feature.

However, is there a need to test combined features? E.g.

  1. Multiple events + multiple targets
  2. Multiple event targets + delegated events
  3. Multiple event targets + delegated events + multiple events

Should I implement those combined tests in addition to single feature tests, or should I believe that I am fully covered by the single feature tests?

mathematics – I’ve been trying to verify Fermat’s last theorem for a small test case using python and I’m facing difficulty with precision handling

Fermat’s last theorem states that there are no natural numbers (1, 2, 3,…) x, y, and z such that x^n + y^n = z^n, in which n is a natural number greater than 2

This is the code I’ve been working with,

def proof(n, g):
  for a in range(1,n):
      for b in range(a, n):
          c = (pow(a, g) + pow(b, g))**(1/g)
          if c.is_integer() and c <= n:
              print(f"{a},{b},{int(c)}")
proof(1000, 6)

The test case always remains 1000, but the exponent which is ‘g’ is changed every time, it ran as expected till g = 5. But when g = 6, the program started providing answers and printed them onto the console. I’m guessing this is a problem with precision and the 6th root of the number I get qualifies as an integer. Please suggest any improvements and how I can fix this problem.

Thank You.

design – Which is preferred: subclass double or create extension methods to test (relative) equality due to floating point differences?

I am writing financial calculation software using .NET C#, which needs to be blazingly fast. There is a lot of fractional math. So using decimal type is pretty much out of the question, given its poor speed relative to using double. But of course double has its problems testing for equality, with floating point rounding issues.

My options seem to be subclassing double and overriding ==, < and >; versus creating extension methods for double equivalent to these. My tendency is to go with the latter – less code to change and maybe it will be less confusing to others reading the code later? Is there another option? What are other good reasons to choose one over the other?

sharepoint online – can anyone test this json and tell me if they experience the same problem am having

Stack Exchange Network


Stack Exchange network consists of 176 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

encryption – Data Key for Production / Test DB

We are encrypting database fields for PII. For Key Generation and storing it, we are using AWS KMS. Data key we have generated using AWS KMS,for the master key we are using CMKs.
Now let’s say there is only one DB field that I want to encrypt which is email.
Also, for simplicity, let’s consider we have two environment test/production.

Now I have created an AES-256 encryption library with GCM Mode(let’s not discuss that).

Now I have some doubts

  • The Data Key / Master Key, can they be same for both test/production. If not, then how will the system work. I mean every quarter we copy the complete prod database to test. Now if we do not have the same key, we will not be able to decrypt it.

  • We will be using HMAC for this also in separate DB column for reading purpose. For this HMAC, should we use the same data key(used in above step) or some different data key?

signal – Field test on iPhone 7. Can’t locate “rsrp0”

I have an unlocked iPhone 7 on T-Mobile, model A1660 on IOS 14.0.1. I’m trying to find the cell signal strength by running the field test as described here. From my reading, rsrp0 is the best option to get a realistic idea of the true cell signal strength. However when I click on the Serving Cell Measurements, instead of seeing a # of fields like “rsrp1”, “rsrp0”, etc, I get the below. Would one of these fields (Measured RSRP perhaps?) provide equivalent information to rsrp0?

Serving Cell Measurements