Debugging MVC app with EEF and heavy jquery implementation - asp.net-mvc

I am working with a new project which is really complex and is written with MVC 1.0 and heavy jQuery implemenation. Since there is not a lot of documentation it is almost impossible to trace the flow of commands in the entire application. So I am trying to debug it and learn the implementation, but with jquery implementaion, it gets harder to understand the flow of commands and which function is called at what moment.
I was wonderng if there is a method to find out where the cursor is in the code at any given moment in time? Step into amd breakpoints has not been working for me that great. Is there any other tricks I might not be aware of to debug a MCV app?
I really appreciate your help.

Pause your debugging session
anytime.
Select the correct thread (using the 'Thread' dropdown)
Use Show next statement

Related

watin dll: other équivalents solutions for parsing web page?

I using watin in a wpf c# project for firing clicks on links and parsing pages in web sites.
It works post part of time but it launchs sometimes exceptions without raisons ans it is not reallly intuitive .
Do you know équivalents more realiable , intuitive ans with a big community and a good documentation
There is one big contender to Watin and it is called Selenium. It is different from Watin and there is a learning curve (you can't just switch to Selenium) but it could suit your needs better (I have VERY stable systems made in Watin and never had an issue with them).
It could help, also, if you post more details about your issue, in the way you asked your question leaves a lot to be desired (what's making it unstable, what portions of the code, what exceptions are you getting, when, etc.)

How to count how many times a function or a line of code is being called?

I am developing a web application in ruby on rails.Before pushing it to production i want to add a functionality in the code using which i can get how many times a particular function is being called.So that i can enhance the code which is being called frequently.And check the dead code which is not being called.
Seems like you can find some examples of AOP for Ruby-on-rails.
Like http://blog.arkency.com/2013/07/ruby-and-aop-decouple-your-code-even-more/
AOP will allow you to execute code before/adter/around a method for example without modifying the class itself.
It would be a good way to count method use without impacting your current code.
You can also take a look at this question
This functionality exists when running tests, but it actually measures how much code is covered by your tests. Check out simplecov, you can use it together with rspec or cucumber, and definitely the last one should give you some sort of indication.
Instead of running tests, you could also run a simple script together with simplecov, to achieve kind of the same effect.
But if you are worried about code quality, I would urge you to look at metric_fu: it will generate all kinds of statistics with regards to the quality of your code.
This is called profiling, and there are plenty of profilers for Ruby. Some of the best profiling tools on the planet exist on the Java platform, and they pretty much Just Work™ out-of-the-box with JRuby. For YARV, there is ruby-prof, for example.

Load Testing Vaadin 6.3.4

I need to load test a Vaadin application.
I found this link explaining how to use JMeter with Vaadin however I can't get it to work. I suspect the problem are my MenuItems since Vaadin 6.4 ChangeLog mentions that some change was made to MenuItems in order to make Vaadin MenuItems HTTP-Level tester friendly. However upgrading the Vaadin 6.4 and 6.5 yielded no better results.
Here is my problem, I need to load test my Vaadin application to prove it will work with at least 50 concurrent users. However the async nature of Vaadin means that most tools have no idea when a response has taken place or whether it is correct. How can I script a test and emulate 50 users? Any help will be much appreciated I've tried a lot with Selenium and other tools but their scripts never execute reliably. Has anyone load test a vaadin app? If so how?
Selenium does not work out of the box with Vaadin apps, that partially is why TestBench exists.
The easiest solution to your problem is to add a sleep to each request in jMeter. It's ugly and needs some experimenting to get the sleep times good enough. And it's not completely fool-proof. It might however be enough for you to prove that 50 concurrent users works.
Another thing is to add some kind of client-side rendering and use JS to check if there is still an existing connection from client to server. TestBench uses something like this for implementing a waitForVaadin() function that checks if the request is complete. Here's some discussion: http://vaadin.com/forum/-/message_boards/message/236584#_19_message_236823
Vaadin uses many technical ids for the components, so in order to automate a realistic navigation you need to correlate those ids.
You can read this blog which illustrates the use of a commercial plugin for Open source Apache JMeter that does auto correlation for you.
You just record and you can replay, all correlation is done by plugin.
Disclaimer : We are provider of this solution

web framework that will reduce number of lines of code

which framework helps in reducing the number of lines of code needed to create a web app?
ruby on rails?
php?
asp.net mvc?
jsp/servlet?
django/python?
I just don't like typing a lot of code especially if it's boilerplate. If I can write 10 lines of code versus 100 to get the same results, I think most people would prefer 10...right? So, tell me which web framework will acheive this goal.
All of them.
I wouldn't use "Shortest program" as a guiding factor in selecting one though.
It really depends on what backend and DB you are using to support your web app.
I mean, if you are consuming .Net web services then I think asp.net (and visual studio) would be the best match to generate all code behind classes to consume the data strongly typed. Other backend/db maybe make you choose a totally different path.
For a complex application: Seaside. None of the others comes close. Especially when you run it on a OODB like Gemstone: Glass
The answer to the question is completely circumstantial; certain frameworks will require less lines of code for specific purposes. Perhaps if you can give the StackOverflow readers an idea of the kind of task you wish to accomplish, they can point you in the direction of the framework that is most likely to accomplish the task in fewest lines of code.
SilverStripe requires almost no lines and no understanding of PHP. It comes with the UI, Auth, and everything you need to get started.
http://silverstripe.org/
http://www.slideshare.net/chillu/modeladmin-in-silverstripe-23
http://doc.silverstripe.com/doku.php?id=modeladmin
I think you can answer this question yourself with this way: Do the get started project.
In my case was: django/python, why?, see the get started project, will take a 1 or 2 hours to understand/develop/deploy, and not python knowledge required, just a hyperactive open mind.

Web Design: Dreamweaver vs custom HTML

I've been having this discussion with my brother, and it looks like none of us is well qualified to answer the question.
n fact, since I've been learning ASP.Net MVC, I've the impression that I should create all my .aspx pages using HTML/CSS. He (my brother) sustains that - in the modern day - we should not spend to much time on HTML/CSS because there are software (like Dreamweaver) which do just that.
Although I do more of the server side coding, I think it's important to settle this matter for further orientation.
By the way, in case I should use Dreamweaver-designed pages, how would I integrate them in my ASPNET-MVC project?
Thanks for helping
This is the classic discussion pro/against html generation, and just by asking the question you risk the post being closed as "subjective" =)
Basically, you have to decide whether you want simplicity in your work creating the code, or in the code itself.
Dreamweaver (and every other WYSIWYG HTML tool I've ever encountered) will generate a lot of extra code, which will make it harder to incorporate your server side code - simply because there's a larger mess to navigate in.
On the other hand, creating the HTML page might be a lot faster than writing the code by hand.
If you're good at using a WYSIWYG editor, be it Dreamweaver, the built-in one in Visual Studio or some other one, you might benefit from drawing up the rough scetches in that. I would recommend, though, that you always do the finishing by hand, in the code. That's the only way you can retain complete control over your output.
From a purist perspective, unless you can already code your HTML, CSS and JavaScript by hand you shouldn't use a tool that does it for you.
Tools are very valuable at making your more productive, but the experience to know when they screw up is more valuable.
Well, the answer is pretty simple. Dreamweaver is just a glorified code editor with autocomplete, the ability to connect to FTP and upload your work within the program, and a unique "design view" which lets you move coded objects around with your mouse and also give you a visual representation of what your work looks like without opening a full browser. It doesn't matter if you use Notepad, Dreamweaver, or another code editor to create your code. For a fact, I know a lot of ASP/.NET programmers just use MS Visual Studio to do their work because ASP/.NET is simply a MS language and Visual Studio supports a lot of tools which ASP/.NET programmers find useful. That said, you can still code ASP/.NET with any other code editor, it just may be more manual or time consuming on your part to do so. You said "Dreamweaver-designed pages" and all this is is just a document coded with Dreamweaver being used as the code editor, there are no Dreamweaver specifics that would add to the document. Unfortunately, your bother does not seem to understand the differences or the complexities between programs or programming languages and vice-a-versa where they are similar. Whether you are programming for HTML or ASP/.NET, making a stylesheet with CSS, your project being server-side or client-side, it is always good practice to use standard markup and make sure all your work is cross-browser compatible with a strong influence on being compatible with IE. Just remember that most of all code is done by hand, and the reason for this is because the programmer needs to fact check everything he/she is doing to minimize errors and create an efficient document or program. Unfortunately again, a program just cannot do as good a job of realizing the ultimate coding goal than that of a human brain can achieve. Oh, and by the way, unless you are creating a simple document and utlizing only CSS to design that document, leave the design up to the designer.
Tomas is on the money with his comments. Your brother's notion that in the "modern day" you shouldn't have to mess with the code is sadly not true. The tools that we have for html/css/web development will get you only so far. You will likely be able to build a "functioning" site with any of them individually or in combination but to get the real fit and finish that you see in a excellent application you will be working in code as well.
Moreover, you have chosen ASP.NET MVC which for ASP is a pretty thin abstraction layer and works pretty close to the metal. It was designed as a framework for folks who do a lot of the code by hand and with minimal wizardry. The tooling at this point reflects that. The tooling will stub you out a basic application, but the rest you do either outside VS2008 or by hand in the VS2008 editor.
If you are "starting to learn" MVC as you said, your workflow will probably start off by using the framework code generated by VS, so now are working in VS2008. The html editor in VS2008 is limited to say the least, so if you want some more wizard driven development of css or html for your views you may work on a view page or a html snippet in Dreamweaver, Expression or your some other editor. You'll then be dropping that code back in VS2008 and doing more work there to link up the view to the controller.
As you get more of an understanding of the css and html you will use the wizards and dialog driven stuff in Dreamweaver less and less simply because it is faster to just open up the code and make the change.

Resources