SQLite Parameters – Not allowing tablename as parameter

Generally one cannot use SQL parameters/placeholders for database identifiers (tables, columns, views, schemas, etc.) or database functions (e.g., CURRENT_DATE), but instead only for binding literal values. With server-side support for parameterized (a.k.a. prepared) statements, the DB engine parses your query once, remembering out the peculiars of any parameters — their types, max lengths, precisions, etc. … Read more

How to deal with Number precision in Actionscript?

This is my generic solution for the problem (I have blogged about this here): var toFixed:Function = function(number:Number, factor:int) { return Math.round(number * factor)/factor; } For example: trace(toFixed(0.12345678, 10)); //0.1 Multiply 0.12345678 by 10; that gives us 1.2345678. When we round 1.2345678, we get 1.0, and finally, 1.0 divided by 10 equals 0.1. Another example: … Read more

Flex 3 – how to support HTTP Authentication URLRequest?

The syntax is a little different for URLRequest, but the idea’s the same: private function doWork():void { var req:URLRequest = new URLRequest(“http://yoursite.com/yourservice.ext”); req.method = URLRequestMethod.POST; req.data = new URLVariables(“name=John+Doe”); var encoder:Base64Encoder = new Base64Encoder(); encoder.encode(“yourusername:yourpassword”); var credsHeader:URLRequestHeader = new URLRequestHeader(“Authorization”, “Basic ” + encoder.toString()); req.requestHeaders.push(credsHeader); var loader:URLLoader = new URLLoader(); loader.load(req); } A couple of … Read more