Tuesday, May 27, 2014

Handy sed command to replace PHP error_reporting

With the new PHP 5.5.9 packaged with Ubuntu 14 I ended up with lots of "Standards Warnings" from PHP, since error_reporting(E_ALL) now includes this. So I wrote a quick one to replace it in every file in the current directory as well as in subdirectories:

find ./ -type f -exec sed -i -e 's/error_reporting(E_ALL);/error_reporting(E_ALL \& ~E_STRICT \& ~E_DEPRECATED);/g' {} \;

Works like a charm!

Wednesday, February 19, 2014

Mr. Selfridge

I've been watching this excellent show (since 'The Paradise' is on hold for now) about the life and times of Harry Gordon Selfridge and the department store (Selfridge & Co) that he started in 1909.

I was, however, very interested to see how much of it was manufactured and how much is based on actual truth, so I started looking around online and found this article with a bit of background on the real Mr. Selfridge. It seems the show isn't far off, although I would like to know if they are going to continue with the story and cover his whole life up to his death in 1947.

Apparently the real Mr. Selfridge died a penniless man who was mistaken more than once for being a homeless vagrant, since he actually lost the store during a later time period in his life.

The real Harry Gordon Selfridge


If so I think the best is still to come, I'm still on Season one!

Block whole countries via .htaccess on Ubuntu

Found a very handy tool today to generate .htaccess files if you have problems and wish to block certain countries from your site.

Just go visit IncrediBILL's HTACCESS TOOLS. Choose your countries you wish to block and copy/paste it directly into your .htaccess file. Easy as that.

Thanks for the handy tool Bill!

Thursday, December 12, 2013

Capitec FAIL

I just posted (IMHO) a very valid question on the Capitec Facebook page, which was summarily deleted (very good PR, that):


My bond originator just sent me this message:

'Please advise whether you have cash available for a deposit OR do you have facilities (savings/CreditCard/ Car Finance) at any other bank? (Where an applicant does not have a banking relationship at any of the major banks (ABSA, STANDARD, FNB and NEDBANK) they are loathe to offer the client a 100% bond.)'

This nonsense has to stop as, according to Fin24 Capitec market share overtook that of Nedbank in May already.
I was just wondering if Capitec has any plans to address this perception in the marketplace that it is not a 'real' bank?

EDIT: It seems the post is auto-moved to 'recent posts', so that is an error on my part. Capitec has responded with: "Hi Ruan, thank you for your concern. Our Marketing Team will be informed of this.".

Thursday, October 17, 2013

IOS 7 + Cordova (Phonegap) issues and crashes

I tracked down two issues so far when creating Cordova apps for IOS 7 - so I thought I will mention it here.

1) If your IOS app contains divs that do not refresh until you start scrolling them - the problem is most likely this. A fix is outlined on that site but I've found in my case it worked better coupled with a Javascript settimeout() to make sure the screen elements are done rendering before applying the new z-index.

2) If your app just crashes but runs fine on IOS5 and 6 - the very first thing I'd recommend doing is check your CSS. This CSS will consistently crash both Safari and your Phonegap app on IOS 7.0.2, but works fine in IOS5 and 6:

.m-ui-checkbox input, .m-ui-radio input {
width: 0px !important;
height: 0px !important;
}


I realise that this CSS doesn't really make sense, (one would rather use display:none !important; in this case), but nonetheless it should not crash the browser.

Hope it helps someone out there.

Saturday, June 15, 2013

TIL: Reddit is worthwhile

I've seen so many tourists coming to SA unprepared. Use Reddit /r/southafria or /r/capetown. Helpful people there. Although not many people - a good crowd.

Thursday, May 30, 2013

Prestashop: First impressions

Today I decided to install an open-source e-commerce system called Prestashop.

Having played with JigoShop and WooCommerce and finding these WordPress plugins a bit lacking in their functionality I wanted to try something more dedicated towards ecommerce itself and less 'bloggy', but at the same time I figured that Magento would be complete overkill.

Online research told me that Prestashop is very well known and in widespread use (especially in Europe) so it seemed like a solid middle of the road option.

Some stuff I learned:

1) Prestashop and Varnish doesn't mix. (They do some weird XHR file upload thing that effectively prevents you from uploading product pictures into PS if you're running the default varnish setup). After a while of fiddling around with their code I decided to just turn off varnish for the site.

2) Prestashop (like wordpress) supports multi-sites running off one back-end - so you can have multiple shops, each with its own configuration. This is a very good feature.

3) The user management (rights and such) is awesome. You can create, for instance, a user who can only change products for only a certain shop and do nothing else.

4) They have a built-in API.

5) With the version I've got (1.5.4) - only the default theme seems to work. Now this seems CRAZY right? I mean there are hundreds of themes out there - but if you apply any of them your product images all end up as question marks. I will have to look through the code to see what is going on but this has been documented/bug reported by a LOT of people so I don't think it is me doing anything wrong - first two examples from google:

http://forge.prestashop.com/browse/PSCFV-8182
http://forge.prestashop.com/browse/PSCFI-2459

None of their 'fixes' do anything useful. So far this is the most irritating bit of this awesome piece of free software.

Tuesday, April 16, 2013

Reverting back to XBMC Eden

Been having loads of problems with the new XBMC 'Frodo' 12.1 release. So much so that I finally had to give up and revert back to 'Eden'. I don't understand how the so-called 'upgraded' version has so many bugs.

The main issues I experienced are:

1) the skipping of whole series when scanning that the previous version used to find
2) only finding the name and not the episode descriptions that the previous version used to find
3) crazy looooong delays before showing the thumbnails for each film and/or episode you hover over.

In the end this just makes it impractical to use.

Luckily there are still copies of the old XMBC available (click here for Windows and here for Mac)

Seriously hoping these bugs will be sorted out soon as I really like the simpler interface.

Monday, March 11, 2013

Application Craft and Unity

I've lately had a a lot of requests from clients who want to see 'real 3D' in their apps. To me, this means a FPS controller where they can walk through a real-time rendered scene without any stutter or waiting for anything to render and above all, it must look very very good.

This presents problems if you are using HTML5/JS/Cordova since IOS does not support WebGL (well, technically Safari does, but it is disabled up to the current version of IOS6).

Enter Unity3D.

I decided to investigate the possibility of using Application Craft to build an app, then linking it to a native Unity3D project.

Now this is not something anybody has done before, so I am (yet again) heading head-first into completely unknown territory here. I know that IOS jails apps, so one can't launch another, but there *is* an exception few people consider when they attempt something like this.

Ever opened a CAD drawing or a PDF on your Ipad? How come those apps launch? That was what tickled my imagination and I did some research on the topic. Apparently you *can* launch a different app after all, comms between your app and the other one seems to be a problem though.

You can pass stuff through, since it is URL based, but passing things back might (I am still looking into this) be an issue. The idea seems to be that you invent your own URL type, i.e. pic://whatever and register pic:// as handled by application X, which is your unity client. The nice thing about this is that you can then pass GET params like normal pic://some.3d.scene.rendering.app?manufacturerID=someID.

My idea is to:

1) Create a decent world in unity (well, this would actually be done by our 3D girl, Riana) - DONE
2) Hook up the FBX scene to our existing product catalogue with C# or JS by downloading in real-time options for textures and presenting the user with an interface to select them - DONE
3) Applying the selected texture to an object in the scene in a way that makes sense (no stretching etc atm it is still stretching the entire texture over the whole object)
4) And letting the controlling Application Craft app know what the user selected (the difficult, if not impossible bit).

I would also like to eventually enable the user to swap out certain objects in the scene (can already do this, but the sizing/textures of the models throw everything out) that are pre-sized and will fit into a specific spot in realtime. But for now, textures will suffice and they are working.

Needless to say this is not an easy project.

I am bargaining on a bit of help from the friendly AC staff :), but I will have to get it done one way or another if I want to deliver what my customers need.

My next step is to create a PhotoSwiper in AC with a bunch of photos and whatever photo you choose acts as the texture for a spinning cube in the Unity app.

If that works one-way comms is solved, then I just need to look into returning selected values.

Friday, February 15, 2013

Another mouse down the drain

Bought a wireless mouse from CNA less than two months ago and besides the fact that it burned through 4x AA Duracells in that time, it has now completely stopped working. Will see what their return policy is when I take it back today. As with most companies in SA I presume this is going to be a bit of a battle again.

Tuesday, January 29, 2013

Configuring R1Soft CDP client on Debian/Ubuntu

If you need to quickly set up a server to be backed up by Idera CDP3 - here's a quick rundown of exactly what you need to do. Run everything as root or use sudo.

Add the Idera repo:
echo deb http://repo.r1soft.com/apt stable main >> /etc/apt/sources.list
Get the key:
wget http://repo.r1soft.com/r1soft.asc
Add the key:
apt-key add r1soft.asc
Update from the new sources:
apt-get update
Install the new enterprise client:
apt-get install r1soft-cdp-enterprise-agent
Test connectivity to server:
r1soft-setup --test-connection
Install kernel headers:
apt-get install linux-headers-$(uname -r)
Get the module:
r1soft-setup --get-module
Add the server key:
r1soft-setup --get-key [Server_URL]
Restart the client:
/etc/init.d/cdp-agent restart

Thursday, December 20, 2012

Handy unix find command


find / \( -perm -4000 -fprintf /root/suid.txt '%#m %u %p\n' \) , \
\( -size +100M -fprintf /root/big.txt '%-10s %p\n' \)


Runs through whole filesystem, finding all large files and all suid files - and listing them in two files called /root/suid.txt and /root/big.txt. Very handy.

Sunday, November 25, 2012

Some interesting comments about the Afrikaner people

"Give me 20 divisions American soldiers and I will breach Europe. Give me 15 consisting of Englishmen, and I will advance to the borders of Berlin. Give me two divisions of those marvellous fighting Boers (Meaning Farmer, originating from the Boer War) and I will remove Germany from the face of the earth."
Field Marshal Bernard L. Montgomery, Commander of the Allied forces during WWII.

"The Americans fight for a free world, the English mostly for honour and glory and medals, the French and Canadians decide too late that they have to participate. The Italians are too scared to fight; the Russians have no choice. The Germans for the Fatherland. The Boers? Those sons of bitches fight for the hell of it."
American General, George "Guts and Glory" Patton

"Take a community of Dutchmen of the type of those who defended themselves for fifty years against all the power of Spain at a time when Spain was the greatest power in the world. Intermix with them a strain of those inflexible French Huguenots, who gave up their name and left their country forever at the time of the revocation of the Edict of Nantes. The product must obviously be one of the most rugged, virile, unconquerable races ever seen upon the face of the earth. Take these formidable people and train them for seven generations in constant warfare against savage men and ferocious beasts, in circumstances in which no weakling could survive; place them so that they acquire skill with weapons and in horsemanship, give them a country which is eminently suited to the tactics of the huntsman, the marksman and the rider. Then, finally, put a fine temper upon their military qualities by a dour fatalistic Old Testament religion and an ardent and consuming patriotism. Combine all these qualities and all these impulses in one individual and you have the modern Boer."
Sir Arthur Conan Doyle

Monday, November 12, 2012

Google Day South Africa

I was fortunate enough to get invited to the Google Day today at the V&A Waterfront (g|south africa).
I loved the touch tables, one of the Googlers recommended that I build my own out of a normal table and a touch-screen TV. Interesting idea.
Here's our new site running on the table:
The most impressive of all the demos I've seen today was the Chrome Web Lab experiment where you can have your photo taken with your webcam and a robot in London draws your face in sand and sends a video back to you. If you would like to try it for yourself head on over to Chrome Web Lab for this and other interesting experiments.

Friday, September 14, 2012

Application Craft interview/case study

The guys from Application Craft did a short interview with me about my work on their platform and did a case study on our company as well.

Check it out here - (click on 'Read the case study' under NDTec for the PDF).

I must say that this platform is maturing rapidly. I would not be surprised if it becomes the premier HTML5 cross-platform RAD app tool on the web.

They've been working so hard to please every single request from every single possible customer and they did it all long before they even started charging.

I respect that - I am not affiliated with the company in any way, so what I post here is just my honest opinion as a developer that's been using this platform for more than a year now. I am promoting them because I honestly believe that this company is breaking new ground in the industry. Most important of all, they're going about it the right way.

You want to make cross-platform apps? Forget about the rest and go AC.


Monday, August 13, 2012

So-verby lapa in Dwarskersbos burns down

Just heard that the So-Verby Lapa in Dwarskersbos burnt to the ground last night.

Very sad news indeed, spent many a good afternoon/evening there!

Will update as I hear more news.