Profiling a VBScript ASP website? - performance

I recently started working on an E-Commerce site that is written in VBscript/Classic ASP. Coming from a PHP background... this is... less than pleasant.
The largest issue I have right now is that there is a ton of extra an unnecessary code. I am looking for a way to get a stack trace... see what functions get called on a particular page... how long the calls take... things like that.
Another thing that has to be slowing things down is the obscene and unnecessary ammount of Dims at the top of all the documents. There has to be a bunch of those that are legacy and not being used. Getting rid of extra Dims should free up memory and make things faster... I hope.
I have a copy of Visual Studio 2010 on my workstation... but I have no idea how to import the site into that... or if I can even accomplish what I'm looking for with VS2010.
Any suggestions as to how I can profile ASP/VBscript is greatly appreciated.

How to profile a classic ASP web site?
I suggest you learn what the Dim statements do BEFORE you declare them useless and the cause of your slowdowns: http://www.htmlgoodies.com/primers/asp/article.php/3477891/ASP-Primer-Some-Basic-VBScript.htm

Related

Firefox Extension - Is this allowed/legal?

I recently installed a Firefox extension and noticed that it was doing something very odd in the background.
I'm a web developer and use Wordpress mainly. One day I was working on a page in WP admin and switched to the Text rather than Visual mode so I could edit some HTML. I noticed a load of junk html in there hidden using display:none
The class names rang a bell, it was the name of the extension I had installed several weeks previous
I immediately uninstalled the extension but of course it was too late. Since it was injecting code right into the text entry boxes in Wordpress, all that junk got saved with my pages. I had to weed through dozens and manually delete this junk, which in some cases had affected the layout.
I contacted the developers, and they gave me some rubbish about it being totally normal, everyone does this sort of thing, its within the Mozilla dev terms, and that it was a feature not a horrific Malware as I was putting forward.
In this case it was just html/css, but what if they were injecting JS/php etc, they could be causing all kinds of damage
I just wondered from a development perspective what peoples thoughts were. Is this legal?
Many thanks in advance
The best course of action is to spread awareness. I would not do here, but maybe write a detailed article explaining which extension it is, what it does, how, why it's bad, how to get rid of it, and alternatives.
Medium, your own blog, Hacker News and other social outlets will certainly be welcoming of such informations. The developers are very well aware of what they are doing so don't expect them to broadcast it and/or take action.
Be also sure to read their ToS again, see what you agreed to. If something seems suspicious you can talk to a lawyer or probably report them, altough this is beyond what I know.
I am a Mozilla Addon reviewer. Please report your findings as Abuse report and/or addon review (it will be read).

Modifying Code Igniter

