A blog on IT, PHP, ASP.NET, MVC Frameworks, Shopping Carts, IDEs, etc

Welcome to my blog on PHP, ASP.NET, MVC Frameworks, Shopping Carts, IDEs and IT in General. Recently I have spent quite a lot of time research many IT related topics and often couldn't find all the info I was looking for in one place, so I decided to finally create a blog to aggregate and share the info to make other people's research a little bit easier (and add my 2c worth of course).

Windows could not start the SQL Server on Local Computer Error Code 3417

December 21st, 2011 5 comments

I havn’t been using SQL Server on my development machine for a while so to speed things up I changed the service startup to manual.  Recently I’ve needed SQL Server but when I tried to start the service I got an error saying Windows could not start the SQL Server on Local Computer with the Error Code 3417.  This was rather odd, so I started doing some google searched but with no direct answer other than people saying that there are issues with the master DB.  As it turned out because i havn’t been using SQL Server (and hence the DB files weren’t being used) Windows has compressed these files to save space (They were coming up with blue colour in the file system).  So I selected all DB and Log files in the C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA folder, went in Properties -> Advanced and unticked the “Compress contents to save disk space” checkbox.  After this all files have turned black and I had no issues starting the service :)

Categories: Programming Tags:

RocketRAID 640 Base System Device Driver Problem due to PLX PEX 8609-8A50BC

December 3rd, 2011 52 comments

I have recently bought a High-Point RocketRAID 640 card so that I can run some SSDs in a RAID. After installing the card by following the instructions I found that the system started getting a driver issue with Base System Device. After considerable searching on the internet I have found a post on a forum about this issue (RocketRAID Base SYstem Device Driver Problem). The issue is basically that there are no drivers for the PLX PEX 8609-BA50BC bridge chip that is used on the RocketRAID card. So, what I have done is emailed HighPoint and asked them to send me the drivers (which is apparently what they did to resolve the issue for the guy at Tweak Town who tested their device). I’m not sure why on earth they don’t just publish the driver or stick it onto their CD that comes with the card. I will update this post if I get the driver from them. Read more…

Categories: Computer Hardware Tags:

Yii 1.1 Application Development Cookbook Book Review

September 14th, 2011 1 comment

Yii 1.1 Application Development Cookbook Book Review
It seems like a few other people looking for information on Yii Framework, the folks at Packt Publishing have also stumbled across my blog and thought it was worth reading… As a result they have asked me to review their new book by Alexander Makarov called Yii 1.1 Application Development Cookbook. I only got the book today, so havn’t yet even had a chance to open it, but I already think it’s a great thing that the folks at Packt Publishing recognise the potential of Yii Framework and it’s quickly growing community and the need for good quality documentation and learning material. After all, as nice as the online cookbook is and as good as all the tutorials are, I personally usually prefer to pick-up a hardcopy (or softcopy) and go through the new topic in a more structured way with someone who has experience on the particular topic guiding me through.

My experience with the last Yii Framework book by Packt wasn’t that great as I found that it focused too much on methodology of agile programmign with too much focus on testing instead of a more in-depth discussion of Yii Framework features, but this book looks a lot more promising. Also, I’ve asked Packt Publishing to send me the equivalent books on Zend and CodeIgniter so that in the spirit of comparison (which is what folk are usually looking for) I can not just review the book but also compare the books side-by-side to pass some judgement on the quality of the latest books available for each of these frameworks (with which I’m quite familiar without the need for the books already). One initial observation already is that the Codeigniter book is a bit outdated as CI has moved on to release 2.0 now with quite a few changes including ditching PHP4 support.

Anyways, stay tuned for the full book review, which will appear on this same URL, so feel free to link to it, so that by the time the review is up, folks will be able to easily find it.

Also, you can Buy Yii 1.1 Application Development Cookbook Book by following the link to the Packt Publishing website and if you’d like a sneak peak here’s free chapter on Extending Yii Framework

Categories: PHP MVC Frameworks Tags:

AsteriskNOW vs Trixbox vs Elastix

July 21st, 2011 7 comments

Anyone who looks to install an Asterisk based PBX will at some stage probably ask themselves as to what package they should go with as it just doesn’t make sense to install everything manually unless you’re super-hardcore.   Some research reveals there are qute a few options being: AsteriskNOW, Trixbox, Elastix, PBX In A Flash (PIAF) and a few other small less popular releases.  Now deciding between which one to install is not that easy and requires a bit of research, unless of course you have come across this blog post because I’ve done the research and now sharing it with you.  One of the problems with doing the research is that much of the information out there is quite outdated and can give you the wrong impression of what you should go for.  I’ll go through each of the distributions and then give a conclusion.

AsteriskNOW 1.7.1 (at the time of writing)

AsteriskNOW is distrubution created and supported by Digium, the company behind Asterisk.  Although some older versions were not based on CentOS, version 1.7.1 is based on CentOS 5 so you get all the benefits of CentOS, being one of the widest used linux distributions that just works with plenty of info around if you need to do something with it.  One the one ISO disk that you download you have the option of what to install.  You can install v1.4 or v 1.6 of Asterisk and you can choose to either install the barebones installation OR the installation with a front-end management interface being either FreePBX or AsteriskGUI.  Personally, because I prefer to modify the config files directly without a GUI and because my configuration is more complex than either FreePBX or AsteriskGUI can support I chose to install the basic version of 1.6 wihout either FreePBX or AsteriskGUI.  This is not something I could coose to do with either Trixbox or the others (not sure abotu PIAF).  The installation only took like 5-10 minutes and was as smooth as you could dream of.  So if you don’t or need a GUI then AsteriskNOW would certainly be the package you choose.  Also, if you do want a GUI but don’t want to install all kinds of extra stuff or if you want to have a GUI but still make quite a few changes to the files directly then the installation option with AsteriskGUI could be the way to go for you.  This is what I did initially before I got so comfortable with the asterisk config files that I found the GUI to be more annoying and constraining than anything else. The one downside I found to AsteriskNOW is that there is very little in terms of documentation, but then again you don’t really need any as such.  Also another thing to note which I personally think is an advantage is that you only get the OS, Asterisk and the GUI when you install AsteriskNOW.  There is no other rubbish like vTiger or some other CRM and other crap.  A PBX is a critical part of any business infrastructure and personally I don’ t feel you should have all other kinds of rubbish installed on your PBX that is not directly to do with the PBX itself.  Chance are your business already has a CRM system so you don’t need to install and run one on the PBX itself.  And even if you do need a CRM system or some other stuff you should install it on an Application Server, not on your PBX.  If you don’t run all kinds of rubbish on your PBX you can get away with a pretty light spec in terms of hardware and let the PBX do it’s job of being a PBX and not an application server.  If you do want to install other rubbish on your PBX despite best practices then you can but at least you’re not forced to!

Trixbox

With Trixbox the only option you get is a pre-packaged solution with FreePBX and all kinds of other rubbish pre-installed.  The operating system is also CentOS.  The setup is nice and simple as well, but perhaps is not as nice as with AsteriskNOW.  If you know you’re going to be running your PBX with FreePBX (which uses an intermediary mysql database to store the config before writing it out to the config files, unlike AsteriskGUI which just reads in and modifies the config files) then Trixbox is an option for you.  I personally found that Trixbox had nothing to offer me over and above AsteriskNOW perhaps with the exception of better documentation and a larger community, but the reality is that most of that is FreePBX anyway.  Another drawback of Trixbox is the fact that you don’t have Digium behind it so when new versions of Asterisk come out they don’t get bundled anywhere near as quickly with Trixbox as they do with AsteriskNOW.  Trixbox made sense when AsteriskNOW didn’t exist or was in it’s infancy, but these days it doesn’t have all the benefits they it once did.

Elastix

Elastix is a similar beast to Trixbox.  It comes with lots and lots of rubbish pre-installed and is more of a do-everything distribution of an application server of which the PBX is only one part

PBX In a Flash (PIAF)

I can’t say I’ve looked much into PIAF but I really don’t see the reason for going with it when you have Asterisk NOW and Trixbox as available options.  PIAF doesn’t seem to be anywhere near as popular as the other 3 either.

Hope all of this helps you choose the right Asterisk distribution for you.

Categories: Asterisk PBX Tags:

Blog Spam Why Bother

May 11th, 2011 2 comments

I just don’t get it… Why do people keep trying to post Spam on this and other blogs… Surely people aren’t stupid and know that WordPress uses Akismet and that even if that fails (which it rarely does) there’s still a human checking the posts and spam is not going to be approved.  It’s just a waste of time! So spammers… Please… stop wasting your time!

Categories: Uncategorized Tags:

WYSIWYG HTML Editor in .NET WPF, Windows Forms, VB6 in Web Browser

February 4th, 2011 4 comments

I’ve spent a fair bit of time looking for a decent HTML Editor control for a variety of platforms… The platforms on which I needed a decent HTML Editor included Visual Basic 6, .NET Windows Forms and now .NET WPF.  The problem is there is no decent native HTML Editor control for any of these, but what’s worse is there aren’t any good third party controls either, so the only option is really to create your own.

Firstly I needed a HTML Editor for VB6.  The option that most people seem to suggest is to use the DHTMLEdit OCX which has now been retired but can still be deployed and then call various methods on it to do the editing.  You can do something similar with the MSHTML control, but once again it’s quite ugly.  I spent some time searching for a better control and found nBit HTML Editor ActiveX Control but after using it for some time found that it produces SUPER UGLY non standards compliant HTML (i.e. 90s style).  Given that my content is going onto an XHTML page that is not an option.  The control is quite nice in terms of function, but is quite restrictive in what you can do and the ugly HTML is a deal breaker.  I didn’t really want to spend heaps of time on implementing all the buttons in DHTMLEdit or the MSHTML by calling execCommand.  A frequently referred to post for implementing a Windows Forms HTML Editor was also not of much use as it is very basic and doesn’t fit my needs.   Another post on Code Project called WYSIWYG HTML Editor was also not of much use as it didn’t do it how I wanted it.

My initial idea before I began my search was to actually use a WebBrowser control with one of the well established OpenSource HTML Editors like TinyMCE, CKEditor or FCKEditor (now superseded by CKEditor), so I thought I’d see what I can find.  I found an article on CodeProject again where someone has implemented TinyMCE HTML Editor in .NET WindowsForms which was pretty close to what i was looking for.  I did a bit more searching and also found a blog post where a fella has done the same with FCKEditor, titled TinyMCE HTML Editor running in Windows Forms and another one called FCKEditor HTML Editor Running on Desktop.  Between all these posts (and the sample code) I pretty much worked out that this is going to be by far the best way to do this.  Some people on various forms and on StackOverflow had taken issue with using the WebBrowser Control in both Windows Forms and WPF as it’s just a wrapper for the COM WebBrowser and they would prefer a native control, but I say who cares, you just need something that works how you want it from a functional perspective and doesn’t take heaps and heaps of code.

I then did a bit more searching to find out how I can avoid any security issues coming up and found a post about WebBrowser in WPF.  That showed how to avoid a warning by adding some code to the HTML page.

So putting all of this together I managed to easily implement a WYSIWYG HTML Editor on all of the platforms being VB6, Windows Forms and WPF.  What you need to do is actually rather simple, with a few specialty tweaks for each platform:

  1. Download the WYSIWYG HTML Editor of your choice (i.e. TinyMCE, CKEditor, FCKEditor or some other) and put into your project directory
  2. Create a HTML file that will host the control.  This file has the page that will be loaded in the WebBrowser and provides stuff like initialisation for the control as well as simple getter and setter methods.  Make sure to add the stuff at the start of your file to stop the security warning coming up. (i.e. <!– saved from url=(0014)about:internet –>)
  3. Put a WebBrowser control in your window and in the Load (or Loaded) event use the Navigate function of the WebBrowser to open your file.  You can also use the Source or Url Property in WPF and WindowsForms respectively.
  4. When you run the project your WebBrowser should show now.
  5. Next thing is to be able to get and set the contents.
  6. In WPF and WindowsForms you can just use InvokeScript to call the JavaScript methods created in Step 2 to get and set the content of the control.  In VB6 the execScript method doesn’t work quite as well so can’t return a value.  To work around that all you do is add a textarea in a hidden div and use the DOM to access that value and then have your getter and setter javascript methods which you call using execScript get and set the values from the textarea, which you interact with via the DOM using WebBrowser.Document.getElementById(‘htmlArea’).value.

That’s pretty much all you need to implement a fully functional HTML Editor.  You can of course do stuff like implement a user control or a custom control in WPF and WindowsForms to reuse the web browser easily.  You can pass in the configuration and so on from the code and you can even write out the HTML from the code so you don’t need the HTML file.  Whichever way you do it is up to you, but this should certainly give you an idea of how to get the basics working, which is the critical part.

Categories: Programming Tags:

Yii and Zend for PHP = ASP.NET and ASP.NET MVC for C#

January 25th, 2011 2 comments

In the past I have extensively used ASP.NET and ASP.NET MVC in C#.  In C# they are basically the only options and it would be rather crazy to try to come up with your own high-level web framework on top of C# and rightfully so.  However when I moved over to be doing a lot of web development in PHP (see PHP for ASP.NET Developers which I blogged about before) things were not so rosy.  PHP is a great scripting language, many things are very simple to do and well geared towards web development.  However, a bad (and a good in some way) thing about PHP is that it’s a very low level language and doesn’t provide many of the higher-level framework nicities that is provided with ASP.NET and ASP.NET MVC straight out of the box.  By nicities I mean things like structured request routing and handling (with hooks/events), page lifecycle, MVC separation, configuration management (e.g. web.config), logging and so on.  It is also a fact that many PHP developers and participants in open-source projects are not professional programmers with an IT or software engineering degree.  What all of this has lead to is A LOT OF HORRIBLE ARCHITECTURE AND CODE.  Having looked through the source code of many many open source PHP projects, there is only a very very small handful that I would say are very well architected.  In some cases there is no architecture at all, in other cases there is some attempt at architecture but it’s not particularly good and in other cases things are over-architected to the point that making even a small change, let alone a complex change becomes extremely difficult.  For many users of these open-source projects this of course doesn’t matter as they don’t ever have to look at the code, but for anyone looking to make serious changes this is quite a problem indeed.  The best architected open-source applications I’ve seen are OpenCart (has it’s architectural flaws, but not too bad), being a Shopping Cart application, and Drupal (being a CMS).  Some people may say Drupal is not well architected because it’s not PHP5 Object Oriented code, but I don’t think you need to have PHP5 or OO for an application be well architected.  For example in C you can structure your application well, or you can structure it poorly and same goes for PHP.  You don’t have to use the latest technology to structure it well.  Sure there are obviously certain performance factors that come into play when you have load lots and lots of modules just to see if they’re enabled, but such is life when you’re building a configurable system.  Other applications in those classes of applications are not very well architected at all.  Here’s a non-exhaustive list:
Shopping Carts

  • PrestaShop – Pretty ugly architecture, poor file structure, doesn’t use MVC (poor form for a modern application), un-necessary use of Smarty for templating, all the admin code output using echoing directly out of modules instead of using MVC pattern, etc.
  • osCommerce – No programming standards, mix of code and markup, terrible code re-use, and just plain ugly bad design.
  • ZenCart – TERRIBLE design rooted in osCommerce that’s almost impossible to change if you try to make serious modifications as you have to change way too many files.
  • Magento – Over-architected to the point of obscrurity (not unexpected given it is based on Zend Framework) which impacts performance and requires lots and lots of caching.
  • Commercial Carts – This includes CSCart, X-Cart, etc – There is some attempt at decent architecture but often it still comes up short.

CMS / Blogs

  • Joomla – Over-architected MVC design and terrible rigid structure and security model.
  • WordPress – Horrible mix of PHP and HTML, although workable to some degree, it is far from well architected.
  • ModX – Ok-ish architecture but also rather ugly when you look at the code.

Now when it comes to frameworks, which is more the subject of this post, things don’t change much.  Most of the frameworks are also poorly designed and structured with their design patterns firmly rooted in PHP4.  This includes CodeIgniter, Kohana, DooPHP and pretty much every other framework I’ve looked at with the exception of Yii and Zend and perhaps Symfony and a few others (see Choosing the Best PHP Framework).  Ultimately after much research I’ve found Yii and Zend to be by far the best structured (with Zend over-engineered).  What I have found is that Yii Framework is by far the closest thing there is to .NET so I’m finding that any application that I’m looking to write even if it’s a console application is well handled by Yii, even if it’s because it has a decent architecture (which I can’t fault).  I’m finding that even for little PHP scripts without a user interface and simple web applications it’s easier and better for me to use Yii Framework even just because of the database access and configuration capabilities that it provides and of course the structured design.  I do find that it is still lacking a few things that are general framework classes (e.g. HttpClient, Application File System) rather than anything specific to do with web development).

