20141125

A modern day blog engine?

This blog will now probably continue here. I'm not sure I'm up to putting any effort in transferring the  old posts.

20141013

Bash Contexts Cont. (for those still bashing)

To iterate on my olde poste mines!: bash contexts about directory-specific shell scripts — via local ./.bashrc's and the following line at the end of ~/.bashrc So, to make this technique complete (and to support login shells starting from non-home directories, like with Terminal.app's Resume), you must also add the following line at the beginning of ~/.profile

20140605

pow and byebug - staying in the web app dev env heaven: an update for ruby 2.1

The previous version (for ruby 1.9) is here.

It seems ruby-debug has fallen out of favour with the community and the replacement is byebug.
So here's my follow-up on the old post.

The steps to enable byebugging in your app dev env:
  1. echo export POW_WORKERS=1 >> ~/.powconfig  # make sure pow runs only one app process — globally
  2. cd <your project directory>
  3. Add byebug to your bundle (and remove ruby-debug if exists).
  4. Paste the following snippet at the end of your config/environments/development.rb — for rails, or in the appropriate development environment initialisation module — for the platform of your choice:
  5. echo export RUBY_DEBUG_PORT=10007 >> .powenv  # make sure we enable debugging with a machine-unique port, e.g. 10007 (you should pick different ports for different projects)
  6. touch tmp/restart.txtThen make any request to actually restart your server.
  7. byebug -R localhost:10007 -d  # you're back in business, go wild with debugger's in your code

20140422

A Nice Support Chat -or- Skype R.I.P., Goodbye M$kype

