I did a item for someone recently, and it was coded up and working fine, so fine, it was almost perfect.
However, unfortunately, the server the item runs on has issues processing the code to perform as expected, and most times, it’ll work successfully, but there are times where it just won’t work, repeatedly for a few minutes then come good.
We’ve looked at data consistency, any possible pattern among the failures, and we get no where. They aren’t based on a specific name, or a specific time, and there’s nothing that joins the dots in the middle of it all.
So the time came to look at an alternative way of doing it.
Fortunately, there are a few ways of doing this exact proces.
It was done in ASP, and it wasn’t working as planned, wshExec, whilst good, is suspected to be part of the problem here. I can’t confirm for certain, but I suspect the server does random checking, and kills off the WSH component in some way.
So I wanted to go from the Chinese ASP, to the Japanese PHP language, which is far more superior.
Unfortunately, all the methods of doing this were quickly shut down when the webhost wouldn’t allow the IUSR account access to CMD, and as a result, we couldn’t system, exec, popen, proc_open, shell_exec or passthru to the server side application to process the data.
So, I did a little digging around, and found nothing else out there aside from the possibility of doing it in .net, and compiling the application into a wrapper, thereby avoiding the wsh calls, but maybe not solving the .. unknown.. problem.
Yes, this isn’t a very constructive use of the time it took to learn the processes behind the language.
It’s like knowing Japanese, Chinese and English, but now having to learn Spanish as one of the last few options to try to get this working as planned originally.
The code in ASP was about 200 lines (including functions). The code in PHP for testing came out to around 20 lines!!.
The code, after several hours of working at it, came about in several files, so many that I simply cannot be seeing a use for .Net in this manner.
I do enjoy the code behind approach though, it’s fantastic to have controls running server side, and process events! It’s really, great. But the downside comes with a somewhat confusing approach, and a lot more work, a lot more code to do what 20 lines of PHP can easily do.
I’m amazed at the host’s reluctance to allow access to the cmd.exe for PHP to process exec statements, they state it was for security reasons, but googling around for any well known exploits, and there doesn’t seem to be many.
They don’t seem very confident in the security of their systems to say no to such a simple request, that no doubt many, many other webhosts do allow simply because they don’t have any doubts to their system security, or they backup, and have a duplicate clone ready to roll if something bad did happen.
Linux systems have ready access to the system shell, the reason for this is because it is secure, it’s just as secure.
I think its time hosts woke up and realised, Windows isn’t THAT bad, Windows Server 2003 is one of the most stable OS’s MS has put on the market (and this isn’t an endorsement for MS, by no means, just as greedy as the pigs over at Telstra), but it is indeed a reliable OS.
Simply put, I run my Linux machine as a Virtual Server (Microsoft) under Windows Server 2003.
Not an issue in the world (except losing a few minutes of time over the course of a few days after applying the fixes to the boot file, that’s not too bad).
Anyway. After my experience with this simple application, I have a few things to say:
1. I love Panels. Great feature, allows swapping of content on a single .aspx and that’s a fantastic idea for those forms pages.
2. I hate the approach to declaring features, and the changes from System.Web.Mail to System.Net.Mail – what a BIATCH.
3. I hate the approach to data access, take a leaf from PHP:
$mysql = “SELECT field from table”;
$myrow = mysql_fetch_assoc(mysql_query($mysql));
… THAT SIMPLE.
With ASP.NET, that becomes at least 5 lines, I’ll count them: 13. That’s double, and then some to do something PHP takes care of in just around 2 – 5 lines.
I can only see the one good thing going for it that would attract some developers, and that’s the code behind / events support, which is FANTASTIC, but it’s too much extra regular coding work for the gain. One would assume that events would make it easier, but .. nope. You can get similar events by setting flags on querystrings, and post data and get the same results for just 2 lines of code.
I still sit with PHP being the superior language!