Categories: PHP Tags:

Yii vs Zend vs Code Igniter Comparision

January 6th, 2011 97 comments

Choosing a PHP framework is not an easy task, especially if you have relatively little experience in PHP to know what makes a good framework or and what doesn’t, but choosing the right PHP framework for the job is absolutely critical in the long term as choosing the wrong PHP framework can lead to a number of negatives, such as longer development time, need for more experienced staff who may be hard to find and of course performance problems.  Unluckily (or perhaps luckily) when it comes to PHP there is such a plethora of PHP MVC Frameworks that it’s damn hard to actually boil them down to the final choice.  With ASP.NET for example it’s quite easy (although it’s gotten a little more complicated lately), previously there was only ASP.NET but now there’s also ASP.NET MVC, which is very different development paradigm and has it’s own catches.  However, one thing with .NET is that you need to choose how you’re going to do your data access, etc, but with most PHP Frameworks there is usually only one or two ways and they tend to do the job quite well.  So, now with this brief introduction, here’s the thoughts on Yii Framework (1.1.5) vs Zend Framework (1.11.0) vs Code Igniter (1.7.2).

Read more…

Categories: PHP MVC Frameworks Tags:

.NET WPF Project Solution Structure

January 3rd, 2011 No comments

I’m currently at the start of developing a fairly sizable project in .NET using C# with WPF.  As this is going to be quite a large project I thought it would be prudent to spend a bit of time upfront to organise it into some sort of a sensible structure which will see us through into the future, so that we don’t have to change it half way because things get too messy.  So I set out to find the appropriate solution structure for a WPF project.  A bit of googling turned up a few posts such as Recommended WPF Project Structure discussion on StackOverflow and WPF Project Structure by Dr. WPF, but neither gave a difinitive answers or detailed Pros and Cons of any particular structure.  So taking what I’ve read and my own experience my analysis is as follows…

Read more…

Categories: .NET WPF Tags:

PHP for ASP.NET Developers

January 2nd, 2011 1 comment

ASP.NET is very nice to use for developing web applications but also comes with a few cons.  The biggest drawbacks of ASP.NET (including ASP.NET MVC) are that it’s more expensive to host than PHP (and you can’t use certain programming concepts if you want to host on shared servers because they require full trust) and you pretty much need to use Visual Studio to do the development (although you could use the Express edition if you’re doing something basic).

Because of these drawbacks some people (like myself) have looked at other options (of which PHP is one).  In the recent years PHP has matured into a pretty decent OO programming language, but raw PHP is still very low level and doesn’t give you much guidance or have much of a framework for implementing your applications.  This of course requires you to be far more skilled in PHP and application architecture in general and would take much more time.  Having a good IDE is also improtant for productivity.

Luckily there is a very nice solution to this problem.

  1. Use an IDE – There are two mature (and FREE) IDEs you can use to develop PHP.  They are Eclipse PDT and NetBeans.  NetBeans kind of comes with everything there (e.g. SVN and Mercurial support), but I still find that Eclipse PDT is the better option, especially if you’re doing much deployment via FTP (with the Aptana Plug-In).  Eclipse PDT also has much better SVN support than NetBeans when you add the Subclipse or Subversive plugins.
  2. Use a PHP Framework – There are far too many PHP frameworks around, and sadly most are not up to scratch or what one would be used to coming from the ASP.NET environment.  However, there are two awesome frameworks which have a good combination of performance, good architecture and are most similar to ASP.NET.  They are Yii Framework and Zend Framework.  Yii Framework seems to have borrowed may concepts from ASP.NET and is an absolute pleasure to use.  It even solves problems which are still a bit of a pain in ASP.NET (e.g. paging in lists).  It is also significantly faster than Zend Framework and hence is my preferred choice.  Zend Framework is more feature rich than Yii Framework, but it has a degree of complexity and doesn’t perform all that well in shared hosting environments.  If you want to use some Zend Framework features with Yii you can easily do so, so you can get the best of both worlds.

That’s pretty much it… By combining those two concepts you can do pretty much the same thing in PHP as you can in ASP.NET without the associated expense.

Categories: ASP.NET, PHP Tags: