Search Results

Search found 236 results on 10 pages for 'infinity'.

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

  • UIGraphicsGetCurrentContext threading problem

    - by Infinity
    Hello guys! The reference says this: "You should call this function from the main thread of your application only." But I would like to get the current graphics context from separate threads. What do you think? What can I do to reach this? Edit: Thanks guys for the answers. I don't know which is good for me at the moment, but thank you very much.

    Read the article

  • Calling javascript from objective-c code

    - by Infinity
    Hello! I found a lots of ways to call objective-c code from javascript, but I want to call the javascript code from objective-c. Last time I submitted a HTML FORM from objective-c, and now I wan't to call a javascript method. What do you think, is there any way to call it and get the response? I am interested in any solution, but I started to think and I think I need to send a html call or something like this, but I am not sure about this because the javascript is client side code, so maybe I need to process it from my objective-c code. What do you think about this?

    Read the article

  • Multiple NSOperationQueues?

    - by Infinity
    Hello! I would like to use NSOperations in my application to resolve threading problems. I have read some tutorials and now I know what I have to do, but I have a problem. There is a must to have the same NSOperationQueue in each class. What if I use a new NSOperationQueue in each class. There will be concurrency problems?

    Read the article

  • NSOperation and UIKit problem

    - by Infinity
    Hello guys! I am doing my download with an object which was inherited from NSOperation. I have read the documentation and when my operation finished I must call the [self.delegate performSelectorOnMainThread:@selector(operationDidFinish:) withObject:self waitUntilDone:YES]; method. It needs to be called on the main thread, because the UIKit is not thread safe and the documentation says this in these non thread safe frameworks cases. In the delegate method I am drawing a pdf or an image, but because it is drawn on the main thread the User Interface is very laggy until the drawing is finished. Maybe can you suggest me a good way to avoid this problem?

    Read the article

  • Using "class/object" MooTools-style events in jQuery

    - by Infinity
    One of the nice things about MooTools, is that it lets you easily assign/fire events to objects, for example: var playerSingleton = new (new Class({ Implements: [Events], initialize: function() {}, setVolume: function() { // do some stuff.. this.fireEvent('volumeChanged') } })); // Somewhere else... playerSingleton.addEvent('volumeChanged', function() { // do something when volume changes }); playerSingleton.setVolume(75); // bam our event fires. How would something like this be done with jQuery? I know there's .bind and .trigger, but it seems like the only way to do this is to bind/fire events to the window object: $(window).bind('volumeChanged', fn); Is there anything better than this, more like the MooTools approach? Thanks!

    Read the article

  • UIView frame origin doesn't set good

    - by Infinity
    Hi guys! Here is my code: frame = _pageContentView.frame; NSLog(@"%f; %f; %f; %f;", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); frame.size.height = pageContentView.frame.size.height; NSLog(@"%f; %f; %f; %f;", frame.origin.x, frame.origin.y, frame.size.width, frame.size.height); _pageContentView.frame = frame; NSLog(@"%f; %f; %f; %f;", _pageContentView.frame.origin.x, _pageContentView.frame.origin.y, _pageContentView.frame.size.width, _pageContentView.frame.size.height); And the NSLog outputs these values: 0.000000; 0.000000; 317.648956; 0.000000; 0.000000; 0.000000; 317.648956; 768.000000; 0.000007; 0.000004; 317.648956; 768.000000; Can you see? In the last row the x and y coordinates are a bit crazy... Where do these number come frome? What's the problem here?

    Read the article

  • MPMoviePlayerController problem at start

    - by Infinity
    Hello guys! I have a problem with MPMoviePlayerController, because when I start it in fullscreen it exists, but the song is still playing. I added the MPMoviePlayerDidExitFullscreenNotification notification and it says that when the video starts playin it exists the full screen. Here's my code: _multimediaPlayer = [[MPMoviePlayerController alloc] init]; _multimediaPlayer.controlStyle = MPMovieControlStyleDefault; _multimediaPlayer.initialPlaybackTime = 0; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayBackDidFinish:) name:MPMoviePlayerPlaybackDidFinishNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayerDidExitFullscreen:) name:MPMoviePlayerDidExitFullscreenNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoPlayerPlaybackStateChanged:) name:MPMoviePlayerPlaybackStateDidChangeNotification object:nil]; NSString *path = [NSString stringWithFormat:@"%@/mag_%d/%@", [FMUtils documentsFolderPathWithFile:nil], _magID, _pageObject.fileName]; if ([FMUtils fileExistsAtPath:path]) { _multimediaPlayer.contentURL = [NSURL fileURLWithPath:path]; } else { _multimediaPlayer.contentURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@%@", self.dataURL, _pageObject.fileName]]; } CGSize objectViewSize = self.frame.size; _multimediaPlayer.view.frame = CGRectMake(0, 0, objectViewSize.width, objectViewSize.height); [self addSubview:_multimediaPlayer.view]; if (_pageObject.blink) { [_multimediaPlayer setFullscreen:YES animated:YES]; } [_multimediaPlayer play]; Most of the time it happens when the video is not downloaded and it needs to stream it. Do you have any idea why is this happen?

    Read the article

  • Presentmodalviewcontroller method problem with retain count

    - by Infinity
    Hello guys! I am trying to present a modal view controller. I have read the documentation, but something is strange. Here's my code: NSLog(@"rc: %d", [modalViewController retainCount]); UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:modalViewController]; [self presentModalViewController:navigationController animated:YES]; [navigationController release]; NSLog(@"rc: %d", [modalViewController retainCount]); And on the console, appears: rc: 2 rc: 24 And I think 24 is very strange... What do you thin? Why is this happening?

    Read the article

  • UIWebView selection

    - by Infinity
    Hello guys! I subclassed the UIWindow to get the clicks from UIWebView. I used a tutorial for this. Here is the link: Tutorial It is working, but after I've got and other tutorial from the writer where he shows how to highlight the text in UIWebView. Here's the second link. But I can't use this second one. I tried to run this code in the - (void)userDidTapWebView:(id)tapPoint; delegate method. This delegate method is called when I tap in the UIWebView. Maybe somebody can help me to correct the script? I would like to get the tapped anchor's link. I tried many different java script, but until now I couldn't get the tapped anchor's link. One of the tries is when I tried to add a function to document.onClick. But I tap an anchor then it needs a second tap to get the anchor and I can't get the link neither with this method.

    Read the article

  • Regular expressions

    - by Infinity
    Hello guys! I need a regular expression for findin a pattern. This is the pattern: id|name|code|mobile I created a pattern for this if I want to search by id (if id = 1): .*1.*|.*|.*|.* But it matches every pattern that contains number 1. What's the problem with it?

    Read the article

  • 3 embedded UIScrollView problem

    - by Infinity
    Hello guys! I have 3 UIScrollView. Here is a sample code, about how they are added in eachother: UIScrollView main; UIScrollView page1; UIScrollView page2; UIScrollView doublePage; UIView pageContent1; UIView pageContent2; UIView doublePageContent; int nrPages = 1; sw2 = 0; main = [[UIScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, 768, 980)]; main.contentSize = CGSizeMake(768 * (nrPages - 1 + sw2), 980); page1.frame = CGRectMake(0, 0, 768, 980); page2.frame = CGRectMake(768, 0, 768, 980); pageNumber = i - 1 + sw2; (i is a variable in a for loop) doublePage.frame = CGRectMake(768 * (pageNumber - 1), 0, 768 * 2, 980); CGFloat contentWidth = [page1 bounds].size.width + [page2 bounds].size.width; CGFloat contentHeight = page1 ? self.page1.bounds.size.height : self.page2.bounds.size.height; doublePageContent = [[UIView alloc] initWithFrame:CGRectMake(0, 0, contentWidth, contentHeight)]; [page1 addSubview:pageContent1]; [page2 addSubview:pageContent2]; [doublePageContent addSubview:page1]; [doublePageContent addSubview:page2]; [doublePage addSubview:doublePageContent]; [main addSubview:doublepage]; And with this structure the main scrollview don't want to scroll. Without the doublepage scrollview it is working good. What do you think? What's the problem? I know this structure is a little weird, but I need this structure because other parts of the code. Edited, added the information about the sizes. If you need something more please tell me. And one more thing.. If I add 1 pixel to the width of the doublePage contentSize.width it scrolls, but a bit hard, so it scrolls first in the doublePage and then in the main.

    Read the article

  • XCode and developer tools

    - by Infinity
    Hello guys! I want to use the FileMerge utility on my mac, but it isn't installed. I searched in the google and there is written that it will be installed with the developer tools. So the big question is where can I find the developer tools, because I downloaded the iPhone SDK 3.2 beta 5, and installed it, but I can't found the download location of developer tools. Maybe can you help me?

    Read the article

  • Mail attachement on iPhone

    - by Infinity
    Hello guys! Is there a way to get the attachements from the Mail app on the iPhone? I've seen some apps which can do it. But how? Can you point me on the right way? I was trying with the MessageUI, but I don't think it is the right way.

    Read the article

  • Python and urllib2: how to make a GET request with parameters

    - by Infinity
    I'm building an "API API", it basically a wrapper for a in house REST web service that the web app will be making a lot of requests to. Some of the web service calls need to be GET rather than post, but passing parameters. Is there a "best practice" way to encode a dictionary into a query string? e.g.: ?foo=bar&bla=blah I'm looking at the urllib2 docs, and it looks like it decides by itself wether to use POST or GET based on if you pass params or not, but maybe someone knows how to make it transform the params dictionary into a GET request. Maybe there's a package for something like this out there? It would be great if it supported keep-alive, as the web server will be constantly requesting things from the REST service. Thanks!

    Read the article

  • Render only a portion of a PDF on iPhone/iPad

    - by Infinity
    Hello guys! I am rendering my pdf in an UIView's drawRect method. Here's my code: - (void)drawRect:(CGRect)rect2 { NSString *filename = @"lol.pdf"; CFStringRef path = CFStringCreateWithCString (NULL, [filename UTF8String], kCFStringEncodingUTF8); CFURLRef url = CFURLCreateWithFileSystemPath (NULL, path, kCFURLPOSIXPathStyle, 0); CGPDFDocumentRef pdf = CGPDFDocumentCreateWithURL(url); CGPDFPageRef page = CGPDFDocumentGetPage (pdf, 1); CGAffineTransform m; CGContextRef context = UIGraphicsGetCurrentContext(); CGRect aRect = CGRectMake(0, 0, 768, 1024); CGContextTranslateCTM(context, 0.0, aRect.size.height); CGContextScaleCTM(context, 1.0, -1.0); m = CGPDFPageGetDrawingTransform (page, kCGPDFMediaBox, aRect, 0, YES); CGContextSaveGState (context); CGContextConcatCTM (context, m); CGContextClipToRect (context,CGPDFPageGetBoxRect (page, kCGPDFCropBox)); CGContextDrawPDFPage (context, page); CGContextRestoreGState (context); } It renders the whole pdf. How can I render only a part from it? Can you help me with it?

    Read the article

  • Java file searching problem

    - by Infinity
    Hello guys! I need to search a file for a word and return the whole line and the line number with this word, then edit the line and write back to the file. Maybe the line number isn't necesary to edit a line in a file. I `was reading after seraching with regexp and opening the filechannel of the file, but I can't get the line number. Maybe there are other better ways to do this. Can you help me how to start this?

    Read the article

  • Find Adjacent Nodes A Star Path-Finding C++

    - by Infinity James
    Is there a better way to handle my FindAdjacent() function for my A Star algorithm? It's awfully messy, and it doesn't set the parent node correctly. When it tries to find the path, it loops infinitely because the parent of the node has a pent of the node and the parents are always each other. Any help would be amazing. This is my function: void AStarImpl::FindAdjacent(Node* pNode) { for (int i = -1; i <= 1; i++) { for (int j = -1; j <= 1; j++) { if (pNode->mX != Map::GetInstance()->mMap[pNode->mX + i][pNode->mY + j].mX || pNode->mY != Map::GetInstance()->mMap[pNode->mX + i][pNode->mY + j].mY) { if (pNode->mX + i <= 14 && pNode->mY + j <= 14) { if (pNode->mX + i >= 0 && pNode->mY + j >= 0) { if (Map::GetInstance()->mMap[pNode->mX + i][pNode->mY + j].mTypeID != NODE_TYPE_SOLID) { if (find(mOpenList.begin(), mOpenList.end(), &Map::GetInstance()->mMap[pNode->mX + i][pNode->mY + j]) == mOpenList.end()) { Map::GetInstance()->mMap[pNode->mX+i][pNode->mY+j].mParent = &Map::GetInstance()->mMap[pNode->mX][pNode->mY]; mOpenList.push_back(&Map::GetInstance()->mMap[pNode->mX+i][pNode->mY+j]); } } } } } } } mClosedList.push_back(&Map::GetInstance()->mMap[pNode->mX][pNode->mY]); } If you'd like any more code, just ask and I can post it.

    Read the article

  • Javascript get anchor href on click

    - by Infinity
    Hello guys! How can I get the href of an anchor when I click on it using javascript? I did the following: document.onClick = myFunc(); function myFunc() { } But how to extend the function to respond only to clicks on anchors and get the href?

    Read the article

  • Javascript, IE, Strings, and Performance problems

    - by Infinity
    Hey guys, So we have this product, and it's really slow in IE. We've already applied a lot of the practices advised by the IE guys themselves (like this, and this), and try to sacrifice clean code for performance in the critical parts like DOM manipulation. However, as you can see in this IE profiler screenshot.. Just "String" is the biggest offender. Almost 750ms of exclusive time. Does this mean IE is spending 750ms just instantiating Strings? I also read this stuff on the Opera dev blog: A build script can remove whitespace, comments, replace strings with Array lookups (to avoid MSIE creating a string object for every single instance of a string — even in conditions) But no more info regarding this. Anyone can clarify? It seems like IE has to create a full String instance every time you have " " in your code, which could explain this, but I don't know what the array lookup optimization would look like. BTW- we don't really do much of string concatenation anywhere in the code. The library we use is MooTools 1.2.4 Any suggestions will be appreciated! Thx

    Read the article

  • Ping remote server and wait to get data

    - by infinity
    Hi I'm building my first application for android and I've reached a point where I can't find a solution even have no idea what to search for in Google. So the problem: I am pinging a remote server with GET request through the application passing some parameters like file_id. Then the server gives back confirmation if the file exists or error otherwise, both in plain text. The error string is $$$ERROR$$$. Actually the confirmation is JSON string that holds the path to the file. If the file doesn't exists on the server it generated the error message and start downloading the file and processing it which normally takes 10-30 seconds. What would be the best way to check if the file is ready for download? I have DownloadFile class that extends AsyncTask but before I reach the point to download the file I need the URL which is dependant on the previous request which is in the main class in the UI thread. Here is some code: public class MainActivity extends Activity { private String getInfo() { // Create a new HttpClient and Post Header HttpClient httpClient = new DefaultHttpClient(); HttpGet httpPost = new HttpGet(infoUrl); StringBuilder sb = null; String data; JSONObject jObject = null; try { HttpResponse response = httpClient.execute(httpPost); // This might be equal "$$$ERROR$$$" if no file exists sb = inputStreamToString(response.getEntity().getContent()); } catch(ClientProtocolException e) { // TODO Auto-generated catch block Log.v("Error: pushItem ClientProtocolException: ", e.toString()); } catch (IOException e) { // TODO Auto-generated catch block Log.v("Error: pushItem IOException: ", e.toString()); } // Clean the data to be complaint JSON format data = sb.toString().replace("info = ", ""); try { jObject = new JSONObject(data); data = jObject.getString("h"); fileTitle = jObject.getString("title"); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } downloadUrl = String.format(downloadUrl, fileId, data); return downloadUrl; } } So my idea was to get the content and if equal to $$$ERROR$$$ go into loop until JSON data is passed but I guess there is better solution. Note: I don't have control over the server output so have to deal with what I have.

    Read the article

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