Search Results

Search found 14610 results on 585 pages for 'william tell'.

Page 5/585 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Prolog - Finding the current directory, relative directory for 'tell' predicate

    - by Bharat
    I'm having trouble trying to figure out how to get prolog to spit out a text file where I want it to. I'm currently doing a bunch of operations and then using tell('output.txt') to record the output. Now the problem is that when I do this, it creates this file in the SWI \bin\ folder. I was wondering if there's a way to make it create this file in the directory containing the actual .pl file. So even if the file was moved (and it will be), the text file gets created right where the source file is. Long story short, is there a way to get the location of the source file once the source file has been consulted? Many Thanks!

    Read the article

  • Java - how to tell class of an object?

    - by lkm
    Given a method that accepts as a parameter a certain supertype. Is there any way, within that method, to determine the actual class of the object that was passed to it? I.e. if a subtype of the allowable parameter was actually passed, is there a way to find out which type it is? If this isn't possible can someone explain why not (from a language design perspective)? Thanks Update: just to make sure I was clear void doSomething(MyType myType) { //determine if myType is MyType OR one of its subclasses } Since the method signature specifies the parameter as being MyType, then how can one tell if the object is actually a subtype of MyType (and which one).

    Read the article

  • Ping or otherwise tell if a device is on the network by MAC in C#

    - by Aric TenEyck
    I'm developing a home security application. One thing I'd like to do is automatically turn it off and on based on whether or not I'm at home. I have a phone with Wifi that automatically connects to my network when I'm home. The phone connects and gets its address via DHCP. While I could configure it to use a static IP, I'd rather not. Is there any kind of 'Ping' or equivalent in C# / .Net that can take the MAC address of a device and tell me whether or not it's currently active on the network?

    Read the article

  • ASP.NET/IIS: Tell IIS do not check for file existence

    - by AgileMeansDoAsLittleAsPossible
    In my Global.asax.cs, I have: routes.MapRoute("AssetCss", "css/{*path}", new { controller = "Asset", action = "Index" }); I also have this in a view: <link href="/css/Root/index.css" rel="stylesheet" type="text/css" /> The problem is that the AssetController does not invoke Index when /css/Root/index.css is requested. This is because a file actually exists at the path /css/Root/index.css. If I recall correctly, there's a checkbox setting in IIS that basically says "Do not check that a file actually exists at the request path [instead, let the RouteTable handle it]." (At least there is in IIS 6.) Is there something I can put in my Web.config that sets this IIS setting to true? How do I tell IIS to let my MVC routes handle the path even if a file exists at the path?

    Read the article

  • how to tell bulider to not to escape values

    - by dorelal
    ruby-1.8.7-p249 > xml = Builder::XmlMarkup.new => <inspect/> ruby-1.8.7-p249 > xml.foo '<b>wow</b>' => "<inspect/><foo>&lt;b&gt;wow&lt;/b&gt;</foo>" ruby-1.8.7-p249 > Builder is escaping the content and is converting the b tag into escaped value . How do I tell builder to no to escape it. I am using ruby 1.8.7 .

    Read the article

  • XSL - How to tell if element is last in series

    - by Chris
    I have an XSL template that is called (below). What I would like to do is be able to tell if I am the last Unit being called. <xsl:template match="Unit[@DeviceType = 'Node']"> <!-- Am I the last Unit in this section of xml? --> <div class="unitchild"> Node: #<xsl:value-of select="@id"/> </div> </xsl:template> Example XML <Unit DeviceType="QueueMonitor" Master="1" Status="alive" id="7"> <arbitarytags /> <Unit DeviceType="Node" Master="0" Status="alive" id="8"/> <Unit DeviceType="Node" Master="0" Status="alive" id="88"/> </Unit>

    Read the article

  • Tell LINQ Distinct which item to return

    - by Jon
    I understand how to do a Distinct() on a IEnumerable and that I have to create an IEqualityComparer for more advanced stuff however is there a way in which you can tell which duplicated item to return? For example say you have a List<T> List<MyClass> test = new List<MyClass>(); test.Add(new MyClass {ID = 1, InnerID = 4}); test.Add(new MyClass {ID = 2, InnerID = 4}); test.Add(new MyClass {ID = 3, InnerID = 14}); test.Add(new MyClass {ID = 4, InnerID = 14}); You then do: var distinctItems = test.Distinct(new DistinctItemComparer()); class DistinctItemComparer : IEqualityComparer<MyClass> { public bool Equals(MyClass x, MyClass y) { return x.InnerID == y.InnerID;; } public int GetHashCode(MyClassobj) { return obj.InnerID.GetHasCode(); } } This code will return the classes with ID 1 and 3. Is there a way to return the ID matches 2 & 4.

    Read the article

  • Cannot add repository key

    - by William Anthony
    I just installed my new laptop with ubuntu 12.04 and when I'm trying to add key, there is a "network unreachable" error. william@ubuntu:~$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A gpg: requesting key CD2EFD2A from hkp server keys.gnupg.net ?: keys.gnupg.net: Network is unreachable gpgkeys: HTTP fetch error 7: couldn't connect: Network is unreachable gpg: no valid OpenPGP data found. gpg: Total number processed: 0 I'm so sure the keyserver is not down, because I tried it again at my old laptop running ubuntu 11.04 william@william:~$ gpg --keyserver hkp://keys.gnupg.net --recv-keys 1C4CBDCDCD2EFD2A gpg: requesting key CD2EFD2A from hkp server keys.gnupg.net gpg: key CD2EFD2A: "Percona MySQL Development Team <[email protected]>" not changed gpg: Total number processed: 1 gpg: unchanged: 1 Is this a bug?

    Read the article

  • How to tell endianness from this output?

    - by Nick Rosencrantz
    I'm running this example program and I'm suppossed to be able to tell from the output what machine type it is. I'm certain it's from inspecting one or two values but how should I perform this inspection? /* pointers.c - Test pointers * Written 2012 by F Lundevall * Copyright abandoned. This file is in the public domain. * * To make this program work on as many systems as possible, * addresses are converted to unsigned long when printed. * The 'l' in formatting-codes %ld and %lx means a long operand. */ #include <stdio.h> #include <stdlib.h> int * ip; /* Declare a pointer to int, a.k.a. int pointer. */ char * cp; /* Pointer to char, a.k.a. char pointer. */ /* Declare fp as a pointer to function, where that function * has one parameter of type int and returns an int. * Use cdecl to get the syntax right, http://cdecl.org/ */ int ( *fp )( int ); int val1 = 111111; int val2 = 222222; int ia[ 17 ]; /* Declare an array of 17 ints, numbered 0 through 16. */ char ca[ 17 ]; /* Declare an array of 17 chars. */ int fun( int parm ) { printf( "Function fun called with parameter %d\n", parm ); return( parm + 1 ); } /* Main function. */ int main() { printf( "Message PT.01 from pointers.c: Hello, pointy World!\n" ); /* Do some assignments. */ ip = &val1; cp = &val2; /* The compiler should warn you about this. */ fp = fun; ia[ 0 ] = 11; /* First element. */ ia[ 1 ] = 17; ia[ 2 ] = 3; ia[ 16 ] = 58; /* Last element. */ ca[ 0 ] = 11; /* First element. */ ca[ 1 ] = 17; ca[ 2 ] = 3; ca[ 16 ] = 58; /* Last element. */ printf( "PT.02: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); printf( "PT.03: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); printf( "PT.04: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.05: Dereference pointer ip and we find: %d \n", *ip ); printf( "PT.06: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.07: Dereference pointer cp and we find: %d \n", *cp ); *ip = 1234; printf( "\nPT.08: Executed *ip = 1234; \n" ); printf( "PT.09: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); printf( "PT.10: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.11: Dereference pointer ip and we find: %d \n", *ip ); printf( "PT.12: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); *cp = 1234; /* The compiler should warn you about this. */ printf( "\nPT.13: Executed *cp = 1234; \n" ); printf( "PT.14: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); printf( "PT.15: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.16: Dereference pointer cp and we find: %d \n", *cp ); printf( "PT.17: val2: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val2, val2, val2 ); ip = ia; printf( "\nPT.18: Executed ip = ia; \n" ); printf( "PT.19: ia[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ia[0], ia[0], ia[0] ); printf( "PT.20: ia[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ia[1], ia[1], ia[1] ); printf( "PT.21: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.22: Dereference pointer ip and we find: %d \n", *ip ); ip = ip + 1; /* add 1 to pointer */ printf( "\nPT.23: Executed ip = ip + 1; \n" ); printf( "PT.24: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.25: Dereference pointer ip and we find: %d \n", *ip ); cp = ca; printf( "\nPT.26: Executed cp = ca; \n" ); printf( "PT.27: ca[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[0], ca[0], ca[0] ); printf( "PT.28: ca[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[1], ca[1], ca[1] ); printf( "PT.29: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.30: Dereference pointer cp and we find: %d \n", *cp ); cp = cp + 1; /* add 1 to pointer */ printf( "\nPT.31: Executed cp = cp + 1; \n" ); printf( "PT.32: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.33: Dereference pointer cp and we find: %d \n", *cp ); ip = ca; /* The compiler should warn you about this. */ printf( "\nPT.34: Executed ip = ca; \n" ); printf( "PT.35: ca[0]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[0], ca[0], ca[0] ); printf( "PT.36: ca[1]: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &ca[1], ca[1], ca[1] ); printf( "PT.37: ip: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &ip, (long) ip, (long) ip ); printf( "PT.38: Dereference pointer ip and we find: %d \n", *ip ); cp = ia; /* The compiler should warn you about this. */ printf( "\nPT.39: Executed cp = ia; \n" ); printf( "PT.40: cp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &cp, (long) cp, (long) cp ); printf( "PT.41: Dereference pointer cp and we find: %d \n", *cp ); printf( "\nPT.42: fp: stored at %lx (hex); value is %ld (dec), %lx (hex)\n", (long) &fp, (long) fp, (long) fp ); printf( "PT.43: Dereference fp and see what happens.\n" ); val1 = (*fp)(42); printf( "PT.44: Executed val1 = (*fp)(42); \n" ); printf( "PT.45: val1: stored at %lx (hex); value is %d (dec), %x (hex)\n", (long) &val1, val1, val1 ); return( 0 ); } Output Message PT.01 from pointers.c: Hello, pointy World! PT.02: val1: stored at 21e50 (hex); value is 111111 (dec), 1b207 (hex) PT.03: val2: stored at 21e54 (hex); value is 222222 (dec), 3640e (hex) PT.04: ip: stored at 21eb8 (hex); value is 138832 (dec), 21e50 (hex) PT.05: Dereference pointer ip and we find: 111111 PT.06: cp: stored at 21e6c (hex); value is 138836 (dec), 21e54 (hex) PT.07: Dereference pointer cp and we find: 0 PT.08: Executed *ip = 1234; PT.09: val1: stored at 21e50 (hex); value is 1234 (dec), 4d2 (hex) PT.10: ip: stored at 21eb8 (hex); value is 138832 (dec), 21e50 (hex) PT.11: Dereference pointer ip and we find: 1234 PT.12: val1: stored at 21e50 (hex); value is 1234 (dec), 4d2 (hex) PT.13: Executed *cp = 1234; PT.14: val2: stored at 21e54 (hex); value is -771529714 (dec), d203640e (hex) PT.15: cp: stored at 21e6c (hex); value is 138836 (dec), 21e54 (hex) PT.16: Dereference pointer cp and we find: -46 PT.17: val2: stored at 21e54 (hex); value is -771529714 (dec), d203640e (hex) PT.18: Executed ip = ia; PT.19: ia[0]: stored at 21e74 (hex); value is 11 (dec), b (hex) PT.20: ia[1]: stored at 21e78 (hex); value is 17 (dec), 11 (hex) PT.21: ip: stored at 21eb8 (hex); value is 138868 (dec), 21e74 (hex) PT.22: Dereference pointer ip and we find: 11 PT.23: Executed ip = ip + 1; PT.24: ip: stored at 21eb8 (hex); value is 138872 (dec), 21e78 (hex) PT.25: Dereference pointer ip and we find: 17 PT.26: Executed cp = ca; PT.27: ca[0]: stored at 21e58 (hex); value is 11 (dec), b (hex) PT.28: ca[1]: stored at 21e59 (hex); value is 17 (dec), 11 (hex) PT.29: cp: stored at 21e6c (hex); value is 138840 (dec), 21e58 (hex) PT.30: Dereference pointer cp and we find: 11 PT.31: Executed cp = cp + 1; PT.32: cp: stored at 21e6c (hex); value is 138841 (dec), 21e59 (hex) PT.33: Dereference pointer cp and we find: 17 PT.34: Executed ip = ca; PT.35: ca[0]: stored at 21e58 (hex); value is 11 (dec), b (hex) PT.36: ca[1]: stored at 21e59 (hex); value is 17 (dec), 11 (hex) PT.37: ip: stored at 21eb8 (hex); value is 138840 (dec), 21e58 (hex) PT.38: Dereference pointer ip and we find: 185664256 PT.39: Executed cp = ia; PT.40: cp: stored at 21e6c (hex); value is 138868 (dec), 21e74 (hex) PT.41: Dereference pointer cp and we find: 0 PT.42: fp: stored at 21e70 (hex); value is 69288 (dec), 10ea8 (hex) PT.43: Dereference fp and see what happens. Function fun called with parameter 42 PT.44: Executed val1 = (*fp)(42); PT.45: val1: stored at 21e50 (hex); value is 43 (dec), 2b (hex)

    Read the article

  • Netbeans - *Easy* way to tell which Netbeans project a file belongs to

    - by sdek
    I was wondering if there is a way in Netbeans (v 6.8, or whatever) to have the editor tabs colored based on which project the file belongs to? Or some other easy way to distinguish which project a file belongs to. Basically my problem is that I have 3-4 netbeans projects, which all have a very similar code base (production version, staging version, development version 1, development version 2), and sometimes I have files open from a few different projects, and I get confused as to which project the file belongs to. And I know that you can hover over the tab and you can see which project it belongs to, but it would be fantastic if there was another, easier way to visually distinguish which project a file belongs to.

    Read the article

  • How do I implement IDataServiceMetadataProvider and tell my Data Service to use that custom provider

    - by Pwninstein
    There's no obvious entry point for implementing a custom provider for an ADO.NET Data Service using IDataServiceMetadataProvider, and then telling a Data Service to use that provider. Has anyone had any luck in this area? I've tried implementing this interface on my Data Source class, but none of my breakpoints are hit. There is also no (obvious) way to set the provider from the Data Service's DataServiceConfiguration parameter passed in to the InitializeService function. Any help would be appreciated. Thanks! Data Services Providers (ADO.NET Data Services) IDataServiceMetadataProvider Members

    Read the article

  • How can I tell if a CSV is in UTF-7 or UTF-8

    - by dru-zod
    Excel seems to save CSV files in (what I think is) UTF-7, despite the fact that most information I have read suggest that in general, you should not UTF-7. Indeed, other applications (Text pad, which lets me choose) save things in UTF-8 (or Unicode etc, but UTF-7 is not even an option). Using .NET, I read the stream, and have to provide the encoding. If I get it wrong, accented characters are replaced with question marks. If I try and let StreamReader work it out (using detectEncodingFromByteOrderMarks), it gets it wrong (at least, it does if the file has been saved in Excel). It is unlikely that anything other then Excel will be used, so I could just assume UTF-7. Are there any other options? I need to support French (accented), German, Dutch, and Norwegian characters.

    Read the article

  • How to tell a rightCalloutAccessoryView has been touched for MapKit

    - by iamdadude
    I have a MKAnnotationView being allocated with a DetailDisclosure button being displayed on the right side of the annotation. How would I go about knowing when a user clicked on the annotation button? This is what my code looks like right now - UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeDetailDisclosure]; pinView.rightCalloutAccessoryView = rightButton; pinView.animatesDrop = YES; Is there a built in method to detect when a accessory view has been touched? I'm guessing it would be like the UITableView methods, but I can't find anything. Thanks for any help.

    Read the article

  • How to tell a connect timeout error from a read timeout error in Ruby's Net::HTTP

    - by Ben Marini
    My question is related to http://stackoverflow.com/questions/2370140/how-to-rescue-timeout-issues-ruby-rails. Here's the common way to rescue from a timeout: def action # Post using Net::HTTP rescue Timeout::Error => e # Do something end I'd like to determine if the exception was raised while trying to connect to the host, or if it was raised while trying to read from the host. Is this possible?

    Read the article

  • Visual Studio Plug-in that can tell the Application Pool name of w3wp.exe when debugging

    - by Colin Niu
    Is there any plug-in for Visual Studio that can display the associated Application Pool name for those w3wp processes when debugging them with "Attach to Process..." ? Usually I have to do following steps before debugging: c: \Windows\system32\inetsrv\appcmd list wps then I get the process id for the Application Pool I want to debug, and then attach it in the Attach to Process window. I feel it will be very pleasure if there's a plug in can do this automatically, but didn't find any such thing after Googled.

    Read the article

  • How to tell if a datareader is open on a connection and close it

    - by Earlz
    Hi, I'm setting up a little thing for connection pooling and on of the more common bugs that we have occur(its always an easy fix, but we just can't remember reader.Close()!) it is when we have a connection that is used by a lot of classes/methods and one method opens a data reader and forgets to close it. This isn't really bad cause a lot of times all you have to do is go into the debugger and go up one level and see the function before it was and check if it had an unclosed data reader. Now, here is the bigger problem. In this connection pool, if a datareader is open, then it's not known until a thread gets a connection and tries to use it and the thing that originally opened the data reader may no longer even be alive. So quite simply, how can you detect if a data reader is open on a connection and is there a way to close the reader without closing the connection?

    Read the article

  • Facebook/FBML: How to tell if a user is a fan of the fan page

    - by Dominic Godin
    Hi, I'm working on a FBML fan page for a client. I need to perform a check to see if the current user is a fan of the page. I tried using the JavaScript API but I've found this is not compatible with FBML. I have looked through the FBML page on the developer wiki and found checks for practically everything else but no is user fan check. Any pointers in the right direction would be most appreciated. Thanks in advance.

    Read the article

  • Can anyone tell me about a jQuery modal dialog box library that doesn't suck

    - by Ritesh M Nayak
    jQuery based modal dialog boxes are great as long as you do as much as the example tells you to. I need a jQuery based modal dialog box library that has to have the following characteristics: It should be fast, something like the add and link dialog on StackOverflow. Most libraries take an eternity to load the dialog with its fancy effects and stuff. I want to call it using a script. Show a hidden div or a span element inline. MOst of the libraries talk filling an anchor with rel, class and href=#hiddenDiv sort of things. I need to be able to what I want without adding unnecessary attributes to my anchor. Something like this function showDialog(values) { processToChangeDom(values); changeDivTobeDisplayed(); modalDialog.show(); } It should reflect changes I make to the DOM in the hidden Div. I used facebox and found out that it makes a copy of the hidden div and changes to the DOM doesn't reflect on the modal window. I need to be able call the close modal div using javascript and also attach beforeOpen and afterClose handlers to the action. Does anyone have any suggestions? I have already tried facebox, simplemodal and a whole range of libraries, most of them don't support one or the other of these functions I described above.

    Read the article

  • Android: how to tell if a view is scrolling

    - by Dave
    in iPhone, this would be simple---each view has a scrollViewDidScroll method. I am trying to find the equivalent in Android. My code works, but it isn't giving me what I want. I need to execute code the entire duration that a view is scrolling. So, even though I use OnGestureListener's onScroll method, it only fires when the finger is on the screen (it's not really named correctly---it should be called "onSlide" or "onSwipe", focusing on the gesture rather than the UI animation). It does not continue to fire if the user flicks the view and it is still scrolling for a few moments after the user lifts his finger. is there a method that is called at every step of the scroll? public class Scroll extends Activity implements OnGestureListener { public WebView webview; public GestureDetector gestureScanner; public int currentYPosition; public int lastYPosition; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); webview = new WebView(this); setContentView(webview); webview.loadUrl("file:///android_asset/Scroll.html"); gestureScanner = new GestureDetector(this); currentYPosition = 0; lastYPosition = 0; } public boolean onTouchEvent(final MotionEvent me) { return gestureScanner.onTouchEvent(me); } public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { // I do stuff here. return true; }

    Read the article

  • F#: Tell me what I'm missing about using Async.Parallel

    - by JBristow
    ok, so I'm doing ProjectEuler Problem #14, and I'm fiddling around with optimizations in order to feel f# out. in the following code: let evenrule n = n / 2L let oddrule n = 3L * n + 1L let applyRule n = if n % 2L = 0L then evenrule n else oddrule n let runRules n = let rec loop a final = if a = 1L then final else loop (applyRule a) (final + 1L) n, loop (int64 n) 1L let testlist = seq {for i in 3 .. 2 .. 1000000 do yield i } let getAns sq = sq |> Seq.head let seqfil (a,acc) (b,curr) = if acc = curr then (a,acc) else if acc < curr then (b,curr) else (a,acc) let pmap f l = seq { for a in l do yield async {return f a} } |> Seq.map Async.RunSynchronously let pmap2 f l = seq { for a in l do yield async {return f a} } |> Async.Parallel |> Async.RunSynchronously let procseq f l = l |> f runRules |> Seq.reduce seqfil |> fst let timer = System.Diagnostics.Stopwatch() timer.Start() let ans1 = testlist |> procseq Seq.map // 837799 00:00:08.6251990 printfn "%A\t%A" ans1 timer.Elapsed timer.Reset() timer.Start() let ans2 = testlist |> procseq pmap printfn "%A\t%A" ans2 timer.Elapsed // 837799 00:00:12.3010250 timer.Reset() timer.Start() let ans3 = testlist |> procseq pmap2 printfn "%A\t%A" ans3 timer.Elapsed // 837799 00:00:58.2413990 timer.Reset() Why does the Async.Parallel code run REALLY slow in comparison to the straight up map? I know I shouldn't see that much of an effect, since I'm only on a dual core mac. Please note that I do NOT want help solving problem #14, I just want to know what's up with my parallel code.

    Read the article

  • Can you tell me why this generates time limit exceeded in spoj(Prime Number Generator)

    - by magiix
    #include<iostream> #include<string.h> #include<math.h> using namespace std; bool prime[1000000500]; void generate(long long end) { memset(prime,true,sizeof(prime)); prime[0]=false; prime[1]=false; for(long long i=0;i<=sqrt(end);i++) { if(prime[i]==true) { for(long long y=i*i;y<=end;y+=i) { prime[y]=false; } } } } int main() { int n; long long b,e; scanf("%d",&n); while(n--) { cin>>b>>e; generate(e); for(int i=b;i<e;i++) { if(prime[i]) printf("%d\n",i); } } return 0; } That's my code for spoj prime generator. Altought it generates the same output as another accepted code ..

    Read the article

  • Tell jQuery to ignore clicks during an animation sequence

    - by dclowd9901
    I'm in the midst of writing a slideShow app (click a button, and you slide through a list of images) for jQuery, but I've run into a little bug where it will respond to the click() request even while an animation is happening. I'm using the animate() function already, so that isn't staving off the additional animation requests. Any way to program around this?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >