The secret of deleting contacts from Constant Contact

September 10th, 2014

You can’t really. An e-mail address in your Constant Contact account tells about your relationship with its owner, the contact. If a recipient becomes fed up with your newsletters and unsubscribes, this information must stick. You must not be allowed to simply delete the address and start over, pretending that nothing has happened.

When you “delete” an e-mail address or a contact using the CtCt website (called GUI) it’s actually only hidden, remaining in the database. It no longer counts towards your quota so for all practical purposes, we can call it deleted. Now, how do you do that with API?

Read the rest of this entry »

Paginating in Constant Contact API

August 30th, 2014

Some services of Constant Contact API return only a subset of results and you’re supposed to submit additional requests with a “next” parameter to fetch more. The implementation isn’t exactly straight forward though, and for some reason, CtCt doesn’t provide any pagination code sample. So here it is, for getContactsFromList().
Read the rest of this entry »

Access denied in mysqldump after ip address change

July 17th, 2014

This one was a real hard nut to crack. My workstation ip address has changed and I could no longer connect to my MySQL server remotely. So far nothing new or interesting. I went to cPanel and added my new ip address to “Remote MySQL” – a list of ip addresses that are allowed to access the database server remotely. Being a cautious person, I also removed my old ip address while I was there.

So now I could connect remotely both from my IDE (via JDBC) and from my local mysql client but to my surprise, I was still getting access denied from mysqldump. Mhm…
Read the rest of this entry »

Tired of template undefined field warnings in PhpStorm?

May 13th, 2014

Code inspection is an awesome feature of PhpStorm. Remember the #gotofail SSL Security Bug? Wouldn’t happen to you with PhpStorm because it warns about unreachable statements. And a lot more.

If however, you get too many warnings, you stop paying attention to them. Especially if you know they’re bogus. One of them is the undefined field warning for template variable assignments in Nette presenter.

Seen this a million times?

Referenced field is not found in subject class.
Note: Check is not performed on objects of type “stdClass” or derived.

Read the rest of this entry »

Human join / implode helper

December 11th, 2013

Did you notice that when humans list items, they use a different glue for the last item?
“Who was there?” “Tom, Bob and Jane.”

Here’s a Nette helper that does the same.

  1.  
  2. public function humanJoin($pieces, $glue = ‘, ‘, $lastGlue = ‘ and ‘)
  3. {
  4.   if (empty($pieces)) {
  5.     return null;
  6.   }
  7.  
  8.   if (count($pieces) == 1) {
  9.     return array_shift($pieces);
  10.   }
  11.  
  12.   $lastItem = array_pop($pieces);
  13.   return join($glue, $pieces) . $lastGlue . $lastItem;
  14. }
  15.  

Use as {$friends|humanJoin} or {$aliens|humanJoin:’, ‘:’ nor ‘}.