I am looking into developing a commercial application using PHP. Since I have experience in CodeIgniter and it has been working well for me, I decided to use it. Now, if ever my application comes to a point that it needs to grow and have to have custom modifications in the platform, is it possible to modify the CodeIgniter source code to the point that it's far from the original?
I'd strongly recommend not modifying the source code as this is the back bone of the application will make updating to futures releases of codeigniter impossible.
Instead you should be creating your own classes/libraries that extend the core bases. This is best practice.
The codeigniter users guide has some fantastic information regarding this, http://codeigniter.com/user_guide/general/creating_libraries.html
Good luck.
Don't modify it, extend it. Ellislab is good about releasing bug fixes and patches, and the last thing you want is to have to re-engineer all the updates into your new hybrid everytime they release updated source code. Plus, different features and bug fixes are released at different paces for the core and reactor, so unless you plan to lock your framework in at the current version, extending is the way to go.
The good news is CI is built for and encourages extensions of the source. The system folder and the application folder separation are a clear indication of how you should segregate your enhancements from the base libraries.
CodeIgniter is written in PHP. You can completely rewrite the framework anyway you like. So the answer is "yes".
There are many big websites that were written in a different language or build on a framework when they started and have been rewritten many times since. I think a lot of developers (mostly freelancers) are over-thinking when starting out. When I start a project, then I try to get it done and get it out in the web asap. If a website starts taking of - and most of the times start making you money - then you can always take the time to rewrite it.
I think it is a lot more important to spend time when you plan and design your database and tables. I think it is a lot harder to redo parts of your database later on then it is to rewrite the code that uses the data.
Just my 2 cents.
If you have used CI, then you should know that being a PHP framework that all of the source-code is there in the download, furthermore opening the system and application folders and looking through there will tell you a lot. Yes all of the source is there in plain English (plain programming English) and not only is it in plain English but has been extensively documented inside and out (literally that is in the source and in the user-guide). CI gained initial fame from that simple fact, that all code is extensively and meticulously documented.
Beyond all that, the question itself raises concerns that maybe you should study CI a bit further before writing commercial applications using it. Ci is a powerful and very easy to use PHP framework, but it is not a WYSIWYG. In my opinion, a coder should know his tools inside and out in order to be able to create a solid secure and trusted application. The first measure of which is to read the user manual, you should know at the very least everything in it, and since there are 12 sections in it that cover everything from extending CI libraries to creating your own libraries, and everything in between I would say you need to spend a little more time with it.
I want to say though, I am not being rude or trying to shame you in any way I am simply saying that you should learn the framework a bit more before venturing into a commercial application using it.
In the early days of PHP people realized how amazingly easy it was to use and how fast you could write an application with it. At the time the major options where very difficult for new and hobby programmers to use or involved expensive software to run, PHP was free, easy to learn and most of all ran on a free OS. It also took hardly any setup to get going, you could download PHP and essentially be programming in minutes. All of these factors lead to the almost destruction of the language.
Entry level programmers were destroying it with bits of code taken from other applications, never knowing (or caring) what the code actually did beyond the simple fact that it did what they wanted at the time, never considering or even investigating if the code might be harmful. Because of this practice PHP applications that had grown to Goliath sized websites, taking thousands of hits an hour were:
beginning to crash
being hacked to reveal sensitive customer/client data
generally crumbling all around the web
All because since the language was so easy to use that people had taken advantage of it and failed to take time to learn it. PHP was becoming a joke to other professional programmers and wasn't even thought of as a viable application language by many who had dubbed it "the copy and paste" language.
So my advice to you, please take the time to know your tools inside and out, what makes them tick, if they have any gotchas and where they are vulnerable. I understand that in order to learn a language to a professional level you have to build with it so I suggest that you take it slow with CI stick to the core for now. Trust me when I say that even in its purest form CI is an amazing and powerful tool that in the right hands can create awesome powerful web application, but in the uneducated/inexperienced hands it can create havoc and destruction.
So (stepping off of the soap box) I simply ask that if you are serious about creating commercial applications period that you take your time and learn your tools/language become as close to an expert on them as possible. I gurentee that if you do that you will always have work when you need it and you will spend less hours beating your head against the table or worse explaining to a client why their site is down.
I truly wish you good luck, just slow down and learn your trade and you will do just fine.
Yes, Codeigniter is an open source framework. However, I would advise against modifying the core of Codeigniter, as most files can be extended and rewritten safely without modifying the core files which will cause you headaches if you ever decide to update.
To extend a core class by default you would do this in Codeigniter. We'll extended the parser class for this example, but this applies to all classes pretty much. This link in the comprehensive user guide will give you all the information you need to extended and overload methods inside of a Codeigniter core class: http://codeigniter.com/user_guide/general/core_classes.html

How to get involved in development of Mozilla Firefox?

