Tons of mail windows opened because of no preferred outgoing server

I don’t use mail normally. So today when I open my app, this caught me by surpriseenter image description here

I selected one of the server and then close the mail window, but there are just so many to go through.

My questions:

1) The email are seemingly created based on some of my calendar events. Why they tried to send me emails?

2) How can I efficiently close all these windows in one go, instead of making a selection of outgoing server than close a mail window?

I have tried to quit the mail app from its context menu of the Dock, but it just forces one of the mail window to the foreground.

How do you cope with tons of web fonts when copying and pasting from web pages?

Whenever I copy something from the web and paste it in my Mail or Evernote, or Apple Notes, it always brings the text style from the page and inserts those weird looking fonts in my mail, or notes.

My solution for that is to paste it in a plain text editor, VIM in my case, and then copy and paste where I need it to get rid of the style. It’s pretty elaborate process, especially when I need to copy/paste often during research.

I’m wondering how other people cope with the fonts, and what’s a better solution?

How to bring a code to conformance with tell, don’t ask without creating tons of methods on other classes?


It used to be fairly common for people to call a getter, do some calculation on it, then call a setter with the result. This is a clear sign your calculation actually belongs to the class you called the getter on. “Tell, don’t ask” was coined to remind people to be on the lookout for that anti-pattern, and it worked so well that now some people think that part is obvious

(source: Karl Bielefeldt’s answer)

This is by far not the first time I hear a piece of such advice.

Yet, looking at the game I’m trying to make, I simply can’t seem to see how to bring this code to conformance with this advice. Admittedly, this anti-pattern is rampant there.

This is the current design: Monsters can be under Effects and can have Actions queued for execution. Monsters are instances of a class specific to their species, which inherits from the Species abstract class – which in turn holds state such as their current HP, stamina, a list of Effects they are under or a list of Actions that are queued for execution.

Let me put here a few examples why it is so hard for me to conform to this advice. For example, let’s pay a closer look on the Attack Action. Seems straightforward enough: total attack power is computed as Attack.power * attacker.power (attacker is a monster) and this value is substracted from the defender’s current HP. But now, where to put this logic? To conform with this piece of advice we would have to have a makeAttack method on the attacker, which passes its current power to the attack, which then multiplies this value by its own power and passes it to the defender’s beAttacked method, which then substracts this amount from its own HP. And, indeed, this is how I started this.

However, it turns out, this is only the simplest case. The Attack on its own can be under Effects. Soon, as the complexity of the game rules was growing, I was finding myself making more and more fields public and moving more and more logic to the effects and actions themselves and away from whatever is under these effects and whatever these actions are supposed to affect.

Consider these requirements:

  • If an Attack is of type Fire AND it penetrates the defender’s shield then a Burn debuff is applied to the defender whose strength is proportional to the amount of fire damage that has passed through the shield.
    • This necessites either querying the defender stats after the damage by the Attack or polluting the defender’s beAttacked method with additional arguments and logic or having an applyBurn method on the defender.
  • If the defender is blocking (is under a Block effect) he mitigates a portion of the incoming damage at the cost of some of his Stamina (he can’t, therefore, mitigate more damage than he has stamina for). How much damage is exactly mitigated depends on the ratio of both monsters’ power.
    • Again: put this logic in the Block buff, which then has to query the state of both monsters AND the power of the attack? Or pollute other classes with unecessary methods?
  • If the defender is under a Dodge buff, he has a chance of avoiding the damage completely, depending on both monsters’ speed ratio.
    • Same problems as above…
  • Attacks that have the AreaOfEffect field set to True cannot be dodged at all…
  • The battle arena itself can be under effects – for example, Hurricane or Conflagration. But- there is a combo – if both effects are in play, thy are both removed and a third effect, Firenado is placed, which is more powerful than both Hurricane and Conflagration at the same time.
    • When Conflagration is being placed it has to ask the battlefield if there is a Hurricane already and remove it if necessary…
  • Force attacks ignore some portion of shield completely, Pierce ones are instead more powerful to the extend they are blocked by shield
    • Make it work with the blocking semantics…

I could go on and on and on. The bottom line is: the only alternative to tell, don’t ask seems to be… For each subclass of Effect that can affect a monster, make a method on the monster. For each subclass of Effect that can affect an Action, make a method on that action. For each subclass of Action that can target a monster, make a method on that monster.

