Witches Brew is approved by Amazon.com and currently available for download for Android devices…
First app, first mistake…
Our first game is live on the appstore for few days…
Based on our stats there were quite a few users willing to leave a review (thanks to all!) but there were none!
After checking out the code, we found the cause… A simple typo error…
It’s fixed now and 1.1 update submitted to appstore along with other changes. I hope that will put us back on track! Just wanted to share that with our fellow app developers…
Can you spot the difference between two links?
Wrong:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsuserReviews?type=Purple+Software&id=
Correct:
itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=
If you couldn’t find it yet, it’s the capital “U” in “viewContentsUserReviews”…
Just in time for halloween, our first game is approved by Apple and released for iPhone & iPad. Android version is also approved by Amazon.com and currently available at Amazon Appstore for Android!
It took a bit more longer than expected, but it’s finally here… Witches’ Brew HD is submitted to the Apple AppStore and should be available very soon!
For us, adventure started with Flash but ultimately ended with CoronaSDK.
Using packager for IPhone (now AIR) was fun at the beginning, but after bumping too many roadblocks with it, we have decided to look for other solutions and finally (thank god) found CoronaSDK…
Flash is still the best solution for the desktops or interactive CD’s, but if your plan is developing apps & games to mobile devices, look no further…
It took us few months to get here but that’s mostly because of the other freelance works we had. If I could combine the time I spent with CoronaSDK, it should be around 2-3 weeks range… And that includes learning Lua from scratch, studying Corona’s own API, developing (for our own needs) and sharing two libs @ Ansca’s code exchange and everything else…
Without CoronaSDK, I cannot even imagine doing all that in such short time…
Btw, I would also like to thank/mention following people for their great tools & contribution…
J. A. Whye for Corona Project Manager
X-pressive for Particle Candy & Text Candy
Andreas Löw for Physics Editor & Texture Packer
Ricardo Rauber for Director Class
I’ve been looking for ways to provide a proper customer support for our website & products. Of course, just giving out your support email could also do it, but I wanted to have centralized on-line solution which makes things easier on both sides of a support request.
After looking for options (of course there are better paid alternatives), I have decided to use osTicket, which is a widely-used open source support ticket system. osTicket also supports email piping, so customers can submit new support request simply by sending an email to us. Email piping support was one of the key factors for my decision.
osTicket Bugs & Fixes
While working on the integration, I’ve noticed few bugs in the osTicket (v1.6.0 Stable) that needs to be fixed for a proper operation.
Captcha Image Problem
After the installation & setup of osTicket I have noticed captcha images are not shown properly. Most of the major browsers were failing to show captcha image by displaying the red X instead. In order to fix that problem you have to edit following file located in “include” subfolder.
class.captcha.php
Edit that file and look for the line #48 and change it as follows:
1 2 3 4 5 |
//Original Header("(captcha-content-type:) image/png"); //Fixed Header("Content-Type: image/png"); |
Captcha Validation Problem
When trying out the system, I have noticed submitting a new ticket is not possible for logged in users. Captcha image is not shown for logged in users (which is a proper thing to do) and when the new ticket is submitted, validation fails. In order to fix that problem you have to edit following file located in the root folder. Thanks to rayflexcom @ osTicket forum for the original fix.
open.php
Edit that file and look for the line #23 and change it as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
//Original if (!$thisuser && $cfg->enableCaptcha()) { if (!$_POST['captcha']) $errors['captcha'] = 'Enter text shown on the image'; elseif (strcmp($_SESSION['captcha'], md5($_POST['captcha']))) $errors['captcha'] = 'Invalid - try again!'; } //Fixed if ($thisclient && $thisclient->getId() && $thisclient->isValid()) { } else { if (!$thisuser && $cfg->enableCaptcha()) { if (!$_POST['captcha']) $errors['captcha'] = 'Enter text shown on the image'; elseif (strcmp($_SESSION['captcha'], md5($_POST['captcha']))) $errors['captcha'] = 'Invalid - try again!'; } } |
Embed osTicket to your WordPress Template
Initial integration is fairly easy, but to fully embed it into your template you should edit the html/css code in php files.
Base Setup
Locate the following file located in the root folder. This is a bit different than the other methods you can find on internet.
First of all, it checks for the current folder. If the request is coming from the osTicket’s default admin folder (scp) it won’t load the WordPress template. Without that line, osTicket admin pages will be broken hybrid of it’s own design and your template.
Second, if you are using WordPress permalinks like I do, sub-pages (contact/index.php, contact/open.php, etc.) will return header section of your WordPress 404 page. osTicket will work but that will not be very SEO friendly. Just change “/contact/” to match your setup (osticket, support, etc.)
main.inc.php
Edit that file and look for the line #99 (with the other includes and requires which you can find under the line that reads “#include required files”) and add the following code:
1 2 3 4 5 6 |
//Original if (!strpos($_SERVER["SCRIPT_FILENAME"], "/scp/")) { $_SERVER["REQUEST_URI"] = "/contact/"; include (ROOT_DIR . '../wp-blog-header.php'); } |
Template Integration
Edit following files located in the “include/client/” subfolder.
header.inc.php
footer.inc.php
Edit both files and change them as follows:
1 2 3 4 5 6 7 |
//header.inc.php //Add this to the top of the file get_header(); //Keep the original html menu code starting with <div id="container"> //footer.inc.php //Add this after the closing div tag for container </div> get_footer(); |
For rest of the changes you should check the files on root folder & “include/client/” folder and edit html/css code to match your template.
You can see the live version of my integration by visiting our “support” page.
If you find this useful, please leave a comment and share using the buttons below!
As I have noted in my previous blog post, I’ve been testing out few CDN services for use with this website; CloudFlare, Incapsula & Torbit.
Currently, Torbit is in invite only beta. Josh Fraser was kind enough to provide me an access but since their system is not public yet, Torbit is not included in the benchmarks. But I have included a short review based on my recent experience. I’m planing to update this post with benchmark numbers in the future as soon as they are eligible…
How I tested
For the load time benchmarks, I have decided to use WebPageTest.org as it is free, providing actual browser results instead of simulated results and offering enough locations to see global timing. In the advanced settings, I have selected “First View Only” & 5 test runs to make sure content get in to the cache. I have repeated those test for multiple times at the different times of day to make sure server load won’t make a big difference.
Test Location First View only> Test runs: 5 | InMotion Business Class East Coast |
CloudFlare Basic (Free) Account Medium Security (Default) |
Incapsula Free Account Trial period (All Features) |
---|---|---|---|
Dulles, VA – IE8 – DSL | 1.624s | 1.567s | 1.792s |
New York, NY – IE8 – DSL | 1.685s | 1.596s | 1.675s |
*Atlanta, GA – IE8 – DSL | 1.853s | 1.740s | N/A |
Chicago, IL – IE9 – DSL | 3.130s | 1.715s | 2.032s |
Kansas City, MO – IE8 – DSL | 2.105s | 1.730s | 2.158s |
San Jose, CA – IE8 – DSL | 3.806s | 1.704s | 2.510s |
San Francisco, CA – IE9 – DSL | 2.620s | 3.090s | 2.571s |
Los Angeles, CA – IE8 – DSL | 2.953s | 1.987s | 2.150s |
Montreal, Canada – IE8 – DSL | 2.153s | 2.003s | 2.107s |
São Paulo, Brasil – IE8 – DSL | 3.700s | 3.292s | 3.773s |
Dublin, Ireland – IE7 – DSL | 4.185s | 2.673s | 2.604s |
Gloucester, UK – IE7 – DSL | 4.761s | 3.306s | 3.330s |
London, UK – IE8 – DSL | 3.833s | 2.265s | 2.038s |
Paris, FR – IE8 – DSL | 2.934s | 1.921s | 2.209s |
Amsterdam, NL – IE8 – DSL | 3.826s | 2.967s | 3.566s |
Geneva, Switzerland – IE8 – DSL | 3.350s | 2.332s | 3.239s |
Frankfurt, DE – IE8 – DSL | 4.536s | 2.225s | 3.591s |
Stockholm, Sweden – IE8 – DSL | 3.019s | 1.903s | 3.894s |
**Israel – IE8 – DSL | 4.446s | 403 Error | 2.189s |
**Nairobi, Kenya – IE8 | 29.327s | 403 Error | 35.014s |
Delhi, India – IE7 – DSL | 8.699s | 4.494s | 9.532s |
Bangalore, India – IE8 – DSL | 10.470s | 5.442s | 5.825s |
Hyderabad, India – IE8 – DSL | 6.978s | 4.787s | 4.233s |
Moscow, Russia – IE8 – DSL | 3.447s | 2.280s | 3.531s |
Singapore – IE8 – DSL | 6.022s | 4.712s | 6.192s |
Taipei, Taiwan – IE9 – DSL | 5.045s | 2.857s | 4.009s |
***Jiangsu, China – IE7 – DSL | 3.728s | 2.447s | 8.083s |
Seoul, Korea – IE 7 – DSL | 7.080s | 3.059s | 7.240s |
Tokyo, Japan – IE9 – DSL | 4.288s | 2.464s | 3.803s |
Sydney, AU – IE7 – DSL | 8.211s | 5.011s | 7.412s |
Wellington, NZ – IE8 – DSL | 5.527s | 4.072s | 5.520s |
Remarks
** CloudFlare returns 403 Error for those locations when using default (MEDIUM) security settings. Setting it to LOW solves that problem.
*** YouTube access blocked in China, so our current home page cannot fully load. Because of that I have used “Start Render” times instead of “Page Load”.
Torbit Review
Torbit works in a different way than the other two services. First of all, they do not offer any security features but purely focused on optimizing and speed.
They are offering some unique optimizations such as HTML5 “Local Storage” or “DOM Storage”. Check out the blog post by Josh or read more about Local Storage.
They have a similar DNS based setup as other two but their CDN system works in the old fashioned way. Once they have your JS, CSS & images loaded in to their cache, URL’s pointing those files will be re-written to use their domains. When the browser connection limits are low (for example, it was 2 for IE7) that is very useful as it allows more simultaneous downloads which means faster page loads. But that is not the case with newer browsers as they already have higher connection limits and using multiple domains may reduce performance (that’s my opinion) because of the extra DNS lookups.
They also have limited (since not all images and/or browsers are compatible) support for WebP images. If all the conditions are matched, it will kick in and Torbit will serve WebP versions on those images for further speed up.
Their current benchmark numbers are almost on par with others. And if your site can benefit from the unique optimizations such as using Local Storage you should check them out today!
Incapsula Review
If you are primarily looking for security with the added benefit of some extra speed, you should check out Incapsula.
Their free account offers more protection than CloudFlare’s free account. Also they are offering few extra services such as uptime monitoring.
But Incapsula is a bit slower when it comes to the speed. I think that’s because of using less data centers (3 according to that post) spread across the world.
I must also not that I have signed but for their free (Personal) plan but they also have a 30 days trial. So, I had access to all features and tests were done with full acceleration.
On a side note, their setup is a bit different. Instead of a full DNS change you’ll just need to point your A & CNAME to provided locations.
CloudFlare Review
As you can see from my tests CloudFlare provided the fastest access, period. At this time, they have 12 data centers spread around the globe and that information (along with datacenter status) is publicly accessible.
They were a bit slow (but just a bit) for the UK and AU/NZ region. But I’ve been told a new DC for UK is coming very soon.
Their setup is pretty straight forward but as they take over all of your DNS, you should be careful to not to miss any entries. Their system detected pretty much everything but I had to manually setup the TXT record for Domain Keys.
I should also mention about a problem I had, somehow my IP is locked out and I was receiving “502 Bad Gateway” error following a false “Web Page Not Available” message when I try to access my sites. But at the same time, sites were fully accessible to the rest of the world. That problem lasted for a while but eventually it returned to the normal.
There are also some reports of false errors over the web (Google “cloudflare 502”) but don’t forget CF is currently in beta.
Another thing to consider is the pages that is shown to users in case of a failure or blocking. Those pages contain CloudFlare links & logo and there are some who not fond of this. You may beg to differ but for a FREE service that is OK with me. And apparently PRO account will have some control over this very soon.
For me, CloudFlare’s WordPress plugin is better than the provided by Incapsula. Both resolves actual visitors IP’s so WordPress will show it correctly. But on top of that when you mark a comment as a spam, CloudFlare posts that information back to their system to prevent further access of that offending user.
Edit: CloudFlare also supports HTML LocalStorage and other some other tricks when their new (beta) Rocket Loader feature is enabled. Thanks to Matthew Prince of CloudFlare for letting me know.
Verdict
All three services are very good. All has their strengths and weaknesses so you should pick one based on your website & your own requirements. But for Pixel Envision, my pick is:
While working to get our site ready for our first product, I’ve been looking for options to speed it up globally without spending a dime, if possible. My first tough was using a regular CDN, but then I realize there is a new & better (in my opinion) way to do it…
You may ask, why?
- Website performance & security at the same time. Your content hosted on could network while getting protected from malicious attacks.
- Simple configuration, they don’t require you to change a thing on your server. Most (if not all) configured by DNS.
- Better SEO than regular CDN networks, no URL rewrites required to serve page assets. All your images stays on your master domain, not on another CDN domain or subdomain of yours.
For the last few days I’ve been testing & benchmarking. So, my next blog entry will be a review on those services.
For the record, there are other similar services but I left them out, because they were either too expensive for my needs or simply not available to test.
- Google Page Speed Service (Access Requested)
- Yottaa (Access Requested)
- Cotendo Cloudlet
- Strangeloop
- Blaze
Here is another PHP code snippet from my library. This PHP function allows you to calculate exchange amounts between 49 countries and 33 currencies.
Function is based on the live conversion reference rates provided by European Central Bank.
Usage
- First 3 parameters are required. First one is the origin currency and the second one is target currency.
- First 2 parameters should be the same type. If you are doing a county code based conversion both must be country codes. If you are doing currency code based conversion, both should be currency codes.
- 3rd parameter is the amount you want to be converted. Should be decimal digits without any currency signs or codes attached to it.
- 4th parameter is optional and set as true by default. When enabled function will prepend or append the currency sign (or code) to the output amount. You may want to turn that off if you will use the returned amount in a calculation.
- 5th and the last parameter is calculation precision. Controls the number of digits after the decimal point. Default is 5.
Usage Samples
- currency_convert(“EUR”,”USD”,100)
- currency_convert(“FR”,”GB”,98);
- currency_convert(“AUD”,”CNY”,145,false,8);
- currency_convert(“GR”,”DK”,3500,true,2);
Download
- Download PHP code snippet
- Code is PHP5 compatible but it should also work on PHP4 (Untested)
License
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
<?php // Realtime currency converter by Pixel Envision (E.Gonenc) // Version 1.0 - 18 August 2011 // Based on the live conversion reference rates provided by European Central Bank // http://www.ecb.europa.eu/ function currency_convert($from, $to, $amount, $sign = true, $sensitivity = 5) { $RATES = $BASE = $in = $out = $append = NULL; //Array of available countries & currencies $CURRENCY = array( "US" => "USD", "BE" => "EUR", "ES" => "EUR", "LU" => "EUR", "PT" => "EUR", "DE" => "EUR", "FR" => "EUR", "MT" => "EUR", "SI" => "EUR", "IE" => "EUR", "IT" => "EUR", "NL" => "EUR", "SK" => "EUR", "GR" => "EUR", "CY" => "EUR", "AT" => "EUR", "FI" => "EUR", "JP" => "JPY", "BG" => "BGN", "CZ" => "CZK", "DK" => "DKK", "EE" => "EEK", "GB" => "GBP", "HU" => "HUF", "LT" => "LTL", "LV" => "LVL", "PL" => "PLN", "RO" => "RON", "SE" => "SEK", "CH" => "CHF", "NO" => "NOK", "HR" => "HRK", "RU" => "RUB", "TR" => "TRY", "AU" => "AUD", "BR" => "BRL", "CA" => "CAD", "CN" => "CNY", "HK" => "HKD", "ID" => "IDR", "IN" => "INR", "KR" => "KRW", "MX" => "MXN", "MY" => "MYR", "NZ" => "NZD", "PH" => "PHP", "SG" => "SGD", "TH" => "THB", "ZA" => "ZAR" ); if (strlen($from) == 2 && strlen($to) == 2) { //Operate using country code if (isset($CURRENCY[$from])) { $in = $CURRENCY[$from]; } if (isset($CURRENCY[$to])) { $out = $CURRENCY[$to]; } } elseif (strlen($from) == 3 && strlen($to) == 3) { //Operate using currency code if (in_array($from, $CURRENCY)) { $in = $from; } if (in_array($to, $CURRENCY)) { $out = $to; } } else { echo "Error: You should either use 2 digit country codes or 3 digit currency codes!"; } if ($in && $out) { //Both currencies available, continue //Load live conversion rates and set as an array $XMLContent = file("http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml"); if (is_array($XMLContent)) { foreach ($XMLContent as $line) { if (ereg("currency='([[:alpha:]]+)'", $line, $currencyCode)) { if (ereg("rate='([[:graph:]]+)'", $line, $rate)) { $RATES[$currencyCode[1]] = $rate[1]; } } } } if (is_array($RATES)) { $RATES["EUR"] = 1; //Add EUR reference to array if ($in != "EUR") { //Normalize rate to given input $BASE = $RATES[$in]; foreach ($RATES as $code => $rate) { $RATES[$code] = round($rate / $BASE, $sensitivity); } } //Prepend or append the currency information if ($sign) { if ($out == "USD") { echo "$"; } elseif ($out == "EUR") { echo "€"; } elseif ($out == "GBP") { echo "£"; } elseif ($out == "JPY") { echo "¥"; } else { $append = $out; } } echo round($amount * $RATES[$out], $sensitivity); //Output the converted amount if ($append) { echo " " . $append; } } else { echo "Error: Unable to load conversion rates!"; } } else { echo "Error: Either one or both of given currencies are not available for conversion!"; } } echo currency_convert("EUR", "USD", 1); ?> |
One of the flash projects I have been working on has required a lip sync talking. Dialogues were dynamic so frame by frame matching was out of the question. So, I ended up with the following action script 3 code which I’m sharing with you here…
It processes the input sound in real time, which returns the different values based on the sound volume and also outputs the sound itself.
You can use those values to match up mouth animation frames as provided in the sample. But you may also simulate the effect using a single mouth image and scaling it based on the values returned by the function…
Usage
- FLA project is compatible with Flash CS4, contains sample speech & mouth animation images.
- speech() is the the sound file linked from the library.
- mouth is the animation clip that contains mouth drawings.
Downloads
- Sample SWF file for preview.
- Download FLA project
License
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
/* - Copyright 2011 Pixel Envision (E.Gonenc) - http://www.pixelenvision.com/ - support@pixelenvision.com */ var left: Number; function processSound(event: SampleDataEvent): void { var bytes: ByteArray = new ByteArray(); playerObject.sourceSnd.extract(bytes, 4096); bytes.position = 0; while (bytes.bytesAvailable & gt; 0) { left = bytes.readFloat() * 128; if (left & lt; 0) { left = -left; } var scale: Number = left * 2; } event.data.writeBytes(bytes); //Define mouth animation here if (scale & lt; 1) { mouth.gotoAndStop(1); } else if (scale & lt; 10) { mouth.gotoAndStop(2); } else if (scale & lt; 25) { mouth.gotoAndStop(3); } else if (scale & lt; 50) { mouth.gotoAndStop(4); } else { mouth.gotoAndStop(5); } //Define mouth animation here trace(scale); } var playerObject: Object = new Object(); playerObject.sourceSnd = new speech(); playerObject.outputSnd = new Sound(); playerObject.outputSnd.addEventListener(SampleDataEvent.SAMPLE_DATA, processSound); playerObject.outputSnd.play(); stop(); |
Here is a teaser sketch of our main character, The Witch! Sorry about the quality, but the photo is taken directly from my wife’s sketchbook…
Game is scheduled for release next month and will be available on this halloween season!
Third PHP snippet I’m sharing from my library is code that tries to get most accurate real IP of the visitor. There are few headers with the IP information but those can be populated with many different ip’s based on customers route to your server. This script evolved in time and I believe it returns a very accurate source IP based on the information given in the request headers. But if you find a bug or a way to enhance it more, let me know!
License
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
<?php function realip() { $ip = trim($_SERVER['REMOTE_ADDR']); if ($_SERVER["HTTP_CLIENT_IP"]) { if (preg_match("~\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}~", trim($_SERVER["HTTP_CLIENT_IP"])) && !preg_match("~^((0|10|127|169\.254|172\.(1[6-9]|2[0-9]|3[0-1])|192\.0\.2|192\.168|255\.255\.255)\.)~", trim($_SERVER["HTTP_CLIENT_IP"]))) { $ip = trim($_SERVER["HTTP_CLIENT_IP"]); } } elseif ($_SERVER["HTTP_X_FORWARDED_FOR"]) { foreach (explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]) as $key) { if (preg_match("~\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}~", trim($key)) && !preg_match("~^((0|10|127|169\.254|172\.(1[6-9]|2[0-9]|3[0-1])|192\.0\.2|192\.168|255\.255\.255)\.)~", trim($key))) { $ip = trim($key); break; } } } return ($ip); } $IP = realip(); ?> |
Validation of email
This is the second PHP snippet I’m sharing from my library. It is not very complicated but get’s the job done. It both checks for the email syntax (REGEX) and existence of the email domain by checking MX & A records…
License
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?php $email = "test@domain.com"; if (!preg_match("/^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)*\.\w{2,8}$/i", $email)) { //E-mail syntax is invalid } elseif (!checkdnsrr(array_pop(explode("@", $email)) , "MX") & amp; & amp; !checkdnsrr(array_pop(explode("@", $email)) , "A")) { //Email server is not valid } else { //E-mail is valid } ?> |