Search Results

Search found 547 results on 22 pages for 'nathan ridley'.

Page 19/22 | < Previous Page | 15 16 17 18 19 20 21 22  | Next Page >

  • Have I checked every consecutive subset of this list?

    - by Nathan
    I'm trying to solve problem 50 on Project Euler. Don't give me the answer or solve it for me, just try to answer this specific question. The goal is to find the longest sum of consecutive primes that adds to a prime below one million. I use wrote a sieve to find all the primes below n, and I have confirmed that it is correct. Next, I am going to check the sum of each subset of consecutive primes using the following method: I have a empty list sums. For each prime number, I add it to each element in sums and check the new sum, then I append the prime to sums. Here it is in python primes = allPrimesBelow(1000000) sums = [] for p in primes: for i in range(len(sums)): sums[i] += p check(sums[i]) sums.append(p) I want to know if I have called check() for every sum of two or more consecutive primes below one million The problem says that there is a prime, 953, that can be written as the sum of 21 consecutive primes, but I am not finding it.

    Read the article

  • Can getters and setters be inlined when definition and declaration are seperated in .h and .cpp files?

    - by Nathan
    I have searched and have been unable to verify how the GCC compiler will handle inlining getters and setters when declaration is in .h file and definition is in .cpp file. Most seem to say that GCC can't see across these source file barriers and won't be able to inline these at all, while others disagree. I have looked at the documentation and I can't find the answer there either. Did I miss it? I do realize that inlining is a choice made by the compiler and is not always guaranteed, but assuming optimal situations, is it at least possible?

    Read the article

  • Can C++ do something like an ML case expression?

    - by Nathan Andrew Mullenax
    So, I've run into this sort of thing a few times in C++ where I'd really like to write something like case (a,b,c,d) of (true, true, _, _ ) => expr | (false, true, _, false) => expr | ... But in C++, I invariably end up with something like this: bool c11 = color1.count(e.first)>0; bool c21 = color2.count(e.first)>0; bool c12 = color1.count(e.second)>0; bool c22 = color2.count(e.second)>0; // no vertex in this edge is colored // requeue if( !(c11||c21||c12||c22) ) { edges.push(e); } // endpoints already same color // failure condition else if( (c11&&c12)||(c21&&c22) ) { results.push_back("NOT BICOLORABLE."); return true; } // nothing to do: nodes are already // colored and different from one another else if( (c11&&c22)||(c21&&c12) ) { } // first is c1, second is not set else if( c11 && !(c12||c22) ) { color2.insert( e.second ); } // first is c2, second is not set else if( c21 && !(c12||c22) ) { color1.insert( e.second ); } // first is not set, second is c1 else if( !(c11||c21) && c12 ) { color2.insert( e.first ); } // first is not set, second is c2 else if( !(c11||c21) && c22 ) { color1.insert( e.first ); } else { std::cout << "Something went wrong.\n"; } I'm wondering if there's any way to clean all of those if's and else's up, as it seems especially error prone. It would be even better if it were possible to get the compiler complain like SML does when a case expression (or statement in C++) isn't exhaustive. I realize this question is a bit vague. Maybe, in sum, how would one represent an exhaustive truth table with an arbitrary number of variables in C++ succinctly? Thanks in advance.

    Read the article

  • MVC.net 2 - change the HTML outputed by ValidationMessageFor - can this be down via templates?

    - by Nathan Kelly
    MVC.net 2 by default outputs validation messages like this: <span id="UserName_validationMessage" class="field-validation-valid">A Validation message</span> I would like it to do it like this: <label id="UserName_validationMessage" class="field-validation-valid">A Validation message</label> Is there a way to do it like the display and editor templates? Or is there another way to do it globally?

    Read the article

  • Should I make sure arguments aren't null before using them in a function.

    - by Nathan W
    The title may not really explain what I'm really trying to get at, couldn't really think of a way to describe what I mean. I was wondering if it is good practice to check the arguments that a function accepts for nulls or empty before using them. I have this function which just wraps some hash creation like so. Public Shared Function GenerateHash(ByVal FilePath As IO.FileInfo) As String If (FilePath Is Nothing) Then Throw New ArgumentNullException("FilePath") End If Dim _sha As New Security.Cryptography.MD5CryptoServiceProvider Dim _Hash = Convert.ToBase64String(_sha.ComputeHash(New IO.FileStream(FilePath.FullName, IO.FileMode.Open, IO.FileAccess.Read))) Return _Hash End Function As you can see I just takes a IO.Fileinfo as an argument, at the start of the function I am checking to make sure that it is not nothing. I'm wondering is this good practice or should I just let it get to the actual hasher and then throw the exception because it is null.? Thanks.

    Read the article

  • Incrase click radius/size

    - by Nathan
    Hello, I'm looking for a way to increase the click size so when I click, it would effectively count as a click on anything that is in a 100px by 100px radius around the click. Any help would be great, I couldn't find anything online for this. Thanks a lot!

    Read the article

  • How can I position QDockWidgets as the screen shot shows using code?

    - by Nathan
    I want a Qt window to come up with the following arrangement of dock widgets on the right. Qt allows you to provide an argument to the addDockWidget method of QMainWindow to specify the position (top, bottom, left or right) but apparently not how two QDockWidgets placed on the same side will be arranged. Here is the code that adds the dock widgets. this uses PyQt4 but it should be the same for Qt with C++ self.memUseGraph = mem_use_widget(self) self.memUseDock = QDockWidget("Memory Usage") self.memUseDock.setObjectName("Memory Usage") self.memUseDock.setWidget(self.memUseGraph) self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea),self.memUseDock) self.diskUsageGraph = disk_usage_widget(self) self.diskUsageDock = QDockWidget("Disk Usage") self.diskUsageDock.setObjectName("Disk Usage") self.diskUsageDock.setWidget(self.diskUsageGraph) self.addDockWidget(Qt.DockWidgetArea(Qt.RightDockWidgetArea),self.diskUsageDock) When this code is used to add both of them to the right side, one is above the other, not like the screen shot I made. The way I made that shot was to drag them there with the mouse after starting the program, but I need it to start that way.

    Read the article

  • Does F# documentation have a way to search for functions by their types?

    - by Nathan Sanders
    Say I want to know if F# has a library function of type ('T -> bool) -> 'T list -> int ie, something that counts how many items of a list that a function returns true for. (or returns the index of the first item that returns true) I used to use the big list at the MSR site for F# before the documentation on MSDN was ready. I could just search the page for the above text because the types were listed. But now the MSDN documentation only lists types on the individual pages--the module page is a mush of descriptive text. Google kinda-sorta works, but it can't help with // compatible interfaces ('T -> bool) -> Seq<'T> -> int // argument-swaps Seq<'T> -> ('T -> bool) -> int // type-variable names ('a -> bool) -> Seq<'a> -> int // wrappers ('a -> bool) -> 'a list -> option<int> // uncurried versions ('T -> bool) * 'T list -> int // .NET generic syntax ('T -> bool) -> List<'T> -> int // methods List<'T> member : ('T -> bool) -> int Haskell has a standalone program for this called Hoogle. Does F# have an equivalent, like Fing or something?

    Read the article

  • Filtering subsets using Linq

    - by Nathan Matthews
    Hi All, Imagine a have a very long enunumeration, too big to reasonably convert to a list. Imagine also that I want to remove duplicates from the list. Lastly imagine that I know that only a small subset of the initial enumeration could possibly contain duplicates. The last point makes the problem practical. Basically I want to filter out the list based on some predicate and only call Distinct() on that subset, but also recombine with the enumeration where the predicate returned false. Can anyone think of a good idiomatic Linq way of doing this? I suppose the question boils down to the following: With Linq how can you perform selective processing on a predicated enumeration and recombine the result stream with the rejected cases from the predicate?

    Read the article

  • SSPI Errors for SQL Server Authentication?!

    - by Nathan
    We have several old ASP and PHP web applications which use SQL Server Authentication. Periodically, all the applications lose the ability to connect to our SQL Server 2000 database server, getting access denied. Corresponding to roughly the same times, we are getting 1115 Cannot generate SSPI Context SQLSTATE HY000 errors on the SQLServer 2000 server. And here's the weird part - rebooting the web server fixes the problem. Rebooting the database server has no effect. This makes no sense to me - I didn't think SSPI was in any way involved with SQL Server Authentication. Any ideas? Edit: Some additional details: The web server is in the DMZ. The hosts file on the web server has an entry for the database server (and the ip address is correct), so the web server (theoretically at least) shouldn't even be going to DNS to connect to the database server. It does not appear to be a firewall issue.

    Read the article

  • Execute a Application On The Server Using PHP(With safe_mode enabled)

    - by Nathan Campos
    I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example: pnote.exe input.pnt output.txt The executable is at exec/, inputfile is at upload/ and outputfile is on compiled/. But I need that a PHP could run the application like that, then I want to know: How could I do this on a server that have exec() disabled and I can't turn it on, because I don't have privileges to do it? How could I echo the output of the program?

    Read the article

  • Programmatically dial a series of numbers on a modem?

    - by Nathan Long
    At work, we just got a large number exotic cellular devices that need to be programmed. To do this, you plug in a standard home telephone and dial a series of numbers, with pauses between them. To me, this is a task that begs to be automated, and we've got one Linux desktop (a test Asterisk machine) with a modem on it. Does anybody know an easy way to approach this task? I could install Ruby or Python on that desktop. I also know PHP, but I'm not sure how to run it outside of a server setup, and it seems silly to install Apache for this.

    Read the article

  • How to change default font in netbeans platform?

    - by nathan
    I'd like to know how to change the default font used in netbeans platform. I'm not asking for changing the font in the Netbeans IDE but in the platform, then all my derived applications would use this default font. A netbeans application is a group of Jcomponent so i could easily set the font of each of those components but there is still things like notifications that i can't access directly to change the font, so i think the best would be to change the font by default. Programmaticaly or any other way... maybe editing one the jar?

    Read the article

  • How to sort the row contents on table cell by using date

    - by MS Nathan
    Hi i am new to iphone application development.i am developing RSS feed Reader it has number of different RSS feeds. In my application (XML parsing), i want to display the content of the row on cell for particular date and with their corresponding title, description (in my application, i am using three labels for displaying title, date and description) on table view cell after parsing xml data. And i want to sort the all kinds of RSS feeds row contents(title, date, description) depends upon the date in single another UIViewController and for each RSS feed has a separate ViewController. thanks in advance.

    Read the article

  • GoogleMaps API v3 - Need help with two "click" event scenarios. Need similar functionality to v2 AP

    - by Nathan Raley
    In version 2 of the API the map click event returned an Overlay, LatLng, Overlaylatlng. I used this to create a generic map event that would either retrieve the coordinates of the Map click event, or return the coordinates of a Marker or other type of Overlay. Now that API v3 doesn't return the Overlay or Overlaylatlng during the map click event, how can I go about creating a generic "click" event for the map that works if the user clicks on a marker or overlay? I really don't want to create a click event for each marker I have on my page as I am creating anywhere from a handful to a couple thousand markers. Also, I had to create a custom ImageMapType in order to display the StreetViewOverlay like we could do in v2 of the API because I couldn't find anywhere that told me how to add the StreetViewOverlay without the pegman icon. How can I go about retrieving the LatLng coordinates of a click on this overlay type as well?

    Read the article

  • Mutually beneficial IP/copyright clauses for contract-based freelance work

    - by Nathan de Vries
    I have a copyright section in the contract I give to my clients stating that I retain copyright on any works produced during my work for them as an independent contractor. This is most definitely not intended to place arbitrary restrictions on my clients, but rather to maintain my ability to decide on how the software I create is licensed and distributed. Almost every project I work on results in at least one part of it being released as open source. Every project I work on makes use of third-party software released in the same fashion, so returning the favour is something I would like to continue doing. Unfortunately, the contract is not so clear when it comes to defining the rights of the client in the use of said software. I mention that the code will be licensed to them, but do not mention specifics about exclusivity, ability to produce derivatives etc. As such, a client has raised concerns about the copyright section of my contract, and has suggested that I reword it such that all copyrights are transferred entirely to the client on final payment for the project. This will almost certainly reduce my ability to distribute the software I have created; I would much prefer to find a more mutually beneficial agreement where both our concerns are appeased. Are there any tried and true approaches to licensing software in this kind of situation? To summarise: I want to maintain the ability to license (parts of) the software under my own terms, independently of my relationship with the client; with some guarantee to the client that no trade-secrets or critical business logic will be shared; giving them the ability to re-use my code in their future projects; but not necessarily letting them sell it (I'm not sure about this, though...what happens if they sell their business and the software along with it?) I realise that everyone's feedback is going to be prefixed with "IANAL", however I appreciate any thoughts you might have on the matter.

    Read the article

  • SQL Stored Procedure

    - by Nathan
    I am trying to run a stored procedure with a while loop in it using Aqua Data Studio 6.5 and as soon as the SP starts Aqua Data starts consuming an increasing amount of my CPU's memory which makes absolutely no sense to me because everything should be off on the Sybase server I am working with. I have commented out and tested every piece of the SP and narrowed the issue down to the while loop. Can anyone explain to me what is going on? create procedure sp_check_stuff as begin declare @counter numeric (9), @max_id numeric (9), @exists numeric (1), @rows numeric (1) select @max_id = max(id) from my_table set @counter = 0 set @exists = 0 set @rows = 0 while @count <= @max_id begin //More logic which doesn't affect memory usage based //on commenting it out and running the SP set @counter = @counter + 1 set @exists = 0 set @rows = 0 end end return

    Read the article

  • Best way to do TDD in express versions of visual studio(eg VB Express)

    - by Nathan W
    I have been looking in to doing some test driven development for one of the applications that I'm currently writing(OLE wrapper for an OLE object). The only problem is that I am using the express versions of Visual Studio(for now), at the moment I am using VB express but sometimes I use C# express. Is it possible to do TDD in the express versions? If so what are the bast was to go about it? Cheers. EDIT. By the looks of things I will have to buy the full visual studio so that I can do integrated TDD, hopefully there is money in the budget to buy a copy :). For now I think I will use Nunit like everyone is saying.

    Read the article

  • Using Lucene to index private data, should I have a separate index for each user or a single index

    - by Nathan Bayles
    I am developing an Azure based website and I want to provide search capabilities using Lucene. (structured json objects would be indexed and stored in Lucene and other content such as Word documents, etc. would be indexed in lucene but stored in blob storage) I want the search to be secure, such that one user would never see a document belonging to another user. I want to allow ad-hoc searches as typed by the user. Lastly, I want to query programmatically to return predefined sets of data, such as "all notes for user X". I think I understand how to add properties to each document to achieve these 3 objectives. (I am listing them here so if anyone is kind enough to answer, they will have better idea of what I am trying to do) My questions revolve around performance and security. Can I improve document security by having a separate index for each user, or is including the user's ID as a parameter in each search sufficient? Can I improve indexing speed and total throughput of the system by having a separate index for each user? My thinking is that having separate indexes would allow me to scale the system by having multiple index writers (perhaps even on different server instances) working at the same time, each on their own index. Any insight would be greatly appreciated. Regards, Nate

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22  | Next Page >