(a chat with their support after they've silently failed to take my money almost three weeks ago leaving my credit very low)

info: at 15:35:57
Please wait for an agent to respond. You are currently '1' in the queue.

info: at 15:35:58
Privacy Statement
You are now chatting with 'Rose Ann S'.

Costa Shapiro: at 15:36:09
Hi Rose Ann

Rose Ann S: at 15:36:11
Hello! Welcome to Skype Live Support! My name is Rose.

Rose Ann S: at 15:36:11
In case we get disconnected, simply click on the Chat Support Link and you will be reconnected to us in no time.

Rose Ann S: at 15:36:11
https://support.skype.com/support_selection .

Rose Ann S: at 15:36:11
With that being said, how may I help you?

Costa Shapiro: at 15:36:26
My payment is pending

Rose Ann S: at 15:36:33
Oh my!

Rose Ann S: at 15:36:51
I understand your having issue with your payment,

Costa Shapiro: at 15:36:59
Yes, can you check it?

Rose Ann S: at 15:36:58
Let me check it here for you.

Costa Shapiro: at 15:37:03
thx

Rose Ann S: at 15:37:08
Sure!

Rose Ann S: at 15:37:09
To make sure I am pulling up the right account may I have your Skype name?

Costa Shapiro: at 15:37:54
xxxxxxxx

Rose Ann S: at 15:38:04
Thank you! May I also know your first name so I can address you properly?

Costa Shapiro: at 15:38:31
Costa

Rose Ann S: at 15:38:38
Thank you Costa.

Rose Ann S: at 15:38:43
It's nice to meet you.

Rose Ann S: at 15:38:52
I am now checking your account here.

Rose Ann S: at 15:39:05
May I know the last 4 digits of your credit card?

Costa Shapiro: at 15:39:15
XXXX

Rose Ann S: at 15:39:15
Just for me to double check it here on my end.

Rose Ann S: at 15:39:19
Thank you.

Rose Ann S: at 15:39:48
I can see here that the status of your card is CREATED.

Rose Ann S: at 15:40:09
What I can advice it I will cancel it here then please try to purchase again.

Rose Ann S: at 15:40:26
Your credit card is not yet active in our end.

Rose Ann S: at 15:40:40
Is it okay with you if I cancel it here?

Costa Shapiro: at 15:40:53
Why?

Rose Ann S: at 15:41:14
As I checked, it is not yet active in our end.

Rose Ann S: at 15:41:41
Just to avoid confusion on our system, we need to delete the info again, then put it back.

Costa Shapiro: at 15:41:47
What does it mean, not active?

Rose Ann S: at 15:41:59
Okay.

Rose Ann S: at 15:42:27
There still no autorization for you to purchase using your credit card since it is not yet active on our end.

Costa Shapiro: at 15:42:35
Your system gets confused by credit cards?

Rose Ann S: at 15:42:53
Yes.

Costa Shapiro: at 15:43:06
Why?

Rose Ann S: at 15:43:23
Because you enter it already.

Costa Shapiro: at 15:43:38
So, if I make the payment again, there's a chance of the system getting confused again, right?

Rose Ann S: at 15:43:49
But it is not yet activated, that is why we need to cancel it and put it back again.

Rose Ann S: at 15:44:22
That is why we need to try, then lets see what will happen.

Rose Ann S: at 15:44:42
Rest assure that once we try to purchase again, it will be successful.

Costa Shapiro: at 15:44:51
You know, this is a funny talk.

Costa Shapiro: at 15:45:20
Your system has a bug and you're trying to make me help you debug it, right?

Rose Ann S: at 15:45:32
No.

Costa Shapiro: at 15:45:47
So how do you know it will be successful?

Rose Ann S: at 15:46:02
What I am saying is, your payment details is not yet active on our end.

Costa Shapiro: at 15:46:21
Has there been a bug that has been fixed?

Rose Ann S: at 15:46:34
What we need to do is purchase again, then put back your payment details.

Costa Shapiro: at 15:46:40
On my end, the card is perfectly active, you know.

Rose Ann S: at 15:46:59
I can say that this is not a bug issue.

Rose Ann S: at 15:47:02
Alright.

Rose Ann S: at 15:47:19
Then please try to purchase again.

Rose Ann S: at 15:47:31
I am sure it will go through on your end.

Costa Shapiro: at 15:48:07
Please help me understand. I make a lot of internet purchases. I've never been told "your card is not active on our end, and this is not a bug".

Costa Shapiro: at 15:48:19
Is this the intended behaviour of your system?

Costa Shapiro: at 15:48:26
If not, it's a bug.

Rose Ann S: at 15:48:36
Let me explain it to you.

Rose Ann S: at 15:48:47
Is that okay with you?

Costa Shapiro: at 15:49:06
If this is a bug, so either you cannot be sure it will work this time, or it has been fixed, correct?

Costa Shapiro: at 15:49:19
Yes, please explain. Your logic kinda eludes me.

Rose Ann S: at 15:49:45
As I said it is not a bug issue. Please give me a minute to explain what I can see on your account.

Rose Ann S: at 15:49:48
Thank you!

Rose Ann S: at 15:51:36
As I checked, the reason why your purchase did not go through is because, your payment details is not yet active on our end, I can see that you purchase Skype credit on your account last April 3,2014. But it still Pending on your end right?

Rose Ann S: at 15:51:51
Nothing to worry, it will never be push through.

Rose Ann S: at 15:52:29
Since your payment details is not yet authorize to purchase.

Costa Shapiro: at 15:53:08
Who authorises my details for purchases?

Rose Ann S: at 15:53:20
You're bank.

Costa Shapiro: at 15:53:52
So my bank did not authorise the transaction, is that what you're saying?

Rose Ann S: at 15:54:21
So what you need to do is contact your bank, then inform them to authorise your transaction with Skype for it to be DELIVERED on your end.

Rose Ann S: at 15:54:25
Yes.

Costa Shapiro: at 15:55:14
Ok, it's a bit different version of what you've said earlier. And it makes sense this time.

Rose Ann S: at 15:55:25
I see.

Rose Ann S: at 15:55:32
Sorry for the confussion.

Rose Ann S: at 15:56:15
The best thing to do is contact your bank now, then rest assure that you will be able to purchase a credit.

Costa Shapiro: at 15:56:22
You are still sure if we delete my details and make another payment attempt, it will go through, right?

Rose Ann S: at 15:57:33
We just want to try to repurchase again, but if it wont work, you really need to contact your bank.

Costa Shapiro: at 15:58:18
I see, so you're not so sure as you were just 5 minutes ago.

Rose Ann S: at 15:58:45
Alright.

Rose Ann S: at 15:58:50
Sorry about that.

Costa Shapiro: at 15:59:04
I'm calling my bank, do you have any transaction id I can give to them?

Rose Ann S: at 15:59:21
It's just that we want to try first other option.

Rose Ann S: at 15:59:24
Alright.

Rose Ann S: at 15:59:50
Here is your reference number about this conversation 1243782898.

Costa Shapiro: at 16:00:04
(I hope they will help me fast enough, because I'm in another country and my Skype credit is extremely low)

Rose Ann S: at 16:00:27
I understand that.

Rose Ann S: at 16:00:50
Do worry once your bank authorise your payment, you will be able to purchase a credit.

Rose Ann S: at 16:01:59
All you need to do is inform your bank that you want to authorise your payment with Skype. Then just to make sure, plase wait within 1 hour then purchase again.

Rose Ann S: at 16:03:45
Is there anything else I can assist you with today?

Rose Ann S: at 16:04:15
Are we still connected Costa?

Costa Shapiro: at 16:05:05
yes, I'm with my credit card company

Rose Ann S: at 16:05:15
Alright.

Rose Ann S: at 16:06:03
Please let me know once your done talking to your bank.

Rose Ann S: at 16:06:06
Thank you!

Costa Shapiro: at 16:08:33
Ok, they said they didn't see any transaction.

Rose Ann S: at 16:09:01
Yes, beacuse your card is not yet authorise to purchase.

Costa Shapiro: at 16:09:25
...from you. No failed transactions at all. And I had a lot of transactions this month.

Costa Shapiro: at 16:09:35
Look, let me explain.

Rose Ann S: at 16:09:44
Okay.

Costa Shapiro: at 16:10:54
How credit card works: I give the number, you charge the money.

Rose Ann S: at 16:11:08
Alright.

Costa Shapiro: at 16:11:15
If a transaction fails, it's either on my bank's end or on your end.

Costa Shapiro: at 16:11:23
I've just cleared my end.

Rose Ann S: at 16:11:29
Okay.

Costa Shapiro: at 16:12:10
Your internal statuses are of no interest to me. You're just wasting my time while I've been a paying customer for a long time.

Costa Shapiro: at 16:12:16
Right?

Rose Ann S: at 16:12:29
Alright.

Rose Ann S: at 16:12:49
Thank you for your effort contacting your bank about this.

Rose Ann S: at 16:14:34
It's just that it is different from Skype, since it is the first time you will use your card XXX, Skype will still need the authorization from your bank for any transaction you will made to us.

Rose Ann S: at 16:15:13
Even if you enter your payment details, we still need the authorisation from your bank for your purchase to be DELIVERED.

Costa Shapiro: at 16:16:39
But your system doesn't seem to have made the transaction.

Costa Shapiro: at 16:16:57
Since my credit company didn't see it.

Costa Shapiro: at 16:17:03
So, what gives?

Rose Ann S: at 16:17:14
Alright.

Rose Ann S: at 16:18:54
Since I can see here all your transaction made with Skype that is not been DELIVERED due to the reason that your payment method is not yet authorise, that is why they cannot see it on their end.

Costa Shapiro: at 16:19:00
I've just looked through my purchase history. Gosh, I've paid 100s of ££ to you...

Rose Ann S: at 16:19:17
But on Skype I can say that we process your purchase request.

Costa Shapiro: at 16:19:54
You know, within this period there were no such problems, this is probably the fourth credit card that I'm using with Skype.

Rose Ann S: at 16:20:09
I see.

Costa Shapiro: at 16:20:22
Who authorises the payment methods? Rose Ann S: at 16:20:53
You need to ask for the authorisation on your bank.

Costa Shapiro: at 16:21:15
You told me it was my bank, well it isn't — they have nothing to authorise — they have no pending transaction on their end.

Costa Shapiro: at 16:21:19
Then who?

Rose Ann S: at 16:21:28
Then once they authorise the payment, you can purchase Skype credit on your Skype account.

Costa Shapiro: at 16:21:51
Please try to understand what I wrote right above.

Rose Ann S: at 16:22:07
I understand it Costa.

Costa Shapiro: at 16:22:35
So, what I should tell my bank to authorise now?

Rose Ann S: at 16:23:00
Agian, the reason why they cannot see the transaction you made is because your payment method is not yet authorise to purchase.

Costa Shapiro: at 16:23:57
Why it is not authorised?

Rose Ann S: at 16:24:14
So even if you make a purchase with us, your bank will not see it because your card is not yet allowed to make a purchase.

Costa Shapiro: at 16:24:38
So I cannot make a purchase with you, right?

Rose Ann S: at 16:25:00
You can if your bank will authorise the payment.

Costa Shapiro: at 16:25:25
But they will not see it since the card is not authorised, right?

Costa Shapiro: at 16:26:05
So they must authorise the payment they don't see, right?

Rose Ann S: at 16:26:19
That is why I ask you to call your bank and inform them that you want to authorise your payment with Skype.

Rose Ann S: at 16:26:31
Your bank is the one deciding to authorize the card or not. Please call them back, and let them know that we need a permission to use this card for Skype purchases.

Costa Shapiro: at 16:26:47
That's what I did. And they said they see no transaction from you.

Costa Shapiro: at 16:27:34
They authorise me to make payments to whoever I want. That's the idea of credit cards.

Rose Ann S: at 16:27:45
Can you please try to purchase now?

Costa Shapiro: at 16:27:59
Why?

Rose Ann S: at 16:28:00
Then let's see if they authorise your card already.

Costa Shapiro: at 16:28:15
They did nothing, I've just talked to them.

Rose Ann S: at 16:28:22
To make sure that your credit card is already authorise to make payment to Skype.

Costa Shapiro: at 16:28:28
They can only authorise transactions they see.

Rose Ann S: at 16:28:29
Okay.

Costa Shapiro: at 16:29:00
My card is authorised to make payments to any business in the world.

Rose Ann S: at 16:29:02
They need to authorise your card.

Rose Ann S: at 16:29:28
Not your transaction made.

Costa Shapiro: at 16:29:34
Nope, my card is authorised to any payments the moment I have it.

Rose Ann S: at 16:29:43
Okay.

Rose Ann S: at 16:30:09
Then make a purchase for Skype credit on your account.

Costa Shapiro: at 16:30:23
That is international Platinum MaserCard I've been using for many years.

Rose Ann S: at 16:31:26
As you said, it is authorise to make purchase, what I can advise is purchase for Skype credit, then I will check it here on my end if it will be DELIVERED.

Costa Shapiro: at 16:31:38
Plus, I've just been talking to the credit card company and they told me I have no problem paying to any company, including Skype... Sorry, Microsoft.

Rose Ann S: at 16:31:52
Okay.

Costa Shapiro: at 16:32:46
I'm saying it's always been authorised, the credit company or bank did not do any action today.

Rose Ann S: at 16:33:04
Okay.

Costa Shapiro: at 16:33:17
So there will be no difference on my end. Will be any difference on your end?

Rose Ann S: at 16:34:21
You need to make a purchase first then let see if there will be a difference on your first purchase.

Costa Shapiro: at 16:35:28
So, you're positive your system has no bugs, but you're not sure what it will do if we try again, right?

Rose Ann S: at 16:35:52
Beacuse it is really not a bug issue.

Rose Ann S: at 16:37:00
Believe me, your not the only person, we ask to authorise first their payment method to make a purchase to Skype.

Costa Shapiro: at 16:38:06
How do you want me to authorise my "first" payment?

Rose Ann S: at 16:38:35
As I said, all you need to do is contact your bank.

Rose Ann S: at 16:38:52
Then as them to authorise your card for your purchase.

Costa Shapiro: at 16:39:58
I just did, what they said was that they had seen no transaction from you and that my card has always been authorised to any payments in the world. What's next?

Rose Ann S: at 16:40:17
Okay.

Costa Shapiro: at 16:42:31
Well I think it's not Okay, I think I've just had enough, I'm taking my money somewhere else, I've heard Rebtel has some nice software.

Costa Shapiro: at 16:42:35
Cheery bye.

Rose Ann S: at 16:42:43
Actually the buttom line here is you need to contact your bank then inform them to authorise your payment with us not the transaction you made. You're credit card I mean.

Rose Ann S: at 16:43:02
Alright.

Costa Shapiro: at 16:43:14
All the best to you and to Microsoft.

Rose Ann S: at 16:43:25
Thank you for your time chatting with me.

Rose Ann S: at 16:43:47
In the future you can also find answers to any common issue and questions at support.skype.com

Rose Ann S: at 16:43:57
It’s been a pleasure assisting you today.

Rose Ann S: at 16:44:03
Good bye for now.

Rose Ann S: at 16:44:07
Take care!

info: at 16:44:17
Chat session has been terminated by the agent.

20140330

mail_view for human — and also for automatic — testing

I've come to use a nice gem called mail_view for visual testing of email templates in Rails.
I think it is totally legit and desirable to re-use that code in the views testing suite, so here we go:
(provided that your MailView's subclass is MailPreview, put this in ./spec/views/mail_spec.rb)

This just checks for the lack of exceptions and any content, but it's a starting point.

p.s. A nice complementary pull request of mine is here.

20140122

The ruby hint of the day: Hash#fetch

Use hash.fetch(key) instead of hash[key] whenever your Hash is constant and you expect the key to be one of the hash keys — it will raise an exception if not found. Early bug detection you see.

20140116

I18n testing outfit for Rails 3.2 (also Rails 4.0-stable)

Now put this in config/initializers/i18n_test.rb and spec it!

N.B. Curiously enough, a similar technique is needed for 4.0 as well.

P.S. Tested and working with Rails 4.0-stable, yay!