Page 1 of 10 in the Programming category Next Page
# Sunday, 29 June 2014

I was working on a test game using Unity3D v4.5 when I bumped into a few quirks here are some quick notes so you don't need to scratch your head like I did.

How Do I Get Rid Of 'Developement Build' Text?


One of the strangest thing is the word developement text that's constantly hovering on the lower right corner of your game EVEN if you set Unity to NOT build a developement build, even if you compiled your Windows Phone app in RELEASE mode. The fix was simple enough, you set the build configuration to MASTER mode.


I did a quick scan of the build settings but I couldn't find any difference between Release and Master but it works interestingly enough.

Why Is The Windows 8.1 Visual Studio Project Meant For ARM Processors?

Trying to run the Windows 8.1 (and possibly the Windows 8.0 one as well) Store project built by Unity will give you this error

Error : DEP0700 : Registration of the app failed. Windows cannot install package SappyUnity because the package requires architecture ARM, but this computer has architecture x64. (0x80073cf3)   

For those of you unfamiliar with the ARM term, that's the processor used in devices like Windows Phone, iOS, Android and also Windows RT based devices. The processor you are running Visual Studio and Windows on is x86 so you'll need to do a quick switch so you can run and debug the app on your local machine.

Select Build-> Configuration Manager


Then in the configuration screen that appears, select x86 from the drop down on the top right.


Note that you also have to change the configuration to Master to remove the "Development Build" text from the screen. And also when you're building for the Windows Store you need to build BOTH an x86 and an ARM version so that you can have the widest potential audience coverage.

Lock Your Windows 8.1 App Orientation

By default the generator Windows Store app by Unity doesn't lock your app to a preferred orientation, so do remember to open up your Package.appxmanifest file and lock your app to landscape or portrait orientation depending on your requirements.



It's soooooo easy to make games in Unity, you drag some objects onto the scene, you attach some behaviours, press the RUN button a few times to debug your game. And all is good! Then something causes Unity to crash, you restart Unity and you find yourself staring at a BLANK SCENE!!! But all your assets like scripts, prefabs, etc. etc. are all ok.

This is because unlike working in a compiled system like Visual Studio, work files such as opened scene files aren't saved in Unity when you hit the RUN button.

So do remember to SAVE OFTEN!!! Lest you lose ALL of your work because of some accident!

Sunday, 29 June 2014 09:52:50 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Tuesday, 10 June 2014

After making a free app like my M2 Sony Camera Remote app sometimes as a developer even though it's free. It'd be nice if there was some avenue for getting paid by our users if they so wish to show their appreciation.

Some of you might say that a good way is to use In App Ads, but I really hate the ad systems that are out there which most people use especially on games that my son plays on the phone or iPod touch. Frequently you see many inappropriate, non family friendly ads.

So, to that end, I resort to using the In App Purchasing system offered to me by the Windows Store. And here's the presentation and sample code which I did on Malaysia's //Publish/ day event.

Check it out here.

Tuesday, 10 June 2014 23:38:43 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Saturday, 05 April 2014

I was recently pointed to the article "10 Very Good Reason To Stop Using Javascript" It sure sounds like link bait to me, but I do think about some of the things so why not? Here's goes a reponse to each of their reasons

1. Javascript Hurts Your Mobile Visitors

This is quite true I suppose, I always have this nagging worry about the whole Single Page Application (SPA) website design which everyone seems to use to be cool. My worry is that a web browser's Javascript virtual machine isn't meant to be running for extended periods, and staying on the same page constantly manipulating elements would just drive it insane. A good example is of course.. the Facebook website, leave it open long enough and depending on your feed you should see your web browser start eating up a ton of resources.

But then again, some of this is just probably caused by bad code and design, so when done right, this is obviously not an issue. After all, if someone had to write 10,000 lines of Javascript to get a page to work, it might mean that he would need 10,000 lines of HTML to get a page to work without Javascript, so where would we be at then?

2. Javascript Hurts Your Robustness

This is true... but then again, this is true for any sort of developement platform if you use a third party library! If we only talk about it from the Javascript angle, the way I try to minimize the impact on my projects is that I prefer Javascript libraries that only have a single role such as to provide UI enhancements such as Bootstrap and avoid entire frameworks that might end up dictating the system design on the server side as well such as AngularJS

3. Javascript Hurts Your Security

The article mentions about security issues like XSS and XSRF, and yes these are legitimate issues. But again, it's a developer problem, like SQL Injection before it, it's a common issue that developers have to actively make sure they're doing their jobs properly to minimize security problems (The reason I didn't say ELIMINATE is that there's no such thing as perfect security... although most security consultants would of course tell you otherwise)

