Search Results

Search found 88955 results on 3559 pages for 'code wizard'.

Page 26/3559 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • Fixing the #mvvmlight code snippets in Visual Studio 11

    - by Laurent Bugnion
    If you installed the latest MVVM Light version for Windows 8, you may encounter an issue where code snippets are not displayed correctly in the Intellisense popup. I am working on a fix, but for now here is how you can solve the issue manually. The code snippets MVVM Light, when installed correctly, will install a set of code snippets that are very useful to allow you to type less code. As I use to say, code is where bugs are, so you want to type as little of that as possible ;) With code snippets, you can easily auto-insert segments of code and easily replace the keywords where needed. For instance, every coder who uses MVVM as his favorite UI pattern for XAML based development is used to the INotifyPropertyChanged implementation, and how boring it can be to type these “observable properties”. Obviously a good fix would be something like an “Observable” attribute, but that is not supported in the language or the framework for the moment. Another fix involves “IL weaving”, which is a post-build operation modifying the generate IL code and inserting the “RaisePropertyChanged” instruction. I admire the invention of those who developed that, but it feels a bit too much like magic to me. I prefer more “down to earth” solutions, and thus I use the code snippets. Fixing the issue Normally, you should see the code snippets in Intellisense when you position your cursor in a C# file and type mvvm. All MVVM Light snippets start with these 4 letters. Normal MVVM Light code snippets However, in Windows 8 CP, there is an issue that prevents them to appear correctly, so you won’t see them in the Intellisense windows. To restore that, follow the steps: In Visual Studio 11, open the menu Tools, Code Snippets Manager. In the combobox, select Visual C#. Press Add… Navigate to C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\SnippetsWin8 and select the CSharp folder. Press Select Folder. Press OK to close the Code Snippets Manager. Now if you type mvvm in a C# file, you should see the snippets in your Intellisense window. Cheers Laurent   Laurent Bugnion (GalaSoft) Subscribe | Twitter | Facebook | Flickr | LinkedIn

    Read the article

  • What source code organization approach helps improve modularity and API/Implementation separation?

    - by Berin Loritsch
    Few languages are as restrictive as Java with file naming standards and project structure. In that language, the file name must match the public class declared in the file, and the file must live in a directory structure matching the class package. I have mixed feelings about that approach. While I never have to guess where a file lives, there's still a lot of empty directories and artificial constraints. There's several languages that define everything about a class in one file, at least by convention. C#, Python (I think), Ruby, Erlang, etc. The commonality in most these languages is that they are object oriented, although that statement can probably be rebuffed (there is one non-OO language in the list already). Finally, there's quite a few languages mostly in the C family that have a separate header and implementation file. For C I think this makes sense, because it is one of the few ways to separate the API interface from implementations. With C it seems that feature is used to promote modularity. Yet, with C++ the way header and implementation files are split seems rather forced. You don't get the same clean API separation that you do with C, and you are forced to include some private details in the header you would rather keep only in the implementation. There's quite a few languages that have a concept that overlaps with interfaces like Java, C#, Go, etc. Some languages use what feels like a hack to provide the same concept like C# using pure virtual abstract classes. Still others don't really have an interface concept and rely on "duck" typing--for example Ruby. Ruby has modules, but those are more along the lines of mixing in behaviors to a class than they are for defining how to interact with a class. In OO terms, interfaces are a powerful way to provide separation between an API client and an API implementation. So to hurry up and ask the question, from a personal experience point of view: Does separation of header and implementation help you write more modular code, or does it get in the way? (it helps to specify the language you are referring to) Does the strict file name to class name scheme of Java help maintainability, or is it unnecessary structure for structure's sake? What would you propose to promote good API/Implementation separation and project maintenance, how would you prefer to do it?

    Read the article

  • Code Golf: Collatz Conjecture

    - by Earlz
    Inspired by http://xkcd.com/710/ here is a code golf for it. The Challenge Given a positive integer greater than 0, print out the hailstone sequence for that number. The Hailstone Sequence See Wikipedia for more detail.. If the number is even, divide it by two. If the number is odd, triple it and add one. Repeat this with the number produced until it reaches 1. (if it continues after 1, it will go in an infinite loop of 1 -> 4 -> 2 -> 1...) Sometimes code is the best way to explain, so here is some from Wikipedia function collatz(n) show n if n > 1 if n is odd call collatz(3n + 1) else call collatz(n / 2) This code works, but I am adding on an extra challenge. The program must not be vulnerable to stack overflows. So it must either use iteration or tail recursion. Also, bonus points for if it can calculate big numbers and the language does not already have it implemented. (or if you reimplement big number support using fixed-length integers) Test case Number: 21 Results: 21 -> 64 -> 32 -> 16 -> 8 -> 4 -> 2 -> 1 Number: 3 Results: 3 -> 10 -> 5 -> 16 -> 8 -> 4 -> 2 -> 1 Also, the code golf must include full user input and output.

    Read the article

  • C# and F# lambda expressions code generation

    - by ControlFlow
    Let's look at the code, generated by F# for simple function: let map_add valueToAdd xs = xs |> Seq.map (fun x -> x + valueToAdd) The generated code for lambda expression (instance of F# functional value) will looks like this: [Serializable] internal class map_add@3 : FSharpFunc<int, int> { public int valueToAdd; internal map_add@3(int valueToAdd) { this.valueToAdd = valueToAdd; } public override int Invoke(int x) { return (x + this.valueToAdd); } } And look at nearly the same C# code: using System.Collections.Generic; using System.Linq; static class Program { static IEnumerable<int> SelectAdd(IEnumerable<int> source, int valueToAdd) { return source.Select(x => x + valueToAdd); } } And the generated code for the C# lambda expression: [CompilerGenerated] private sealed class <>c__DisplayClass1 { public int valueToAdd; public int <SelectAdd>b__0(int x) { return (x + this.valueToAdd); } } So I have some questions: Why does F#-generated class is not marked as sealed? Why does F#-generated class contains public fields since F# doesn't allows mutable closures? Why does F# generated class has the constructor? It may be perfectly initialized with the public fields... Why does C#-generated class is not marked as [Serializable]? Also classes generated for F# sequence expressions are also became [Serializable] and classes for C# iterators are not.

    Read the article

  • Posting source code in blogger- fails with C# containers

    - by Lirik
    I tried the solutions that are posted in this related SO question and for the most part the code snippets are working, but there are some cases that are still getting garbled by Blogger when it publishes the blog. In particular, declaring generic containers seems to be most troublesome. Please see the code examples on my blog and in particular the section where I define the dictionary (http://mlai-lirik.blogspot.com/). I want to display this: static Dictionary<int, List<Delegate>> _delegate = new Dictionary<int,List<Delegate>>(); But blogger publishes this: static Dictionary<int, list=""><delegate>> _delegate = new Dictionary<int, list=""><delegate>>(); And it caps the end of my code section with this: </delegate></delegate></int,></delegate></int,> Apparently blogger thinks that the <int and <delegate> portion of the dictionary are some sort of HTML tags and it automatically attempts to close them at the end of the code snippet. Does anybody know how to get around this problem?

    Read the article

  • Yet another "What is this code doing"-type of Perl code

    - by Mike
    I have inherited some code from a guy whose favorite past time was to shorten every line to its absolute minimum (and sometimes only to make it look cool). His code is hard to understand but I managed to understand (and rewrite) most of it. Now I have stumbled on a piece of code which, no matter how hard I try, I cannot understand. my @heads = grep {s/\.txt$//} OSA::Fast::IO::Ls->ls($SysKey,'fo','osr/tiparlo',qr{^\d+\.txt$}) || (); my @selected_heads = (); for my $i (0..1) { $selected_heads[$i] = int rand scalar @heads; for my $j (0..@heads-1) { last if (!grep $j eq $_, @selected_heads[0..$i-1]); $selected_heads[$i] = ($selected_heads[$i] + 1) % @heads; #WTF? } my $head_nr = sprintf "%04d", $i; OSA::Fast::IO::Cp->cp($SysKey,'',"osr/tiparlo/$heads[$selected_heads[$i]].txt","$recdir/heads/$head_nr.txt"); OSA::Fast::IO::Cp->cp($SysKey,'',"osr/tiparlo/$heads[$selected_heads[$i]].cache","$recdir/heads/$head_nr.cache"); } From what I can understand, this is supposed to be some kind of randomizer, but I never saw a more complex way to achieve randomness. Or are my assumptions wrong? At least, that's what this code is supposed to do. Select 2 random files and copy them. === NOTES === The OSA Framework is a Framework of our own. They are named after their UNIX counterparts and do some basic testing so that the application does not need to bother with that.

    Read the article

  • Code Organization Connundrum: Web Project With Multiple Supporting DLLs?

    - by Code Sherpa
    Hi. I am trying to get a handle on the best practice for code organization within my project. I have looked around on the internet for good examples and, so far, I have seen examples of a web project with one or multiple supporting class libraries that it references or a web project with sub-folders that follow its namespace conventions. Assuming there is no right answer, this is what I currently have for code organization: MyProjectWeb This is my web site. I am referencing my class libraries here. MyProject.DLL As the base namespace, I am using this DLL for files that need to be generally consumable. For example, my class "Enums" that has all the enumerations in my project lives there. As does class MyProjectException for all exception handling. MyProject.IO.DLL This is a grouping of maybe 20 files that handle file upload and download (so far). MyProject.Utilities.DLL ALl my common classes and methods bunched up together in one generally consumable DLL. Each class follows a "XHelper" convention such as "SqlHelper, AuthHelper, SerializationHelper, and so on... MyProject.Web.DLL I am using this DLL as the main client interface. Right now, the majority of class files here are: 1) properties (such as School, Location, Account, Posts) 2) authorization stuff ( such as custom membership, custom role, & custom profile providers) My question is simply - does this seem logical? Also, how do I avoid having to cross reference DLLs from one project library to the next? For example, MyProject.Web.DLL uses code from MyProject.Utilities.DLL and MyProject.Utilities.DLL uses code from MyProject.DLL. Is this solved by clicking on properties and selecting "Dependencies"? I tried that but still don't seem to be accessing the namespaces of the assembly I have selected. Do I have to reference every assembly I need for each class library? Responses appreciated and thanks for your patience.

    Read the article

  • How do the size standard libraries compare for different languages

    - by Roman A. Taycher
    Someone was recently raving about how great jQuery was and how it made javascript into a pleasure and also how the whole source code was so small(and one file). I looked it up on www.ohloh.net/ and it said it was about 30,000 lines of javascript, when I tired curl piped to wc it said about 5000 lines(strange discrepancy that, maybe test suites, ect?). I thought well it isn't that strange since javascript from what I've heard has a lot of fun dynamic tricks, so you can probably get away with a small library. But then I thought what about other high level languages, the ones with large standard libraries and wondered how big the standard are for python/ruby/haskell/pharo(smalltalk)/*ml/ect. (libraries not vm stuff to the degree its possible to separate it) Anybody know? Any details (comment/blank/code lines , test code lines, lines in language vs lines in ffi/byte-code) are appreciated! edit: ps. since it started this me asking about jQuery as a bonus if you could please list the size of mega frameworks, a megaframewok provides so much that people using an x megaframework in language y might sometimes refer to programming in xy or even x rather then in y (ie. : qt, jQuery, etc.).

    Read the article

  • Semantically linking to code snippets

    - by Tim
    What's the most simple and semantic way of presenting code snippets in HTML? Possible XHTML syntax <a href="code_sample.php" type="text/x-php"> Example of widget creation </a> Example of linked file (code_sample.php): // Create a new widget $widget = new widget(); Pros: Semantically uses title to describe the source code being referenced Up to the client to render snippet Having very many custom server-side implementations tells me it should be standardized Browsers can have plug-ins for copy+paste, download, etc Seems to me this is where it belongs (not in Javascript) Degradation: non-compliant browsers receive a link to the associated content Cons: Not semantic enough? Seems wrong to replace hyperlinks with source code for presentation <object> might be better, but wouldn't degrade as nicely. Background I'm trying to create a "personal" XHTML standard for storing notes (wow, this is probably among the nerdiest things I've said). Since notes are just "scratch" it needs to be very lightweight. SO's markdown is very lightweight but not semantic enough for my needs. Plus, now I'm just curious. What's the most ideal syntax for linking to client-rendered code-snippets?

    Read the article

  • Executing logic before save or validation with EF Code-First Models

    - by Ryan Norbauer
    I'm still getting accustomed to EF Code First, having spent years working with the Ruby ORM, ActiveRecord. ActiveRecord used to have all sorts of callbacks like before_validation and before_save, where it was possible to modify the object before it would be sent off to the data layer. I am wondering if there is an equivalent technique in EF Code First object modeling. I know how to set object members at the time of instantiation, of course, (to set default values and so forth) but sometimes you need to intervene at different moments in the object lifecycle. To use a slightly contrived example, say I have a join table linking Authors and Plays, represented with a corresponding Authoring object: public class Authoring { public int ID { get; set; } [Required] public int Position { get; set; } [Required] public virtual Play Play { get; set; } [Required] public virtual Author Author { get; set; } } where Position represents a zero-indexed ordering of the Authors associated to a given Play. (You might have a single "South Pacific" Play with two authors: a "Rodgers" author with a Position 0 and a "Hammerstein" author with a Position 1.) Let's say I wanted to create a method that, before saving away an Authoring record, it checked to see if there were any existing authors for the Play to which it was associated. If no, it set the Position to 0. If yes, it would find set the Position of the highest value associated with that Play and increment by one. Where would I implement such logic within an EF code first model layer? And, in other cases, what if I wanted to massage data in code before it is checked for validation errors? Basically, I'm looking for an equivalent to the Rails lifecycle hooks mentioned above, or some way to fake it at least. :)

    Read the article

  • Insert code into a method - Java

    - by DutrowLLC
    Is there a way to automatically insert code into a method? I have the following and I would like to insert the indicated code: public class Person { Set<String> updatedFields = new LinkedHashSet<String>(); String firstName; public String getFirstName(){ return firstName; } boolean isFirstNameChanged = false; // Insert public void setFirstName(String firstName){ if( !isFirstNameChanged ){ // Insert isFirstNameChanged = true; // Insert updatedFields.add("firstName"); // Insert } // Insert this.firstName = firstName; } } I'm also not sure if I can the subset of the method name as a string from inside the method itself as indicated on the line where I add the fieldName as a string into the set of updated fields: updatedFields.add("firstName");. And I'm not sure how to insert fields into a class where I add the boolean field that tracks if the field has been modified or not before (for efficiency to prevent having to manipulate the Set): boolean isFirstNameChanged = false; It seems to most obvious answer to this would be to use code templates inside eclipse, but I'm concerned about having to go back and change the code later.

    Read the article

  • An algo for generating code callgraphs

    - by Shrey
    I am working on a project which requires generating some metrices of a code (it can be C/C++/Java/Python). One of the metrices can be that I create a callgraph after parsing the code entered (the programs are expected to be small - probably under 1000L). As of now, I am looking for a way to create a program (it can be C/Python) which can take as input a file (C/C++/Python/Java) and then create a textual output containing approximate calling sequence as well as tokens in the code file. As of now, I have looked at some other tools which do the same thing - like splint, pylint, codeviz etc. So, I have two ways of solving my problem: Read and understand the algorithm these tools use (tokenization-graph generation etc) Or, have a basic algo (something like very high level steps) and then sit down to create each of them as I want them to be. I know, re-inventing the wheel is not a good idea, but, I would still like to give option (2) a shot. Only issue is, currently I am a blank. My question: Does any one have any knowhow about how to create code graphs? Any hints as to what I should do? Any top levels steps which I can follow? Thanks a lot.

    Read the article

  • F# - POCO Class

    - by ebb
    Hey there! I'm trying to write a POCO class in proper F#... But something is wrong.. The C# code that I want to "translate" to proper F# is: public class MyTest { [Key] public int ID { get; set; } public string Name { get; set; } } The closest I can come to the above code in F# is something like: type Mytest() = let mutable _id : int = 0; let mutable _name : string = null; [<KeyAttribute>] member x.ID with public get() : int = _id and public set(value) = _id <- value member x.Name with public get() : string = _name and public set value = _name <- value However when I try to access the properties of the F# version it just returns a compile error saying "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved." The code thats trying to get the property is a part of my Repository (I'm using EF Code First). module Databasethings = let GetEntries = let ctx = new SevenContext() let mydbset = ctx.Set<MyTest>() let entries = mydbset.Select(fun item -> item.Name).ToList() // This line comes up with a compile error at "item.Name" (the compile error is written above) entries What the hell is going on? Thanks in advance!

    Read the article

  • Organising UI code in .NET forms

    - by sb3700
    Hi I'm someone who has taught myself programming, and haven't had any formal training in .NET programming. A while back, I started C# in order to develop a GUI program to control sensors, and the project has blossomed. I was just wondering how best to organise the code, particularly UI code, in my forms. My forms currently are a mess, or at least seem a mess to me. I have a constructor which initialises all the parameters and creates events. I have a giant State property, which updates the Enabled state of all my form control as users progress through the application (ie: disconnected, connected, setup, scanning) controlled by a States enum. I have 3-10 private variables accessed through properties, some of which have side-effects in changing the values of form elements. I have a lot of "UpdateXXX" functions to handle UI elements that depend on other UI elements - ie: if a sensor is changed, then change the baud rate drop down list. They are separated into regions I have a lot of events calling these Update functions I have a background worker which does all the scanning and analysis. My problem is this seems like a mess, particularly the State property, and is getting unmaintainable. Also, my application logic code and UI code are in the same file and to some degree, intermingled which seems wrong and means I need to do a lot of scrolling to find what I need. How do you structure your .net forms? Thanks

    Read the article

  • Debugging unmanaged code while debugging managed code

    - by sc_ray
    Hi, The .NET 3.5 application I am working on consists of bunch of different solutions. Some of these solutions consist of managed code(C#) and others have unmanaged code(C++). Methods written in C# communicate with the ones written in C++. I am trying to trace the dependencies between these various functions and I thought setting breakpoints on the solution consisting my C++ functions. One of the C# solutions have the startup project. I run this solution in debug mode with the expectation that the breakpoints in my unmanaged code will be hit but nothing really happens. Can somebody guide me through the process of debugging mixed applications such as these using the Visual Studio IDE? Thanks

    Read the article

  • How to write Tetris in Scala? (code review)

    - by eed3si9n
    Today's the 25th birthday of Tetris. I believe writing Tetris clone is one of the best ways to familiarize oneself to a new language or a platform. It's not completely trivial and it lends itself well to learning language specific constructs like iterators and closures. I've been hearing about Scala, and finally decided to read some docs and write a Tetris clone. So, this is my first Scala code. I did try to use functional constructs, but am sure there are lots of things I can improve to do it more Scala way. Please give me suggestions using comment. Also other submissions of Tetris clone in Scala are welcome too. I'm aware that the actual question itself is somewhat subjective, but I think this is of some value since others can use this as example (or anti-example) code. Edit: Let me rephrase the question. What can I do to make the code more Scala-ish?

    Read the article

  • How do I sign exes and dlls with my code signing certificate

    - by Tim
    (I purchased a code signing cert from Thawte and have been going out of my mind with frustration at the whole process. What I have from them are: .spc / .p7b file .pvk file (NOTE I do not have a pfx file from them. God knows why, but I have been fighting with their tech support for a week) In any case I find "help" links on their site and at MS for signcode.exe which is useless for me because I can't find that exe on my machine, however I do have signtool.exe. Unfortunately i am mystified at the command line parameters listed on this MS help site. Specifically, what parameters do I use and what values? I tried what I thought was obvious but it does not work at all. I can get the signing wizard to work, however I need this to work non-interactively in a hudson CI batch file. It really doesn't seem like it should be this difficult, but so far it is all black magic. thanks for any help

    Read the article

  • Cannot run code on device

    - by lostInTransit
    Hi I have some source code which I had developed and later gave to another team. They signed it with their certificate and provisioning profile. Now I have the code back and have set the appropriate values in the project properties for code signing identity (with my cert and profile). But when I run the application on a device, I get an error showing the other team's certificate and prompting that the provisioning profile does not exist. I don't know where it is being referenced. Can someone please help. Thanks.

    Read the article

  • Code reviews for larger MVC.NET team using TFS

    - by Parrots
    I'm trying to find a good code review workflow for my team. Most questions similar to this on SO revolve around using shelved changes for the review, however I'm curious about how this works for people with larger teams. We usually have 2-3 people working a story (UI person, Domain/Repository person, sometimes DB person). I've recommended the shelf idea but we're all concerned about how to manage that with multiple people working the same feature. How could you share a shelf between multiple programmers at that point? We worry it would be clunky and we might easily have unintended consequences moving to this workflow. Of course moving to shelfs for each feature avoids having 10 or so checkins per feature (as developers need to share code) making seeing the diffs at code review time painful. Has anyone else been able to successfully deal with this? Are there any tools out there people have found useful aside from shelfs in TFS (preferably open-source)?

    Read the article

  • in TFS can we customize the merge algorithm (conflict resolution)

    - by Jennifer Zouak
    In our case we want to igonore changes in code comment headers for generated code. In Visual Studio, we can change the merge tool (GUI that pops up) and use a 3rd party tool that is able to be customized to ignore changes (http://msdn.microsoft.com/en-us/library/ms181446.aspx). Great, so a file comparison no longer highlights code comments as differences. However when it comes time to checkin, the TFS merge algorith is still prompting us to resolve conflicts. Is there any way to better inform the merge conflict resolution algorithm about which changes are actually important to us? Or can we replace the algorithm or otherwise have it subcontract its work to a 3rd party?

    Read the article

  • Running NUnit tests in Visual Studio 2010 with code coverage

    - by adrianbanks
    We have recently upgraded from Visual Studio 2008 to Visual Studio 2010. As part of our code base, we have a very large set of NUnit tests. We would like to be able to run these unit tests within Visual Studio, but with code coverage enabled. We have ReSharper, so can run the tests within Visual Studio, but it does not allow the code coverage tool to do its thing and generate the coverage statistics. Is there any way to make this work, or will we have to convert the tests over to MSTest?

    Read the article

  • Funniest code names for software projects

    - by furtelwart
    Developers are creative. Not as they create wonderfull GUIs or proof their sense for art with good color combinations, but with code names. Every project has a code name, sometimes official, sometimes private (with a good reason!). Here are my favourites: Android: 1.6 = Donut 2.0 = Eclaire (picture of Google's eclaire) grml (Live distribution based on Debian GNU/Linux, comes from Austria therefore in German) Hustenstopper (cough stopper) Eierspass (egg fun) Meilenschwein (mile pig, it's a pun with milestone) Lackdose-Allergie (lacquer can allergy, it's a pun with lactose allergy) Hello-Wien (pun with Halloween, Wien being German for Vienna) I really like to see the funniest code names you ever heard of. Aren't there any more funny project names?

    Read the article

  • Typical practice for redistributing third party source code with your source code

    - by bglenn
    I'm releasing an application I wrote as an open-source project by creating a public source-code repository. I use a third-party library which is also open-source and freely redistributable. I'm not versioning the third-party library, but should I include it in my repository for the convenience of those cloning the repository or should I expect them to download the third-party library on their own? To be clear, I'm not asking if I should version the third-party code or if I can redistribute it, but whether it is standard practice to include third-party source code as a convenience.

    Read the article

  • Obtaining C++ Code Coverage

    - by anon
    I'm on Linux. My code is written in C++. My program is non-interactive; it runs as "./prog input-file", processes the file, and exits. I have various unit tests "input-file0, input-file1, input-file2, ..." For designing new unit tests, I want to know what lines of code existing tests do not cover. Question: Given that I control how "prog" is compiled/run; how can I get list of the lines of code that "./prog input-file" does not hit? Thanks!

    Read the article

  • How to detect code duplication during development ?

    - by David Dibben
    We have a fairly large code base, 400K LOC of C++, and code duplication is something of a problem. Are there any tools which can effectively detect duplicated blocks of code? Ideally this would be something that developers could use during development rather than just run occasionally to see where the problems are. It would also be nice if we could integrate such a tool with CruiseControl to give a report after each check in. I had a look at Duploc some time ago, it showed a nice graph but requires a smalltalk environment to use it, which makes running it automatically rather difficult. Free tools would be nice, but if there are some good commercial tools I would also be interested.

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >