SOLUTION: A simple way to set up an isolated LAMP environment in Windows plus installing WordPress, Drupal and Joomla with simple clicks

Instead of installing a LAMP environment by installing the different components separately in Windows, there’s a simple one click install which works beautifully. Plus you can install PHP apps like WordPress, Drupal, Joomla using the same one click installs.

 

  1. Download and install XAMPP

  2. I am running IIS on my machine which uses port 80. Therefore Apache needs to be using a different port as you can’t have two web servers listening on the same port. Run C:\xampp\xampp-control.exe. Clicking the Start button for Apache will fail because Apache is trying to listen on port 80 which is already being used by IIS. Apache needs to use a different port. Click on the Config button and open the httpd.conf file. Change the line ‘Listen 80’ to ‘Listen 81’ or any available port. Save the file. We need to change the SSL port as well. Click the Config button and select the httpd-ssl.conf file. Change the line ‘Listen 443’ line to ‘Listen 444’ or another open port. Save the file. Now clicking the Start button for Apache will start it. If not, view the visible log for the error and fix accordingly.

  3. Click the Start button for MySQL. Now your LAMP environment is ready for use.

  4. Download and install apps like WordPress from Bitnabi. The installer is smart enough to install the app within XAMPP. No further configuration is necessary

  5. To bring up WordPress for example and if you followed the previous steps, open a browser and go to localhost:81/wordpress and WordPress should show up.   Follow the instructions from there for first time use.

  6. Similarly if you installed Drupal and Joomla, you can use localhost:81/drupal or localhost:81/joomla

  7. I wrote the instruction above from memory. I hope I didn’t miss a step but it should be easy to follow the steps.
separator

SOLUTION: How to debug PHP apps (like WordPress) in Visual Studio

In my previous post I talked about how to view what SQL statements a PHP program sends to a MySQL database in real time. Coming from using Microsoft’s development tools (Visual Studio, .NET & SQL Server) to using PHP and MySQL, I feel Microsoft has made me a spoiled developer with the tools I have on hand. Tools that are very powerful, yet easy to use and require very little or no setups. I came across a tool which enables me to code and debug PHP in my favorite IDE, Visual Studio (VS).

PHP Tools for Visual Studio from Devsense. It’s a Visual Studio extension which enables you to code and debug PHP applications right from inside VS. It’s very easy to set up including the set up for xdebug for debugging. It even showed the recommended xdebug settings and offered to apply the changes to php.ini instead of me doing them manually. As a PHP beginner, I like that PHP documentation is available inside VS. When hovering over any PHP method, a tooltip shows me the function description. It’s a big time saver. I don’t have to open a PHP site or book to learn what function does. A basic version is free and a Pro version is $79. A 30 day trial is available which has all the Pro features. The Basic version doesn’t include debugging and other features. So for me the Basic version is of no use as the whole reason for me for using such a tool is for debugging. I just started evaluating the product yesterday and I am very impressed with the ease and quality of this software.

I am a full time .NET developer however I am working on a personal project which involves WordPress and converting a WordPress to .NET. That’s why I am learning PHP because I need to know how WordPress and the plugin work in PHP. More...

separator

SOLUTION: How to trace SQL Commands emitted from PHP applications such as WordPress?

 

One application I find very useful is SQL Server Profiler which I often use for debugging Windows apps which connect to SQL Server. The profiler displays all the commands which were issued by the app. One of my personal projects I am working on is WordPress. WordPress uses PHP and MySQL for its database. WordPress interacts heavily with MySQL. I need to debug WordPress and find out it’s sending to MySQL? I need a tool like SQL Server Profiler. I did some research and was disappointed to find out there’s nothing as powerful and as easy to use as SQL Server Profiler. This is when I appreciate what Microsoft provides for its developers. I am a .NET developer and switching to PHP and MySQL is an less pleasant experience. I will blog about how to set up PHP debugging.

I tried different MySQL profilers or tracers, as some call them. I was getting annoyed by how clunky or how buggy or how time consuming these tools are to set up and use until I came across a tool which looked very promising, Neor Profile SQL. It’s a free proxy app which sits between your client (WordPress in my case) and MySQL. It receives and captures the SQL commands from the client and then passes them to MySQL. Then it receives the response and passes them back to the client.

 

Easy Setup:

Neor was very simple to set up. All I had to do is tell WordPress to talk to Neor instead of to MySQL and this is done by changing the port it uses from port 3306 (MySQL’s port) to Neor’s port 4040 (can be changed). In WordPress this is done by changing the port number in the wp-config.php. Neor needs to be running during debugging.

Don’t forget to change back the port number when you’re done. This is as close SQL Server Profiler experience as I could get. Real time SQL logging with some useful statistics.

Enjoy.

 

neor1

(Screen1): This screen shows the sessions WordPress used to load my  home page. The home page has an image slider which issues its own SQL commands.

 

neor2

 

(Screen 2): Then double clicking the first session, shows the queries in this screen capture. The SQL code of the selected query is shown.

separator

SOLUTION: Microsoft Excel cannot open or save any more documents…

Today I came across an error message from Excel 2013. I was trying to open an .xlxs file and received this error:

excelmessage

 

I have gigs of free memory (system has 32G RAM) and gigs of free disk space on my c drive and the drive which holds the temp folder. So I know this error message is misleading and the issue is most probably something total unrelated to this message.

After searching the web, the simple solution was to right-click on the file and click the unblock button. It seems Windows (I am using Windows 8) didn’t trust the file because it I downloaded it from the web.

separator

Tool Tip: resizing an image with least pixelation and jaggies

This is a quick tip. If you experience too much jaggies or pixelation when scaling a bitmap image up or down, try Perfect Resize from OnOneSoftware. It comes either as a stand alone program or as a plugin for Photoshop and other graphics software. In some instances, it does a much better job than Photoshop’s resizing feature. The company offers a 30 day fully functional download.

separator

You can buy a Tesla model S car with a single website template

 

tesla

 

I was researching some commercial Magento themes (templates) this week. Magento is a PHP based e-commerce (shopping cart) solution. My favorite site for providing templates is Themeforest. They have affordable high quality mostly web 2.0 style themes. The site itself is very clean, high quality, simple yet very usable. I sorted the Magento themes by number of sales. This usually means the first themes in the result listing are of polished high quality themes and that’s why they sell well. One statistic Themeforest provides for each theme is the number of sales. I looked at the first theme, Fortis and quickly determined the revenue:

Price $80 x # sold 1639 (as of now) = $131,120. Wow! That’s a lot of money from selling a single digital product. The template was added to Themeforest on March 6th, 2012. Not bad for less than a year display and more to come.

minus Themeforest’s average commission, say 35%, what’s left is $85,228 (rates schedule)

minus taxes, pure profit is at least $50,000.

What do I do to reward myself from a side job which put $50,000 in my pocket?

A brand new exciting Tesla model S car!

So if you want to make some extra money and you’re a good web designer, consider selling templates. Not just html templates but a full theme for a CMS or shopping cart or platform. These templates sell for more and have less competition.

separator

Upgraded the blog software to BlogEngine v2.7

I upgraded BlogEngine, the software which runs the blog, to the latest v2.7. The major enhancement is the extension-less URLs. So no more .aspx extension. The BlogEngine website mentions a security fix also.

The look of the website is still the same.

separator

SOLUTION: 0x80040605 error during installation of Windows Essentials 2012

I haven’t been blogging since May (about 7 months) and I got a new computer since then. I use Microsoft Live Writer for writing this blog. When I tried to install Windows Essentials, and chose Live Writer only, I got an error during installation. It was error 0x80040605 and the source was wllogin-amd64. I looked at the installation log at C:\ProgramData\Microsoft\WLSetup\Logs and looked for the first occurrence of an error and it was error downloading wllogin-amd64 file. I am running the offline installer which means all files should be included in the msi file. Downloading in a log file sometimes does not mean doing an actual download of a file over the Internet. It could mean searching and getting the file locally.

I did some research on the web and read about similar issues and tried some troubleshooting tips. The annoying part is I would the same error every time I repeat the install but with a different source! Sometimes it’s crt110-i386 or Watson-x64 or d3dx10-i386. This is confusing when the source changes randomly. It’s not straightforward to troubleshoot when different errors occur for the same action. One time it was another error than 0x80040605.

I decided that doing research and reading a lot will be more productive. When I do a web research, I include Chinese pages translated into English. Google automatically provides translated web pages in their search results. I came across a tip which solved my problem which I found in one of the Chinese sites.

The Solution:
I logged in using a different admin user and the installation went through without a hitch. I relogged in into my normal admin account and Live Writer worked just fine. I don't have an explanation why the earlier installation didn't finish properly other than something running under my regular account was inteferring with the installation.

separator

BugAid, a Visual Studio debugger add-on. A quick review.

 

bugaid

 

I spend a lot of development time in Visual Studio (VS) and I am a fan of using any product which increases my productivity and makes my work more fun. That's why I use products like Resharper, Tabs Studio & Mole 2010. These are commercial products I purchased. I also use some free add-ons like RightHand Dataset Visualizer which is the best dataset visualizer around. (Even though it's 35M! The author uses third party components which are packaged into a single dll)

 

Recently I came across a new add-on called BugAid from bugaidsoftware.com. It's an add-on for Visual Studio's debugger inline watch and adds some nice features to it. It's still in beta and this review is based on version 0.5.1206.6134_456.

 

Some of the features which BugAid adds:

  • Star important members. Show properties you're interested in at the top of the watch window including properties from base classes. More...
separator

My tip for easily creating a jQuery selector for any element in the DOM even if it doesn't have an id or style

I was working with the web ReportViewer in ASP.NET and I had a need to make it display in a certain way. This is a server control which, for the most part, behaves like a blackbox. It produces HTML which you have little control over. Before the Visual Studio 2010 version, the ReportViewer displayed incorrectly under non IE browsers. Even in VS 2010, it has some issues with non IE browsers. For example the ReportViewer toolbar displays in several lines under Google Chrome.

The HTML produced by this control is just huge and it seems to produce different HTML under different browsers. To fix some issues, I had to create some jQuery code to manipulate the HTML after the page renders.
I had to target some elements which are way way deep in the DOM hierarchy. Some of these elements do not have any IDs.

This is how you can target any DOM element regardless of their position in the DOM and whether they have an ID:

  1. Fire up Firebug in Firefox  More...
separator