I don’t like this. Aside from the clutter such a solution would introduce, this kind of defeats the purpose of having separate Effect and Action subclasses. Logic that is semantically theirs would, in the end, be moved to methods of other classes! So, AFAIK, tell, don’t ask is supposed to precisely avoid this what it would now introduce! If I have, say, 15 different types of Effects, then it makes sense to enable these Effects to simply operate on instances of IMonster whose requirements are kept simple (IMonster is supposed to have HP, stamina, etc, but not necessarily provide a burnMe method) rather than instances of IBurnableMonster which kind of makes little sense because every monster is burnable.

This also seems more elegant to me insofar as modifying the game’s rules (adding a new effect or something like that) is supposed to boil down to only adding a new Effect subclass and/or making changes to one Effect subclass rather than also considering all classes this Effect would affect. (OK I’m lying here: the practice shows this is not the case, however, this is what I – ideally – wanted to achieve through this design).

So… currently I have a lot of getters and a lot of public fields. Which, I suppose, is a little tragedy in the eyes of any experienced engineer. As the number of special cases was growing, I even removed the makeAttack and beAttacked methods from the monster and instead put this logic in the Attack action.

However, now that I described the “architecture”, how should this be handled in a more right-handed way?

Tons of OpenDKIM Issues

I for the life of me cannot get OpenDKIM to work correctly. I can send and receive messages just fine with postfix and roundcube. I have tried tons of things to get this working. At this point, I am not getting any errors, but OpenDKIM is not signing mail. I have tried everything I can find on this site already.

Here is my main.cf:

# See /usr/share/postfix/main.cf.dist for a commented, more complete version  # Debian specific:  Specifying a file name will cause the first # line of that file to be used as the name.  The Debian default # is /etc/mailname. #myorigin = /etc/mailname  smtpd_banner = $  myhostname ESMTP $  mail_name (Raspbian) This is not an open relay. biff = no  # appending .domain is the MUA's job. append_dot_mydomain = no  # Uncomment the next line to generate "delayed mail" warnings #delay_warning_time = 4h  readme_directory = no  policyd-spf_time_limit = 3600  milter_default_action = accept milter_protocol = 6 smtpd_milters = unix:/var/run/opendkim/opendkim.sock non-smtpd_milters = unix:/var/run/opendkim/opendkim.sock  # TLS parameters smtpd_tls_cert_file = /root/fullchain.pem smtpd_tls_key_file = /root/privkey.pem smtpd_use_tls = yes smtpd_tls_auth_only = yes smtpd_tls_loglevel = 2  smtpd_sasl_type = dovecot smtpd_sasl_path = private/auth smtpd_sasl_auth_enable = yes   smtpd_relay_restrictions =   # subject even authenticated users and trusted networks   # to the policy check   #check_policy_service inet:127.0.0.1:10031   permit_mynetworks   reject_unknown_sender_domain   permit_sasl_authenticated   defer_unauth_destination  smtpd_recipient_restrictions =   permit_mynetworks   permit_sasl_authenticated   check_policy_service unix:private/policyd-spf,   # we exclude our networks and SASL authenticated users   # from all further checks.   # since I don't know if the policy service is relevant   # for unauthenticated mail, I commented it out here   # check_policy_service inet:127.0.0.1:10031   warn_if_reject reject_non_fqdn_hostname   warn_if_reject reject_non_fqdn_sender   reject_invalid_hostname   reject_unknown_sender_domain  smtpd_data_restrictions = reject_unauth_pipelining  # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for # information on enabling SSL in the smtp client.  myhostname = mail.smbecker.tk alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = localhost relayhost = mynetworks = 10.0.0.0/8 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 mailbox_size_limit = 0 recipient_delimiter = + inet_interfaces = all  #Handing off local delivery to Dovecot's LMTP, and telling it where to store mail virtual_transport = lmtp:unix:private/dovecot-lmtp  #Virtual domains, users, and aliases virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf  inet_protocols = ipv4 

Here is my opendkim.conf:

# This is a basic configuration that can easily be adapted to suit a standard # installation. For more advanced options, see opendkim.conf(5) and/or # /usr/share/doc/opendkim/examples/opendkim.conf.sample.  # Log to syslog Syslog                  yes # Required to use local socket with MTAs that access the socket as a non- # privileged user (e.g. Postfix) UMask                   002  # Map domains in From addresses to keys used to sign messages KeyTable                /etc/opendkim/key.table SigningTable            /etc/opendkim/signing.table  # Hosts to ignore when verifying signatures ExternalIgnoreList      /etc/opendkim/trusted.hosts InternalHosts           /etc/opendkim/trusted.hosts   # Sign for example.com with key in /etc/dkimkeys/dkim.key using # selector '2007' (e.g. 2007._domainkey.example.com) #Domain                 example.com #KeyFile                /etc/dkimkeys/dkim.key #Selector               2007  # Commonly-used options; the commented-out versions show the defaults. #Canonicalization       simple Mode                    sv SubDomains              no  AutoRestart             yes AutoRestartRate         10/1m Background              yes DNSTimeout              5 SignatureAlgorithm      rsa-sha256  # Socket smtp://localhost # # ##  Socket socketspec # ## # ##  Names the socket where this filter should listen for milter connections # ##  from the MTA.  Required.  Should be in one of these forms: # ## # ##  inet:port@address           to listen on a specific interface # ##  inet:port                   to listen on all interfaces # ##  local:/path/to/socket       to listen on a UNIX domain socket # #Socket                  inet:8892@localhost Socket                  local:/var/spool/postfix/var/run/opendkim/opendkim.sock  ##  PidFile filename ###      default (none) ### ###  Name of the file where the filter should write its pid before beginning ###  normal operations. # PidFile               /var/spool/postfix/var/run/opendkim/opendkim.pid   # Always oversign From (sign using actual From and a null From to prevent # malicious signatures header fields (From and/or others) between the signer # and the verifier.  From is oversigned by default in the Debian pacakge # because it is often the identity key used by reputation systems and thus # somewhat security sensitive. OversignHeaders         From  ##  ResolverConfiguration filename ##      default (none) ## ##  Specifies a configuration file to be passed to the Unbound library that ##  performs DNS queries applying the DNSSEC protocol.  See the Unbound ##  documentation at http://unbound.net for the expected content of this file. ##  The results of using this and the TrustAnchorFile setting at the same ##  time are undefined. ##  In Debian, /etc/unbound/unbound.conf is shipped as part of the Suggested ##  unbound package  # ResolverConfiguration     /etc/unbound/unbound.conf  ##  TrustAnchorFile filename ##      default (none) ## ## Specifies a file from which trust anchor data should be read when doing ## DNS queries and applying the DNSSEC protocol.  See the Unbound documentation ## at http://unbound.net for the expected format of this file.  TrustAnchorFile       /usr/share/dns/root.key  ##  Userid userid ###      default (none) ### ###  Change to user "userid" before starting normal operation?  May include ###  a group ID as well, separated from the userid by a colon. # UserID                opendkim 

Here is my /etc/systemd/system/multi-user.target.wants/opendkim.service (I had to edit in order to get opendkim.sock and opendkim.pid to even show up and be able to get rid of the postfix errors)

[Unit] Description=OpenDKIM DomainKeys Identified Mail (DKIM) Milter Documentation=man:opendkim(8) man:opendkim.conf(5) man:opendkim-genkey(8) man:opendkim-genzone(8) man:opendkim-testadsp(8) man:opendkim-testkey http://www.opendkim.org/docs.html After=network.target nss-lookup.target  [Service] Type=forking PIDFile=/var/spool/postfix/var/run/opendkim/opendkim.pid UMask=0007 ExecStart=/usr/sbin/opendkim -P /var/spool/postfix/var/run/opendkim/opendkim.pid -p local:/var/spool/postfix/var/run/opendkim/opendkim.sock Restart=on-failure ExecReload=/bin/kill -USR1 $  MAINPID  [Install] WantedBy=multi-user.target 

key.table:

smbecker.tk smbecker.tk:YYYYMM:/etc/opendkim/keys/smbecker.tk.private 

signing.table:

*@smbecker.tk smbecker.tk 

I have done tons of editing and checking owners and permissions to get to even this point getting rid of milter connection errors (not found and refused). The opendkim.pid changes to root ownership everytime opendkim is restarted, but even if I do a chown and chmod to give it to opendkim with a 0777, I still get same result. Messages don’t get signed:

