Search Results

Search found 88709 results on 3549 pages for 'code efficiency'.

Page 45/3549 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • Map a column to be IDENTITY in db with EF4 Code-Only

    - by Tomas Lycken
    Although I have marked my ID column with .Identity(), the generated database schema doesn't have IDENTITY set to true, which gives me problems when I'm adding records. If I manually edit the database schema (in SQL Management Studio) to have the Id column marked IDENTITY, everything works as I want it - I just can't make EF do that by itself. This is my complete mapping: public class EntryConfiguration : EntityConfiguration<Entry> { public EntryConfiguration() { Property(e => e.Id).IsIdentity(); Property(e => e.Amount); Property(e => e.Description).IsRequired(); Property(e => e.TransactionDate); Relationship(e => (ICollection<Tag>)e.Tags).FromProperty(t => t.Entries); } } As I'm using EF to build and re-build the database for integration testing, I really need this to be done automatically...

    Read the article

  • .net 4.0 with Code Access Security NetFx40_LegacySecurityPolicy won't work

    - by user210903
    Hi- I'm trying to use an external library DevExpress.XtraTreeList.v8.1.dll in my vsto office addin built using VS2010 beta 2. I am getting the following compile time error: DevExpress.Utils.AppareanceObject threw an exception -- System.NotSupportedException. The error message goes on to say that for compatibility reasons I can use the NetFx40_LegacySecurityPolicy switch. I've tried putting this config variable in all of the following locations: 1) my applications config file. 2) C:\Windows\Microsoft.NET\Framework\v4.0.21006\msbuild.exe.config 3) C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\dev.exe.config None of these have resolved the problem. Here were the references I've used. re-enable cas msdn.microsoft.com/en-us/library/ee191568(VS.100).aspx How do I get rid of this error so I can build the application in vs 2010?

    Read the article

  • Code Golf: Triforce

    - by chpwn
    This is inspired by/taken from this thread: http://www.allegro.cc/forums/thread/603383 The Problem Assume the user gives you a numeric input ranging from 1 to 7. Input should be taken from the console, arguments are less desirable. When the input is 1, print the following: *********** ********* ******* ***** *** * Values greater than one should generate multiples of the pattern, ending with the one above, but stacked symmetrically. For example, 3 should print the following: *********** *********** *********** ********* ********* ********* ******* ******* ******* ***** ***** ***** *** *** *** * * * *********** *********** ********* ********* ******* ******* ***** ***** *** *** * * *********** ********* ******* ***** *** * Bonus points if you print the reverse as well. *********** *********** ********* ********* ******* ******* ***** ***** *** *** * * *********** ********* ******* ***** *** * * *** ***** ******* ********* *********** * * *** *** ***** ***** ******* ******* ********* ********* *********** *********** Can we try and keep it to one answer per language, that we all improve on?

    Read the article

  • F# currying efficiency?

    - by Eamon Nerbonne
    I have a function that looks as follows: let isInSet setElems normalize p = normalize p |> (Set.ofList setElems).Contains This function can be used to quickly check whether an element is semantically part of some set; for example, to check if a file path belongs to an html file: let getLowerExtension p = (Path.GetExtension p).ToLowerInvariant() let isHtmlPath = isInSet [".htm"; ".html"; ".xhtml"] getLowerExtension However, when I use a function such as the above, performance is poor since evaluation of the function body as written in "isInSet" seems to be delayed until all parameters are known - in particular, invariant bits such as (Set.ofList setElems).Contains are reevaluated each execution of isHtmlPath. How can best I maintain F#'s succint, readable nature while still getting the more efficient behavior in which the set construction is preevaluated. The above is just an example; I'm looking for a general pattern that avoids bogging me down in implementation details - where possible I'd like to avoid being distracted by details such as the implementation's execution order since that's usually not important to me and kind of undermines a major selling point of functional programming.

    Read the article

  • Share c# class source code between several projects

    - by phq
    I have written a class that will handle internal logging in my application. Now I want to use this class in another new and totally separate project. I could simply copy the file to the new project folder, but I would like to only have one copy of it to maintain so that all changes in it will apply to both projects over time. I can use the "add existing file", but where do I put the file so that the next developer knows that it is required. I have once had a "shared" folder for this but one time that folder was not brought into the next development computer. What is the best way to organize this so that it makes most sense for new maintainers and minimizes the risk for broken links in projects.

    Read the article

  • Formatting the code en-masse in Visual Studio

    - by AngryHacker
    I've inherited a project where all the private variables, and there are thousands, are separated by a blank line. For instance, private pnlSecurityReport _pnlSecurityReport = null; private pnlCalendar _pnlCalendar = null; private CtlContacts _pnlContacts = null; private pnlEmails _pnlEmails = null; private CtlNotes _pnlNotes = null; private pnlRoles _pnlRoles = null; private pnlSecurity _pnlSecurity = null; private pnlSignatures _pnlSignatures = null; This is really annoying. I'd like to remove the blank lines. Beyond writing my own tool to seek out and remove the extra line, is there a way to do this, perhaps, using RegEx-Fu in the Search and Replace dialog?

    Read the article

  • Efficiency of nested Loop

    - by didxga
    See the following snippet: //first nested loops for(int i=0;i<10;i++) { for(int j=1;j<1000000;j++) { //do some stuff } } //second nested loops for(int i=0;i<1000000;i++) { for(int j=1;j<10;j++) { //do some stuff } } I am wondering why the first nested loops is running slower than the second one? Regards!

    Read the article

  • Code Golf: Numeric Equivalent of an Excel Column-Name

    - by Vivin Paliath
    Can you figure out the numeric equivalent of an Excel column string in the shortest-possible way, using your favorite language? For example, the A column is 1, B is 2, so on and so forth. Once you hit Z, the next column becomes AA, then AB and so on. Rules: Here is some sample input and output: A: 1 B: 2 AD: 30 ABC: 731 WTF: 16074 ROFL: 326676 I don't know if the submitter is allowed to post a solution, but I have a Perl solution that clocks in at 125 characters :).

    Read the article

  • How can i optimize this c# code?

    - by Pandiya Chendur
    I have converted my Datatable to json string use the following method... public string GetJSONString(DataTable Dt) { string[] StrDc = new string[Dt.Columns.Count]; string HeadStr = string.Empty; for (int i = 0; i < Dt.Columns.Count; i++) { StrDc[i] = Dt.Columns[i].Caption; HeadStr += "\"" + StrDc[i] + "\" : \"" + StrDc[i] + i.ToString() + "¾" + "\","; } HeadStr = HeadStr.Substring(0, HeadStr.Length - 1); StringBuilder Sb = new StringBuilder(); Sb.Append("{\"" + Dt.TableName + "\" : ["); for (int i = 0; i < Dt.Rows.Count; i++) { string TempStr = HeadStr; Sb.Append("{"); for (int j = 0; j < Dt.Columns.Count; j++) { if (Dt.Rows[i][j].ToString().Contains("'") == true) { Dt.Rows[i][j] = Dt.Rows[i][j].ToString().Replace("'", ""); } TempStr = TempStr.Replace(Dt.Columns[j] + j.ToString() + "¾", Dt.Rows[i][j].ToString()); } Sb.Append(TempStr + "},"); } Sb = new StringBuilder(Sb.ToString().Substring(0, Sb.ToString().Length - 1)); Sb.Append("]}"); return Sb.ToString(); } Is this fair enough or still there is margin for optimization to make it execute faster.... Any suggestion...

    Read the article

  • Pulling and pushing between two google code repositories

    - by Kim L
    I'll start by quoting google's blog Project owners can now create multiple repositories for their project, and they can choose to make any of those new repositories a clone of any of the project's other repositories. These project clones share the same commit access permissions as the original project and make it easier for project members to work together on new features. A common pattern in the Mercurial world is to place each "official" branch into a separate repository with naming conventions like "project-crew", "project-stable", and so on. I've done exactly this. I have my default repository and then I've cloned that repository to a repo named "dev". I intend to use the default repository as my stable repo and then the dev repo as my primary development repo. Now I'm just wondering how on earth I should go about to pull and push between the default and the dev repositories?

    Read the article

  • Doxygen, too heavy to maintain ?

    - by Phong
    I am currently starting using doxygen to document my source code. I have notice that the syntax is very heavy, every time I modify the source code, I also need to change the comment and I really have the impression to pass too much time modifying the comment for every change I make in the source code. Do you have some tips to document my source code efficiently ? Does some editor (or plugin for existing editor) for doxygen to do the following exist? automatically track unsynchronized code/comment and warn the programmer about it. automatically add doxygen comment format (template with parameter name in it for example) in the source code (template) for every new item PS: I am working on a C/C++ project.

    Read the article

  • Code Golf: Finite-state machine!

    - by Adam Matan
    Finite state machine A deterministic finite state machine is a simple computation model, widely used as an introduction to automata theory in basic CS courses. It is a simple model, equivalent to regular expression, which determines of a certain input string is Accepted or Rejected. Leaving some formalities aside, A run of a finite state machine is composed of: alphabet, a set of characters. states, usually visualized as circles. One of the states must be the start state. Some of the states might be accepting, usually visualized as double circles. transitions, usually visualized as directed arches between states, are directed links between states associated with an alphabet letter. input string, a list of alphabet characters. A run on the machine begins at the starting state. Each letter of the input string is read; If there is a transition between the current state and another state which corresponds to the letter, the current state is changed to the new state. After the last letter was read, if the current state is an accepting state, the input string is accepted. If the last state was not an accepting state, or a letter had no corresponding arch from a state during the run, the input string is rejected. Note: This short descruption is far from being a full, formal definition of a FSM; Wikipedia's fine article is a great introduction to the subject. Example For example, the following machine tells if a binary number, read from left to right, has an even number of 0s: The alphabet is the set {0,1}. The states are S1 and S2. The transitions are (S1, 0) -> S2, (S1, 1) -> S1, (S2, 0) -> S1 and (S2, 1) -> S2. The input string is any binary number, including an empty string. The rules: Implement a FSM in a language of your choice. Input The FSM should accept the following input: <States> List of state, separated by space mark. The first state in the list is the start state. Accepting states begin with a capital letter. <transitions> One or more lines. Each line is a three-tuple: origin state, letter, destination state) <input word> Zero or more characters, followed by a newline. For example, the aforementioned machine with 1001010 as an input string, would be written as: S1 s2 S1 0 s2 S1 1 S1 s2 0 S1 s2 1 s2 1001010 Output The FSM's run, written as <State> <letter> -> <state>, followed by the final state. The output for the example input would be: S1 1 -> S1 S1 0 -> s2 s2 0 -> S1 S1 1 -> S1 S1 0 -> s2 s2 1 -> s2 s2 0 -> S1 ACCEPT For the empty input '': S1 ACCEPT For 101: S1 1 -> S1 S1 0 -> s2 s2 1 -> s2 REJECT For '10X': S1 1 -> S1 S1 0 -> s2 s2 X REJECT Prize A nice bounty will be given to the most elegant and short solution. Reference implementation A reference Python implementation will be published soon.

    Read the article

  • Copy Field and Methods

    - by javaguy
    I am new to java. I was wondering if there is a tool to copy fields and method easily. E.g if I have private String foo; // with getter/setters I should be able to select foo and type bar car in a textbox and the tool should generate fields bar and car with their getter/setters.

    Read the article

  • Is this a good code (came across while reading code of a colleague)

    - by eriks
    // file a.hpp class a; typedef boost::shared_ptr<a> aPtr class a{ public: static aPtr CreateImp(); virtual void Foo() = 0 ; .... }; //file aImp.hpp class aImp : public a{ virtual void Foo(); }; //file aImp.cpp aPtr a::CreateImp() { return aPtr(new aImp()); } void aImp::Foo(){} The client must use CreateImp to get ptr to 'a', and can't use 'a' other ways. What do you think about this implementation? what do you think about this king of implementation?

    Read the article

  • Good code highlighting, syntax analysis and code assist editor on js.erb and css.erb files

    - by Pickachu
    I want to know if there is a good compatible api that supports erb and javascript highlighting. I've already tried Eclipse with Aptana RadRails. Perhaps I'm configuring something wrong, but it guesses that I'm using html.erb on both css.erb and js.erb files. I've tried too the Emacs with js2-mode, nXhtml and Rinari modes. Again, it works fine for html.erb, but it detects the css.erb and js.erb as html.erb files. Maybe it's possible to configure it to accept that files and be compatible.

    Read the article

  • Large Scale VHDL modularization techniques

    - by oxinabox.ucc.asn.au
    I'm thinking about implimenting a 16 bit CPU in VHDL. A simplish CPU. ADD, MULS, NEG, BitShift, JUMP, Relitive Jump, BREQ, Relitive BREQ, i don't know somethign along these lines Probably all only working with 16bit operands. I might even cut it down and use only a single operand and a accumulator. With Some status regitsters, Carry, Zero, Neg (unless i use a Accumlator), I know how to design all the parts from logic gates, and plan to build them up from first priciples, So for my ALU I'll need to 'build' a ADDer, proably a Carry Look ahead, group adder, this adder it self is make up oa a couple of parts, wich are themselves made up of a couple of parts. Anyway, my problem is not the CPU design, or the VHDL (i know the language, more or less). It's how i should keep things organised. How should I use packages, How should I name my processes and port maps? (i've never seen the benifit of naming the port maps, or processes)

    Read the article

  • ASP .NET Code analysis tool to check cross site scripting

    - by Prashant
    I am aware of a tool which MS has provided which tells you about coss site scripting attack etc. The tool is http://www.microsoft.com/downloads/details.aspx?FamilyId=0178e2ef-9da8-445e-9348-c93f24cc9f9d&displaylang=en But are there tools which you have used for ASP .NET applications which do similar to this and which one is widely used in ASP .Net applications ?

    Read the article

  • why to use code generators

    - by Night Walker
    Hi all I have encountered this topic lately and couldn't understand why they are needed ... Can you explain me why i should use them in my projects and how they can ease my life . Examples will be great, and where from i can learn this topic little more . Thanks.

    Read the article

  • jQuery/Javascript framework efficiency

    - by Russell
    My latest project is using a javascript framework (jQuery), along with some plugins (validation, jquery-ui, datepicker, facebox, ...) to help make a modern web application. I am now finding pages loading slower than I am used to. After some js profiling (thanks VS2010!), it seems a lot of the time is taken procesing inside the framework. Now I understand the more complex the ui tools, the more processing needs to be done. The project is not yet at a large stage and I think would be average functions. At this stage I can see it is not going to scale well. I noticed things like the 'each' command in jQuery takes quite a lot of processing time. Have others experienced some extra latency using JS frameworks? How do I minimise their effect on page performance? Are there best practices on implementation using JS frameworks? Thanks

    Read the article

  • Efficiency of checking for null varbinary(max) column ?

    - by Moe Sisko
    Using SQL Server 2008. Example table : CREATE table dbo.blobtest (id int primary key not null, name nvarchar(200) not null, data varbinary(max) null) Example query : select id, name, cast((case when data is null then 0 else 1 end) as bit) as DataExists from dbo.blobtest Now, the query needs to return a "DataExists" column, that returns 0 if the blob is null, else 1. This all works fine, but I'm wondering how efficient it is. i.e. does SQL server need to read in the whole blob to its memory, or is there some optimization so that it just does enough reads to figure out if the blob is null or not ? (FWIW, the sp_tableoption "large value types out of row" option is set to OFF for this example).

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >