PHP – Useful TinyMVC View Helpers

Back again with more TinyMVC code. As I get more into this framework the more code I’ll be posting up, the functions in the code below are to be used directly from TinyMVC views and not controllers or models.

One of the most useful features below is block($view) allowing you to directly output other views, inside your view (like CakePHP does) although this is technically not following “strict” MVC guidelines it is still a very useful feature.

Continue reading

Posted in PHP, PHP frameworks | Tagged , , , | Leave a comment

PHP – TinyMVC Template Wrapper Plugin

TinyMVC provides a great structure for developing new projects, it’s small base allows the developer to write new plug-ins and extend on the existing framework. Below you’ll find a template wrapper I have made to manage the views and assigning of data. The class allows you to set a default view to be used in order to keep consistency throughout; so that you can minimize view code in the controllers.

Continue reading

Posted in PHP, PHP frameworks | Tagged , , | 1 Comment

Java – Creating and Switching to a new Activity in Android

Below is a small tutorial showing you how to create a new Android Activity and Switch to it whenever needed as well as passing information between them, basically, this will allow you to switch to a new interface such as an options page for example, when required.

Continue reading

Posted in Android | Tagged , , , | Leave a comment

Java – SQLite Database Helper Class for Android

One of the most used features on the Android platform is being able to save and fetch your data from some sort of database, Android comes packaged with libraries to manage SQLite Databases. I have written a helper class to get you started using it, there are also examples showing how to read and write to the database using SQL and in-built methods.

Continue reading

Posted in Android | Tagged , , , | Leave a comment

Java – Using Android’s System Notifications

After playing around with Android (and I’ve spent only around 2 hours so far) I found out that it’s quite easy to access the System Notifications and send messages from your own Activity along with the custom titles, content and icons which will appear in the system tray of Android – This should work on all versions of Android, although it’s only tested on 3.0+.

Continue reading

Posted in Android | Tagged , , | Leave a comment

PHP Page basic page caching

One of the most useful things you can do in terms of performance is to cache the page you’re currently serving so that no code gets executed again and again when it isn’t needed. I’ve provided a sample below of how you can set-up quick and dirty page caching by including template files in your code.

Continue reading

Posted in PHP | Tagged , , | Leave a comment

PHP Object to Multidimensional Array

Below is a piece of code showing how to transform an Object into a Multidimensional Array, there are quite a few functions in PHP that return stdClass objects such as some MySQL, JSON or XML functions. If it is a one dimensional array, you’ll probably typecast it (array)$data; to get the result you want – But if the Object has multiple dimensions to it and you typecast it you’ll get a mixture of Array with elements that contain Objects.

Continue reading

Posted in PHP | Tagged , , , | Leave a comment

PHP Simple permission framework with Bitwise operations

Below is an example class of a basic permission framework with permissions worked out by using bitwise operations. This provides basic functions such as hasAccess() can() and permNeeded()

I won’t be going into detail regarding binary math and why it works as it does, as there are many other sites out there explaining this in great detail. This is just an example code post.

Continue reading

Posted in PHP | Tagged , , , | Leave a comment