Would de-coupling using interfaces/templates make the system easier to maintain at the cost of over-engineering?

I have been practicing this hybrid approach for dependency injection in the last couple of days and I am wondering if it should also apply to components which are within the same package?

For example:

I have a GPIO module that uses the device chip and that required to be mocked for unit testing. I also exposed its Pins as interfaces, so their consumers would not have any coupling.

I have a Motor component that lives in another package and consumes the GPIO Pins’ interfaces.

Then a ControlAgent component that lives within the same package as the Motor component, and consumes it.

One benefit of using an interface for the Motor and a template class for its implementation seems to be making its construction a little more generic (as long as I provide what’s needed at compile time), and also makes the unit testing easier.

But I also have three more components (PID/Encoder/Odometry) and potentially more that are consumed by the ControlAgent.

Seems like a big effort in development time and complexity to setup each of those as interfaces when they are part of the same package.

What is the long term benefit (if any) in the ControlAgent consuming all of its neighboring components as std::unique_ptrs (or any pointers) to interfaces rather than friends/members?

Especially since the implementations use templates, so the types must be known at compile time.

Does the over-engineering make the implementation less readable but also more maintainable?

Making complex UI easier – User License

  • I have an admin portal for a Staff / Tech Support to check USB Dongle license information and help customers solve problems

  • The client interface is much simpler, but due to legacy data and how the hardware was built years ago I can’t reduce these fields for the staff users

  • If the account has multiple licenses, then I display a series of
    accordions, so each one is a license/dongleenter image description here

I moved the important information to the top.

Some options I thought to improve user experience:

  1. Contextual (can hide some fields in some cases, but my dev says it could be very expensive), like Network licenses could be hidden if the product level is not network, the same thing for lease
  2. An inexpensive option could be tabs or nested accordions, but I wonder whether those are really user-friendly
  3. Working on visual hierarchy

I finished personal project, I would like some help cleaning it up and making look nicer, and easier to work with

I just finished working on a personal project, it is a sort of email type program where you create an account and you can message people, the code works(as far as I’m aware) but it is not clean, different areas have different indents, i add more variable than I need, I print things that don’t need to be printed and probably way more than that.

( I realise that it will say import getpass ,and have nothing for it in the code , that is because i forgot to change the password inputs to getpass inputs before putting it on my drive. )

If anyone is willing to help or give advice that would be gratefully appreciated…

Thanks, King

Where the code is located in your files you need a folder called Data with txt files: accountIDs, addCommandList, isAdmin, names, nicknames, passwords. a folder called messages in it a folder called received.

