Tuesday, November 20, 2012

WordPress As a Framework for Web Apps - Building a Simple Recipe Database

In the past WordPress has grown from a powerful blog-system to a powerful CMS and, more recently, to a powerful framework for web applications. In fact, using WordPress customization features and the WordPress API, there are not many applications I can think of, you couldn't build. However, there are a lot of applications you shouldn't build with WordPress. Choosing which framework to use (or choosing not to use one) is balancing between many pros and cons affecting architecture, performance, security, scalability and so on.
I found WordPress extremely useful as base for medium sized web apps, without too much traffic. Building a small application, for example a restaurant table booking system, from scratch or even with a framework like Rails or CakePHP, would involve thinking about database scheme, controller structure, authentication, user interfaces etc. A lot of this stuff WordPress is already doing: you already have rough user management, a working admin interface and you only have to think about how to map your data-model to the already existing WordPress database structure.
Our use case: A recipe database
Now, I want to show you how to implement a simple recipe database with WordPress. Requirements are really basic:
  1. Allows adding recipes and editing them just like ordinary posts or pages
  2. Allows categorizing recipes in hierarchical categories like Healthy -> Chicken -> Marinated Chicken Breasts
  3. Allows adding ingredients to a recipe and finding recipes by ingredients
  4. Allows adding quantities to ingredients of a recipe, e.g. 500ml milk, 20g sugar, 3 tablespoons olive oil

Using VBA To Search For The Latest Version Of A Text File

If you're using VBA to import data from a text file, you might need to make sure you're using the latest version of the file. This article will show you how to use VBA to search a folder and identify the correct document based on the date and time the file was created.
One example could be that you receive daily files which are the basis for a regular report you compile in Excel.
18-3-2012Report.csv

19-3-2012Report.csv

20-3-2012Report.csv
Listing Files With The File System Object
The Microsoft Scripting Runtime library must be selected under references in the tools tab before any code you write can access the file system.
Our short piece of VBA code will select all the files in the appropriate folder and find the file with the most recent file creation date.
First, we'll create the file system object and select the folder, which in this example is called "files" and is under the folder of the active workbook.
Dim fso As Scripting.FileSystemObject
Dim SourceFolder As Scripting.FolderSet fso = New Scripting.FileSystemObject
Set SourceFolder = fso.GetFolder(ActiveWorkbook.path & "\files")
Next, we can loop through the folder and determine the most recent file. We do this by creating a date object, which by default defines the year as 1899 - depending on the version of Excel you have.
To begin, we set the newest date as "30/12/1899" so every file will have been created after that date. As we loop through the code we redefine the newest date and file depending on the file creation date.

Using VBA To Search And Retrieve Data From A Text File Containing A Code Library

Sometimes it's easier to save information in a text file, rather than adding another sheet to a possibly already cluttered Excel application. In some instances, the use of a text file might be the only option in a particular situation.
This article will explain how you can organize a text file to make it easy to search for, and retrieve information.
Organizing The File
We'll use the example of using a text file containing a code library, where you can store individual procedures for later use.
One way to search the file is to place your own tags around the code, so that your own VBA code can find the block of text and do something with it. In this case, the "tags" are already in place with the sub and end sub lines.
Perhaps your text file looks something like the text below and you want to retrieve the changeMe procedure which changes the color, bold and font type of the selected cell.
Sub firstCodeSnippet()

' other subs

end subSub changeMe(cellAdress)

Range(cellAddress).Select

With Selection.Font

.Name = "Tahoma"

.Bold = True

.ColorIndex = 3

End With

End sub
Sub otherCodeSnippets() ' other subs end sub

Now, you just need to write some VBA code to retrieve the data.

Monday, October 1, 2012

Use Drupal For Building Community Website

The world of cyber technologies are changing rapidly. The phenomenal rise of Facebook can be easily noticed. Social networking websites are not for fun anymore. Now, these websites have converted into biggest market place in virtual arena. The social networking has become regular business networking. Thus, you can see new entrant, who wants to build community building site for commercial purpose. Such business organizations are looking for best web technologies and Drupal is amongst these web technologies. This content management system can also be used for running a social networking website.
Customization and easy management facility
With this tool, you get the chance to give desirable look and feel in your website. It is based on an object oriented server backend scripting language called PHP, which provides scope for customizing your website as per specific business needs. Apart from this, you can manage your website efficiently by conducting few simple tasks. By using this simply operable CMS tool, you can update your social networking website regularly. Additionally, it provides multiple user accounts and controls features. With the help of these features, you can give specific controls to your social networkers for letting them connected with their friends and update their regular status massages.
Availability of Numerous Modules
Social networking website needs wide ranging functionalities to keep their users engaged. You can enable needful functionalities by installing modules from its 5000+ module directory. Apart from this, you can also take Drupal module development services for installing customized modules in your website.