Search Results

Search found 4637 results on 186 pages for 'john rasch'.

Page 134/186 | < Previous Page | 130 131 132 133 134 135 136 137 138 139 140 141  | Next Page >

  • is "else if" faster than "switch() case" ?

    - by John
    Hello, I'm an ex Pascal guy,currently learning C#. My question is the following: Is the code below faster than making a switch? int a = 5; if (a == 1) { .... } else if(a == 2) { .... } else if(a == 3) { .... } else if(a == 4) { .... } else .... And the switch: int a = 5; switch(a) { case 1: ... break; case 2: ... break; case 3: ... break; case 4: ... break; default: ... break; } Which one is faster? I'm asking ,because my program has a similiar structure(many,many "else if" statements). Should I turn them into switches?

    Read the article

  • Is map/collection order stable between calls?

    - by John
    If I have a hash map and iterate over the objects repeatedly, is it correct that I'm not guaranteed the same order for every call? For example, could the following print two lines that differ from each other: Map<String,Integer> map = new HashMap<String,Integer>() {{ put("a", 1); put("b", 2); put("c", 3); }}; System.out.println(map); System.out.println(map); And is this the case for sets and collections in general? If so, what's the best way in case you have to iterate twice over the same collection in the same order (regardless of what order that is)? I guess converting to a list.

    Read the article

  • How to return the number of a month in C# function

    - by john
    I want to return the number of a month and i made a function but it always returns 0 this is my code: public int getNrMonth(String s) { int nr=0; if (s.Equals("January")) nr = 1 if (s.Equals("February")) nr = 2; return nr; } Could someone tell me wath is wrong please? I'm beginner!

    Read the article

  • Creating C# Classes at runtime

    - by John Hartsock
    Hello, I have been curious about dynamically create class at runtime in C# and stumbled across this article. http://olondono.blogspot.com/2008/02/creating-code-at-runtime.html I am curious to hear some pros and cons regarding construction of a class at runtime. Any opinions?

    Read the article

  • DataSet.GetChanges - Save the updated record in a different table than the source one

    - by John Dev
    I'm doing operation on a dataset containing data from a sql table named Test_1 and then get the updated records using the DataSet.GetChanges(DataRowState.Modified) function. Then i try to save the dataset containing the updated records on a different table than the source one (the table is names Test and has the same structure as Test_1) using the following statement: sqlDataAdapter.Update(changesDataSet,"Test"); I'm getting the following error : Update unable to find TableMapping['Test'] or DataTable 'Test' I'm new to ado.net and don't even know if it"s something possible. Any advice is welcome. Just to provide a bit of context. ETL jobs are importing data in temp table with same structure as the original but with _jobid suffix. Right after a rule engine is doing validation before updating the original table.

    Read the article

  • Difference between [object variable] and object.variable in Obj-C?

    - by John Smith
    I was working on a program today and hit this strange bug. I had a UIButton with an action assigned. The action was something like: -(void) someaction:(id) e { if ([e tag]==SOMETAG) { //dostuff } } What confuses me is that when I first wrote it, the if line was if (e.tag==SOMETAG) XCode refused to compile it, saying error: request for member 'tag' in 'e', which is of non-class type 'objc_object*' but I thought the two were equivalent. So under what circumstances are they not the same?

    Read the article

  • Abstract away a compound identity value for use in business logic?

    - by John K
    While separating business logic and data access logic into two different assemblies, I want to abstract away the concept of identity so that the business logic deals with one consistent identity without having to understand its actual representation in the data source. I've been calling this a compound identity abstraction. Data sources in this project are swappable and various and the business logic shouldn't care which data source is currently in use. The identity is the toughest part because its implementation can change per kind of data source, whereas other fields like name, address, etc are consistently scalar values. What I'm searching for is a good way to abstract the concept of identity, whether it be an existing library, a software pattern or just a solid good idea of some kind is provided. The proposed compound identity value would have to be comparable and usable in the business logic and passed back to the data source to specify records, entities and/or documents to affect, so the data source must be able to parse back out the details of its own compound ids. Data Source Examples: This serves to provide an idea of what I mean by various data sources having different identity implementations. A relational data source might express a piece of content with an integer identifier plus a language specific code. For example. content_id language Other Columns expressing details of content 1 en_us 1 fr_ca The identity of the first record in the above example is: 1 + en_us However when a NoSQL data source is substituted, it might somehow represent each piece of content with a GUID string 936DA01F-9ABD-4d9d-80C7-02AF85C822A8 plus language code of a different standardization, And a third kind of data source might use just a simple scalar value. So on and so forth, you get the idea.

    Read the article

  • Django store regular expression in DB which then gets evaluated on page

    - by John
    Hi, I want to store a number of url patterns in my django model which a user can provide parameters to which will create a url. For example I might store these 3 urls in my db where %s is the variable parameter provided by the user: www.thisissomewebsite.com?param=%s www.anotherurl/%s/ www.lastexample.co.uk?param1=%s&fixedparam=2 As you can see from these examples the parameter can appear anywhere in the string and not in a fixed position. I have 2 models, one holds the urls and one holds the variables: class URLPatterns(models.Model): pattern = models.CharField(max_length=255) class URLVariables(models.Model): pattern = models.ForeignKey(URLPatterns) param = models.CharField(max_length=255) What would be the best way to generate these urls by replacing the %s with the variable in the database. would it just be a simple replace on the string e.g: urlvariable = URLVariable.objects.get(pk=1) pattern = url.pattern url = pattern.replace("%s", urlvariable.param) or is there a better way? Thanks

    Read the article

  • What restrictions exist choosing a MFC version to use with Visual C++?

    - by John
    Each version of Visual Studio comes with a specific version of the MFC framework, but I believe MFC SDK can be downloaded separately. Since MFC is just C++, is there any reason you couldn't use the latest version with an older version of VC++... I don't mean trying to get the ribbon working in MSVC++ 6, But we're on VS2005 and some of the newer MFC features would be useful.

    Read the article

  • Do Distributed Version Control Systems promote poor backup habits?

    - by John
    In a DVCS, each developer has an entire repository on their workstation, to which they can commit all their changes. Then they can merge their repo with someone else's, or clone it, or whatever (as I understand it, I'm not a DVCS user). To me that flags a side-effect, of being more vulnerable to forgetting to backup. In a traditional centralised system, both you as a developer and the people in charge know that if you commit something, it's held on a central server which can have decent backup solutions in place. But using a DVCS, it seems you only have to push your work to a server when you feel like sharing it. It's all very well you have the repo locally so you can work on your feature branch for a month without bothering anyone, but it means (I think) that checking in your code to the repo is not enough, you have to remember to do regular pushes to a backed-up server. It also means, doesn't it, that a team lead can't see all those nice SVN commit emails to keep a rough idea what's going on in the code-base? Is any of this a real issue?

    Read the article

  • rails: self-referential association

    - by john
    hi, My needs are very simple: I have a Tip table to receive comments and have comments to receive comments, too. To retrieve each comment that is stored in the same table (comments), I created another key for the comments on comments: "inverse_comments". I tried to use one comments table by using self-referntial association. Some resources seem to bring more than one table into the piture which are diffent from my needs. So I came up whth the following modeling for comments: class Comment < ActiveRecord::Base belongs_to :tip belongs_to :user has_many :mycomments, :through => :inverse_comments, :source => :comment end Apparently something is missing here but I cannot figure it out. Could some one enlighten me on this: what changes I need to do to make the model work? thanks.

    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

  • Wordpress Re-usable Custom Widget

    - by John
    I created a custom widget for wordpress. But I can only use it once. I can't assign multiple instances of the widget to my sidebars. Can anyone show me sample code on how to make my custom widgets re-useable?

    Read the article

  • Haskell graph data type representation

    - by John Retallack
    I want to represent a graph in Haskell in the following manner: For each node I want to store it's value and a list of adjacent nodes,the problem which i'm having difficulties with is that I want the adjacent nodes to be stored as references to other nodes. For example: I want node ny to be stored as („NY“ (l p)) where l and p are adjacent nodes,and not as („NY“ („London“ „Paris“)). I tried something like this : data Node a = Node { value :: a , neighbors :: [Node a] }deriving (Show) let n1 = Node {value=1, neighbors=[n2]} let n2 = Node {value=1, neighbors=[n1 n3]} let n3 = Node {value=1, neighbors=[n2]} But i get en error in let,What am I doing wrong ?

    Read the article

  • response from server

    - by john
    When I create request to the server: <script language="javascript" type="text/javascript"> function ajaxFunction() var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Your browser broke!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.write(ajaxRequest.responseText); document.myForm.time.value = ajaxRequest.responseText; } } ajaxRequest.open("GET", "http://www.bbc.co.uk", true); ajaxRequest.send(null); } </script> Why response is nothing? Why response isnt html code of this web site?

    Read the article

  • SQL Server 15MM rows, simple COUNT query. 15+ seconds?

    - by john
    We took over a website from another company after a client decided to switch. We have a table that grows by about 25k records a day, and is currently at 15MM records. The table looks something like: id (PK, int, not null) member_id (int, not null) another_id (int, not null) date (datetime, not null) SELECT COUNT(id) FROM tbl can take up to 15 seconds. A simple inner join on 'another_id' takes over 30 seconds. I can't imagine why this is taking so long. Any advice? SQL Server 2005 Express

    Read the article

< Previous Page | 130 131 132 133 134 135 136 137 138 139 140 141  | Next Page >