import random from random import * import datetime import string import os import getpass global usernames global passwords global jointPassList usernames = [line.strip()for line in open('Data/names.txt', 'r')] passwords = [line.strip()for line in open('Data/passwords.txt', 'r')] isAdmin = [line.strip()for line in open('Data/isAdmin.txt', 'r')] accountIDs = [line.strip()for line in open('Data/accountIDs.txt', 'r')] nicknames = [line.strip()for line in open('Data/nicknames.txt', 'r')] jointPassList ='\n'.join(map(str, passwords))  def main():                 print('\n')                 print('\n')                 print('/help (1/2) for help')                 currentUserIndex = usernames.index(ascname)                 command =input('>>>')                 if command =='/help':                                  print('/signout       | sign out\n/details        | account details\n/setpas        | set password\n/userlist     | all users\n/mymessages | your messages\n/message | message\n/addcommand | add command')                                 input()                                 main()                 if command =='/details':                                  print('Name:      ', ascname)                                 print('AccountID: ', accountIDs[currentUserIndex])                                 print('Nickname:  ', nicknames[currentUserIndex])                                 input()                                 main()                 if command =='/setpas':                                  newpas =input('Enter your new password: ')                                 passwords[currentUserIndex] = newpas                                 jointPassList ='\n'.join(map(str, passwords))                                 openfile =open('Data/passwords.txt', 'w')                                 openfile.write(jointPassList)                                 openfile.close()                                                       input()                                 main()                 if command =='/userlist':                                 userlist =open('Data/names.txt').read()                                 print(userlist)                                 input()                                 main()                 if command =='/message':                                 whatuser =input('What user: ')                                 if whatuser in usernames:                                     message =input('What message would you like to send: ')                                     openfile =open('Data/messages/recieved/'+whatuser+'.txt', 'a')                                     date = str(datetime.datetime.now())                                     openfile.write(date + ' : ')                                     openfile.write(message+'\n')                                     openfile.close()                                     input()                                     main()                                  elif whatuser not in usernames:                                                 print('Nobody was found.')                                                 input()                                                 main()                  if command =='/mymessages':                                 messagesList = [line.strip()for line in open('Data/messages/recieved/'+ascname+'.txt', 'r')]                                 messages = '\n'.join(messagesList)                                 print(messages)                                 input()                                 main()                  if command =='/addcommand':                                 openfile =open('Data/addCommandList.txt', 'a')                                 addcommand =input('What would you like see added to this database: ')                                 openfile.write(addcommand+'\n')                                 openfile.close()                                 input()                                 main()                  if command =='/admin':                                 print(isAdmin[currentUserIndex])                                                                if isAdmin[currentUserIndex] =='True':                                                 print('Nice :)')                                                 input()                                                 main()                                  elif isAdmin[currentUserIndex] =='False':                                                 print('You are not an Admin')                                                 change =input()                                                 if change =='False':                                                                 isAdmin[currentUserIndex] = True                                                                 main()                                                 else:                                                                 main()                                  if isAdmin[currentUserIndex] =='False':                                                 delete =input('Are you sure you would like to delete your account: ')                                                 if delete =='y':                                                                 accountIDs.remove(accountIDs[currentUserIndex])                                                                 isAdmin.remove(isAdmin[currentUserIndex])                                                                 usernames.remove(usernames[currentUserIndex])                                                                 passwords.remove(passwords[currentUserIndex])                                                                 nicknames.remove(nicknames[currentUserIndex])                                                                 os.remove('Data/messages/recieved/'+ascname+'.txt')                                                                 openfile = open('Data/names.txt', 'w')                                                                 openfile.write(name + '\n')                                                                 openfile.close()                                                                  openfile = open('Data/accountIDs.txt', 'w')                                                                 openfile.write(str(accountID) + '\n')                                                                 openfile.close()                                                                  openfile = open('Data/nicknames.txt', 'w')                                                                 openfile.write(nickname + '\n')                                                                 openfile.close()                                                                  openfile = open('Data/passwords.txt', 'w')                                                                 openfile.write(password + '\n')                                                                 openfile.close()                                                                  openfile = open('Data/isAdmin.txt', 'w')                                                                 openfile.write(adminFalse + '\n')                                                                 openfile.close()                                                                 print('Complete...')                                                                 signin()                   if command =='/signout':                                  areYouSure =input('Are you sure you would like to sign out(y/n): ')                                 if areYouSure =='y':                                                 print('Signing out\n.\n.\n.')                                                 signin()                                 elif areYouSure =='n':                                                 main()                                 else:                                                 main()                   else:                                 print(command, 'is not a command in our library, type /addcommand to request new command.')                                 input()                                 main()  def signin():                 existingAccount =input('Do you have an existing account (y/n): ')                 if existingAccount =='y':                                 global ascname                                 global ascpass                                 ascname =input('Enter your username: ')                                 currentUsername = ascname                                 if ascname in usernames:                                                 userIndex = usernames.index(ascname)                                                 print('Correct username.')                                                 ascpass =input('Enter your password: ')                                                 while ascpass in passwords:                                                                 passcheck = passwords.index(ascpass)                                                                 if userIndex == passcheck:                                                                                 print('welcome back', ascname + '.')                                                                                 main()                                                                  else:                                                                                 wrongPass =input('Incorrect password.')                                                                                 input()                                                                                 signin()                                                 print('Yes')                                                 wrongPass =input('Incorrect password.')                                                 input()                                                 signin()                                 elif ascname not in usernames:                                                 wrongName =input('Incorrect username.')                                                 input()                                                 signin()                                 else:                                                 #debuging                                                 print('Error')                                                 singin()                  elif existingAccount =='n':                                 name =str(input('Enter your name: '))                                 while len(name) == 0:                                                 name =input("You haven't entered anything, try again.")                                                 input()                                                 signin()                                 if name in open('Data/names.txt').read():                                                 name =input('That name already exists.')                                                 input()                                                 signin()                                 usernames.append(name)                                 password =input('Enter your new password: ')                                 while len(password) < 4:                                                 password =input('Your password must be 5 characters long.')                                                 input()                                                 signin()                                 passwords.append(password)                                  nickname =input('Enter your nickname: ')                                 accountID =random()                                 while accountID in accountIDs:                                                 accountID =random()                                  adminFalse = str(False)                                 isAdmin.append(adminFalse)                                  openfile = open('Data/messages/recieved/' +name+ '.txt',  'w+')                                 openfile.write('\n')                                 openfile.close()                                  openfile = open('Data/names.txt', 'a')                                 openfile.write(name + '\n')                                 openfile.close()                                  openfile = open('Data/accountIDs.txt', 'a')                                 openfile.write(str(accountID) + '\n')                                 openfile.close()                                  openfile = open('Data/nicknames.txt', 'a')                                 openfile.write(nickname + '\n')                                 openfile.close()                                  openfile = open('Data/passwords.txt', 'a')                                 openfile.write(password + '\n')                                 openfile.close()                                  openfile = open('Data/isAdmin.txt', 'a')                                 openfile.write(adminFalse + '\n')                                 openfile.close()                                    signin()                  else:                                 signin()  signin() 