4. Javascript Hurts Your SEO

ABSOLUTELY true, ESPECIALLY true if you're implementing your site as a Single Page Application (SPA) Google has some guidelines on making your AJAX links indexable but that probably only works with Google. Surprisingly the solution I used which was to create an invisible link to a dummy non AJAX static page with listing of links worked pretty well, I later found out that this was an actual method which people have talked about called a snapshot.

5. Javascript Hurts Your Development Time

No shit, but then again it's the same as with any development language which a person is unfamiliar with. But while it's true that Javascript code can get VERY complicated and messy (ESPECIALLY true if you're using MVC libraries) Tools are getting better, developers are getting more experienced.

As for cross browser / cross platform compatibility and testing, my approach to it is that if the web application NEEDS to be pretty much powered by Javascript with no fallback possible, I'll inform the client that only HTML5 level browsers are supported, and that means IE < 8 is totally unsupported, IE < 10 will see some visual discrepancies, but major functions will work. You might argue that there are ways to get everything to work and look exactly the same but in that case you're just setting yourself up to be hit by this issue as well as the issue #2.

6. Javascript Hurts Your Testing Costs

Again, this is very true. From my experience this seems to be mainly caused by the fact that traditional testing systems are unable to test Javascript heavy sites because they are unable to execute the Javascript in the context of a webpage. So it gets very complicated and expensive to bring in the resources necessary to test the system.

7. Javascript Hurts Your Website Performance

Aaaa.. the TIMELESS battle between the developer and the client arguing that the page must finish loading before X seconds or MILLIONS of users will be lost!!! You don't need Javascript to cause this issue, but of course, again it's all up to the developer to do a proper job to deliver better performance. And it's up to the Project Manager to tell the client that their expectations of a page just APPEARING in the browser is not physically possible.

8. Javascript Hurts Your Software Investment

"Client-side technology is doomed to fail" Wow... that sounds exactly like how people use to argue that ThinPCs would become a thing and normal x86 desktops would fade into obscurity. Let's break down the original article's examples.

Java applets failed primarily because the additional cost of the runtime download made it a barrier to entry for normal users BEFORE the broadband age, although once we DID have the bandwidth Oracle didn't seem to be interested in paying much attention to the applet usage of Java anymore. It also didn't help Java's case that a HTML5 browser's capability has caught up to MOST usage scenarios for a Java applet.

During it's time Flash had a smaller runtime download and could deliver impressive multimedia capabilities and features when compared to Java, that's what made it the dominant plugin previously. There's a chicken and egg argument about the role Apple played in Flash's demise when they choose to chase the HTML5 standard instead of Flash, but without a doubt HTML5 once again had most of the important features which someone would use Flash for but WITHOUT the additional runtime download.

There's only one thing that Flash is currently still ahead compared to HTML5, and that is it's ability to manipulate and playback video files. Due in part to everyone still trying to figure out how to standardize video manipulation based on patented video codecs I believe.

The main risk for Javascript boils down to WHICH library or framework do you bank your future on? Because you don't want to back a library where the developers decide to abandon it after a few releases and stop patching bugs... But again, this is an issue that isn't exclusive to Javascript only.

9. Javascript Hurts Your Software Architecture

This is true, write Javascript long enough and you'll know that it's incredibly messy to get any sense of order once your application reaches any sort of scale. A lot of people are trying to solve this issue by coming out with new languages like Typescript and DartScript. But those feel more like band aids to me. I try to avoid hitting this issue by avoiding the SPA metaphor (Because this is the simplest reason to cause your application to scale) and I will never use any sort of Javascript library that exerts influence into the backend server design.

10. JavaScript Is Not Needed

Absolutely FALSE!!! While it is true that almost anything you can do with Javascript can be done on the server side (The author of the original article seems to be ignoring any sort of UX requirements and filing them under "new" and "cool") Proper used of JavaScript allows many performance gains and UX improvements.

The NEED for Javascript should never be questioned. The question is that can the developer be entrusted with the power of Javascript responsibly?

I like to mention that if there ever was a language worthy of the phrase "With great power comes great responsbility" It would be Javascript.

And that's it... damn.. this rant is longer than the original article, well, hope it helps to provide some insight to this topic!

Saturday, 05 April 2014 23:18:37 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Thursday, 06 March 2014

There's a lot of buzz surrounding the whole NoSQL buzzword, and I've recently been able to give both Memcached and Redis a quick try and look over. And here are my initial findings follow some tests and poking around. Note that I'm by no means have very in depth experience of both these systems, I'm just recording my findings down so I can look back at it in the future to see if I still think of them the same way next time.

Memcached is the simpler one to explain, it's essentially an in memory store of key/value pairs. Which basically means it you're essentially storing values in the form of"some session data" in it. This usually leads to questions about why one would need to use an external service to cache simple key/value pairs in memory when your platform might already have something similar (ie. the Cache collection in ASP.Net) but the nifty thing about Memcached is that you can configure it to be redundant and highly available spanning across multiple servers among other tricks.

Redis like Memcached is also about to store key/value pairs as well, but it is also able to store structured data, lists and weighted lists. Which you can then manipulate and perform some simple operations on them like sorting, joining, calculating. Conceptually I'm more inclined to just call Redis a simple In Memory Database, but I think that's complicating it a bit much! But not only is Redis an In Memory Database, you can configure it to persists it's memory contents to disk ensuring that data can be preserved between server restarts and applications crashes. But wouldn't that make it behave just like a traditional database then, not quite I'd say.

Both Memcached and Redis excel in the fact that retrieval and storage of data is LIGHTNING fast compared to a traditional database, and why wouldn't they be considering that all the data is held in memory instead of on disk. So what kind of problem would arise from using them? Why, memory usage of course! Since the 2 systems will just keep writing to memory, if you don't keep an eye on them they WILL take everything if you just keep stuffing them full of data.

I'll say that it's easier to handle Memcached's memory usage, since it's main role is to cache data. If it reaches the memory limit, it'll just drop older values to make way for any new values. After all the whole idea of a cache is that while it exists to speed up data access, it can easily be discarded and rebuilt from the original source.

But with Redis it's a different, as mentioned Redis is cooler than Memcache in the sense that you can perform data aggregation on it, in fact you might be tempted to just run your website ENTIRELY off Redis, but then there are a few caveats about it. The first being the fact that Redis doesn't support the concept of ACID very well, so you can't use it for anything where data atomicity is a must. The other more important caveat is that Redis is an In Memory database, the WHOLE database needs to be in memory at the same time so if you want to speed up the look up of that 6GB customer DB file with Redis? Sure you can do that, but you're gonna have to dedicate 6GB of memory to hosting that database and that's not something you might be able to do.

UPDATE 7th March 2014 : Just figured out that in Redis you can ALSO set it so that when it approaches a memory limit, it can auto discard elements and thus it can also work like a cached store as well instead of having to define everything to expire explicitly.

The way I look at it is that Redis is great for caching datasets which require constantly manipulation but you don't want to burden the database with the queries. And it'll work great as long as you can give it the memory to work with. Such as... an item listing database which you want to allow users to sort according to different criterias.

And that was my quick look at Memcached and Redis, interesting stuff and I can't wait to work with them some more... ok, not so much on Memcached probably, it's features are a bit too specialized. :P

Thursday, 06 March 2014 17:24:48 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Thursday, 13 February 2014

Ever had this need to decipher a string to HEX form on the go? Or maybe you need to answer a client's email on how exactly to type out the value for the URL Encoded Query String while you're enjoying a movie with your significant other? Can't remember all the HEX values for a particular string? No problem, with M2StringToolkit you can freely convert between several formats easily. Currently supports the following encoding types with more to come!

  • Base64
  • URL
  • HTML
  • Javascript
  • HEX

Get it for your Windows Phone 8 device today!


Thursday, 13 February 2014 10:24:23 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Sunday, 10 November 2013
A few years ago Microsoft introduced a new ASP.Net feature called ASP.Net Web Pages. I found the light use of control tags intriguing, but I didn't see any reason to use it instead of the standard ASP.Net Web Forms style of developing web sites. It also didn't help that Microsoft seemed like it was talking about Razor as a side component to be used with ASP.Net MVC another new feature which I wasn't too keen on. But recently as I sat down to take a look at Razor once more, it finally dawned on me what Razor is actually good for. So make yourself a drink and come back to the longest code snippet filled article ever written by me on this site!

Sunday, 10 November 2013 21:00:45 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Wednesday, 03 July 2013

“The site isn’t working with Internet Explorer 10!!!” yells my client through the IM window, to which I gave a WTF expression since I developed it under IE10 and it worked beautifully.

Wondering what kind of problem it could be I got him to open up a remote session so I could see what the problem was, sure enough the site was a mess, layouts were wrong, backgrounds were missing, it was as if the browser forgotten to download a few CSS files, so I hit F12 to bring up the developer tools and then I saw the problem.


For some reason his IE10 was in IE7 mode, which was outside of the support scope of the project (Thankfully!). So I switched it back to IE10, and everything looked and worked fine again.

So if someone is complaining that the site looks and works horribly in IE10 when it shouldn’t be, you might want to check if any of these compatibility settings are in effect!

Wednesday, 03 July 2013 00:13:12 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Sunday, 31 March 2013

You could download some free open sourced sample site, or can even hammer out a simple catalogue and ordering system via code if you’re capable of doing so.

But the thing is that after the customer has paid for their order then comes the REAL WORK, it needs to get the PHYSICAL item to be delivered to the customer and that’s not something the website can actually do!

“How hard can it be to package something up and send it to the post office?” You might ask? The answer to this question is determined by the scale of operation. If it was just a housewife trying to sell some things through a blog, then yes it’s a simple matter of her logging on to check on pending orders, pick all the orders HERSELF, pack all the orders into boxes HERSELF, send it to the post office HERSELF, and then update the order status with tracking number HERSELF. Then yes, it’s not complicated at all since it’s all done by ONE person, and only ONE person needs to know about the state of the order.

Now imagine if it’s an online store of a public company, when an order comes in, the Order Processing department would verify the orders, send it to the Storage Warehouse to pick the items in the order deliver it over to the Delivery department for actual packing and delivery then update the delivery status of the order. All this while that this is happening, the Customer Service department must have enough visibility of the process to be able to answer any customer enquiries that pop up.

Different companies and organizations would have different workflows and auditing requirements than the simplified scenario which I listed above, the most important thing to understand is that the work required to build an Online Store Website ISN’T limited to just making a website which the customer can buy stuff from. Depending on who’s running the online store, the backoffice to support the entire process might turn out to be just as complicated as the online store website itself!

Sunday, 31 March 2013 13:37:29 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Sunday, 03 March 2013

If you’re a web developer, and you’ve been making web sites for mobile devices you’ve no doubt come across using this META tag to control the width of the browser’s view window.

<meta name="viewport" content="width=800" />

Given the snippet above, the window would be constrained to a pixel width of 800 pixels. If you don’t know how this works, basically it’s like resizing your desktop browser window to 800 pixels, since the user can’t do such a thing on a mobile phone browser you as the content provider would need to do it.

In any case, pretty much all modern mobile web browsers would support the use of this to control the viewport window width. And of course, so does Internet Explorer 10 for Windows Phone 8. Kind of…

It’s not that IE10 doesn’t support the use of the viewport meta tag. But rather it’s limited in what can be supported. From my testing you are able to set the viewport width to these values using the viewport meta tag:- 240 (Will be resized to 320), 320 and 480.

Setting the width to any value other than those mentioned would result in the default width of 1024 to be used, and that’s not what you want!

So? Is all hope lost if you need to set a arbitrary width value for your viewport in IE10? Is it time to add to the #iesux hash tag archive?!


While we can’t have full control over the viewport width using the META tag, we can use another method which is through the use of the CSS device adaptation features. Basically you just need to include in your css file somewhere a directive like this.

<style type="text/css">        
    @-ms-viewport {
        width: 550px;

No no no, put your pitch forks back down this is not a Microsoft only feature, the MS prefix is just to indicator that it’s still a vendor specific extension like how box-shadow and border-radius used to have it. See.. here’re the W3C specifications for this.

Anyway, with this you will be able to set the viewport to any value which you want. Therefore when you want to set a viewport width and make sure it works with all mobile browsers you would make your page contains something like this.

<meta name="viewport" content="width=550" />
<style type="text/css">
@-ms-viewport { width: 550px; }

Anyway here are a few more notes regarding this viewport setting.

When doing testing on your Windows Phone with different viewport values, don’t just REFRESH the page whenever you update the viewport value. Usually the phone doesn’t respect the new viewport value when you just do a refresh, best to close the tab and open the URL from a new tab.

Internet Explorer 10 on Windows 8 (not phone, the actual PC version) in both Metro and Desktop modes will actually respect the @viewport value. Just remember that the Metro IE has it’s zoom level turned up a bit by default. The fact that a PC browser actually respects the @viewport directive could lead to some interesting applications.

Finally I find it funny that the compatibility repository Can I Use doesn’t seem to have an entry for @viewport wonder if it’s because it’d bad to show MS actually being ahead of everyone else in supporting something. Smile with tongue out

Sunday, 03 March 2013 10:55:30 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
# Saturday, 26 January 2013

Learnt of this 2D map editor tool called Ogom Editor, saved me a ton of time of coming up with something of my own design! Highly recommended


Saturday, 26 January 2013 22:48:59 (Malay Peninsula Standard Time, UTC+08:00)  #    Comments [0]  | 
Page 1 of 10 in the Programming category Next Page