Search Results

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

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

  • EF4 Code-First CTP5 Many-to-one

    - by Kevin McKelvin
    I've been trying to get EF4 CTP5 to play nice with an existing database, but struggling with some basic mapping issues. I have two model classes so far: public class Job { [Key, Column(Order = 0)] public int JobNumber { get; set; } [Key, Column(Order = 1)] public int VersionNumber { get; set; } public virtual User OwnedBy { get; set; } } and [Table("Usernames")] public class User { [Key] public string Username { get; set; } public string EmailAddress { get; set; } public bool IsAdministrator { get; set; } } And I have my DbContext class exposing those as IDbSet I can query my users, but as soon as I added the OwnedBy field to the Job class I began getting this error in all my tests for the Jobs: Invalid column name 'UserUsername'. I want this to behave like NHibernate's many-to-one, whereas I think EF4 is treating it as a complex type. How should this be done?

    Read the article

  • PHP: Making my code simpler/shorter welcome message

    - by Karem
    Any suggestion to make this welcome message shorter: <?php if(isset($_SESSION['user_id'])) { if(isSet($_SESSION['1stTime'])){ ?> <strong id="welcome" style="font-size: 10px;"> <a href="logout.php"> Logga ut </a> </strong> <?php }else{ $_SESSION['1stTime'] = time(); ?> <script> $(document).ready(function() { $("#welcome").fadeIn("slow"); setTimeout(function(){ $("#welcome").fadeOut("slow"); setTimeout(function(){ $("#welcome").html("<a href='logout.php'>Logga ut</a>"); $("#welcome").fadeIn(); }, 800); }, 5000); }); </script> <strong id="welcome" style="display: none; color: #FFF; font-size: 10px;">Hej, <?php echo $FULL; ?>!</strong> <?php } } ?> First it checks if you are signed in. Next if 1stTime is set, if it is then show "Log out" in swedish, if it isnt, then introduce with "Hi, NAME", and then change to "Log out" after 5 seconds(jquery) + set the session How can i make this simpler?

    Read the article

  • Where to draw the line between efficiency and practicality

    - by dclowd9901
    I understand very well the need for websites' front ends to be coded and compressed as much as possible, however, I feel like I have more lax standards than others when it comes to practical applications. For instance, while I understand why some would, I don't see anything wrong with putting selectors in the <html> or <body> tags on a website with an expected small visitation rate. I would only do this for a cheap website for a small client, because I can't really justify the cost of time otherwise. So, that said, do you think it's okay to draw a line? Where do you draw yours?

    Read the article

  • Save VM properties with EF code first

    - by Julien
    I thought this would be simple but can't find any good examples. public Class BookVm : ImplementsPropertyChanged { public int BookId {get;set;} private bool _favorite; public bool Favorite { get { return _favorite; } set { _favorite = value; OnPropertyChanged("Favorite"); MyDbContext.SaveChanges() // this does not work } } Then in my XAML bound to Book <CheckBox Content="Favorite" IsChecked="{Binding Favorite}" /> How and when do I call SaveChanges() on my DatabaseContext? I don't want to implement a save button. If I intercept the PropertyChange event and call SaveChanges, nothing seems to happen. My object is modified in memory but the database does not see a change. My BookVm class is created on application startup like so: foreach (var book in MyDbContext.Books) Books.Add(book); Where Books is an ObservableCollection<Book> in my MainWindowVm

    Read the article

  • Visual Studio - easy way to bring up type definition as source code

    - by Igor Zevaka
    Oftentimes I want to bring up a system class in a source view, so that I can browse the properties and methods exposed by the class in a source view. Below is the screenshot of what I mean: Usually I do this by selecting the class name and pressing F12 (or right clickGo To Definition). However, if I haven't got it anywhere ready, i have type it up and then do Go To Definition. Most of the time I have to delete what I typed later on. Is there a way to bring up this view without having to type the class name? The VS2010 Navigate To dialog doesn't support this.

    Read the article

  • Code Golf: Counting XML elements in file on Android

    - by CSharperWithJava
    Take a simple XML file formatted like this: <Lists> <List> <Note/> ... <Note/> </List> <List> <Note/> ... <Note/> </List> </Lists> Each node has some attributes that actually hold the data of the file. I need a very quick way to count the number of each type of element, (List and Note). Lists is simply the root and doesn't matter. I can do this with a simple string search or something similar, but I need to make this as fast as possible. Design Parameters: Must be in java (Android application). Must AVOID allocating memory as much as possible. Must return the total number of Note elements and the number of List elements in the file, regardless of location in file. Number of Lists will typically be small (1-4), and number of notes can potentially be very large (upwards of 1000, typically 100) per file. I look forward to your suggestions.

    Read the article

  • where are wrong in my php code ????

    - by user318068
    hi all, <td align="center" bgcolor="#FFFFFF"><?php echo '<label onclick="window.open('profilephp.php?member=$row['MemberID']','mywindow')">'.{$row['MemberName']}.'</label>';?><br /> <?php echo "<p align='center'><img width='100' height='100' src={$row['MemberImg']} alt='' /></p>";?></td></tr> Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\home - Copy\membercopy.php on line 141 I really don't know where it went wrong. Please help,

    Read the article

  • Fast exchange of data between unmanaged code and managed code

    - by vizcaynot
    Hello: Without using p/invoke, from a C++/CLI I have succeeded in integrating various methods of a DLL library from a third party built in C. One of these methods retrieves information from a database and stores it in different structures. The C++/CLI program I wrote reads those structures and stores them in a List<, which is then returned to the corresponding reading and use of an application programmed completely in C#. I understand that the double handling of data (first, filling in several structures and then, filling all of these structures into a list<) may generate an unnecessary overload, at which point I wish C++/CLI had the keyword "yield". Depending on the above scenario, do you have recommendations to avoid or reduce this overload? Thanks.

    Read the article

  • machine learning and code generator from strings

    - by BCS
    The problem: Given a set of hand categorized strings (or a set of ordered vectors of strings) generate a decision function to categorize more input. The question: are there any tools out there that will do that? I'm thinking of some kind of reasonably polished, download, install and go kind of things, as opposed to to some library or a brittle academic program.

    Read the article

  • Conversion from C code to CudaC code I get unpredictable results

    - by Abhi
    include include include include define pi 3.14159265359 lo*lo*p-2*mu,freq=2.25*1e6,wavelength=(long double)lo/freq,dh=(long double)wavelength/ 30.0,dt=(long double)dh/(lo*1.5); (1000*dh)); (p*dh),lambdaplus2mudtbydh=(lambda+2*mu)*dt/dh,lambdadtbydh=lambda*dt/dh,dtmubydh=dt*mu/ dh; double**U,long double**V){ for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){ U[i+1][l]+=dtbyrhodh*(X[i+1][l+1]-X[i+1][l]+Z[i+1][l]- Z[i][l]); [k+1]-Y[j][k+1]); } double**U,long double**V){ for(int k=0,l=0;k<=yno-1 && l<=yno;k++,l++){ U[i+1][k])+lambdadtbydh*(V[i+1][k+1]-V[i][k+1]); V[i][k+1])+lambdadtbydh*(U[i+1][k+1]-U[i+1][k]); U[j][l]); int main(){ clock_t start,end; long double time_taken; start=clock(); long double **X,**Y,**U,**V,**Z;int n=1; X=Make2DDoubleArray(xno+2,yno+2); Y=Make2DDoubleArray(xno+2,yno+2); Z=Make2DDoubleArray(xno+1,yno+1); U=Make2DDoubleArray(xno+2,yno+2); V=Make2DDoubleArray(xno+2,yno+2); for (n=1;n<=timesteps;n++){ } end=clock(); time_taken=(long double)(end-start)/CLOCKS_PER_SEC; printf("Time elapsed is %Lf\nGRID Size:%Lf*%Lf\nTime Steps Taken:%d\n",time_taken,(xno),floor(yno),n); return 0; }

    Read the article

  • PHP Array Efficiency and Memory Clarification

    - by CogitoErgoSum
    When declaring an Array in PHP, the index's may be created out of order...I.e Array[1] = 1 Array[19] = 2 Array[4] = 3 My question. In creating an array like this, is the length 19 with nulls in between? If I attempted to get Array[3] would it come as undefined or throw an error? Also, how does this affect memory. Would the memory of 3 index's be taken up or 19? Also currently a developer wrote a script with 3 arrays FailedUpdates[] FailedDeletes[] FailedInserts[] Is it more efficient to do it this way, or do it in the case of an associative array controlling several sub arrays "Failures" array(){ ["Updates"] => array(){ [0] => 12 [1] => 41 } ["Deletes"] => array(){ [0] => 122 [1] => 414 [1] => 43 } ["Inserts"] => array(){ [0] => 12 } }

    Read the article

  • Partial PHP code refresh

    - by Tom
    Is it possible to refresh only the part of the page? How? the part: if (checkExpiry($member->expires)==true) { print timeLeft($leftts); } else { print "expired"; } I have table which is showing name, email, time until membership ends and I need to refresh 'time until membership ends' every second.

    Read the article

  • Efficiency of the .NET garbage collector

    - by Jonas B
    OK here's the deal. There are some people who put their lives in the hands of .NET's garbage collector and some who simply wont trust it. I am one of those who partially trusts it, as long as it's not extremely performance critical (I know I know.. performance critical + .net not the favored combination), in which case I prefer to manually dispose of my objects and resources. What I am asking is if there are any facts as to how efficient or inefficient performance-wise the garbage collector really is? Please don't share any personal opinions or likely-assumptions-based-on-experience, I want unbiased facts. I also don't want any pro/con discussions because it won't answer the question. Thanks

    Read the article

  • How to make this C++ code more DRY?

    - by Macha
    I have these two methods on a class that differ only in one method call. Obviously, this is very un-DRY, especially as both use the same formula. int PlayerCharacter::getAttack() { attack = 1 + this.level; for(int i = 0; i <= current_equipment; i++) { attack += this.equipment[i].getAttack(); } attack *= sqrt(this.level); return attack; } int PlayerCharacter::getDefense() { defense = 1 + this.level; for(int i = 0; i <= current_equipment; i++) { defense += this.equipment[i].getDefense(); } defense *= sqrt(this.level); return defense; } How can I tidy this up in C++?

    Read the article

  • Improve Efficiency in Array comparison in Ruby

    - by user2985025
    Hi I am working on Ruby /cucumber and have an requirement to develop a comparison module/program to compare two files. Below are the requirements The project is a migration project . Data from one application is moved to another Need to compare the data from the existing application against the new ones. Solution : I have developed a comparison engine in Ruby for the above requirement. a) Get the data, de duplicated and sorted from both the DB's b) Put the data in a text file with "||" as delimiter c) Use the key columns (number) that provides a unique record in the db to compare the two files For ex File1 has 1,2,3,4,5,6 and file2 has 1,2,3,4,5,7 and the columns 1,2,3,4,5 are key columns. I use these key columns and compare 6 and 7 which results in a fail. Issue : The major issue we are facing here is if the mismatches are more than 70% for 100,000 records or more the comparison time is large. If the mismatches are less than 40% then comparison time is ok. Diff and Diff -LCS will not work in this case because we need key columns to arrive at accurate data comparison between two applications. Is there any other method to efficiently reduce the time if the mismatches are more thatn 70% for 100,000 records or more. Thanks

    Read the article

  • Quick question about jQuery selector content efficiency

    - by serg
    I am loading HTML page through ajax and then doing a bunch of searches using selectors: $.ajax({ ... dataType: "html", success: function(html) { $("#id1", html); $(".class", html); //... } } Should I extract $(html) into a variable and use it as a content, or it doesn't matter (from performance point)? success: function(html) { $html = $(html); $("#id1", $html); $(".class", $html); //... }

    Read the article

  • Code First entity framework connection string

    - by Suneel Dixit
    I have 3 class projects in my solutions. 1. MVC4 project 2. Domain 3. Tests In the MVC4 project I have added a web.config file with the connection string as <add name="EfDbContext" connectionString="Data Source=.;Initial Catalog=SportsStore;Integrated Security=true;" providerName="System.Data.SqlClient"/> I have a class by name EfDbContext in Domain project which inherits DbContext. When I view the website in browser, I get the server not found error. I debugged the EfDbContext class and found that the Database.Connection.ConnectionString is set to \SqlExpress with database as EfDbContext. Why is that?

    Read the article

  • Code Golf: All +-*/ Combinations for 3 integers

    - by Flash84x
    Write a program that takes 3 integers separated by spaces and perform every single combination of addition, subtraction, multiplication and division operations possible and display the result with the operation combination used. Example: $./solution 1 2 3 Results in the following output 1+2+3 = 6 1-2-3 = -4 1*2*3 = 6 1/2/3 = 0 (integer answers only, round up at .5) 1*2-3 = -1 3*1+2 = 5 etc... Order of operation rules apply, assume there will be no parenthesis used i.e. (3-1)*2 = 4 is not a combination, although you could implement this for "extra credit" For results where a divide by 0 occurs simply return NaN

    Read the article

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