Monday, December 30, 2013

BPAY payments / Customer Reference Number (CRN) generation - Luhn algorithm, mod 10 version 5 (MOD10V05)

1. BPAY payments

BPAY has become quite a comfortable and an easy online payment solution for Australian customers, more and more applications provide this option to be used. In order to start accepting BPAY payments in your application or website - you just need to make a few steps, like:
  • Register as the BPAY Biller at -> you'll get your BPAY Biller code then;
  • When your customer is willing to make a BPAY transfer - your application should generate a Customer Reference Number (CRN) programmatically (see below), or you can even generate valid CRNs manually using CRN Generator Tool (win/mac desktop app) - anyway, each CRN generated for a User can be used by him further on, although some applications/services do prefer to generate a new CRN for each new Order a User makes - both approaches are quite fine;
  • Then you should provide this pair of values to such a Customer:
    • your BPAY Biller code;
    • his CRN generated/assigned to him;
  • Then he makes a BPAY payment using these credentials - using various online banking interfaces or even mobile apps that support BPAY option;
  • You accept it on your end, then you just need to check the CRN value mentioned inside the payment details -> identify your Customer -> process the corresponding Order.

2. Customer Reference Number (CRN) generation

CRN is an identifier of a Customer within the BPAY Biller's customer base. This is a number of certain length (that is set up in advance by Biller when he gets registered), consisting of the following two parts:

  • CRN "seed" - certain numeric value that you choose, representing your Customer or an Order document inside your database. It can be your Customer or Order ID, but we recommend to avoid exposing your internal autoincremented IDs, instead - some randomized public IDs (of certain length, e.g. 12 digits) would better be used. So, for example, such a 12digits-length number is taken for this part.
  • and a Check digit has to be calculated and appended to the value above. For BPAY CRNs specifically this Check digit gets calculated based on the value above - using the Luhn algorithm, mod 10 version 5 (MOD10V05):

$seed_length = strlen($seed);
$total = 0;

// Calculate the sum of the products of "seed"'s digits with their 1-based array position numbers, accordingly
for($i = 0; $i < $seed_length; $i++) $total += $seed{$i} * ($i + 1);

// The check digit to be found - would be the the sum above mod 10
$check_digit = fmod($total, 10);

// Resulting CRN: concatenation of the "seed" value with the Check digit calculated above
$result = $seed. $check_digit;

Monday, July 15, 2013

Sierra w802s (Overdrive PRO 3G/4G) Mobile Hotspot firmware update [patched, "no update"]

So, what we have:
  • Sierra w802s (Overdrive PRO 3G/4G) Mobile Hotspot ("Sprint"-unlocked)

What we need:
  • update its firmware to 802s_patched_firmware_new_no_update.bin with the aim to:
    • stabilize its connection by getting rid of "disconnecting..."-related issues, hang-ups;
    • get rid of the issue with reconnection unability until its battery gets re-inserted;
    • and of course, avoid those insistent suggestions to upgrade firmware finally resulting into the device workability loss at all, in our case;
  • avoid "The update cannot proceed. There is a SKU version mismatch." error while updating.

Steps to go:
  • download this firmware (link above);
  • open it with any text editor, find "sku:" inside, copy it somewhere (e.g. clipboard):

  • export router settings:

  • you get "cfg.txt" this way - open this file using any text editor, find "eagle_sku" parameter, and update its value to the one we copied above ("1453010" in our case), save the file:
  • import this configuration file back into the device:

  • and now you get the ability to finally update the actual firmware:

  • the update gets started, you'll see its progress on the device's screen, and the whole process is going to take several minutes. The device gets rebooted then, and Yahooo! - you get it working with the new soft inside, no that boring "disconnecting..." constantly, no suggestions to "update your firmware" that might lead to disfunction, etc. You're all done.

To those exhausted with "SKU version mismatch" :)
Hope it helps,
Kind regards,..

Saturday, June 1, 2013

Redmine A1 theme "Issues coloring acc. to Priority" broken [fixed]

We love Redmine, and we like the A1 theme, among the rest of. But we've faced an issue with Issues coloring (acc. to Priority) broken in fresh versions of Redmine (Redmine version 2.3.1.stable, at least, but people have been reporting similar issues for a long time already, e.g. yet in Redmine 2.1.2).

The actual A1 theme is wonderful (thanks to Kirill Bezrukov @ RedmineCRM), but Redmine has changed their default enumerations (those seeded with the corresponding rake task from Redmine), specifially and at least - the actual "Issue priorities" enumeration (it's IDs have been changed), that is now looking like:
So having forked the original A1 from (v1.1.1 at that moment), we had to amend the coloring, and this is how our fixed A1 theme colors the Issues listing on Redmine version 2.3.1.stable now:

For those suffered from this "issues coloring acc. to priority" broken in Redmine's Issues listing as of Redmine versions 2.1.2-2.3.1, at least:

Tuesday, November 20, 2012

Continuous integration for a Rails-based project. Why we moved away from TravisCI in favour of CircleCI.

We've faced an issue recently with TravisCI on a Rails project, that would better be avoided next time.

Initially we've chosen TravisCI due to an easy/simple project start based on it. Although it didn't support private repos, the project was in a public repo, so that wasn't a problem. It was a real good CI solution actually.
But our app specifics made its unit tests to be rather time-consuming at that stage (http requests making and their responses usage in the tests), so TravisCI in its turn was just interrupting the tests after 25 minutes, leading to build failures of course. As it turned out, this 25 min limit was NOT configurable in Travis (it becomes important in some cases, so it's looking rather dully to have such a limitation, isn't it?), so we had to look around a bit.

CircleCI became a good replacement. Allowing the tests without that limitation - it became the solution at that stage. A very simple quick setup, a clean nice list of revisions with build statuses, and (compared to Travis) while in its beta, for now, allows private repositories for free.

By the way, later we've "eased" the tests when running on the side of CI, in the sense of time consumption - a VCR-based optimizing solution (records your test suite's HTTP interactions and replays them during future test runs for fast, deterministic, accurate tests) allowed to greatly speed them up there - by reusing the HTTP responses VCR cache generated locally and then pushed to Amazon S3 storage for sharing among the environments. So that "25min limit issue" has lost its actuality in our case. But still, CircleCI has "occupied" the status of problem solver since the previous case :)

P.S. Thanks to Paul Biggar @ CircleCI for being so attentive and quick with his help when needed.

Wednesday, November 7, 2012

GPU-accelerated video decoding for Chrome enabled

Google Chrome Blog: Longer battery life and easier website permissions...: A wise person once said, “Modern life is a constant search... for a power outlet.” With today’s new Chrome Stable release , we hope you can ...

Tuesday, November 6, 2012

Leaving MongoDB in favour of {Riak & PostgreSQL}. A real feedback from Kiip.

MongoDB is definitely a great NoSQL solution, very popular, but its mission is also clearly defined, where it's the choice and where it's not. Kiip has shared their opinion and the whole story about why they moved to {Riak & PostgreSQL partly} after a year running MongoDB in production (A Year with MongoDB). So, it's not that it was a kind of a total failure, no. The basic factors've been listed, let's summarize them briefly - both cons and pros about Mongo, based on the actual experience.

The Good

  • Schemaless 
  • Simple replication
  • Query Language
  • Full-featured Drivers for Many Languages

The Bad

  • Non-counting B-Trees
  • Poor Memory Management
  • Uncompressed field names
  • Global write lock
  • Safe off by default
  • Offline table compaction
  • Secondaries do not keep hot data in RAM

Thanks Kiip, valuable details to be considered for decisions making yet on the early stages.

Friday, July 27, 2012

Adobe Flash hangs up (freezes) the Google Chrome and Skype in Windows 7


  • OS Version: 6.1.7601. (Windows 7 Ultimate x86 Eng)
  • Google Chrome 20.0.1132.57 m
  • Adobe Flash 11.3.300.265
  • Skype

One would say that's a kind of mysticism, and this is how it looked like, but only at a glance, though.

A few regular updates of (a) Adobe Flash , (b) Google Chrome, with its Flash player included by the way, and (c) Skype during June-July, 2012 - brought some unexpected and unwanted behavior to this bunch of software pieces, they started hanging, just at the most inconvenient situations:
  • you start playing a Flash video in Chrome - it hangs up, freezes partly (only the current tab) or sometimes totally;
  • sometimes (rather often during a day indeed), during most active hours, Skype hangs up, freezes, as it's been noticed - after an attempt to play a "new message" sound, so that you can see the messages arrived being left unread regardless that you stare at them on and on, and your own messages you start typing and sending - can't be sent out just showing that progress animation against each your message. When it happens, you can even notice the sound "tick" as the failed attempt to play that.
It's been noticed as well, as a temporary workaround, that when it happens (e.g. both Skype and Chrome have hung up, frozen that way, or when one of them has) you just go and open another Chrome tab, open any flash video, it's "trying to start" during a few to ten seconds - and yahoo! - it helps, looking like it's making a kind of break-through - both Skype and Chrome are getting back live and you get some relax... until the next freeze :)

Found out that although the Flash version included into the Chrome distribution was the latest one (Chrome updates handle that), there was still the stand-alone Flash version used by IE, Skype and others - that was not the latest one. So, it's been updated to the latest non-debug one 11.3.300.265.

Some other suspects made me check a list of ideas, incl. the video hardware acceleration used by Flash, and thus some possible incompatibility with the video drivers, etc. But the system/apps logs contained nothing related, and disabling that Flash "hardware acceleration" didn't help either.

Decided to force the Chrome to use only the stand-alone Flash instance, not the one included into the Chrome distribution:

Managed to get the Chrome.exe crash report, just having tried to close it during such a freeze:

  A problem caused this program to stop interacting with Windows.
Problem signature:
  Problem Event Name: AppHangXProcB1
  Application Name: chrome.exe
  Application Version: 20.0.1132.57
  Application Timestamp: 4ffb8830
  Hang Signature: 2eb7
  Hang Type: 160
  Waiting on Application Name: svchost.exe:AudioClientRpc
  Waiting on Application Version:
  OS Version: 6.1.7601.
  Locale ID: 1058
  Additional Hang Signature 1: 2eb7a648a00def5e39335df086248eb6
  Additional Hang Signature 2: 34d2
  Additional Hang Signature 3: 34d2997c9a2e6209300a7c0c69298b8a
  Additional Hang Signature 4: 2eb7
  Additional Hang Signature 5: 2eb7a648a00def5e39335df086248eb6
  Additional Hang Signature 6: 34d2
  Additional Hang Signature 7: 34d2997c9a2e6209300a7c0c69298b8a

Oh, that "svchost.exe:AudioClientRpc" has brought some piece of hope indeed. Has checked whether the sound drivers are the latest, went into its advanced properties with the suspect of some sound drivers incompatibilities, trying to simplify the sound device usage, turning off various effects one by one - finally faced the reason and the solution. It was the system-wide "Equalizer" on-the-fly enhancement provided by the sound drivers, it turned to be the reason why various applications were hanging trying to communicate with the audio device.


  • PlayBack Devices -> Speakers -> Properties -> Enhancements -> "Disable all sound effects" checkbox should be turned ON, that solves this problem in this specific case.
Considering the wide variety of Flash-related crashes, issues, feezes in various OSs like Windows, Linux (specifically Ubuntu), OS X reported recently, the updates from Adobe would be highly appreciated.

In the mean time, looking forward and thanks in advance,