I am a CS grad student, and I am interested in spending some spare time in getting involved with development of Mozilla Firefox web browser . I would like to contribute to HTML renderer , JavaScript engine etc. But I don't have any solid experience in writing parsers or similar stuff, and I don't have any clue from where to start.
There are of course some links in https://developer.mozilla.org/En/Developer_Guide/ but since Firefox is already is very huge project, I don't know from where I should start learning.
So, my question is what core things I need to learn first to get started with Web browser Development and from where I can learn this (any links)? Do I have to revise how to write parsers/compilers? How do I learn to write HTML renderer/ JavaScript engine? Is it even possible considering they are already very huge projects? Sometime back, I downloaded source code of V8 JavaScript engine (http://code.google.com/p/v8/) but I couldn't understand much from it's source code as it was highly optimized code, and there were no much useful comments for beginner like me to understand what going on.
Update:
I am fairly comfortable working with C, C++, Java, PHP, C#, VB.Net, JavaScript and I am more interested in learning how web browser parses an web page, how it constructs and maintains the DOM, how CSS is applied, how HTML reflow engine works, how it interacts with JavaScript engine, how it interacts with web server, how the components are drawn on the screen etc.
Read the docs on getting started. Hang out on irc.mozilla.org in #developers and watch for interesting conversations. Introduce yourself in #introduction and ask questions. Go to http://bugzilla.mozilla.org and start searching for open bugs in components that sound interesting, then look for bugs that catch your fancy. Use tools like http://mxr.mozilla.org/ and http://dxr.mozilla.org to help you locate the relevant code, and ask questions in #developers. Learn, hack, repeat.
I wrote a post about my experiences getting involved over the past year, and it seems to reflect the path that a significant amount of Mozilla developers took.
You might want to review a list of known bugs and see if you're able to fix them. Other possible way to get a foot in the door is to get involved in quality assurance tasks, which would help you learn better internals of the application.
Bugs marked in Bugzilla with the [good first bug] whiteboard status are a good place to start. You can view the list here.
Find something you like and try to fix it! The developers on IRC (#developers in irc.mozilla.org) are usually happy to help when you get stuck.
If you are interested in parsing, learn finite state automata and formal gramars, it should be part of your CS curriculum at some point, like in a compilers class. For the javascript part, study about JIT compilers, specially on how a tracing JIT works. Follow Mozilla development blogs, here is a good starting article:
http://hacks.mozilla.org/2010/03/a-quick-note-on-javascript-engine-components/
Finally, but not least importantly, try to contact people already working there, and try to build a mentor-pupil relationship, they can assign you tasks and can help if you get stuck when working on the code. Going to opensource conferences is a great way to meet the people behind a project and get started contributing.
Mozilla Developer Guide

What is the most challenging development environment you've ever had to work in and what did you do to get around the limitations?

By 'challenging development environment' I don't mean you're on a small boat that's rocking up and down and someone is holding a gun to your head. I mean, are the tools at your disposal making the problem difficult?
Development is typically a cycle of code, run, observe the result, repeat. In some environments this is a very quick and painless process, but in others it's very difficult. We end up using little tricks to help us observe the result and run the code faster.
I was thinking of this because I just started using SSIS (an ETL tool included with SQL Server 2005/8). It's been quite challenging for me to make progress, mainly because there's no guidance on what all the dialogs mean and also because the errors are very cryptic and most of the time don't really tell you what the problem is.
I think the easiest environment I've had to work in was VB6 because there you can edit code while the application is running and it will continue running with your new code! You don't even have to run it again. This can save you a lot of time. Surprisingly, in Netbeans with Java code, you can do the same. It steps out of the method and re-runs the method with the new code.
In SQL Server 2000 when there is an error in a trigger you get no stack trace, which can make it really tricky to locate where the problem occurred since an insert can have a cascading effect and trigger many triggers. In Oracle you get a very nice little stack trace with line numbers so resolving the problem is very easy.
Some of the things that I see really help in locating problems:
Good error messages when things go wrong.
Providing a stack trace when a problem occurs.
Debug environment where you can pause, then output the value of variables and step to follow the execution path.
A graphical debug environment that shows the code as it's running.
A screen that can show the current values of variables so you can print to them.
Ability to turn on debug logging on a production system.
What is the worst you've seen and what can be done to get around these limitations?
EDIT
I really didn't intend for this to be flame bait. I'm really just looking for ideas to improve systems so that if I'm creating something I'll think about these things and not contribute to people's problems. I'm also looking for creative ways around these limitations that I can use if I find myself in this position.
I was working on making modifications to Magento for a client. There is very little information on how the Magento system is organized. There are hundreds of folders and files, and there are at least a thousand view files. There was little support available from Magento forums, and I suspect the main reason for this lack of information is because the creators of Magento want you to pay them to become a certified Magento developer. Also, at that time last year there was no StackOverflow :)
My first task was to figure out how the database schema worked and which table stored some attributes I was looking for. There are over 300 tables in Magento, and I couldn't find out how the SQL queries were being done. So I had just one option...
I exported the entire database (300+ tables, and at least 20,000 lines of SQL code) into a .sql file using PhpMyAdmin, and I 'committed' this file into the subversion repositry. Then, I made some changes to the database using the Magento administration panel, and redownloaded the .sql file. Then, I ran a DIFF using TortioseSvn, and scrolled through the 20k+ lines file to find which lines had changed, LOL. As crazy as it sounds, it did work, and I was able to figure out which tables I needed to access.
My 2nd problem was, because of the crazy directory structure, I had to ftp to about 3 folders at the same time for trivial changes. So I had to keep 3 windows of my ftp program open, switch between them and ftp each time.
The 3rd problem was figuring out how the url mapping worked and where some of the code I wanted was being stored. Here, by sheer luck, I managed to find the Model class I was looking for.
Mostly by sheer luck and other similar crazy adventures I managed to work my way through and complete the project. Since then, StackOverflow was started and by a helpful answer to this bounty question I was able to finally get enough information about Magento that I can do future projects in a less crazy manner (hopefully).
Try keypunching your card deck in Fortran, complete with IBM JCL (Job Control Language), handing it in at the data center window, coming back the next morning and getting an inch-thick stack of printer paper with the hex dump of your crash, and a list of the charges to your account.
Grows hair on your fingernails.
I guess that was an improvement on the prior method of sitting at the console, toggling switches and reading the lights.
Occam on a 400x transputer network. As there was only one transputer that could output to console debugging was a nightmare. Had to build a test harness on a Sun network.
I took a class once, that was loosely based on SICP, except it was taught in Dylan rather than Scheme. Actually, it was in the old Dylan syntax, the prefix one that was based on Scheme. But because there were no interpreters for that old version of Dylan, the professor wrote one. In Java. As an applet. Which meant that it had no access to the filesystem; you had to write all of your code in a separate text editor, and then paste it into the Dylan interpreter. Oh, and it had no debugging facilities, of course. And being a Dylan interpreter written in Java, and this was back in 2000, it was ungodly slow.
Print statement debugging, lots of copying and pasting, and an awful lot of cursing at the interpreter were involved.
Back in the 90's, I was developing applications in Clipper, a compilable dBase-like language. I don't remember if it came with a debugger, we often used a 3rd-party debugger called 'Mr Debug' (really!). Although Clipper was fast, some of our more intensive routines were written in C. If you prayed to the correct gods and uttered the necessary incantations, you could use Microsoft's CodeView debugger to debug the C code. But usually not for more than a few minutes, as the program usually didn't like to spend much time running with CodeView (usually memory problems).
I had a series of makefile switches that I used to stub out the sections of code that I didn't need to debug at the time. My debugging environment was very sparse so there was as much free memory as possible for the program. I also think I drank a lot more back then...
Some years ago I reverse engineered game copy protections. Because the protections was written in C or C++ they were fairly easy to disassemble and understand what was going on. But in some cases it got hairy when the copy protection took a detour into the kernel to obfuscate what was happening. A few of them also started to use of custom made virtual machines to make the problem less understandable. I spent hours writing hooks and debuggers to be able to trace into them. The environment really offered a competetive and innovative mind. I had everything at my disposal save time. Misstakes caused reboots and very little feedback what went wrong. I realized thinking before acting is often a better solution.
Today I dispise debuggers. If the problem is in code visible to me I find it easiest to use verbose logging. (Sometimes the error is not understanding the interface/environment then debuggers are good.) I have also realized time is of an essance. You need to have a good working environment with possibility to test your code instantly. If you compiler takes 15 sec, your environment takes 20 sec to update or your caches takes 5 minutes to clear find another way to test your code. Progress keeps me motivated and without a good working environment I get bored, angry and frustrated.
The last job I had I was a Sitecore Developer. Bugfixing can be very painful if the bug only occurs on the client's system, and they do not have Visual Studio installed on the system, with the remote debugging off, and the problem only happens on the production server (not the staging server).
The worst in recent memory was developing SSRS reports using Dundas controls. We were doing quite a bit with the grids which required coding. The pain was the bugginess of the controls, and the lack of debugging support.
I never got around the limitations, but just worked through them.

Visual Studio Web Design

I'm using visual studio 2005 and have been building asp.net applications. Mostly just departmental level apps for reporting and data maintenance. They work and they look ok but they don't look great. I don't have any other tools like Dreamweaver or Expression. Can anyone name any books or resources for making better looking web pages in Visual Studio.
Thanks,
Billy
Honestly, the IDE does a fairly good job at design work. We are transitioning our designers from Dreamweaver to Visual Studio 2008, and they definitely like the tools.
Don't take this the wrong way, but some people just can't make a page look good, no matter what tool it is. I am one of those people. I can code all day long, but if I need to put a page together, it is going to look like something right of of the 90's.
I'd recommend looking for some HTML templates, and adapting them to your product. There are open source templates out there, and ones that can be bought for relatively little money.
I always try to write the code myself rather than using design tools.
There is a lot that you can to do with CSS and HTML, and it's important to understand how those pieces fit together.
If your looking for some good examples of site design, I recommend checking out http://csszengarden.com
They have a lot of different designs that are all based off the same HTML file, so it gives you some great perspective into the possibilities of CSS.
My buddy Jacob Sanford has a book out you should look at:
Professional ASP.Net Design
First thing you need to do is learn CSS. You can't expect to style anything if you don't know the technology used to do it. I would start with the HTML-Dog tutorials, and go from there. More importantly is actually having a good sense of design, and that is much, much harder.
Design skills don't have anything to do with dreamweaver. To develop a good sense of design, you need to start getting introspective about the sites you visit. Think about why things look good or bad. Paired with your CSS knowledge, when you see something that looks cool, think about how you would implement it. If you dont know, the source code is right there so take some time to figure it out.
I have been doing this for about 5 years or so now, and I still suck at coming up with new designs. (although, I am better at it then when I started.) What I do when I start a site is rip off the basic design from somewhere else, and make it my own. For asp I use devexpress controls, which have alot of great looking themes, so usually I just end up extending the look and feel of the controls to the rest of the site.

Resources