December 5, 2017

10 Reasons Why It Is Best To Date a Software Engineer

Recently I landed on a Quora answer for why software engineers make up the best people to date. I found it so relevant that I thought of making a post about it here. This is not my answer – all credit goes to Nishant Neeraj on Quora for What are 10 reasons why it is best to marry a software engineer compared to someone from other professions?

He says this applies to all software engineers irrespective of their gender and I agree. I was surprised at how closely they match me and what I would do 😮 😮

1) They are logical.
Come on, this is a job requirement.

2) They need you.
They need you. Whole day banging head in cubical in figuring out complex concurrency bug, your soft pretty face is all they want to see.

3) They love to do activities with you. 
Unlike many other professions, software engineering is basically a sitting job. Most devs want to do some outdoor activity. So, you wouldn’t end up with a spouse that wants to sleep in the weekends. They’d love to take you for a long drive and not talk about the work.

4) They buy you expensive gifts.
Software engineering earns well. Not extremely well, but better than average. Expect a car key when you were expecting a necklace or a watch.

(I can hear someone saying, “R, This is too much!”)

5) They do not forget dates.
Most of the software engineers know how to use any scheduler. They will probably have a cronjob setup on a test server that reminds them how to behave during your PMS cycle or not to call you when you are watching your favorite sports.

6) They love gadgets (and fix them too).
Software engineers love gadgets. One would argue that everyone loves them. The difference here is they know why they love a particular gadget. They will tell you why Android is better than iPhone and why you should get an iPhone while they should get an Android.

7) You will learn something new.
Software engineering involves stuff that can mostly always be done on a laptop. So, you wanted to build a website for a social cause that you are working on? They will tell you how simple it is to put together a simple PHP project that she/he can teach you over the weekends. And hey! work with him/her over next weekend. She/He will tell you how to integrate it with Facebook, Twitter, SMS, and add a payment gateway too!

8) All-nighters for you.
Apart from all the usual stuff *wink* that keep them up with you all night, they are usually good at pulling all-nighters for important stuff. So, if you cannot sleep because your friend got promoted undeservedly, wake ’em up, and talk some.

9) They make good parents.
So, the daycare is not taking your kids and you have a guys/ladies-day-out? Ask your spouse to WFH (Work from Home).

10) Free computer wiz for all your needs.
This is an obvious one. Use your computer like it is never gonna break. Because when it does, help is just a flirt-talk away.

Pull a discussion from movies, comics, music, business, politics, science, technology, medical, or any other place. They usually have a point of view that is not a dumb one. They love to listen and then research on the topic and come back with more on the topic. On a bad day, they will like to criticize holes in your theories with citations. And pester you till you get teary; then guilty feeling takes over them and very soon you get a gift with an apology.

December 4, 2017

Deleting Magento Customer Address Programmatically

When upgrading Magento for one of our customers, we’ve realized somehow all the shipping information were half complete. It either had a region filled out without address or zip code. When you enter that customer’s profile and try to save it, it wouldn’t save because these are required fields. This was causing these old customers to purchase stuff from the store because they assumed their address was saved.

The best thing to do when you encounter such an issue with Magento is to clear saved addresses altogether. Our team has written a neat little script that would delete all the saved addresses given that you know their email addresses. This is easy to find out if you were to just export all customer profiles through Magento panel. Some might argue that you can do this Data Profiles Import/Export function. Unfortunately, Magento has a function to replace only if the value contains something. If you leave it blank, it wouldn’t touch that field. So you would still have the customers whose addresses are half filled with missing information.

I hope this helps someone in need 🙂

<?php
  include('app/Mage.php');
  Mage::app();  
  
  $customer_emails = array(
    "user1@example.com",
    "user2@example.com"
);
  
  foreach($customer_emails as $customer_email){
    
    echo $customer_email . "</br>";
    $customer = Mage::getModel("customer/customer");
    $customer->setWebsiteId(Mage::app()->getWebsite()->getId());
    $customer->loadByEmail($customer_email); //load customer by email id
    $customer_id = $customer->getId();
    
      echo $customer_id. "</br>";
      foreach ($customer->getAddresses() as $address)
      {
         $customerAddress[] = $address->toArray();
         
         $address->delete();
      }
      
    echo '<pre/>';print_r($customerAddress );
  }
  
  
?>

 

October 11, 2017

Get rid of .DS_Store files from GIT Repo on Mac OS X

Whether you are new to GIT repositories or an experienced developer, I am sure, at some point in using GIT, you must have come across these annoying .DS_Store files that seem to populate out of nowhere. It is a much apparent problem if you have enabled viewing hidden files.

What are they? DS_Store is a short form for Desktop Service Store that contains attributes of a folder and is created every single time a folder is navigated to. The more you navigate through your program source code, the more .DS_Store files you will end up finding. You can delete them but they will appear again.

I am okay with seeing them on my Mac but when you have an auto deployment script setup for GIT, you prefer not having these useless files on your Linux machine. We use a neat little auto deployment script which gets executed each time new updates are pushed to our repository. We have a repo for each of our business applications so it saves our developers plenty of time navigating their way through FTP programs and updating files through that.

To help address this issue, you can configure GIT globally to ignore .DS_Store files by executing this the following:

git config --global core.excludesfile ~/.gitignore

OR, if you already pushed some of these .DS_Store files, you can get rid of them from your repo in the following way. Go to the root of your app directory and execute the following command in terminal:

find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch

That will get rid of all recognition of .DS_Store in your repo. Next, add the .DS_Store to the ignore list. You can do that by simply creating a .gitignore file. Place the following in the .gitignore file at the root of your app directory.

.DS_Store

Save it as .gitignore and push the changes through. Voila! One less annoying problem to worry about 🙂 I am still giving thought towards publishing the source code for our Auto Deploy script 😉

Older Posts