Search Results

Search found 2670 results on 107 pages for 'review'.

Page 22/107 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • How should I organize my C# classes? [closed]

    - by oscar.fimbres
    I'm creating an email generator system. I'm creating some clases and I'm trying to make things right. By the time, I have created 5 classes. Look at the class diagram: I'm going to explain you each one. Person. It's not a big deal. Just have two constructors: Person(fname, lname1, lname2) and Person(token, fname, lname1, lname2). Note that email property stays without value. StringGenerator. This is a static class and it has only a public function: Generate. The function receives a Person class and it will return a list of patterns for the email. MySql. It contains all the necessary to connect to a database. Database. This class inherits from MySql class. It has particular functions for the database. This gets all the registries from a table (function GetPeople) and return a List. Each person from the list contains all data except Email. Also it can add records (List but this must contains an available email). An available email is when an email doesn't have another person. For that reason, I have a method named ExistsEmail. Container. This is the class which is causing me some problems. It's like a temporary container. It supposed to have a people list from GetPeople (in Database class) and for each person it adds, it must generate a list of possible names (StringGenerator.Generate), then it selects one of the list and it must check out if exists in the database or in the same container. As I told above this is temporal, it may none of the possible emails is available. So the user can modify or enter a custom email available and update the list in this container. When all the email's people are available, it sends a list to add in the database, It must have a Flush method, to insert all the people in the database. I'm trying to design correct class. I need a little help to improve or edite the classes, because I want to separate the logic and visual, and learn of you. I hope you've been able to understand me. Any question or doubt, please let me know. Anyway, I attached the solution here to better understand it: http://www.megaupload.com/?d=D94FH8GZ

    Read the article

  • C# -Fluent interface implementation Help

    - by nettguy
    I am implementing the following piece of code using Fluent Interface design in C# 3.0. The code is working fine. public interface ITrainable { ITrainable AddSkill(string _skill); } public interface ISearchSkill { ISearchSkill SearchSkill(SoftwareEngineer emp,string[] _skills); } public abstract class Person { public Person(){} protected string Name { get; set; } } public class SoftwareEngineer:Person,ITrainable { protected internal List<string> skillSet { get; set; } public SoftwareEngineer() { } public SoftwareEngineer(string name) { Name=name; skillSet = new List<string>(); } public ITrainable AddSkill(string _skill) { skillSet.Add(_skill); return this; } } public class HRExecutive :Person,ISearchSkill { SoftwareEngineer _employee; public HRExecutive() { _employee=new SoftwareEngineer(); } public ISearchSkill SearchSkill(SoftwareEngineer _employee,string[] skills) { this._employee= _employee; foreach (string _skill in skills) { if (_employee.skillSet.Contains(_skill)) { Console.WriteLine(Name + " is trained on " + _skill); } else { Console.WriteLine(Name + " is not trained on " + _skill); } } return this; } } Execution SoftwareEngineer emp1 = new SoftwareEngineer("JonSkeet"); emp1.AddSkill("java").AddSkill("C#").AddSkill("F#"); HRExecutive hr = new HRExecutive(); hr.SearchSkill(emp1, new string[] { "java", "C#" }). SearchSkill(emp1, new string[] { "Oracle", "F#" }); Question : I don't want the skillSet of SoftwareEngineer being accessed by some XXX class.It could be accessed by limited classes.But protected internal List<string> skillSet { get; set; } is the only option (i think) i can declare in order to access the skillSet from HRExecutive.If i do so other XXX class can still access it. How to rewrite the code to prevent it?

    Read the article

  • Website Reviewing Application/Interface

    - by Eric Di Bari
    I am the technology director at a small nonprofit, and we are in the process of making a new website. We have several proposed mock-ups of different homepage designs, and need to receive input from our board members. Is there an online application/program/framework that will receive and organize user comments? I'm looking for something that will allow commenting while viewing the page, rather than just a message board or wiki.

    Read the article

  • Are there any code critique sites or similar resources?

    - by Ukko
    I have noticed when people post example code illustrating some issue that they are having often they will gather a number of comments addressing the quality of the code they presented and not the actual problem asked. This is very helpful--if not well directed. Often, this is wasted effort since the asker is often not receptive and the code is often chopped down to something small to post leaving lots of rough edges. In the old days you would see people asking questions like this on comp.lang.lisp and other parts of the comp.lang hierarchy. But that bit of the net kind of sank into the sewers of neglect. Is there a comparable one-stop-shop today? I am partially asking for selfish reasons, I know how to write good idiomatic C, Lisp, O'Caml, and Java code. But I learned C++ pre-template and STL, those rusty skills are not really applicable to today's C++. I have picked up languages like Scala in a vacuum and get by, but am I really doing it correctly? There are so many ways you can abuse a language, I am currently working against a codebase of Fortran written in C, and I recognize and loathe the "that guy" who wrote it. I don't want to be someone else's "that guy" if I can help it. Just because it works does not mean that one did not totally miss the boat on how it should have been done. Do you seek out this type of critique? If so how, where and why? What types of benefits do you derive from it? How about abuse and trolls?

    Read the article

  • Details to log when starting an application

    - by Karl
    To help support and anyone who may use one of my applications I tend to log a few things during the application startup. Currently I log: Start Time App Name App Author App Version App Classpath Current working directory Java vendor Java version Max heap size Taking into consideration this application may be used / supported by a whole host of people can anyone think of any other vital details which we / others should log for good practice?

    Read the article

  • LINQ to SQL: NOTing a prebuilt expression

    - by ck
    I'm building a library of functions for one of my core L2S classes, all of which return a bool to allow checking for certain situations. Example: Expression<Func<Account, bool>> IsSomethingX = a => a.AccountSupplementary != null && a.AccountSupplementary.SomethingXFlag != null && a.AccountSupplementary.SomethingXFlag.Value; Now to query where this is not true, I CAN'T do this: var myAccounts= context.Accounts .Where(!IsSomethingX); // does not compile However, using the syntax from the PredicateBuilder class, I've come up with this: public static IQueryable<T> WhereNot<T>(this IQueryable<T> items, Expression<Func<T, bool>> expr1) { var invokedExpr = Expression.Invoke(expr1, expr1.Parameters.Cast<Expression>()); return items.Where(Expression.Lambda<Func<T, bool>> (Expression.Not(invokedExpr), expr1.Parameters)); } var myAccounts= context.Accounts .WhereNot(IsSomethingX); // does compile which actually produces the correct SQL. Does this look like a good solution, and is there anything I need to be aware of that might cause me problems in future?

    Read the article

  • Using TXMLDocument to serialize form settings to XML and database.

    - by LukLed
    I have an interface: type IXMLSerializable = interface function SaveToXML : DOMString; function SaveToXMLDocument : IXMLDocument; procedure LoadFromXML(AXML : DOMString); end; It is used to serialize some settings of forms or frames to xml. Simple implementation: SaveToXMLDocument: function TSomething.SaveToXMLDocument: IXMLDocument; begin Result := TXMLDocument.Create(nil); with Result do begin Active := True; with AddChild(Self.Name) do begin AddChild(edSomeTextBox.Name).Attributes['Text'] := edSomeTextBox.Text; end; end; Result := XMLDoc; end; LoadFromXML: procedure TSomething.LoadFromXML(AXML: DOMString); var XMLDoc : IXMLDocument; I : Integer; begin XMLDoc := TXMLDocument.Create(nil); with XMLDoc do begin LoadFromXML(AXML); Active := True; with ChildNodes[0] do begin for I := 0 to ChildNodes.Count-1 do begin If ChildNodes[I].NodeName = 'edSomeTextBox' then edSomeTextBox.Text := ChildNodes[I].Attributes['Text']; end; end; end; end; SaveToXML: function TSomething.SaveToXML: DOMString; begin SaveToXMLDocument.SaveToXML(Result); end; DOMString result of SaveToXML is saved to database to blob field. I had some encoding issues with other implementations and this one works fine (right now). Do you see any dangers in this code? Can I have issues with different settings on various machines and systems?

    Read the article

  • lambda vs. operator.attrGetter('xxx') as sort key in Python

    - by Paul McGuire
    I am looking at some code that has a lot of sort calls using comparison functions, and it seems like it should be using key functions. If you were to change seq.sort(lambda x,y: cmp(x.xxx, y.xxx)), which is preferable: seq.sort(key=operator.attrgetter('xxx')) or: seq.sort(key=lambda a:a.xxx) I would also be interested in comments on the merits of making changes to existing code that works.

    Read the article

  • A tool for finding duplicate code in PHP

    - by Toby
    Are there any tools available that can scan multiple .php files and report back duplicated lines/chunks of code? It doesn't have to be really smart but basically give me a starting point for manual scans to improve the codebase of some of my apps.

    Read the article

  • Can I overwrite an Object that has been Locked() in C#?

    - by makerofthings7
    I have a few objects that I'd like to send to the server, but I want to make sure that this is the only thread that moving the data from Stage to Upload. Is the following code valid in a multithreaded environment? List<CounterInternal> UploadToServer = new List<CounterInternal>(); List<CounterInternal> StagingQueue = new List<CounterInternal>(); lock (this.UploadToServer) lock (this.StagingQueue) { if (UploadToServer.Count == 0) { UploadToServer = StagingQueue.DoDeepCopyExtensionMethod(); // is the following line valid given that I have a Lock() on it? StagingQueue = new List<CounterInternal>(); } } }

    Read the article

  • lambda vs. operator.attrgetter('xxx') as sort key function in Python

    - by Paul McGuire
    I am looking at some code that has a lot of sort calls using comparison functions, and it seems like it should be using key functions. If you were to change seq.sort(lambda x,y: cmp(x.xxx, y.xxx)), which is preferable: seq.sort(key=operator.attrgetter('xxx')) or: seq.sort(key=lambda a:a.xxx) I would also be interested in comments on the merits of making changes to existing code that works.

    Read the article

  • When to give in and start The Big Rewrite?

    - by John Cromartie
    I've had my share of projects where the first thing I think is "let's just rewrite it in ." Everybody feels the urge at some point. In fact, I think I've had the urge to rewrite pretty much every project I've ever been on. However, it is accepted wisdom that a total rewrite is generally a bad idea. The question is: when do you look at a project and say: "OK, it's time to start over." What sort of metrics or examples can you cite of where a rewrite was truly necessary? How bad does the code have to be? How old can a project get before there too much invested?

    Read the article

  • C#: Specify that a function arg must inhert from one class, and implement an interface?

    - by Rosarch
    I'm making a game where each Actor is represented by a GameObjectController. Game Objects that can partake in combat implement ICombatant. How can I specify that arguments to a combat function must inherit from GameObjectController and implement ICombatant? Or does this indicate that my code is structured poorly? public void ComputeAttackUpdate(ICombatant attacker, AttackType attackType, ICombatant victim) In the above code, I want attacker and victim to inherit from GameObjectController and implement ICombatant. Is this syntactically possible?

    Read the article

  • Applying WCAG 2.0 to Non-Web ICT: second draft published from WCAG2ICT Task Force - for public review

    - by Peter Korn
    Last Thursday the W3C published an updated Working Draft of Guidance on Applying WCAG 2.0 to Non-Web Information and Communications Technologies. As I noted last July when the first draft was published, the motivation for this guidance comes from the Section 508 refresh draft, and also the European Mandate 376 draft, both of which seek to apply the WCAG 2.0 level A and AA Success Criteria to non-web ICT documents and software. This second Working Draft represents a major step forward in harmonization with the December 5th, 2012 Mandate 376 draft documents, including specifically Draft EN 301549 "European accessibility requirements for public procurement of ICT products and services". This work greatly increases the likelihood of harmonization between the European and American technical standards for accessibility, for web sites and web applications, non-web documents, and non-web software. As I noted last October at the European Policy Centre event: "The Accessibility Act – Ensuring access to goods and services across the EU", and again last month at the follow-up EPC event: "Accessibility - From European challenge to global opportunity", "There isn't a 'German Macular Degernation', a 'French Cerebral Palsy', an 'American Autism Spectrum Disorder'. Disabilities are part of the human condition. They’re not unique to any one country or geography – just like ICT. Even the built environment – phones, trains and cars – is the same worldwide. The definition of ‘accessible’ should be global – and the solutions should be too. Harmonization should be global, and not just EU-wide. It doesn’t make sense for the EU to have a different definition to the US or Japan." With these latest drafts from the W3C and Mandate 376 team, we've moved a major step forward toward that goal of a global "definition of 'accessible' ICT." I strongly encourage all interested parties to read the Call for Review, and to submit comments during the current review period, which runs through 15 February 2013. Comments should be sent to public-wcag2ict-comments-AT-w3.org. I want to thank my colleagues on the WCAG2ICT Task Force for the incredible time and energy and expertise they brought to this work - including particularly my co-authors Judy Brewer, Loïc Martínez Normand, Mike Pluke, Andi Snow-Weaver, and Gregg Vanderheiden; and the document editors Michael Cooper, and Andi Snow-Weaver.

    Read the article

  • Best Method For Evaluating Existing Software or New Software

    How many of us have been faced with having to decide on an off-the-self or a custom built component, application, or solution to integrate in to an existing system or to be the core foundation of a new system? What is the best method for evaluating existing software or new software still in the design phase? One of the industry preferred methodologies to use is the Active Reviews for Intermediate Designs (ARID) evaluation process.  ARID is a hybrid mixture of the Active Design Review (ADR) methodology and the Architectural Tradeoff Analysis Method (ATAM). So what is ARID? ARD’s main goal is to ensure quality, detailed designs in software. One way in which it does this is by empowering reviewers by assigning generic open ended survey questions. This approach attempts to remove the possibility for allowing the standard answers such as “Yes” or “No”. The ADR process ignores the “Yes”/”No” questions due to the fact that they can be leading based on how the question is asked. Additionally these questions tend to receive less thought in comparison to more open ended questions. Common Active Design Review Questions What possible exceptions can occur in this component, application, or solution? How should exceptions be handled in this component, application, or solution? Where should exceptions be handled in this component, application, or solution? How should the component, application, or solution flow based on the design? What is the maximum execution time for every component, application, or solution? What environments can this component, application, or solution? What data dependencies does this component, application, or solution have? What kind of data does this component, application, or solution require? Ok, now I know what ARID is, how can I apply? Let’s imagine that your organization is going to purchase an off-the-shelf (OTS) solution for its customer-relationship management software. What process would we use to ensure that the correct purchase is made? If we use ARID, then we will have a series of 9 steps broken up by 2 phases in order to ensure that the correct OTS solution is purchases. Phase 1 Identify the Reviewers Prepare the Design Briefing Prepare the Seed Scenarios Prepare the Materials When identifying reviewers for a design it is preferred that they be pulled from a candidate pool comprised of developers that are going to implement the design. The believe is that developers actually implementing the design will have more a vested interest in ensuring that the design is correct prior to the start of code. Design debriefing consist of a summary of the design, examples of the design solving real world examples put in to use and should be no longer than two hours typically. The primary goal of this briefing is to adequately summarize the design so that the review members could actually implement the design. In the example of purchasing an OTS product I would attempt to review my briefing prior to its distribution with the review facilitator to ensure that nothing was excluded that should have not been. This practice will also allow me to test the length of the briefing to ensure that can be delivered in an appropriate about of time. Seed Scenarios are designed to illustrate conceptualized scenarios when applied with a set of sample data. These scenarios can then be used by the reviewers in the actual evaluation of the software, All materials needed for the evaluation should be prepared ahead of time so that they can be reviewed prior to and during the meeting. Materials Included: Presentation Seed Scenarios Review Agenda Phase 2 Present ARID Present Design Brainstorm and prioritize scenarios Apply scenarios Summarize Prior to the start of any ARID review meeting the Facilitator should define the remaining steps of ARID so that all the participants know exactly what they are doing prior to the start of the review process. Once the ARID rules have been laid out, then the lead designer presents an overview of the design which typically takes about two hours. During this time no questions about the design or rational are allowed to be asked by the review panel as a standard, but they are written down for use latter in the process. After the presentation the list of compiled questions is then summarized and sent back to the lead designer as areas that need to be addressed further. In the example of purchasing an OTS product issues could arise regarding security, the implementation needed or even if this is this the correct product to solve the needed solution. After the Design presentation a brainstorming and prioritize scenarios process begins by reducing the seed scenarios down to just the highest priority scenarios.  These will then be used to test the design for suitability. Once the selected scenarios have been defined the reviewers apply the examples provided in the presentation to the scenarios. The intended output of this process is to provide code or pseudo code that makes use of the examples provided while solving the selected seed scenarios. As a standard rule, the designers of the systems are not allowed to help the review board unless they all become stuck. When this occurs it is documented and along with the reason why the designer needed to help the review panel back on track. Once all of the scenarios have been completed the review facilitator reviews with the group issues that arise during the process. Then the reviewers will be polled as to efficacy of the review experience. References: Clements, Paul., Kazman, Rick., Klien, Mark. (2002). Evaluating Software Architectures: Methods and Case Studies Indianapolis, IN: Addison-Wesley

    Read the article

  • JSR Updates and Inactive JSRs

    - by heathervc
     The following JSRs have made progress in the JCP program this week: JSR 342, Java Platform, Enterprise Edition 7 (Java EE 7) Specification, has posted an Early Draft 2 Review.  This review closes 30 November. JSR 338, Java Persistence 2.1, has posted an Early Draft 2 Review.  This review closes 30 November.  JSR 346, Contexts and Dependency Injection for Java, EE 1.1, has posted a Public Review.  This review closes 3 December.  JSR 352, Batch Applications for the Java Platform, has posted a Public Review.  This review closes 3 December. Inactive JSRs: In 2008, we initiated an effort to identify JSRs that had not continued to make progress in the JCP program.  We have reported on this topic since that time at JCP Executive Committee Meetings. The term 'Inactive JSRs' was introduced, and a process was developed with the guidance of the EC to reduce the number of Inactive JSRs  (reduced from over 60 to 2 JSRs) through either moving to the next JSR stage or being Withdrawn or declared Dormant.  This process has been formalized in JCP 2.8 and above, with the introduction of JSR deadlines.  The JSRs which were put to a Dormancy Ballot in September 2012  have been approved by the EC and are now declared Dormant.  You can view the results of the JSR Voting on JCP.org.  The latest Inactive JSRs report is available as part of the September 2012 JCP EC Face-to-Face Meeting Materials. 

    Read the article

  • ANTS CLR and Memory Profiler In Depth Review (Part 1 of 2 &ndash; CLR Profiler)

    - by ToStringTheory
    One of the things that people might not know about me, is my obsession to make my code as efficient as possible.  Many people might not realize how much of a task or undertaking that this might be, but it is surely a task as monumental as climbing Mount Everest, except this time it is a challenge for the mind…  In trying to make code efficient, there are many different factors that play a part – size of project or solution, tiers, language used, experience and training of the programmer, technologies used, maintainability of the code – the list can go on for quite some time. I spend quite a bit of time when developing trying to determine what is the best way to implement a feature to accomplish the efficiency that I look to achieve.  One program that I have recently come to learn about – Red Gate ANTS Performance (CLR) and Memory profiler gives me tools to accomplish that job more efficiently as well.  In this review, I am going to cover some of the features of the ANTS profiler set by compiling some hideous example code to test against. Notice As a member of the Geeks With Blogs Influencers program, one of the perks is the ability to review products, in exchange for a free license to the program.  I have not let this affect my opinions of the product in any way, and Red Gate nor Geeks With Blogs has tried to influence my opinion regarding this product in any way. Introduction The ANTS Profiler pack provided by Red Gate was something that I had not heard of before receiving an email regarding an offer to review it for a license.  Since I look to make my code efficient, it was a no brainer for me to try it out!  One thing that I have to say took me by surprise is that upon downloading the program and installing it you fill out a form for your usual contact information.  Sure enough within 2 hours, I received an email from a sales representative at Red Gate asking if she could help me to achieve the most out of my trial time so it wouldn’t go to waste.  After replying to her and explaining that I was looking to review its feature set, she put me in contact with someone that setup a demo session to give me a quick rundown of its features via an online meeting.  After having dealt with a massive ordeal with one of my utility companies and their complete lack of customer service, Red Gates friendly and helpful representatives were a breath of fresh air, and something I was thankful for. ANTS CLR Profiler The ANTS CLR profiler is the thing I want to focus on the most in this post, so I am going to dive right in now. Install was simple and took no time at all.  It installed both the profiler for the CLR and Memory, but also visual studio extensions to facilitate the usage of the profilers (click any images for full size images): The Visual Studio menu options (under ANTS menu) Starting the CLR Performance Profiler from the start menu yields this window If you follow the instructions after launching the program from the start menu (Click File > New Profiling Session to start a new project), you are given a dialog with plenty of options for profiling: The New Session dialog.  Lots of options.  One thing I noticed is that the buttons in the lower right were half-covered by the panel of the application.  If I had to guess, I would imagine that this is caused by my DPI settings being set to 125%.  This is a problem I have seen in other applications as well that don’t scale well to different dpi scales. The profiler options give you the ability to profile: .NET Executable ASP.NET web application (hosted in IIS) ASP.NET web application (hosted in IIS express) ASP.NET web application (hosted in Cassini Web Development Server) SharePoint web application (hosted in IIS) Silverlight 4+ application Windows Service COM+ server XBAP (local XAML browser application) Attach to an already running .NET 4 process Choosing each option provides a varying set of other variables/options that one can set including options such as application arguments, operating path, record I/O performance performance counters to record (43 counters in all!), etc…  All in all, they give you the ability to profile many different .Net project types, and make it simple to do so.  In most cases of my using this application, I would be using the built in Visual Studio extensions, as they automatically start a new profiling project in ANTS with the options setup, and start your program, however RedGate has made it easy enough to profile outside of Visual Studio as well. On the flip side of this, as someone who lives most of their work life in Visual Studio, one thing I do wish is that instead of opening an entirely separate application/gui to perform profiling after launching, that instead they would provide a Visual Studio panel with the information, and integrate more of the profiling project information into Visual Studio.  So, now that we have an idea of what options that the profiler gives us, its time to test its abilities and features. Horrendous Example Code – Prime Number Generator One of my interests besides development, is Physics and Math – what I went to college for.  I have especially always been interested in prime numbers, as they are something of a mystery…  So, I decided that I would go ahead and to test the abilities of the profiler, I would write a small program, website, and library to generate prime numbers in the quantity that you ask for.  I am going to start off with some terrible code, and show how I would see the profiler being used as a development tool. First off, the IPrimes interface (all code is downloadable at the end of the post): interface IPrimes { IEnumerable<int> GetPrimes(int retrieve); } Simple enough, right?  Anything that implements the interface will (hopefully) provide an IEnumerable of int, with the quantity specified in the parameter argument.  Next, I am going to implement this interface in the most basic way: public class DumbPrimes : IPrimes { public IEnumerable<int> GetPrimes(int retrieve) { //store a list of primes already found var _foundPrimes = new List<int>() { 2, 3 }; //if i ask for 1 or two primes, return what asked for if (retrieve <= _foundPrimes.Count()) return _foundPrimes.Take(retrieve); //the next number to look at int _analyzing = 4; //since I already determined I don't have enough //execute at least once, and until quantity is sufficed do { //assume prime until otherwise determined bool isPrime = true; //start dividing at 2 //divide until number is reached, or determined not prime for (int i = 2; i < _analyzing && isPrime; i++) { //if (i) goes into _analyzing without a remainder, //_analyzing is NOT prime if (_analyzing % i == 0) isPrime = false; } //if it is prime, add to found list if (isPrime) _foundPrimes.Add(_analyzing); //increment number to analyze next _analyzing++; } while (_foundPrimes.Count() < retrieve); return _foundPrimes; } } This is the simplest way to get primes in my opinion.  Checking each number by the straight definition of a prime – is it divisible by anything besides 1 and itself. I have included this code in a base class library for my solution, as I am going to use it to demonstrate a couple of features of ANTS.  This class library is consumed by a simple non-MVVM WPF application, and a simple MVC4 website.  I will not post the WPF code here inline, as it is simply an ObservableCollection<int>, a label, two textbox’s, and a button. Starting a new Profiling Session So, in Visual Studio, I have just completed my first stint developing the GUI and DumbPrimes IPrimes class, so now I want to check my codes efficiency by profiling it.  All I have to do is build the solution (surprised initiating a profiling session doesn’t do this, but I suppose I can understand it), and then click the ANTS menu, followed by Profile Performance.  I am then greeted by the profiler starting up and already monitoring my program live: You are provided with a realtime graph at the top, and a pane at the bottom giving you information on how to proceed.  I am going to start by asking my program to show me the first 15000 primes: After the program finally began responding again (I did all the work on the main UI thread – how bad!), I stopped the profiler, which did kill the process of my program too.  One important thing to note, is that the profiler by default wants to give you a lot of detail about the operation – line hit counts, time per line, percent time per line, etc…  The important thing to remember is that this itself takes a lot of time.  When running my program without the profiler attached, it can generate the 15000 primes in 5.18 seconds, compared to 74.5 seconds – almost a 1500 percent increase.  While this may seem like a lot, remember that there is a trade off.  It may be WAY more inefficient, however, I am able to drill down and make improvements to specific problem areas, and then decrease execution time all around. Analyzing the Profiling Session After clicking ‘Stop Profiling’, the process running my application stopped, and the entire execution time was automatically selected by ANTS, and the results shown below: Now there are a number of interesting things going on here, I am going to cover each in a section of its own: Real Time Performance Counter Bar (top of screen) At the top of the screen, is the real time performance bar.  As your application is running, this will constantly update with the currently selected performance counters status.  A couple of cool things to note are the fact that you can drag a selection around specific time periods to drill down the detail views in the lower 2 panels to information pertaining to only that period. After selecting a time period, you can bookmark a section and name it, so that it is easy to find later, or after reloaded at a later time.  You can also zoom in, out, or fit the graph to the space provided – useful for drilling down. It may be hard to see, but at the top of the processor time graph below the time ticks, but above the red usage graph, there is a green bar. This bar shows at what times a method that is selected in the ‘Call tree’ panel is called. Very cool to be able to click on a method and see at what times it made an impact. As I said before, ANTS provides 43 different performance counters you can hook into.  Click the arrow next to the Performance tab at the top will allow you to change between different counters if you have them selected: Method Call Tree, ADO.Net Database Calls, File IO – Detail Panel Red Gate really hit the mark here I think. When you select a section of the run with the graph, the call tree populates to fill a hierarchical tree of method calls, with information regarding each of the methods.   By default, methods are hidden where the source is not provided (framework type code), however, Red Gate has integrated Reflector into ANTS, so even if you don’t have source for something, you can select a method and get the source if you want.  Methods are also hidden where the impact is seen as insignificant – methods that are only executed for 1% of the time of the overall calling methods time; in other words, working on making them better is not where your efforts should be focused. – Smart! Source Panel – Detail Panel The source panel is where you can see line level information on your code, showing the code for the currently selected method from the Method Call Tree.  If the code is not available, Reflector takes care of it and shows the code anyways! As you can notice, there does seem to be a problem with how ANTS determines what line is the actual line that a call is completed on.  I have suspicions that this may be due to some of the inline code optimizations that the CLR applies upon compilation of the assembly.  In a method with comments, the problem is much more severe: As you can see here, apparently the most offending code in my base library was a comment – *gasp*!  Removing the comments does help quite a bit, however I hope that Red Gate works on their counter algorithm soon to improve the logic on positioning for statistics: I did a small test just to demonstrate the lines are correct without comments. For me, it isn’t a deal breaker, as I can usually determine the correct placements by looking at the application code in the region and determining what makes sense, but it is something that would probably build up some irritation with time. Feature – Suggest Method for Optimization A neat feature to really help those in need of a pointer, is the menu option under tools to automatically suggest methods to optimize/improve: Nice feature – clicking it filters the call tree and stars methods that it thinks are good candidates for optimization.  I do wish that they would have made it more visible for those of use who aren’t great on sight: Process Integration I do think that this could have a place in my process.  After experimenting with the profiler, I do think it would be a great benefit to do some development, testing, and then after all the bugs are worked out, use the profiler to check on things to make sure nothing seems like it is hogging more than its fair share.  For example, with this program, I would have developed it, ran it, tested it – it works, but slowly. After looking at the profiler, and seeing the massive amount of time spent in 1 method, I might go ahead and try to re-implement IPrimes (I actually would probably rewrite the offending code, but so that I can distribute both sets of code easily, I’m just going to make another implementation of IPrimes).  Using two pieces of knowledge about prime numbers can make this method MUCH more efficient – prime numbers fall into two buckets 6k+/-1 , and a number is prime if it is not divisible by any other primes before it: public class SmartPrimes : IPrimes { public IEnumerable<int> GetPrimes(int retrieve) { //store a list of primes already found var _foundPrimes = new List<int>() { 2, 3 }; //if i ask for 1 or two primes, return what asked for if (retrieve <= _foundPrimes.Count()) return _foundPrimes.Take(retrieve); //the next number to look at int _k = 1; //since I already determined I don't have enough //execute at least once, and until quantity is sufficed do { //assume prime until otherwise determined bool isPrime = true; int potentialPrime; //analyze 6k-1 //assign the value to potential potentialPrime = 6 * _k - 1; //if there are any primes that divise this, it is NOT a prime number //using PLINQ for quick boost isPrime = !_foundPrimes.AsParallel() .Any(prime => potentialPrime % prime == 0); //if it is prime, add to found list if (isPrime) _foundPrimes.Add(potentialPrime); if (_foundPrimes.Count() == retrieve) break; //analyze 6k+1 //assign the value to potential potentialPrime = 6 * _k + 1; //if there are any primes that divise this, it is NOT a prime number //using PLINQ for quick boost isPrime = !_foundPrimes.AsParallel() .Any(prime => potentialPrime % prime == 0); //if it is prime, add to found list if (isPrime) _foundPrimes.Add(potentialPrime); //increment k to analyze next _k++; } while (_foundPrimes.Count() < retrieve); return _foundPrimes; } } Now there are definitely more things I can do to help make this more efficient, but for the scope of this example, I think this is fine (but still hideous)! Profiling this now yields a happy surprise 27 seconds to generate the 15000 primes with the profiler attached, and only 1.43 seconds without.  One important thing I wanted to call out though was the performance graph now: Notice anything odd?  The %Processor time is above 100%.  This is because there is now more than 1 core in the operation.  A better label for the chart in my mind would have been %Core time, but to each their own. Another odd thing I noticed was that the profiler seemed to be spot on this time in my DumbPrimes class with line details in source, even with comments..  Odd. Profiling Web Applications The last thing that I wanted to cover, that means a lot to me as a web developer, is the great amount of work that Red Gate put into the profiler when profiling web applications.  In my solution, I have a simple MVC4 application setup with 1 page, a single input form, that will output prime values as my WPF app did.  Launching the profiler from Visual Studio as before, nothing is really different in the profiler window, however I did receive a UAC prompt for a Red Gate helper app to integrate with the web server without notification. After requesting 500, 1000, 2000, and 5000 primes, and looking at the profiler session, things are slightly different from before: As you can see, there are 4 spikes of activity in the processor time graph, but there is also something new in the call tree: That’s right – ANTS will actually group method calls by get/post operations, so it is easier to find out what action/page is giving the largest problems…  Pretty cool in my mind! Overview Overall, I think that Red Gate ANTS CLR Profiler has a lot to offer, however I think it also has a long ways to go.  3 Biggest Pros: Ability to easily drill down from time graph, to method calls, to source code Wide variety of counters to choose from when profiling your application Excellent integration/grouping of methods being called from web applications by request – BRILLIANT! 3 Biggest Cons: Issue regarding line details in source view Nit pick – Processor time vs. Core time Nit pick – Lack of full integration with Visual Studio Ratings Ease of Use (7/10) – I marked down here because of the problems with the line level details and the extra work that that entails, and the lack of better integration with Visual Studio. Effectiveness (10/10) – I believe that the profiler does EXACTLY what it purports to do.  Especially with its large variety of performance counters, a definite plus! Features (9/10) – Besides the real time performance monitoring, and the drill downs that I’ve shown here, ANTS also has great integration with ADO.Net, with the ability to show database queries run by your application in the profiler.  This, with the line level details, the web request grouping, reflector integration, and various options to customize your profiling session I think create a great set of features! Customer Service (10/10) – My entire experience with Red Gate personnel has been nothing but good.  their people are friendly, helpful, and happy! UI / UX (8/10) – The interface is very easy to get around, and all of the options are easy to find.  With a little bit of poking around, you’ll be optimizing Hello World in no time flat! Overall (8/10) – Overall, I am happy with the Performance Profiler and its features, as well as with the service I received when working with the Red Gate personnel.  I WOULD recommend you trying the application and seeing if it would fit into your process, BUT, remember there are still some kinks in it to hopefully be worked out. My next post will definitely be shorter (hopefully), but thank you for reading up to here, or skipping ahead!  Please, if you do try the product, drop me a message and let me know what you think!  I would love to hear any opinions you may have on the product. Code Feel free to download the code I used above – download via DropBox

    Read the article

  • How to make code-review feel less like a way to *shift* the responsibility? [duplicate]

    - by One Two Three
    This question already has an answer here: How do you make people accept code review? 33 answers Sometimes it seems to me that people ask for code-reviews just so they would be able to say "Xyz reviewed my code!"(1) when something broke. Question, is that ever the case? (Or is it just my imagination) If it is, how do I handle this? (1): What s/he really meant: It's Xyz's fault or something along those lines.

    Read the article

  • Micro Niche Finder Review - Is it Worth Investing in For Niche Research?

    As you know, keywords are at the heart of SEO (Search Engine Optimization) but as you may also know the general search terms on Google are getting very competitive and hard to rank for so the secret nowadays is to do niche research to try and find "meaty", long-tail, low competition keywords. Can Micro Niche Finder help you do this? Find out in this review.

    Read the article

  • A review of the latest version of Crypto Obfuscator for .NET and its features.

    Crypto Obfuscator For .Net is a powerful and easy-to-use product for code protection, deployment and optimization of your your .Net software. A review of the latest version of Crypto Obfuscator for .NET and its features.  read moreBy Peter BrombergDid you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • I have submitted app to app store and app status came like 'Metadata Rejected' and following review status. I do not have login page

    - by user3717465
    We began the review of your app but are not able to continue because we need a demo account to fully access your app features. Please provide demo account details in the Review Notes section of the Version Information for your app. Please ensure that the information you provide includes any data necessary to demonstrate the functionality of your app features. You can provide demo account information, including passwords, in the Review Notes section of your iTunes Connect App Information. While your iTunes Connect Application State shows as Metadata Rejected, we don't require a new binary to correct this issue. Please visit iTunes Connect, Manage Your Applications. Select your app, then click View Details of the desired version. Click the Edit button next to Version Information to edit the Review Notes for your app, then click "Save". how to correct the meta data. because i do not have login account.

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >