CMP 1911's

The #1 community for Gun Owners of the Northeast

Member Benefits:

  • No ad networks!
  • Discuss all aspects of firearm ownership
  • Discuss anti-gun legislation
  • Buy, sell, and trade in the classified section
  • Chat with Local gun shops, ranges, trainers & other businesses
  • Discover free outdoor shooting areas
  • View up to date on firearm-related events
  • Share photos & video with other members
  • ...and so much more!
  • Orlando

    Active Member
    Does it matter what your number is? When they get to you then you will be notified. Numbers are being assigned to all 19000 orders. When yours comes up you will be notified. If your number is above the allotment of the years 1911's you be in line for next year
     

    dreadpirate

    Ultimate Member
    Mar 7, 2010
    5,521
    Cuba on the Chesapeake
    OK CMP, here you go.
    This Java code will read in a file of customers emails, assign randomly, numbers starting at 1000, write the results to a CSV like that can be read by a spreadsheet, and email these out to everyone.

    /*
    *
    */
    package com.siriusjava.cmprng.cmprng;

    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;

    import java.util.ArrayList;
    import java.util.List;
    import java.util.Properties;
    import java.util.Random;

    import javax.mail.Session;
    import javax.mail.Authenticator;
    import javax.mail.Message;
    import javax.mail.Multipart;
    import javax.mail.PasswordAuthentication;
    import javax.mail.Transport;
    import javax.mail.internet.InternetAddress;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMessage;
    import javax.mail.internet.MimeMultipart;

    /**
    *
    * @author dreadpirate
    */
    public class ProcessCustomers {

    private class Customer {

    private String customerNumber;
    private String customerEmail;
    private int randomNumber;

    public String getCustomerNumber() {
    return customerNumber;
    }

    public void setCustomerNumber(String customerNumber) {
    this.customerNumber = customerNumber;
    }

    public String getCustomerEmail() {
    return customerEmail;
    }

    public void setCustomerEmail(String customerEmail) {
    this.customerEmail = customerEmail;
    }

    public int getRandomNumber() {
    return randomNumber;
    }

    public void setRandomNumber(int randomNumber) {
    this.randomNumber = randomNumber;
    }

    public String getDataLine() {
    return customerEmail + "," + customerNumber + "," + randomNumber;
    }

    @Override
    public String toString() {
    return "Customer{" + "customerNumber=" + customerNumber + ", customerEmail=" + customerEmail + ", randomNumber=" + randomNumber + '}';
    }
    }

    private List<Customer> customerData = new ArrayList<Customer>();
    private String dataFileInName;
    private String dataFileOutName;
    private Properties prop = new Properties();
    private Session session;

    private ProcessCustomers() {
    }

    public static void main(String[] args) {
    int statusCode = 0;
    ProcessCustomers instance = new ProcessCustomers();

    try {
    System.out.println("Start ...");
    instance.processArgs(args);
    instance.readNamesFromFile();
    instance.assignRandomNumbers();
    instance.writeResults();
    instance.emailOutNotice();
    } catch (Exception e) {
    statusCode = 1;
    e.printStackTrace();
    }

    System.out.println("Done");
    System.exit(statusCode);
    }

    public void processArgs(String[] args) {
    dataFileInName = args[0];
    dataFileOutName = args[1];
    }

    public void readNamesFromFile() {

    try ( BufferedReader objReader = new BufferedReader(new FileReader(dataFileInName))) {
    String strCurrentLine = null;
    while ((strCurrentLine = objReader.readLine()) != null) {
    String[] fields = strCurrentLine.split(",");
    String email = fields[0];
    String customerNumber = fields[1];
    Customer customer = new Customer();
    customer.setCustomerEmail(email.trim());
    customer.setCustomerNumber(customerNumber.trim());

    customerData.add(customer);
    }
    } catch (IOException e) {
    throw new RuntimeException(e);
    }

    }

    public void assignRandomNumbers() {
    assignRandom();
    for (Customer c : customerData) {
    System.out.println(c);
    }
    }

    public void writeResults() {
    try ( FileWriter writer = new FileWriter(dataFileOutName, true); BufferedWriter bufferedWriter = new BufferedWriter(writer);) {
    for (Customer c : customerData) {
    String lineOut = c.getDataLine();
    bufferedWriter.write(lineOut);
    bufferedWriter.newLine();
    }
    } catch (Exception e) {
    throw new RuntimeException(e);
    }
    }

    public void emailOutNotice() {
    setupEmailProps();
    createEmailSession("myEmailUser", "myEmailPass");
    for (Customer c : customerData) {
    sendEmail(c);
    }
    }

    private void assignRandom() {
    Random rand = new Random();
    List<Customer> givenList = new ArrayList(customerData);
    int randomNumber = 1000;
    int numberOfElements = customerData.size();

    for (int i = 0; i < numberOfElements; i++) {
    int randomIndex = rand.nextInt(givenList.size());
    Customer randomCustomer = givenList.get(randomIndex);
    randomCustomer.setRandomNumber(randomNumber++);
    givenList.remove(randomIndex);
    }
    }

    private void createEmailSession(String username, String password) {
    session = Session.getInstance(prop, new Authenticator() {
    @Override
    protected PasswordAuthentication getPasswordAuthentication() {
    return new PasswordAuthentication(username, password);
    }
    });
    }

    private void setupEmailProps() {
    prop.put("mail.smtp.auth", true);
    prop.put("mail.smtp.starttls.enable", "true");
    prop.put("mail.smtp.host", "smtp.mailtrap.io");
    prop.put("mail.smtp.port", "25");
    prop.put("mail.smtp.ssl.trust", "smtp.mailtrap.io");
    }

    private void sendEmail(Customer customer) {
    try {
    Message message = new MimeMessage(session);
    message.setFrom(new InternetAddress("nobody@cmp.org"));
    message.setRecipients(
    Message.RecipientType.TO, InternetAddress.parse(customer.getCustomerEmail()));
    message.setSubject("CMP 1911 Random Number Assignment");

    String msg = "Your random number assigment is " + customer.getRandomNumber();

    MimeBodyPart mimeBodyPart = new MimeBodyPart();
    mimeBodyPart.setContent(msg, "text/html");

    Multipart multipart = new MimeMultipart();
    multipart.addBodyPart(mimeBodyPart);

    message.setContent(multipart);

    Transport.send(message);
    } catch (Exception e) {
    throw new RuntimeException(e);
    }

    }
    }
     

    TheRealJimDavis

    Active Member
    Jan 28, 2013
    477
    The Burnie
    They did. All the packets have numbers. When they get to the packet, in that numerical order, they check it, then send out the email telling you what your number is and if the packet is good to go or not. Or at least that’s the impression I got reading their forum from the admins.
     

    dreadpirate

    Ultimate Member
    Mar 7, 2010
    5,521
    Cuba on the Chesapeake
    This is the only I can find:
    ---------------------------------------
    1. How will I know if my order has been assigned a Random Number Generator (RNG) number?

    A: CMP will send you an email with your RNG #. You can expect a call concerning your actual order w/in 30-60 days.
    The email will be titled: "CMP 1911 order acknowledgement"
    And the email address will be in the format of the first letter of the sender's name, their last name, with extension @thecmp.org

    DO NOT call or email to see where you are in the queue. There are over 19,000 order packets and they simply don't have the time to go through all of them for one person.
    -------------------

    It does not say "it may be up to 6 months before we get back to you with an RGN #". If that's the case, then just say so - don't leave people guessing.
     

    Mike OTDP

    Ultimate Member
    Feb 12, 2008
    3,319
    I think the frustration comes from people expecting to be given a RGN quickly. Especially since some of us aren't FFLs, and had to beg an FFL to send a copy via SEPCOR. We have no idea where we stand in the queue, or even if we are in it at all.
     

    TheRealJimDavis

    Active Member
    Jan 28, 2013
    477
    The Burnie
    Ah, yes, I understand that frustration. I went on the forum and read a good bit of the posts thinking mine must've made it to the circular file, then found the admin's talking to people about it, and thus gave you my aforementioned explanation.
     

    Blacksmith101

    Grumpy Old Man
    Jun 22, 2012
    22,162
    I know the numbers are random, but did you send your packet in early or at the end?




    Q

    It dosen't make a difference. My brother and I sent our packets at the same time the end of the second week he already has his gun and I am still waiting for a number.:mad54:
     

    DivingDriver

    Ultimate Member
    MDS Supporter
    Jan 14, 2016
    1,514
    Nanjemoy MD
    I sent my packet out the first day you could. Still waiting like you.. Almost as much fun as waiting for your can to be released.
     

    Users who are viewing this thread

    Forum statistics

    Threads
    274,930
    Messages
    7,259,475
    Members
    33,350
    Latest member
    Rotorboater

    Latest threads

    Top Bottom