Posts tagged applications
For the last 5-10 minutes I've been wondering why a check on a variable which should be valid has been returning false.
The check is ctype_digit, which returns true if all characters in a string are digits.
So if $var = 1;, you might expect it to return true, but it doesn't.
Why not? Well, as the PHP manual states, this function acts on strings not integers.
Therefore checking something that has been specifically set as an integer (as in the example above) or typecast to be an integer at some point (as is my case) ctype_digit will fail as the data it is checking is not a string in the first place!
So there you go. Although 99% of data handled in PHP is in string form at some point, and therefore a ctype_digit check is generally completely valid, in some special cases it might be worth combining a ctype_digit() check with a preceding is_string() check depending on your application.
When you type keywords into your Firefox address bar and hit enter it usually goes off and searches a particular search engine for you. e.g. Google (as the default) but sometimes other applications you install override this behaviour and replace a Google search with their own search.
In my case I accidently chose to install the Ask toolbar along with another piece of software I actually wanted on my machine. Ok I thought, that was a mistake so Iâ€™ll just go and uninstall the Ask toolbar and everything will be fine, right? Wrong! Removing the Ask toolbar alone will not reset the default options in Firefox that were overwritten when the toolbar initially installed.
Thankfully though this is something thatâ€™s pretty easy to fix, even if it might look complicated. Hereâ€™s how you do it:
- Type about:config into the firefox address bar (the place where youâ€™d normally type a web address) to open up the firefox config options
- In the filter box enter: keyword.URL
- Double click the value column to change the the default url used for keyword searches
- Enter the search url you actually want to use e.g: http://www.google.com/cse?cx=partner-pub-6458081723116676:1i1tbs-63yw&ie=ISO-8859-1&sa=Search&q=
Itâ€™s that easy!
Also youâ€™ll probably find other search options have been overwritten. The others I found that needed changing back were anything in the browser.search group. i.e. if you filter the config options by browser.search as above, youâ€™ll see various options that have the value Ask (in my case) All of these need to be changed back to say Google or Google.co.uk or whatever is appropriate.
Iâ€™ve been using the released version of Windows 7 for about 4 days on and off now and have to say it seems to be a massive improvement over Vista.
In my opinion itâ€™s what Vista should have been (the whole release of Vista vs. XP being akin to the release of Windows ME vs. windows 98 i.e. a bit of a joke, with the real improvements come in the next version again â€“ in that case XP in this case 7).
Anyway, things to note so far are:
- Battery life seems to be improved â€“ Win 7 seems to require a lot less juice to run well
- Stacked taskbar icons make the management of multiple applications easier
- Icon themes are nicer than Vista
- Network management is much improved over Vista for those who change networks a lot
- Start up screen is fairly funky
- User Account Control and other Security options are less intrusive
- Windows Media Centre is included in the Pro Version (Vista Business excluded itâ€¦)
- So far ALL of the applications that I used to run on XP and Vista seem to run without issue, even small 3rdparty standalone tools (programs that don't require an installer to run)
Thatâ€™s a fairly short list so far but just for those improvements (minimal though some of them may seem) Iâ€™d say itâ€™s worth it.
Iâ€™d recommend upgrading for anyone whoâ€™s currently using Vista, especially on a laptop and for those of you still running Windows XP, though in your case you might also need a hardware upgrade too.
Today I have started writing 2 new Facebook applications, Doomsday Device and Game Stats.
You can find out more about each by visiting the following development blogs:
Yesterday for a bit of fun I decided I'd try and write my first application for facebook - and I have to say the setup based on the example code they give you is pretty straightforward, however it could do with some extra vital documentation.
What would be in this documentation you ask?
You might think, "being a social networking site users may want to upload photos or other filesÂ to your app. for various reasons", so lets make that side of things easy and secure.
Well obviously facebook didn't,Â and as such seem to haveÂ turned off/prevented access to PHP's $_FILES array and don't mention it anywhere obvious.
This is annoying as it wasn't really mentioned anywhere and, after all, your app is essentially it's own self contained program sitting on it's own server somewhere which obeys it's own set of rules and just appears on facebook by means of, what can only be described as an extended iframe, so why should they prevent access?
In fact file upload is possibleÂ but you have to do it via some convoluted method where you mime encode the fileÂ and send it through via POST, which is a pain.
Though I spent 3 hours or so trying to work out why my app wasn't receiving files before finding this out, that hasn't deterred me and you can expect some more posts about Facebook app building here as soon as I have time to write them