Posts tagged applications

ctype_digit rtfm!

1

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.

Rant over...





Changing The Default Search Engine in Firefox Back To Google or To Something Else

2

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:

  1. 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
  2. In the filter box enter: keyword.URL
  3. Double click the value column to change the the default url used for keyword searches
  4. 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.





Windows 7 64Bit – Impressions So Far…

1

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 icon smile Windows 7 64Bit – Impressions So Far…
  • 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.





2 New Facebook Apps Begun

0

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:

Starting App’s For Facebook

3

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 icon smile Starting Apps For Facebook

Go to Top