Search Results

Search found 29841 results on 1194 pages for 'random number generator'.

Page 76/1194 | < Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >

  • how to generate random bubbles from array of sprites in cocos2d?

    - by prakash s
    I am devoloping the bubble shooter game in cocos2d how to generate random bubbles from array of sprites here is my code (void)addTarget { CGSize winSize = [[CCDirector sharedDirector] winSize]; //CCSprite *target = [CCSprite spriteWithFile:@"3.png" rect:CGRectMake(0, 0, 256, 256)]; NSMutableArray * movableSprites = [[NSMutableArray alloc] init]; NSArray *images = [NSArray arrayWithObjects:@"1.png", @"2.png", @"3.png", @"4.png",@"5.png",@"1.png",@"5.png", @"3.png", nil]; for(int i = 0; i < images.count; ++i) { NSString *image = [images objectAtIndex:i]; // generate random number based on size of array (array size is larger than 10) CCSprite*target = [CCSprite spriteWithFile:image]; float offsetFraction = ((float)(i+1))/(images.count+1); target.position = ccp(winSize.width*offsetFraction, winSize.height/2); target.position = ccp(350*offsetFraction, 460); [self addChild:target]; [movableSprites addObject:target]; //[target runAction:]; id actionMove = [CCMoveTo actionWithDuration:10 position:ccp(winSize.width/2,winSize. height/2)]; This code generating bubbles with *.png colour bubbles but i want to generate randomly because for shooting the bubbles by shooter class help me please id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [target runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; } }

    Read the article

  • What is 0x10 in decimal?

    - by Omar Abid
    I have the following code: SN.get_Chars(5) SN is a string so this should give the 5th Char Ok! Now i have another code but : SN.get_Chars(0x10) I wonder what 0x10 is? Is it a number? If it's so, then what is it in decimal notation?

    Read the article

  • Regex negative match query

    - by Matt
    Hey guys, I've got a regex issue, Im trying to ignore just the number '41', I want 4, 1, 14 etc to all match. I've got this [^\b41\b] which is effectively what I want but this also ignores all single iterations of the values 1 and 4. As an example, this matches "41", but I want it to NOT match: \b41\b

    Read the article

  • Large number of soft page faults when assigning a TJpegImage to a TBitmap

    - by Robert Oschler
    I have a Delphi 6 Pro application that processes incoming jpeg frames from a streaming video server. The code works but I recently noticed that it generates a huge number of soft page faults over time. After doing some investigation, the page faults appear to be coming from one particular graphics operation. Note, the uncompressed bitmaps in question are 320 x 240 or about 300 KB in size so it's not due to the handling of large images. The number of page faults being generated isn't tolerable. Over an hour it can easily top 1000000 page faults. I created a stripped down test case that executes the code I have included below on a timer, 10 times a second. The page faults appear to happen when I try to assign the TJpegImage to a TBitmap in the GetBitmap() method. I know this because I commented out that line and the page faults do not occur. The assign() triggers a decompression operation on the part of TJpegImage as it pushes the decompressed bits into a newly created bitmap that GetBitmap() returns. When I run Microsoft's pfmon utility (page fault monitor), I get a huge number of soft page fault error lines concerning RtlFillMemoryUlong, so it appears to happen during a memory buffer fill operation. One puzzling note. The summary part of pfmon's report where it shows which DLL caused what page fault does not show any DLL names in the far left column. I tried this on another system and it happens there too. Can anyone suggest a fix or a workaround? Here's the code. Note, IReceiveBufferForClientSocket is a simple class object that holds bytes in an accumulating buffer. function GetBitmap(theJpegImage: TJpegImage): Graphics.TBitmap; begin Result := TBitmap.Create; Result.Assign(theJpegImage); end; // --------------------------------------------------------------- procedure processJpegFrame(intfReceiveBuffer: IReceiveBufferForClientSocket); var theBitmap: TBitmap; theJpegStream, theBitmapStream: TMemoryStream; theJpegImage: TJpegImage; begin theBitmap := nil; theJpegImage := TJPEGImage.Create; theJpegStream:= TMemoryStream.Create; theBitmapStream := TMemoryStream.Create; try // 2 // ************************ BEGIN JPEG FRAME PROCESSING // Load the JPEG image from the receive buffer. theJpegStream.Size := intfReceiveBuffer.numBytesInBuffer; Move(intfReceiveBuffer.bufPtr^, theJpegStream.Memory^, intfReceiveBuffer.numBytesInBuffer); theJpegImage.LoadFromStream(theJpegStream); // Convert to bitmap. theBitmap := GetBitmap(theJpegImage); finally // Free memory objects. if Assigned(theBitmap) then theBitmap.Free; if Assigned(theJpegImage) then theJpegImage.Free; if Assigned(theBitmapStream) then theBitmapStream.Free; if Assigned(theJpegStream) then theJpegStream.Free; end; // try() end; // --------------------------------------------------------------- procedure TForm1.Timer1Timer(Sender: TObject); begin processJpegFrame(FIntfReceiveBufferForClientSocket); end; // --------------------------------------------------------------- procedure TForm1.FormCreate(Sender: TObject); var S: string; begin FIntfReceiveBufferForClientSocket := TReceiveBufferForClientSocket.Create(1000000); S := loadStringFromFile('c:\test.jpg'); FIntfReceiveBufferForClientSocket.assign(S); end; // --------------------------------------------------------------- Thanks, Robert

    Read the article

  • Counting number of times an item occurs in a linked list

    - by HanaCHaN92
    Here is the assignment: Here's the assignment: Implement a method countValue() that counts the number of times an item occurs in a linked list. Remember to use the STL list. int countValue(list front, const int item); Generate 20 random numbers in the range of 0 to 4, and insert each number in the linked list. Output the list by using a method which you would call writeLinkedList which you would add to the ListP.cpp. In a loop, call the method countValue() , and display the number of occurrences of each value from 0 to 4 in the list. Remember that all the above is to be included in the file ListP.ccp Run: 2 3 4 0 1 0 2 4 2 3 3 4 3 3 3 0 0 2 0 2 0 : 5, 1 : 1, 2 : 5, 3 : 6, 4 : 3 and here is what I have so far: #include<iostream> #include<list> #include<tchar.h> int countValue(list<int> front, const int item); using namespace std; int _tmain(int argc, _TCHAR* argv[]){ list<int> front; int listCount; cout << "Enter the size of the list: "; cin >> listCount; for (int i = 1; i <= listCount; i++) front.insert(rand()%5); cout << "Original List of Values: " << endl; //writeLinkedList(front, " "); cout << endl; for(int j=0;j<5;++j) cout << countValue (front,j) << endl; cout << endl; return 0; } int countValue(list<int> front, const int item) { int count0; int count1; int count2; int count3; int count4; list<int> *List; for(list<int>::iterator i = front.begin(); i != front.end(); i++) { if(List->item == 0) { count0++; } if(List->item == 1) { count1++; } if(List->item == 2) { count2++; } if(List->item == 3) { count2++; }if(List->item == 4) { count4++; } } } And here are the errors: error C2065: 'list' : undeclared identifier line 5 error C2062: type 'int' unexpected line 5 error C2661: 'std::list<_Ty>::insert' : no overloaded function takes 1 arguments line 16 error C3861: 'countValue': identifier not found line 21 IntelliSense: no instance of overloaded function "std::list<_Ty, _Ax>::insert [with _Ty=int, _Ax=std::allocator<int>]" matches the argument list line 16 IntelliSense: too few arguments in function call line 16 error C2039: 'item': is not a member of 'std::list<_Ty>' lines 34, 38, 42, 46, 49 IntelliSense: declaration is incompatible with "int countValue" (declared at line 5) line 25 IntelliSense: class "std::list<int, std:: allocator<int>>" has no member "item" lines 34, 38, 42, 46, 49 I just want to know what I've done wrong and how to fix it and also if someone could help me figure out if I'm doing the countValue function wrong or not based on the instructions I would really appreciate it. I've read the chapter in our textbook several times, looked up tutorials on youtube and on Dream in Code, and still I can not figure this out. All helpful information is appreciated!

    Read the article

  • Limiting Number of Characters in a ContentEditable div

    - by Bill Dami
    Hi guys, I am using contenteditable div elements in my web application and I am trying to come up with a solution to limit the amount of characters allowed in the area, and once the limit is hit, attempting to enter characters simply does nothing. This is what I have so far: var content_id = 'editable_div'; //binding keyup/down events on the contenteditable div $('#'+content_id).keyup(function(){ check_charcount(content_id, max); }); $('#'+content_id).keydown(function(){ check_charcount(content_id, max); }); function check_charcount(content_id, max) { if($('#'+content_id).text().length > max) { $('#'+content_id).text($('#'+content_id).text().substring(0, max)); } } This DOES limit the number of characters to the number specified by 'max', however once the area's text is set by the jquery .text() function the cursor resets itself to the beginning of the area. So if the user keeps on typing, the newly entered characters will be inserted at the beginning of the text and the last character of the text will be removed. So really, I just need some way to keep the cursor at the end of the contenteditable area's text.

    Read the article

  • Get contact name from just the number

    - by user1190019
    Say i have an edit text and a button. In the edit text you would type a number and then when you hit the button it will either show the contact information or return with the name of that contact. I have tried all sorts of methods provided with no luck. The one i have successfully gotten the furthest with was the following... But i had no luck returning the name. Cursor phoneCursor = null; contactList = new HashMap<String,String>(); try{ Uri uContactsUri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI; String strProjection = ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME; phoneCursor = getContentResolver().query(uContactsUri, null, null, null, strProjection); phoneCursor.moveToFirst(); String name = ""; String phoneNumber = ""; int nameColumn = phoneCursor.getColumnIndex(Phone.DISPLAY_NAME); int phoneColumn = phoneCursor.getColumnIndex(Phone.NUMBER); phoneCursor.moveToNext(); } } catch(Exception e){ Log.e("[SmsMain] getContactData", e.toString()); } finally{ if(phoneCursor != null){ phoneCursor.close(); phoneCursor = null; } } }

    Read the article

  • Wrong number of args passed to: repl$repl

    - by grm
    Hi, I have a trouble with a compojure "Getting started" example that I do not seem to understand. When I run the example from http://weavejester.github.com/compojure/docs/getting-started.html ...I get the following error at the lein repl step: ~/hello-www> lein repl src/hello_www/core.clj Exception in thread "main" java.lang.IllegalArgumentException: Wrong number of args passed to: repl$repl (NO_SOURCE_FILE:0) at clojure.lang.Compiler.eval(Compiler.java:5359) at clojure.lang.Compiler.eval(Compiler.java:5311) at clojure.core$eval__4350.invoke(core.clj:2364) at clojure.main$eval_opt__6502.invoke(main.clj:228) at clojure.main$initialize__6506.invoke(main.clj:247) at clojure.main$script_opt__6526.invoke(main.clj:263) at clojure.main$main__6544.doInvoke(main.clj:347) at clojure.lang.RestFn.invoke(RestFn.java:483) at clojure.lang.Var.invoke(Var.java:381) at clojure.lang.AFn.applyToHelper(AFn.java:180) at clojure.lang.Var.applyTo(Var.java:482) at clojure.main.main(main.java:37) Caused by: java.lang.IllegalArgumentException: Wrong number of args passed to: repl$repl at clojure.lang.AFn.throwArity(AFn.java:439) at clojure.lang.AFn.invoke(AFn.java:43) at clojure.lang.Var.invoke(Var.java:369) at clojure.lang.AFn.applyToHelper(AFn.java:165) at clojure.lang.Var.applyTo(Var.java:482) at clojure.core$apply__3776.invoke(core.clj:535) at leiningen.core$_main__59$fn__61.invoke(core.clj:94) at leiningen.core$_main__59.doInvoke(core.clj:91) at clojure.lang.RestFn.applyTo(RestFn.java:138) at clojure.core$apply__3776.invoke(core.clj:535) at leiningen.core$_main__59.invoke(core.clj:97) at user$eval__67.invoke(NO_SOURCE_FILE:1) at clojure.lang.Compiler.eval(Compiler.java:5343) ... 11 more I have tried both the stable and the developer version of lein without any success. Any ideas on what I could look for next? I get the same result both on linux and cygwin. When I run it manually, it seems to work fine on linux: java -cp "lib/*" clojure.main src/hello_www/core.clj 2010-05-17 19:34:17.280::INFO: Logging to STDERR via org.mortbay.log.StdErrLog 2010-05-17 19:34:17.281::INFO: jetty-6.1.14 2010-05-17 19:34:17.382::INFO: Started [email protected]:8080

    Read the article

  • Find Port Number and Domain Name to connect to Hive Table

    - by user1419563
    I am new to Hive, MapReduce and Hadoop. I am using Putty to connect to hive table and access records in the tables. So what I did is- I opened Putty and in the host name I typed- ares-ingest.vip.host.com and then I click Open. And then I entered my username and password and then few commands to get to Hive sql. Below is the list what I did $ bash bash-3.00$ hive Hive history file=/tmp/rjamal/hive_job_log_rjamal_201207010451_1212680168.txt hive> set mapred.job.queue.name=hdmi-technology; hive> select * from table LIMIT 1; So my question is- I was trying to connect to Hive Tables using Squirrel SQL Client, so in that my Connection URL is- jdbc:hive://ares-ingest.vip.host.com:10000/default. So whenever I try to connect with these attributes, I always get Hive: Could not establish connection to ares-ingest.vip.host.com:10000/default: java.net.ConnectException: Connection timed out: connect. It might be possible I am using wrong port number or domain name here. Is there any way from the command prompt I can find out these two things, like what Domain Name and Port Number(where Hive server is running) should I use to connect to Hive table from Squirrel SQL Client. As I know host and port are determined by where the hive server is running

    Read the article

  • Variable number of two-dimensional arrays into one big array

    - by qlb
    I have a variable number of two-dimensional arrays. The first dimension is variable, the second dimension is constant. i.e.: Object[][] array0 = { {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"}, {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"}, ... }; Object[][] array1 = { {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"}, {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"}, ... }; ... Object[][] arrayi = ... I'm generating these arrays with a for-loop: for (int i = 0; i < filter.length; i++) { MyClass c = new MyClass(filter[i]); //data = c.getData(); } Where "filter" is another array which is filled with information that tells "MyClass" how to fill the arrays. "getData()" gives back one of the i number of arrays. Now I just need to have everything in one big two dimensional array. i.e.: Object[][] arrayComplete = { {"tim", "sanchez", 34, 175.5, "bla", "blub", "[email protected]"}, {"alice", "smith", 42, 160.0, "la", "bub", "[email protected]"}, ... {"john", "sdfs", 34, 15.5, "a", "bl", "[email protected]"}, {"joe", "smith", 42, 16.0, "a", "bub", "[email protected]"}, ... ... }; In the end, I need a 2D array to feed my Swing TableModel. Any idea on how to accomplish this? It's blowing my mind right now.

    Read the article

  • Searching Week-wise/Month-wise record counts(number) and the StartDate+EndDate(datetime) of the Week

    - by Muzaffar Ali Rana
    I have a question in connection to this question earlier posted by me:- http://stackoverflow.com/questions/2452984/daily-weekly-monthly-record-count-search-via-storedprocedure I want to have the Count of Calls on Weekly-basis and Monthly-basis, Daily-basis issue is resolved. ISSUE NUMBER @1:Weekly-basis Count of Calls and Start-Date and End-Date of Week I have searched the Start-Date and End-Date of Week including their individual Count of Calls as well in the below-mentioned query. But the problem is that I could not get the result in one single table, although I have used the Temporary Tables(#TempTable+#TempTable2). Kindly help me in this regards. NOTE:Table Creation commented as for executing more than once. ----- *** TABLE CREATION OF #TempTable & #TempTable2 *** ---------- --CREATE TABLE #TempTable( StartDate datetime,EndDate datetime,CallCount numeric(18,5)) --CREATE TABLE #TempTable2( StartDate datetime,EndDate datetime,CallCount numeric(18,5)) DECLARE @StartDate datetime,@EndDate datetime,@StartDateTemp1 datetime,@StartDateTemp2 datetime,@EndDateTemp datetime,@Period varchar(50); SET @StartDate='1/1/2010'; SET @EndDate='2/28/2010'; SET @StartDateTemp1=@StartDate; SET @StartDateTemp2=DATEADD(dd, 7, @StartDate ); SET @Period='Weekly'; IF (@Period = 'Weekly') BEGIN WHILE ((@StartDate <= @StartDateTemp1) AND (@StartDateTemp2 <= @EndDate)) BEGIN IF((@StartDateTemp1 < @StartDateTemp2 ) AND (@StartDateTemp1 != @StartDateTemp2) ) BEGIN SELECT convert(varchar, @StartDateTemp1, 106) AS 'Start Date', convert(varchar, @StartDateTemp2, 106) AS 'End Date', COUNT(*) AS 'Call Count' FROM TRN_Call WHERE (CallTime = @StartDateTemp1 AND CallTime <= @StartDateTemp2 ); END SET @StartDateTemp1 = DATEADD(dd, 7, @StartDateTemp1); SET @StartDateTemp2 = DATEADD(dd, 7, @StartDateTemp2); END END ISSUE NUMBER @2:Monthly-basis Count of Calls and Start-Date and End-Date of Week In this case, I have the same search, but will have to search the Call Counts plus the Start-Date and End-Date of the Month. Kindly help me in this regards as well.

    Read the article

  • Large number of simultaneous long-running operations in Qt

    - by Hostile Fork
    I have some long-running operations that number in the hundreds. At the moment they are each on their own thread. My main goal in using threads is not to speed these operations up. The more important thing in this case is that they appear to run simultaneously. I'm aware of cooperative multitasking and fibers. However, I'm trying to avoid anything that would require touching the code in the operations, e.g. peppering them with things like yieldToScheduler(). I also don't want to prescribe that these routines be stylized to be coded to emit queues of bite-sized task items...I want to treat them as black boxes. For the moment I can live with these downsides: Maximum # of threads tend to be O(1000) Cost per thread is O(1MB) To address the bad cache performance due to context-switches, I did have the idea of a timer which would juggle the priorities such that only idealThreadCount() threads were ever at Normal priority, with all the rest set to Idle. This would let me widen the timeslices, which would mean fewer context switches and still be okay for my purposes. Question #1: Is that a good idea at all? One certain downside is it won't work on Linux (docs say no QThread::setPriority() there). Question #2: Any other ideas or approaches? Is QtConcurrent thinking about this scenario? (Some related reading: how-many-threads-does-it-take-to-make-them-a-bad-choice, many-threads-or-as-few-threads-as-possible, maximum-number-of-threads-per-process-in-linux)

    Read the article

  • jQuery to populate form fields based on first entered value where number of fields is unknown

    - by da5id
    Greetings, I have a form with a variable number of inputs, a simplified version of which looks like this: <form> <label for="same">all the same as first?</label> <input id="same" name="same" type="checkbox" /> <input type="text" id="foo[1]" name="foo[1]" value="" /> <input type="text" id="foo[2]" name="foo[2]" value="" /> <input type="text" id="foo[3]" name="foo[3]" value="" /> <input type="text" id="foo[4]" name="foo[4]" value="" /> <input type="text" id="foo[5]" name="foo[5]" value="" /> </form> The idea is to tick the #same checkbox and have jQuery copy the value from #foo[1] into #foo[2], #foo[3], etc. They also need to clear if #same is unchecked. There can be any number of #foo inputs, based upon input from a previous stage of the form, and this bit is giving me trouble. I'm sure I'm missing something obvious, but I can't get any variation on $('#dest').val($('#source').val()); to work. Help!

    Read the article

  • Tokenizing a string with unequal number of spaces between fields

    - by gatechgrad
    I am tryint to tokenize entries from a file. However I am not able to use the line.split("") option because of unequal number of spaces between files. I am copying a few lines from my file below: "08-09-2010 21:21:46 00:22:7f:a6:9b:69 -79" "08-09-2010 21:21:46 04:4f:aa:b4:49:49 -79" "08-09-2010 21:21:46 04:4f:aa:31:4e:59 tikona 18002090044 -83" "08-09-2010 21:21:46 00:22:7f:26:9b:69 tikona 18002090044 -74" "08-09-2010 21:21:46 04:4f:aa:34:0d:c9 tikona 18002090044 -82" "08-09-2010 21:21:46 04:4f:aa:71:4e:59 -85" "08-09-2010 21:21:46 04:4f:aa:34:21:89 tikona 18002090044 -75" "08-09-2010 21:21:46 04:4f:aa:34:49:49 tikona 18002090044 -77" "08-09-2010 21:21:46 04:4f:aa:74:0d:c9 -85" "08-09-2010 21:22:47 18 APs were seen " I need to access the first column (which is a datetime object) the second column (00:22...) and the last column (-79 etc.). I have no trouble accessing the first and second columns, but not the last column. When I do a info=line.spilt(""), since the third column might or might no entries, I am not able to determine the token number. How do i access the 4th column? Is there a way i can use info[i].contains(" -")?

    Read the article

  • What kind parser that phpdoc use ?

    - by justjoe
    When the first time, i install phpdoc, i love it so much. And i want to create its mini version for myself use. So, can anybody give me information about what kind of parser it has. and Maybe a image reference on how it works (so i can picture it visually in my mind) ?

    Read the article

  • Hash of unique value = unique hash?

    - by Nebs
    Theoretically does hashing a unique value yield a unique value? Let's say I have a DB table with 2 columns: id and code. id is an auto-incrementing int and code is a varchar. If I do ... $code = sha1($id); ... and then store $code into the same row as $id. Will my code column be unique as well? What about if I append the current time? eg: $code = sha1($id . time()); Thanks.

    Read the article

  • Jquery Randomizing within Categories

    - by David Chase
    Hi, so here is my question in a situation if you will. i have 6 items in div classes which correspond to 3 categories something like this class ="boat" class ="car" class ="bike" class ="blueboat" class ="redcar" class ="greenbike" so is there a jquery/javascript approach with .addClass where when someone clicks on the button "Randomize" it addClass .mine to each one of the 3 categories ie blueboat.mine and redcar.mine and bike.mine but not boat or car or greenbike because they are in the same category? or another situation rather than .addClass use a jquery/javascript so when "Randomize" is clicked to randomly show 3 out of 6 items one in each category of boat,car,bike and hide the rest blueboat,redcar,greenbike. in this situation all 6 items are on the page when document is ready but with the randomize only 3 are left one from each category. please let me know if anyone has any ideas or needs further clarification any help is greatly appreciated. thank you -david

    Read the article

  • How to Pythonically yield all values from a list?

    - by bodacydo
    Suppose I have a list that I wish not to return but to yield values from. What is the most Pythonic way to do that? Here is what I mean. Thanks to some non-lazy computation I have computed the list ['a', 'b', 'c', 'd'], but my code through the project uses lazy computation, so I'd like to yield values from my function instead of returning the whole list. I currently wrote it as following: List = ['a', 'b', 'c', 'd'] for item in List: yield item But this doesn't feel Pythonic to me. Looking forward to some suggestions, thanks. Boda Cydo.

    Read the article

  • Ruby on Rails equivalent for Maven Archetypes

    - by Drew
    Maven Archetypes are handy ways to get a project up and going in no time flat. Rails is kinda like an archetype in and of itself. However, I'm curious to know if there are any Rails equivalents for Maven Archetypes. For example, I want to create an Archetype with full authentication already built in via Authlogic. With Maven Archetypes I would need to build a project with it already ready to go, create my archetype and start working back parameterizing things that should be parameterized. Then anyone can make a Rails project with Authlogic set up by filling out a few questions during the archetype generate command and boom! Fully functional Rails app with Authlogic built in. Is there a Rails Equivalent? Are Generators expected to do this? Is this just not Rails-y?

    Read the article

  • Flex Canvas child Randomly resizes

    - by BS_C3
    Hi! I have an application with a viewstack that contains all the components that need to be displayed. The navigation is defined in the main application. All the components are based on canvas. The main application looks like that: <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:components="components.*"> <mx:VBox width="1024" height="100%" horizontalCenter="0" verticalGap="0" backgroundColor="#FFFFFF"> <mx:Image id="header" verticalAlign="top" /> <mx:ViewStack id="body" horizontalCenter="0" verticalCenter="0" width="100%" height="100%"> <components:HomePage id="hp" width="100%"/> <components:CollectionSelection id="cs" width="100%"/> <components:SearchEngine id="se" width="100%"/> <components:SearchResult id="sr" width="100%"/> <components:Tray id="tr" width="100%"/> <components:Order id="or" width="100%"/> </mx:ViewStack> <mx:Image id="footer" verticalAlign="bottom" maintainAspectRatio="false" width="100%"/> </mx:VBox> </mx:Application> I'm getting a strange behaviour from the TRAY component. Here's the code for component Tray (I've only left the display info): <mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Image id="bg" horizontalCenter="0" verticalCenter="0" width="100%" height="100%" maintainAspectRatio="false"/> <mx:HBox width="100%"> <mx:Button x="20" y="20" label="BACK"/> <mx:Spacer width="100%"/> <mx:LinkBar itemClick="linkbar_itemClick(event)" styleName="GLBLinkBTN" separatorColor="#FFFFFF" separatorWidth="1" > <mx:dataProvider> <mx:Object label="CLEAR"/> <mx:Object label="LOGOUT"/> </mx:dataProvider> </mx:LinkBar> </mx:HBox> <mx:VBox id="mainBox" horizontalCenter="0" verticalCenter="0" verticalGap="0"> <mx:HBox width="100%" height="50" backgroundColor="#60524D" verticalAlign="bottom" paddingBottom="5"> <mx:Label styleName="TRTitle" paddingLeft="15"/> <mx:Spacer width="100%"/> <mx:Label styleName="TRItems" paddingRight="15"/> </mx:HBox> <mx:HorizontalList id="hlist" dataProvider="{TrayData.instance.itemsCollection}" columnCount="{TrayData.instance.hlistColumns}" rowCount="1" itemRenderer="components.TrayItem" horizontalScrollPolicy="off" rollOverColor="#FFFFFF" selectionColor="#FFFFFF" horizontalCenter="0" verticalCenter="0" borderStyle="none" horizontalScrollPosition="{TrayData.instance.hsPosition}" /> <mx:HBox width="100%" backgroundColor="#E7DDDB" height="40" verticalAlign="middle" paddingLeft="20" paddingRight="20"> <mx:Box width="25" verticalAlign="middle" horizontalAlign="left"> <mx:Button id="leftBtn" /> </mx:Box> <mx:Spacer width="100%"/> <mx:Box width="25" verticalAlign="middle" horizontalAlign="right"> <mx:Button id="rightBtn" /> </mx:Box> </mx:HBox> </mx:VBox> </mx:Canvas> All the components are displaying properly. However, sometimes, randomly, the vbox "mainBox" in the tray component is not displaying as it should: the horizontallist shrinks and instead of fully displaying its items, I get horizontal and vertical scrollbars for each item... I'm currently trying to reproduce this behaviour (to get a print screen) but right know, it's working fine... -_-' As soon as I get it work as it shouldn't, I'll upload an image. Here's the code for the itemRenderer (just in case...): <mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" > <mx:HBox width="100%" paddingTop="0" paddingBottom="0" paddingRight="3"> <mx:Spacer width="100%"/> <mx:Box width="14" height="14" verticalAlign="middle" horizontalAlign="center"> <mx:Button width="8" height="8"/> </mx:Box> </mx:HBox> <mx:VBox paddingLeft="20" paddingRight="20" verticalGap="15" paddingBottom="15"> <mx:Canvas id="thumbnail"> <mx:Image id="thumbnailBG" /> <mx:Image id="thumbnailIM" /> </mx:Canvas > <mx:VBox width="100%" verticalGap="7"> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label paddingBottom="5"/> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74"opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> <mx:HBox width="100%" height="13"> <mx:Label width="74" opaqueBackground="#ECE5E2"/> <mx:Label /> </mx:HBox> </mx:VBox> <mx:Button /> </mx:VBox> </mx:VBox> Your help would really be appreciated. Regards, BS_C3

    Read the article

  • ANTLR parser hanging at proxy.handshake call

    - by Peter Boughton
    I am attempting to get a basic ECMAScript parser working, and found a complete ANTLR grammar for ECMAScript 3, which appears to compile ok and produces the appropriate Lexer/Parser/Walker Java files. (Running inside ANTLR IDE plugin for Eclipse 3.5) However, when actually trying to use it with some simple test code (following guide on ANTLR wiki), it just hangs when trying to create the parser: CharStream MyChars = new ANTLRFileStream(FileName); // FileName is valid ES3Lexer MyLexer = new ES3Lexer(MyChars); CommonTokenStream MyTokens = new CommonTokenStream(MyLexer); MyTokens.setTokenSource(MyLexer); ES3Parser MyParser = new ES3Parser( MyTokens ); // hangs here ES3Parser.program_return MyReturn = MyParser.program(); I've tracked down the problem to inside the ES3Parser constructor, where it's calling the function proxy.handshake() - before this line I can successfully do System.out.println("text") but after it I get nothing. So, how do I go about finding out why it's hanging, and stopping it - or even just bypassing this section (can/should I disable debugging?) - so long as that lets it work and allows me to get on with doing useful stuff.

    Read the article

  • Collision detection of huge number of circles

    - by Tomek Tarczynski
    What is the best way to check collision of huge number of circles? It's very easy to detect collision between two circles, but if we check every combination then it is O(n^2) which definitely not an optimal solution. We can assume that circle object has following properties: -Coordinates -Radius -Velocity -Direction Velocity is constant, but direction can change. I've come up with two solutions, but maybe there are some better solutions. Solution 1 Divide whole space into overlapping squares and check for collision only with circles that are in the same square. Squares needs to overlap so there won't be a problem when circle moves from one square to another. Solution 2 At the beginning distances between every pair of circles need to be calculated. If the distance is small then these pair is stored in some list, and we need to check for collision in every update. If the distance is big then we store after which update there can be a collision (it can be calculated because we know the distance and velocitites). It needs to be stored in some kind of priority queue. After previously calculated number of updates distance needs to be checked again and then we do the same procedure - put it on the list or again in the priority queue.

    Read the article

  • Reduce number of config files to as few as possible

    - by Scott
    For most of my applications I use iBatis.Net for database access/modeling and log4Net for logging. In doing this, I need a number of *.config files for each project. For example, for a simple application I need to have the following *.config files: app.config ([AssemblyName].[Extention].config) [AssemblyName].SqlMap.config [AssemblyName].log4Net.config [AssemblyName].SqlMapProperties.config providers.config When these applications go from DEV to TEST to PRODUCTION environments, the settings contained in these files change depending on the environment. When the number of files get compounded by having 5-10 (or more) supporting executables per project, the work load on the infrastructure team (the ones doing the roll-outs to the different environments) gets rather high. We also have a high risk of one of the config files being missed, or a mistype in the config file. What is the best way to avoid these risks? Should I combine all of the config files into one file? (is that possible with iBatis?) I know that with VisualStudio 2010 they introduce transforms for these config files that allow the developer to setup all the settings for the different environments and then dynamically (depending on the build kicked off) the config files get updated to the correct versions. (VS 2010 - transforms) Thank you for any help that you can provide.

    Read the article

  • getline at a certain line for file IO

    - by BSchlinker
    Is there anyway to use getline to read a specific line within a file? For instance, to immediately read line #20? It seems inefficient to do any type of look to read and discard earlier lines. I know about fseek, but there is no guarantee that the records will be the same length on each line. I imagine this is simply what is required in order to find lines. After all, to know when the end of the line has been reached, it needs to find the break line character, so it makes sense for it to need to read each line. Just wondering if there was any quicker method.

    Read the article

< Previous Page | 72 73 74 75 76 77 78 79 80 81 82 83  | Next Page >