Random Person Generator (Python)

Name: Fiona Fandsee
Phone Number: 732-592-5840
Email: fandseefiona0@yahoo.com
Password: A7fAJI9B
Address: 6221 West Wethersfield Road 
City: Glendale, AZ
Postal Code: 85304
Bank: Fifth Third Bank
Account Number: 1537459034

Example of Console Output

    "phone": "786-158-3327", 
    "address": {
        "city": "Wilmington", 
        "address1": "376 Whites Road", 
        "address2": "", 
        "coordinates": {
            "lat": 42.880951, 
            "lng": -72.84163699999999
        "state": "VT", 
        "postalCode": "05363"
    "name": {
        "surname": "Rower", 
        "firstname": "Asha"
    "bank": {
        "account_num": "8366805248", 
        "bank": "Citizens Bank of Massachusetts"
    "email": {
        "password": "%oaL3IG@", 
        "email": "rowerasha6@aol.com"

Example of JSON Output

I was bored so decided to create a random fake person generator in Python. The code for this generator is available on my GitHub here, but I will go over a little bit about what the code does. Most of the magic happens in the main.py file. It calls several methods I made up and will create a fake person’s name, phone, email & password, bank information, and address. This information can be outputted in JSON or plain text in the console and be used in other avenues. If you include main.py in another script and call main.json_output() then you can use parse that JSON in a for loop to generate many different people. My idea for this is that I get a lot of spam emails so I decided to click on them and when they ask for personal information, I can mess around with the scammers and waste their time by providing them with false information. I’m not responsible for any uses or modifications of the code, but feel free to take a look, execute the code or add any other changes to it. I may add other stuff like social security number or credit card number if I have time.

Node.js and MongoDB: Part 2 – Refactor Hell

How I usually feel about deprecation warnings. Source.

I mentioned briefly in my last post about how the book I have been using, Node.JS, MongoDB and Angular JS Web Development, has a lot of deprecated code in it once I hit chapter 13. I do not want to teach myself code that is going to end up being trash here as the technology world evolves so whenever I got the deprecation warning, I actually went ahead and refactored all the source code from the book into the latest version using the documentation from MongoDB’s API. This way, I actually am learning the latest and official way to do things, and creating great reference code for me in the future to use (and for anyone who actually reads these blog posts or browses my GitHub as well). Chapter 15 was definitely the worst of it. First of all, the book starts using a new collection called “word_stats” that has over 4000 words in it. However, the book neglects to tell you where to get the collection data from. It pissed me off originally, and I actually was about to just skip to chapter 16 until, lo and behold, I noticed a massive generate_data.js file in the chapter 16 source code folder. I opened it up in VS Code and discovered thats the file that generates the schema and all the data for the word_stats collection. I decided to go ahead and give it a run and now I could start messing around with the source code in chapter 15. I was happy I did not have to skip that chapter. But the good news only lasted a short while as I went to run the source code and was met with the infamous DeprecationWarning message yet again:

You can see all the examples use [collection].group which Mongo kindly informs us will be deprecated in newer versions.

Now for the past DeprecationWarning messages, the fix was usually simple. Something like change update to updateMany, so no sweat there. But in this particular message it tells me, “We recommend rewriting using the aggregation framework.” I was set to refactor the group method into the aggregation framework. Now since I have never messed with MongoDB before this book, it was kind of like trying to read a foreign language for the first time. Some wods you realized were close to English and could easily understand but the rest made no sense whatsoever. I have spent the past few days reading StackOverflow, the MongoDB docs and the MongoDB Node.js docs trying to understand what the hell is going on. Here’s a little sample to compare the refactoring for one of the examples.

doc_group.js [Book Source Code with Group]
              function (obj, prev) { prev.count++; }, true,
              function(err, results){
        console.log("\n'O' words grouped by first and last" +
                    " letter that end with a vowel: ");

doc_group_refactored.js [My Refactored Code with Aggregation Framework]
        {$match: {first: 'o', last:{$in:['a','e','i','o','u']}}}, 
        {$sortByCount: "$last"}    
]).toArray(function(err, docs){
        console.log("\n'O' words grouped by first and last" +
                        " letter that end with a vowel: ");

So, to me, the syntax is way different. [collection].group() is has the following parameters: keys, query, initial, reduce, finalize, command, options, callback. The [collection].aggregate() function just takes an array of the steps in the pipeline as the only parameter and returns an array instead of an object so I have to use toArray to get the information I need. So we can break things down, but the first thing you do in aggregation is find a match. In our case, we need to match where the first letter is ‘o’ and the last letter is a vowel (in the array of vowels). Fortunately, the document has a field path for $first and $last letter of each word so luckily we can just copy that directly over from the group’s query parameter. It looks like they set a placeholder 0 for the count and then use the reduce parameter function to increment for each word it finds that matches the first set of items in the query parameter. Then after the count is done, it returns the whole object. I think I actually like the aggregation framework better now that I have practiced using it, plus I found the $sortByCount operator in the aggregation framework and once I understood how to use it, it automatically did the counting for me and was easy. There is no need for a reduce or finalize function, just one line of code and I can do the counting with the new aggregation framework. The output, however, is not as detailed but I think works just fine:

doc_group.js [Book Source Code with Group]
'O' words grouped by first and last letter that end with a vowel: 
[ { first: 'o', last: 'e', count: 21 },
  { first: 'o', last: 'o', count: 1 },
  { first: 'o', last: 'a', count: 1 } ]

doc_group_refactored.js [My Refactored Code with Aggregation Framework]
'O' words grouped by first and last letter that end with a vowel: 
[ { _id: 'e', count: 21 },
  { _id: 'a', count: 1 },
  { _id: 'o', count: 1 } ]

You can see above that the original code prints out the first and last letters to the output. But using $sortByCount, the item we are grouping by becomes _id so in our case that is the last letter. I would love to figure out how to add the first letter in there too (even though it really doesn’t matter) but every time I tried, I got null as a response so I will just leave it alone.In the book, they actually go over the aggregate method over the next few pages (after the group method), but the callback function is no longer a parameter like the book states so I still needed to refactor that code as well.

You can view the full source code for chapter 15 and all of my refactoring in my GitHub repo. Hopefully my refactoring can help someone else who needs to migrate from the group to the aggregation framework in MongoDB with Node.js. I think this is long enough of a post for a single chapter of a book, I will be learning Mongoose for Node.js next which is another plugin to connect to MongoDB. I probably will skip writing a post about that chapter unless something interesting happens, hopefully soon I will be getting into AngularJS!

Node.js and MongoDB: Part 1

Node.js, MongoDB and AngularJS Web Development Book

“If you aren’t going forwards, you’re going backwards” the old adage goes. I recently picked up this book called Node.JS, MongoDB and Angular JS Web Development. I normally use PHP MVC, SQL Server and HTML5 for coding my web applications in a personal or work environment but I figured it is best to pick up on some of the most widely used languages that other companies use as well to help round out my technology education. I am familiar with Node.js from trying to create my own artificially intelligent chatbot a few years back using Wit.AI. However MongoDB and AngularJS I have heard about, but never actually done anything with them.

Learning MongoDB has been interesting, it is nothing like SQL Server or MySQL which I have used many times before. I have successfully launched the MongoDB daemon, created a user and database admin and turned on authentication for the database.

The next section of this book starts discussing how to connect Node.js to MongoDB, however at the time the book was published, they must have used an older version of the MongoClient but never listed the version they use in this book. Therefore much of the code does not actually work and I was left to search online with the official MongoDB API Documentation to try and figure out how to make a connection and perform operations. I’m not entirely mad about this, I am still learning the ropes, but it definitely can be an obstacle to some who just buy the book hoping its a one stop shop and all of a sudden nothing is working for them (and many people actually say that in the reviews I have seen online for the book).

Getting the hang of things! Created a new DB, listing, creating and deleting collections!

It definitely does present more of a challenge to not be able to word for word use the books source code but to look at the book and then compare to official documentation and refactor the code as needed to make it work. Once I begin to hit chapter 13 dealing with all the Node.JS and MongoClient code, a lot of the books code was deprecated so I needed to refactor a lot of it on my own for it to work. With VS Code, I can get tooltips that guide me with the official documentation, which is SUPER helpful:

VS Code Tooltips are very helpful!

Starting in Chapter 14, I learned how to do a whole bunch of things to documents in a MongoDB collection such as: creating, inserting, saving, updating.etc. The book makes a separate file for each of these methods, I decided to make one giant document.js and you can pass a parameter such as ‘save’ or ‘update’ and it uses the correct method to do so. Plus the code is refactored up to the current 3.2 version.

Using arguments to perform several different actions in one document!

I have this chapter and all of the code for my practice in my GitHub at this repo. At this point, I have created one rather lengthy blog post since Chapter 14 was quite a long chapter so I will stop this post here and continue Chapter 15 in the next post!

End of Year Device Check In App

Another application I built at work, during the month of February, that I am super proud of is a way for us to check in devices at our high school. Essentially, a teacher logs in and the application will automatically pull a list of the teacher’s classes. Then the teacher selects a class and the application will grab all the enrolled students from our SIS and then use that list to communicate with our Asset Management software and return a list of all the devices assigned to those students in a beautiful array of cards! Just in case additional devices are found, teachers can add those at the top. In this testing page, I did not add all the icons that is in production, however you can see on the added devices that the icons are for collecting accessories such as case, protective shield and charger. It allows us to at a glance see if all the accessories were collected. Clicking on an asset pops up a modal to verify the correct student who is assigned is the one turning in the device, and capturing information on the accessories! All checked accessories’ icons will change green based on what is selected in the form. Proud of how this one turned out as well!

View of the dynamically loaded assets for all enrolled students in a specific class!
View of the modal to collect information about a specific device.

Prom Tickets Web App

I work in a school district and one of my latest projects is to create a custom application for prom tickets. It features the ability to scan a student’s ID and will verify the student against a list for eligibility and then automatically send out tickets to the students for Prom all at once! Here are some screenshots of the app of the beginning process where it can check for eligibility. Also attached is a screenshot where the student would automatically get the tickets sent to their email! Proud of how it turned out!

login screen
Login Screen with Google SSO
eligibility checking
Eligibility Checking
automated tickets emailed
Automatically sends students their tickets!

Online Security

In this day and age where everything we do is largely based online, and hackers are constantly evolving and staying one step ahead of all security standards, it’s always nice to take a step back and evaluate yourself to see if you are adhering to a security standard yourself. Protecting your online life is a must in this day and age. If someone could get ahold of your email account that you use to log into your social media, all they would need to do is reset your passwords to all those accounts, and click the link in your email then reset your email password and your entire digital life is gone in just a matter of MINUTES. I’m going to go through some security features you may or may not be aware of to help keep your online presence locked down and secure.

Password Managers

Image result for lastpass
(Image courtesy of LastPass)

The first step in online security is a password manager. There are many different options to choose from such as Dashlane, 1Password, RememBear, and my personal choice, LastPass. According to a survey done in 2017 by the SecureAuth Corp, 81% of people surveyed used the same password on multiple accounts online. Once one of the websites is taken, the hacker then just will try that password on everything else and boom down goes everything that has that same password. A password manager is helpful to keep all of your online content secure with separate passwords, randomly generated to at least 12-16 characters. You need to remember just one password to log into the password manager (don’t skimp out on this one! Make it secure and write it down someplace you will never forget it!!) and then all of your other passwords are there for you to use. I love Lastpass because the main features are free, including my personal favorite multi-device sync. Also with the addition of password filling from third-party apps in iOS 12, once I reach a website (such as Netflix), my keyboard will havemy secure password ready to enter for me in one click.

Image result for ios 12 password fill
Image courtesy of LastPass

With the ease of how password managers can auto-fill in your data AND generate secure passwords for you, the benefits for using one and keeping your information safe and secure make this a great first step in your online security.

Two-Factor Authentication (2FA)

Image result for 2FA
(Image Courtesy of Falcon.io)

Now that you have your passwords unique and secure, there is still one more step to ensure hackers still do not get lucky in somehow cracking your password or it getting leaked online in a data breach. Two-Factor Authentication. With two-factor authentication, you will enter your password, and then you will get a time-sensitive code generated and sent to you via email, text or in a 2FA app (such as Duo Mobile, LastPass Authenticator or Google Authenticator) to enter along side your password. This verifies not only your digital token (username and password) but a physical component as well (access to your phone). Below are some resources for both Apple and Android on links to get the 2FA apps (easier in my opinion and also if you ever switch phone numbers, you can backup the data and not get locked out) and the instructions on how to enable 2FA on various platforms. I hope this was an informative guide on internet security and that it helps you in securing your digital life!

Mobile Two Factor Code Apps

Instructions on Enabling 2FA

Email Providers

Social Media Services

Financial Institutions

  • Check with your specific institution. Many of the bigger banks already have a form of multifactor authentication enabled by default to keep your financial accounts safe and secure



My Hackintosh Setup
My Hackintosh Setup

Spent probably around 8-10 hours the past two days and I set up MacOS Sierra on my Custom built computer. It’s using my GTX 970 FTW for dual monitor support (hoping I could get my third monitor working but it doesnt seem to want to work). I used Unibeast for Sierra to put on the computer, for whatever reason High Sierra would not work, it wouldn’t recognize the boot drive. Hopefully soon I can try to upgrade!

Hackintosh PC Specs:

  • Intel i5-4670 3.4GHZ Quad-Core Processor
  • MSI H87-G43 ATX Motherboard
  • 16GB DDR3-1600 RAM
  • EVGA GTX 970 FTW+ 4GB Graphics Card
  • 2TB Seagate HDD (MacOS), 3TB Seagate HDD (Windows)

The rest are on PCPartPicker.com.

Blog Started!

Today, I decided to start a blog to keep track of all the projects I’m working on and share them with the world. I recently deleted my Facebook account and stopped using my Twitter and decided I still wanted to share things I’m working on but leave it with just technology so no personal items are mixed in the timeline. So this is it!