Does Quadratically-Constrainted Quadratic Programming get easier if all constraints are equalities?

A Quadratically-Constrainted Quadratic Program consists of optimizing a quadratic objective function while imposing quadratic constraints, which can be inequalities or equalities. Obviously, describing the problem with inequalities alone can suffice, as $ a\le b$ and $ a\ge b$ is equivalent to just $ a=b$ . For this reason, a lot of literature just focuses on the inequalities.

However, I only have quadratic equality constraints, without any inequalities. In fact, it’s enough constraints, that I believe in my case the space of points satisfying the constraints is discrete (like $ 2^{n/2}$ separate points or something). So it becomes very little of an “optimization” problem, and much more of a “search space” problem. I would like to figure out a way to transform this system into a form amenable to discrete search, but I can’t find any directives on how to accomplish that. All the heuristics/approximations I could find for QCQP definitely seem to treat more of the “not very constrained” case, where you’re moving around continuously in the allowed region — that picture doesn’t apply here, though.

I realize that searching all $ 2^{n/2}$ points is intractable in general, of course. But I hope that whatever form it would come in would then be amenable to its own heuristic searches, like a binary quadratic program is.

How do I show the selected items in an easier manner in this dropdown

I have a dropdown with checkboxes as items. HERE is the working example

enter image description here

I let people select multiple options from this after they search for it One problem I notice is that it is not immediately obvious which items have been selected. enter image description here

  1. Should I add a button that says show selected, how does filtering work with that?
  2. Should I add a checkbox saying show selected, what happens during filtering?
  3. Should I add tags below this searchbox where each tag has a delete button and shows the selected item?
  4. Here is another way to rephrase the question, what is the easiest way the user will see their selected options in this?

Some guidance is super appreciated

METHOD – An easier way to create targeted and better CPA / PPV popups for your campaigns or website

Method: Better Clickbank popups

There is a full PDF describing this method below available from here – otherwise continue reading :)

Also, all instances of hxxp:// in the method below should be replaced with http://

We all know that when trying to sell a product it’s good to engage the user and there are number of ways to do this:
• Target the user by country
• Add in a count down
• Provide a clear “call to action”…

METHOD – An easier way to create targeted and better CPA / PPV popups for your campaigns or website

Why designing UI with VisualBasic, WinForms builder was so much easier than with Sketch?

I remember, back in the days when we were mostly making applications for Windows using VisualBasic or WinForms, making a good looking app using VisualBasic or Winforms/WPF builder was easy.

It almost didn’t matter how you dropped all of your buttons/controls on a page, it would always look good.

Just drop 3 buttons and it even looks fine!

enter image description here

Now, myself, being a developer have to use Sketch from time to time. But the trend is opposite: no matter how I arrange those rectangles and shuffle colors on the page – it always comes up as crap.

No matter how I mix colors and add shadows, it still looks like crap!

enter image description here

So why is it so? Why was WinForms so tolerant? And why does Sketch requires such a sharp graphical design skill?

Is there some fundamental principle or difference between those tools, so that one is tolerant, whilst another one so intolerant to lack of graphic design talent?