DKIM Information: DKIM Signature  This message does not contain a DKIM Signature 

I am using Raspian-Stretch. I have Postfix, Dovecot, Roundcube all working and am sending emails via Roundcube. All outgoing email should have DKIM signatures, but don’t.

[GET FREE] Download without registration, Tons of PLR, MRR, Products – 8K Files

100% FREE PLR, MRR, Product
Download without registration!

http://plrstorage.com/free/ 
Code (markup):

PACKAGE FEATURES:

* All Working Links!
* Download one file at a time or many. No need to download an entire Zip File just to find one file!
* Spyware, Virus Free.. Guaranteed
* High Quality Products!
* Full Ownership Rights! Sell or give away
* Many Products with complete sales pages
* Full Software Applications with Source Code

Optimising program with tons of if statements Java

I have a program that will ask the user to input their grades for 4 different sections of a project, then tell them what their total mark is, what grade they got and how many marks away they were from the next grade. I managed to make a single loop for all inputs rather than having a loop for each individual one, but there are still quite a lot of if statements to determine what grade they got and how far away they were from the next one, and I can’t figure out how to optimise it since I’m still very new to Java.

import java.util.Arrays; import java.util.InputMismatchException; import java.util.Scanner;  public class PortfolioGrade {      public static void main(String[] args) {         // TODO Auto-generated method stub         String[] words = new String[]{"Analysis", "Design", "Implementation", "Evaluation"};         int[] marks = new int[words.length];         for(int counter = 1; counter <= words.length; counter++) {             System.out.println("Enter your mark for the '" + words[counter - 1] + "' part of the project: ");             while(true) {                 try {                     Scanner reader = new Scanner(System.in);                     marks[counter - 1] = reader.nextInt();                     if(marks[counter - 1] < 0 || marks[counter - 1] > 25) {                         System.out.println("Please input a number between 0 and 25.");                         continue;                     }                     break;                 } catch(InputMismatchException e) {                     System.out.println("Please input a valid integer.");                 }             }         }          int totalmark = Arrays.stream(marks).sum();         String grade = null;         String nextgrade = null;         Integer marksaway = null;          if(totalmark < 2) {             grade = "U";             marksaway = 2 - totalmark;             nextgrade = "1";         } else if(totalmark >= 2 && totalmark < 4) {             grade = "1";             marksaway = 4 - totalmark;             nextgrade = "2";         } else if(totalmark >= 4 && totalmark < 13) {             grade = "2";             marksaway = 13 - totalmark;             nextgrade = "3";         } else if(totalmark >= 13 && totalmark < 22) {             grade = "3";             marksaway = 22 - totalmark;             nextgrade = "4";         } else if(totalmark >= 22 && totalmark < 31) {             grade = "4";             marksaway = 31 - totalmark;             nextgrade = "5";         } else if(totalmark >= 31 && totalmark < 41) {             grade = "5";             marksaway = 41 - totalmark;             nextgrade = "6";         } else if(totalmark >= 41 && totalmark < 54) {             grade = "6";             marksaway = 54 - totalmark;             nextgrade = "7";         } else if(totalmark >= 54 && totalmark < 67) {             grade = "7";             marksaway = 67 - totalmark;             nextgrade = "8";         } else if(totalmark >= 67 && totalmark < 80) {             grade = "8";             marksaway = 80 - totalmark;             nextgrade = "9";         } else if(totalmark >= 80) {             grade = "9";         }          System.out.println("Your total mark was " + totalmark + ".");         System.out.println("You got a Grade " + grade + ".");         if(grade == "9") {             System.out.println("You achieved the highest grade!");         } else if(marksaway == 1) {             System.out.println("You were " + marksaway + " mark away from a Grade " + nextgrade + ".");         } else {                 System.out.println("You were " + marksaway + " marks away from a Grade " + nextgrade + ".");         }     } } 

Asking about how to find tons of clients

Hello DPers

I am a writer with no less than 7 years experience. Writing is my hobby and so far, my main income comes from writing. Almost all of my clients come from this forum and a number of freelance sites. Well, what I want to ask is " can I get clients outside of this forum and other similar forums? Can I search for clients by contacting website owners directly?

Thanks for your answer