ASP.NET MVC vs Yii MVC

yii frameworkI wanted to create a simple web application that allows me manage the data in MySQL Database, I do not wish to waste my time on coding simple CRUD functions. I prefer to generate the codes every time i modified the database.

Been notice that ASP.NET MVC would help me to achieve that, able to find samples of running ASP.NET MVC with MySQL (By default, the codes run with MsSQL).  But in the end, i found out few issues of using it.

  1. All Visual Studio Express version does not allow 3rd party extensibility.
    Means I can’t use Entity Framework with .Net Connector by MySQL to auto generate the “Model” with Visual Studio.
    Not everyone have a Standard(Paid licence) version of Visual Studio, I’m using Visual Studio 2008 Standard for the testing above.
  2. Since I’m using Visual Studio 2008 Standard, I’m only able to use ASP.NET MVC2, which now they have launched ASP.NET MVC3 (with better features and support).
So I have to look for other alternatives, but somehow, “Yii” has been a buzzword among the company. There are even presentation and demo on how to create sites in 10mins or so.
Well, is free and there is so many Gurus around to guide me and give me crash course and all I need to do is to learn how to setup Apache & PHP on my Windows. Why not give it a try… after all, if it is PHP, there shoudn’t be a problem generating CRUD and models with MySQL.
After the completed the setup, I start to follow the quick guide on setting up Yii and guide to setup my first Yii Application. Encountered the problems bellow which took some of my time to diagnose:
  • Warning: date(): It is not safe to rely on the system’s timezone settings
    “WTF”
    was the first thing that comes on my mind, then I goggled and found out Setting timezone in your php.ini date.timezone = “UTC” to fix this.
  • CDbConnection failed to open the DB connection: could not find driver
    Again, “WTF” comes in my mind again.

    1. First, I checked if my DB connection setting was correct for Yii, and it looks good.
    2. Next, lots of google results showing “extension=php_mysql.dll was not enabled“. So I enabled it in PHP.ini, and restart the apache. But I still can’t connect my first Yii application.
    3. Dafaq~~~~ done more google and found a new word call “PDO extenstion”. So I run my personal favorite PHP code (sorry, not “hello world”), phpinfo.php page and looked for the PDO section, nothing was loaded.
      Checked with all the Yii Gurus but non of them encounter this issue, reason is they install Apache & PHP via Xampp and Wamp… :(
    4. After sometime google-ing, found out that I need to do the following chances.
      php.ini set extension_dir = “C:\webserver\php\ext”
Damn~~~~ *@#*&*&%*#&*!&$*&!@($& !!!!
And finally, my first Yii Application runs~~~ Horaay….
So the lesson learn in this experience is, all those tutorial or videos of “Creating Yii application in 10min” is for people who knows and been using PHP.
For a .NET guy like me, we’ll need more time than 10 mins to run our “First” Yii application, because we learn how to setup the server first…. So is 20 mins for to really create our “First” Yii application (if we find a video or tutorial on “setting up apache & php in 10 mins“)
Overall, Yii serve the purpose of letting me do more advance stuff instead of wasting time creating simple and boring management page for internal staff.
Next… The UI control challenge awaits me…

 

Setting up Apache & PHP on Windows the manual way.

There is quite a few easy options to run PHP in a Window OS, there is Microsoft’s IIS, Apache Friend’s Xampp, Wamp Server. Tried setting up via Xampp on my Mac, ended up with lots of confusion after skipping a lot of process.

So decided to do it the manual way, is a bit confusing to search for a tutorial on doing this.
Then comes a youtube video link shared by a PHP fan (Thanks Moh, your a life saviour).

After completed the steps, I have problem starting the Apache Services. Checked the Event Log and found “Apache error – cound not bind to address 0.0.0.:80“.

Realized that I had Microsoft IIS installed and running as well, I do not want to stop the IIS services as my main task are done in .NET. So I went to look for solutions.

I end up change the Apache Server to use a different port from a forum post, here are the steps:

  1. look for httpd.conf which is located in “conf” folder inside your Apache folder. (For my case is C:\apache\conf)
  2. Search for the words that starts with “Listen“, somewhere around line 120.
  3. Change “Listen 80” to “Listen <new port number>
  4. Save and start the Apache Services.
  5. Done

After that, I start testing my first PHP code with phpinfo() (The “Hello World” test seems to be boring for me).

My first PHP code runs and I continue on setting up Yii Framework

 

Building my first Window Phone 7 app.

After winning the “Innovation Day” on 2010 with “iProperty Android App”, we participated on “iProperty Hack day 2011″ with extending the company’s services to the Window Phone 7 platform. The ideas are the same as the Android App, but this time I participate with a team (consist of 1 designer and another web developer).

We didn’t win but we are given a go on developing the app.

Designer
For the designer, it was a golden opportunity to learn about “Metro UI” which personally I feel that the it is one of the key factor to become “iPhone” or “Android” killer. The simplicity and the standard of the design both on the phone and the apps, makes me feel that even my non IT literate dad can use it.

Web Developer
For the web developer, who is passionate on native mobile application development. It was a wonderful entry to the mobile development world.

Why? Because:

  1. Microsoft Visual Studio
    We .Net Developers eat “Microsoft Visual Studio” for breakfast, so we familiar with the IDE. No time wasted on making the IDE run at all.
  2. C# as the language
    Our “Mother Language”, what more can we say?
  3. The “Emulator” was fast and smooth, I was developing in a low end notebook and the “Emulator” still runs nicely.
  4.  Full of resource on how to get started. Oh yeah, less time taken on Google!!
  5. Toolkit that those awesome people created, that have a list of beautiful & fantastic UI component to use.

Me
For me? Well, comparing with Android, i suffered less due to the few factors mention above. 😀

But there is more, we have invested lots of our time creating the web services and the framework for the company’s site. We get to reuse those stuff (done with blood and sweat) without any efforts at all.
Oh yeah, is like adding Wings to them and make them fly!!

The surprising experience of implementing “Image Lazy Loading“, when we are starting to adding this to the app, I explained to the Web Developer on how complicated this is. It was based on my horrible experience applying it on the Android Application, I banged my head on the wall countless times on this!!

After hearing what I say, The Web Developer took over my laptop, added the URL to the image to a image control in the XAML. And run the application, and immediately i saw the “Image Lazy Loading” itself…

Next thing I realized is, open source stuff makes you become a complicated person, and forgot how easy and joyful programming with Microsoft Tools.

Team
By now, you must be wondering whether I’m over promoting. There is  however some challenges during the development.

  1. Some learning curve on XAML
  2. Understanding “Metro UI” and applying to the applications.
  3. Endless (Bottomless) list
    It was the most challenging part in the Android development previously, same situation here.
  4. Live Tiles
    The minimum interval is 30 minutes, so you have to manually run the Live Tiles when first running the application to test if it is working.
    It took us sometime, but glad we figured it out in the end. 😀

We gone through these difficult moments with “Pair Programming“, which really help us shorten the time wastage!!
The Web Developer paired with The Designer to understand more on “Metro UI”.
Me and The Web Developer paired to learn & solve all the obstacles.

We spent 2 to 3 days, and 3 to 4 hours each day after work, paring to solve our challenges, learning each other’s coding skills and knowledge.

Then we take up different areas and work on it after we went home.

Experience Gain
I can say out loud out with confident that with “Pair Programming”, we can learn any programming language we want. We can even conquer the world!!! (A bit over I guess :D)

The links to the application if your interested.
iProperty SG Window Phone 7 App
iProperty MY Window Phone 7 App