Search Results

Search found 3152 results on 127 pages for 'jq beginner'.

Page 68/127 | < Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >

  • How to do a random-and-unique generator?

    - by javaLearner.java
    I already wrote a random generator which take arguments a and b, where a is minimun and b is maximum value, like this randomGenerator(int a, int b) What I want to do next is: Using a loop, then generate unique number from a to b. Example: I want to have 8 unique numbers, int a = 1; int b = 10; int value; If I do the loop, there is a high % that same number will appear more than once. Any idea how to do it? My own way is: while(int i <= 8){ randomGenerator(a,b); // if value is not in array, then insert into array } I am stuck at the comment part. Is there any way to check if a variable is exists in an array?

    Read the article

  • Python script to remove lines from file containing words in array

    - by chromesub
    I have the following script which identifies lines in a file which I want to remove, based on an array but does not remove them. What should I change? sourcefile = "C:\\Python25\\PC_New.txt" filename2 = "C:\\Python25\\PC_reduced.txt" offending = ["Exception","Integer","RuntimeException"] def fixup( filename ): print "fixup ", filename fin = open( filename ) fout = open( filename2 , "w") for line in fin.readlines(): for item in offending: print "got one",line line = line.replace( item, "MUST DELETE" ) line=line.strip() fout.write(line) fin.close() fout.close() fixup(sourcefile)

    Read the article

  • Pass reference to ArrayLists to a method.

    - by bhavna raghuvanshi
    here is the whole program: public class ListMerge { public static void main( String[] args) { Scanner input = new Scanner(System.in); System.out.println ("Input length of arraylist 1:"); int n = input.nextInt(); ArrayList x = new ArrayList(); ArrayList y = new ArrayList(); for (int i = 0; i < n; i++) { System.out.println ("Input x[ " + i +"] :" ); x.add(new Integer(i)); } System.out.println ("Input length of arraylist 2:"); int m = input.nextInt(); for (int i = 0; i < m; i++) { System.out.println ("Input y[ " + i +"] :" ); y.add(new Integer(i)); } } list int merge(ArrayList x, ArrayList y) { List all = new ArrayList(); all.addAll(x); all.addAll(y); System.out.println(all); return all; } } also tell me how do i call the function merge?

    Read the article

  • Prev and next button

    - by daniel
    My website has previous and next buttons. When the page loads id like the previous button to be invisible.(on the first panel) After the user clicks the next button (to go to 2nd panel), id like the previous button to appear. Is there some javascript that will do this?

    Read the article

  • deleting an array that stores pointers to some objects

    - by memC
    hi, I am storing pointers to elements of a vec_A in an array A* a_ptrs[3] . Assume that vec_A will not be resized. So, a_ptrs[i] will point to the correct element. My question is: Suppose A* a_ptrs[3] is declared in a class B. Since it is not created using 'new' I am guessing I don't need to delete it in the destructor. Am I right?? class A { public: int getNumber(); A(int val); ~A(){}; private: int num; }; A::A(int val){ num = val; }; int A::getNumber(){ return num; }; int main(){ int i =0; int num; std::vector<A> vec_A; for ( i = 0; i < 10; i++){ vec_A.push_back(A(i)); } A* a_ptrs[3]; a_ptrs[0] = &vec_A[0]; a_ptrs[1] = &vec_A[3]; a_ptrs[2] = &vec_A[5]; for (i = 0; i<3; i++){ std::cout<<"\n: a_ptrs[i].getNumber() = "<<a_ptrs[i]->getNumber(); } std::cout << "\nPress RETURN to continue..."; std::cin.get(); return 0; }

    Read the article

  • Python point lookup (coordinate binning?)

    - by Rince
    Greetings, I am trying to bin an array of points (x, y) into an array of boxes [(x0, y0), (x1, y0), (x0, y1), (x1, y1)] (tuples are the corner points) So far I have the following routine: def isInside(self, point, x0, x1, y0, y1): pr1 = getProduct(point, (x0, y0), (x1, y0)) if pr1 >= 0: pr2 = getProduct(point, (x1, y0), (x1, y1)) if pr2 >= 0: pr3 = getProduct(point, (x1, y1), (x0, y1)) if pr3 >= 0: pr4 = getProduct(point, (x0, y1), (x0, y0)) if pr4 >= 0: return True return False def getProduct(origin, pointA, pointB): product = (pointA[0] - origin[0])*(pointB[1] - origin[1]) - (pointB[0] - origin[0])*(pointA[1] - origin[1]) return product Is there any better way then point-by-point lookup? Maybe some not-obvious numpy routine? Thank you!

    Read the article

  • What groupbox method (if any) monitors radio button selections?

    - by JohnK813
    I'm creating a VB.NET application that includes two radio buttons inside of a groupbox. If the first radio button is selected, a certain tab on a tab form should be enabled. If the second radio button is selected, that tab should be disabled. Is there a groupbox method that monitors both radio buttons and fires when the selection changes? Or do I need to set up individual methods for each radio button?

    Read the article

  • Help with string equality in Java

    - by annayena
    The following function accepts 2 strings, the 2nd (not 1st) possibly containing *'s (asterisks). An * is a replacement for a string (empty, 1 char or more), it can appear appear (only in s2) once, twice, more or not at all, it cannot be adjacent to another * (ab**c), no need to check that. public static boolean samePattern(String s1, String s2) It returns true if strings are of the same pattern. It must be recursive, not use any loops, static or global variables. Also it's prohibited to use the method equals in the String class. Can use local variables and method overloading. Can use only these methods: charAt(i), substring(i), substring(i, j), length(). Examples: 1: TheExamIsEasy; 2: "The*xamIs*y" ---> true 1: TheExamIsEasy; 2: "Th*mIsEasy*" ---> true 1: TheExamIsEasy; 2: "*" ---> true 1: TheExamIsEasy; 2: "TheExamIsEasy" ---> true 1: TheExamIsEasy; 2: "The*IsHard" ---> FALSE I am stucked on this question for many hours now! I need the solution in Java please kindly help me.

    Read the article

  • Separating a group of functions into an includable file in C?

    - by zebra
    I know this is common in most languages, and maybe in C, as well. Can C handle separating several functions out to a separate file and having them be included? The functions will rely on other include files, as well. I want the code to retain all functionality, but the code will be reused in several C scripts, and if I change it once I do not wish to have to go through every script and change it there, too.

    Read the article

  • Best place to create windows form objects

    - by user333484
    I'm creating a windows app in c# 2008 that will have around 8-10 dialog boxes. I want these forms to exist throughout the life of the program. Where's the best place to create and store the objects? I'm coming from Delphi, where Form objects were usually stored in global variables. I'm tempted to do it in the static Program class. Should I put them in the main form instead? Thanks for helping a C# newb out.

    Read the article

  • Why is Python 3.1 throwing a SyntaxError when printing after loop? [resolved]

    - by bubersson
    Hi, I'm trying to run this snippet in Python 3.1 console and I'm getting SyntaxError: >>> while True: ... a=5 ... if a<6: ... break ... print("hello") File "<stdin>", line 5 print("hello") ^ SyntaxError: invalid syntax >>> (This is just shortened code to make a point.) Am I missing something? Is there some other Magic I don't know about? Thanks for your help (since this is my first StackOverflow question and I'm not a native English speaker)

    Read the article

  • Error message regarding IEnumerable.GetEnumerator().

    - by Bon_chan
    I get this error message and I can't figure out why! Error 1 'Exo5Chap12.ShortCollection<T>' does not implement interface member 'System.Collections.IEnumerable.GetEnumerator()'. 'Exo5Chap12.ShortCollection<T>.GetEnumerator()' cannot implement 'System.Collections.IEnumerable.GetEnumerator()' because it does not have the matching return type of 'System.Collections.IEnumerator'. E:\MyFolders\Dev\c#\Chapter12\Exo5Chap12\Exo5Chap12\exo5.cs 9 18 Exo5Chap12 Here is the code with an implementation of GetEnumerator(). What is wrong? public class ShortCollection<T> : IList<T> { protected Collection<T> innerCollection; protected int maxSize = 10; public IEnumerator<T> GetEnumerator() { return (innerCollection as IEnumerator<T>).GetEnumerator(); } }

    Read the article

  • What does this java output mean?!

    - by Phil
    public class Arrys { private int[] nums; //Step 3 public Arrys (int arrySize) { nums = new int[arrySize]; } public int [] getNums (){ return nums; } } Test class: public class TestArrys { public static void main(String args[]) { //Step 4 Arrys arry = new Arrys(10); System.out.println("\nStep4 "); for(int index = 0; index < arry.getNums().length; index++) { System.out.print(arry.getNums()); } } } It's incredibly simple, that is why I think I'm doing something fundamentally wrong. All I want is to display the value of the array. This is what I get back. I am totally lost, there is nothing in my book that explains this nor does googling it help. Step4 [I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440[I@1ac88440

    Read the article

  • Creating a series of vectors from a vector

    - by bluetongue
    I have a simple two vector dataframe (length=30) that looks something like this: > mDF Param1 w.IL.L 1 AuZgFw 0.5 2 AuZfFw 2 3 AuZgVw 74.3 4 AuZfVw 20.52 5 AuTgIL 80.9 6 AuTfIL 193.3 7 AuCgFL 0.2 8 ... I'd like to use each of the rows to form 30 single value numeric vectors with the name of the vector taken from mDF$Param1, so that: > AuZgFw [1] 0.5 etc I've tried melting and casting, but I suspect there may be an easier way?? Thanks in advance BT

    Read the article

  • I cannot change the target .NET Framework in IIS 6

    - by David Pike
    The option to target another version of the .Net Framework is disabled on a particular test system we are using on a current project. I have tried the following without success: Killing all W3WP.EXE processesRestarting the IIS serviceRemote Debugging has been removed from the box. Just hoping for some pointers.

    Read the article

< Previous Page | 64 65 66 67 68 69 70 71 72 73 74 75  | Next Page >