Search Results

Search found 6612 results on 265 pages for 'seconds'.

Page 9/265 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • AccountManagement.UserPrincipal.Current takes 5 seconds

    - by Adel Hazzah
    I'm using the new .NET 3.5 System.DirectoryServices.AccountManagement API. In my code, I need to determine the current System.DirectoryServices.AccountManagement.UserPrincipal. My naive approach was to do this: using AccountManagement = System.DirectoryServices.AccountManagement; ... // Determine current UserPrincipal. // (On my machine, this blocks for 5 seconds) // AccountManagement.UserPrincipal principal = AccountManagement.UserPrincipal.Current; My computer is a stand-alone machine running Vista. I am not part of any domain, etc. Any ideas on how to improve the performance?

    Read the article

  • Simple MySQL Query taking 45 seconds (Gets a record and its "latest" child record)

    - by Brian Lacy
    I have a query which gets a customer and the latest transaction for that customer. Currently this query takes over 45 seconds for 1000 records. This is especially problematic because the script itself may need to be executed as frequently as once per minute! I believe using subqueries may be the answer, but I've had trouble constructing it to actually give me the results I need. SELECT customer.CustID, customer.leadid, customer.Email, customer.FirstName, customer.LastName, transaction.*, MAX(transaction.TransDate) AS LastTransDate FROM customer INNER JOIN transaction ON transaction.CustID = customer.CustID WHERE customer.Email = '".$email."' GROUP BY customer.CustID ORDER BY LastTransDate LIMIT 1000 I really need to get this figured out ASAP. Any help would be greatly appreciated!

    Read the article

  • read angles in radian and convert them in degrees/minutes/seconds

    - by Amadou
    n=0; disp('This program performs an angle conversion'); disp('input data set to a straight line. Enter the name'); disp('of the file containing the input Lambda in radian: '); filename = input(' ','s'); [fid,msg] = fopen(filename,'rt'); if fid < 0 disp(msg); else A=textscan(fid, '%g',1); while ~feof(fid) Lambda = A(1); n = n + 1; A = textscan(fid, '%f',1); end fclose(fid); end Alpha=Lambda*180/pi; fprintf('Angle converted from radian to degree/minutes/seconds:\n'); fprintf('Alpha =%12d\n',Alpha); fprintf('No of angles =%12d\n',n);

    Read the article

  • Reload AJAX data every X minutes/seconds, jQuery

    - by NightMICU
    Hi everyone, I programmed a CMS that has a log of who has recently logged into the system. Presently, this data is fed into a jQuery UI tab via Ajax. I would like to put this information into a sidebar on the main page and load it via AJAX every 30 seconds (or some set period of time). How would I go about doing this? Does the PHP response need to be JSON coded? I am fairly new to AJAX and JSON data. Here is the PHP I am currently using to pull details from the users table- <?php $loginLog = $db->query("SELECT name_f, name_l, DATE_FORMAT(lastLogin, '%a, %b %D, %Y %h:%i %p') AS lastLogin FROM user_control ORDER BY lastLogin ASC LIMIT 10"); while ($recentLogin = $loginLog->fetch()) { echo $recentLogin['name_f'] . " " . $recentLogin['name_l'] . " - " . $recentLogin['lastLogin']; } ?> Thanks!

    Read the article

  • Time difference in seconds (as a floating point)

    - by pocoa
    >>> from datetime import datetime >>> t1 = datetime.now() >>> t2 = datetime.now() >>> delta = t2 - t1 >>> delta.seconds 7 >>> delta.microseconds 631000 Is there any way to get that as 7.631000 ? I can use time module, but I also need that t1 and t2 variables as DateTime objects. So if there is a way to do it with datettime, that would be great.

    Read the article

  • how to convert seconds to time format?

    - by Dewan159
    hi there for some reason i convert a time format like : 03:30 to seconds 3*3600 + 30*60 , now .. i wanna convert it back to it's first ( same ) format upthere ... how could that be ? My attempt : 3*3600 + 30*60 = 12600 12600 / 60 = 210 / 60 = 3.5 , floor(3.5) = 3 = hour now .. what about the minutes ?? considering the value can be like 19:00 or 02:51 ... i think you got the picture and by the way, how to convert 2:0 for example to 02:00 using RegEx ? Thanks in advance

    Read the article

  • mysql query takes 145 seconds

    - by suomee
    I have a a mysql db with myisam engine. Along with many other table I have this table "et" which has around 8137037 records. I have created indexes (individual index of column hname and pnum, it did not help much later created joint index of hname and pnum and it help execute within a second)such that queries like "select st from et where hname='name' and pnum='1' limit 1;" execute fast (with in a second) but the problem is I must execute this query "select st from et where hname='name' and pnum='1' order by id limit 1" where id is the primary key of the table and this query sometimes take 145 seconds :( how can i resolve this issue?

    Read the article

  • Execute the function automatically in 30 seconds, if the button is not pressed

    - by You Kuper
    I want to add the following functionality to my web page: if a user has not pressed the 'Accept' button during 30 seconds, then $('#popupBoxAccept').click( function() {..} is executed automatically. $(document).ready(function() { loadPopupBox(); }); function loadPopupBox() { // to load the Popupbox $('#popup_box').fadeIn("slow"); } $('#popupBoxAccept').click( function() { //... }); $('#popupBoxDecline').click( function() { //... }); <div id="popup_box"> <a id="popupBoxAccept">Accept</a> <a id="popupBoxDecline">Decline</a> </div>

    Read the article

  • How do you maintain focus when a particular aspect of programming takes 10+ seconds to complete?

    - by Jer
    I have a very difficult time focusing on what I'm doing (programming-wise) when something (compilation, startup time, etc.) takes more than just a few seconds. Anecdotally it seems that threshold is about 10 seconds (and I recall reading about study that said the same thing, though I can't find it now). So what typically happens is I make a change and then run the program to test it. That takes about 30 seconds, so I start reading something else, and before I know it 20 minutes have passed, and then it takes (if I'm lucky!) another 10+ minutes to deal with the context switch to getting back into programming. It's not an exaggeration to say that some things that should take me minutes literally take hours to complete. I'm very curious about what other programmers do to combat this tendency (or if I'm unique and they don't have this tendency?). Suggestions of any type at all are welcome - anything from "sit on your hands after hitting the compile button", to mental tricks, to "if it takes 30 seconds to start up something to test a change, then something's wrong with your development process!"

    Read the article

  • IIS7 ASP.NET Session drops in seconds

    - by shxo
    For testing I have 1 isolated page - no masters, controls, …. My sessions are lost after about 30 seconds. I’ve tried setting timeout on the page itself, in web.config, both, and neither. Tried forms authentication with timeout and windows authentication. Recycle the AppPool after changes. I can response.write from the Session_Start , but I never get any response.writes from the Session_End. Some things I’ve tried: <sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" sqlConnectionString="data source=127.0.0.1;" cookieless="false" timeout="20" /> <sessionState mode="InProc" cookieless="false" timeout="20"/> <sessionState mode="InProc" timeout="20"/> <sessionState timeout="20"/> No luck. My runtime is set to: <httpRuntime useFullyQualifiedRedirectUrl="true" maxRequestLength="204800" requestLengthDiskThreshold="204800" executionTimeout="600" /> I don’t know what this would be relevant, but I can’t think of anything else to post! Thanks!

    Read the article

  • Datareceived Serialport event stops raising after some seconds

    - by Mario
    Hi, I was hoping someone could help me out with this problem. I have a system (VB .NET) where I must read a person's weight (RS232 Sluice) and id (Fingerprint - 2 biometric reader, rs232) and compare it to a database. I have 3 serialports in my app, one for the sluice and the other 2 are to receive the id from the fingerprint readers, both of which call the same sub to get the id from the reader. I've been testing just one reader and it seemed to work fine, I got data from the datareceived and joined it together to get the id. The problem comes at this moment: I put a finger, sends the id, if it's ok sends a message, otherwise, writes the id to a textbox. But in-between reads, if I let 5 or 10 seconds pass without putting a finger on the reader it seems like I get no data at all anymore, the datareceived event nevers gets raised but if I keep putting a finger constantly it works pretty good, this is really weird to me. I was thinking of some things: **Maybe the port gets closed somehow after some time? I never call the CLose() method **The fact both datareceived eventhandlers call the same method and delegate **Maybe the connection settings are missing something? I tested with hyperterminal and the port keeps getting info even after time without activity and I use the same config with my application, maybe I need to change more settings like DTEenable and RTSenable? Please I need some help with this issue, it's to control access so it needs to be running 24/7 thanks in advance!

    Read the article

  • What is the most simple way to execute java class every 30 seconds

    - by Gandalf StormCrow
    I've been reading about java/spring/hibernate and worked trough a "dummy" examples so I told my friend to recommend something a bit harder for me, and now I'm stuck.. here is the simplest class I could think of package spring.com.practice; public class Pitcher { private String shout; public String getShout() { return shout; } public void setShout(String shout) { this.shout = shout; } public void voice() { System.out.println(getShout()); } } What is the most simple way to print out something by calling metod voice() from spring beans, and do it repeadatly every 30 seconds lets say, here is what I've got so far : <bean id="simpleTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean"> <property name="jobDetail" ref="jobSchedulerDetail" /> <property name="startDelay" value="0" /> <property name="repeatInterval" value="30" /> </bean> <bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="schedulerName" value="pitcherScheduler" /> <property name="triggers"> <list> <ref bean="simpleTrigger" /> </list> </property> </bean> <bean id="pitcher" class="spring.com.practice.Pitcher"> <property name="shout" value="I started executing..."></property> </bean> And yes I'm trying to run this on Jboss 5, I'm building a project with maven.

    Read the article

  • setContentView taking long time (10-15 seconds) to execute

    - by Paul
    I have a large activity that contains 100 or more buttons. But it's working fine once loaded. Problem however is loading. From clicking its launch icon to getting the first view it takes 10-12 seconds. Until the first view, it shows gray title bar in black background. At least, I want to show a simple progress bar or dialog while its loading. But it seems like you cannot show anything before setContentView executed. I think I have tried everything I could without any success. If you can give me any hint or idea, I would be thankful. UPDATE: I found a dramatic resolution. It takes now a second to load the view. I didn't use splash, thread or async task at all - BTW, don't try to use thread or async on UI because Android UI is not thread-safe. Problem was that those buttons were based on a custom class that requires initialization to load same resource. - so 100 or more file operations were happening on setContentView. Making them a just single loading solved my problem.

    Read the article

  • SQL SERVER – SQL in Sixty Seconds – 5 Videos from Joes 2 Pros Series – SQL Exam Prep Series 70-433

    - by pinaldave
    Joes 2 Pros SQL Server Learning series is indeed fun. Joes 2 Pros series is written for beginners and who wants to build expertise for SQL Server programming and development from fundamental. In the beginning of the series author Rick Morelan is not shy to explain the simplest concept of how to open SQL Server Management Studio. Honestly the book starts with that much basic but as it progresses further Rick discussing about various advanced concepts from query tuning to Core Architecture. This five part series is written with keeping SQL Server Exam 70-433. Instead of just focusing on what will be there in exam, this series is focusing on learning the important concepts thoroughly. This book no way take short cut to explain any concepts and at times, will go beyond the topic at length. The best part is that all the books has many companion videos explaining the concepts and videos. Every Wednesday I like to post a video which explains something in quick few seconds. Today we will go over five videos which I posted in my earlier posts related to Joes 2 Pros series. Introduction to XML Data Type Methods – SQL in Sixty Seconds #015 The XML data type was first introduced with SQL Server 2005. This data type continues with SQL Server 2008 where expanded XML features are available, most notably is the power of the XQuery language to analyze and query the values contained in your XML instance. There are five XML data type methods available in SQL Server 2008: query() – Used to extract XML fragments from an XML data type. value() – Used to extract a single value from an XML document. exist() – Used to determine if a specified node exists. Returns 1 if yes and 0 if no. modify() – Updates XML data in an XML data type. node() – Shreds XML data into multiple rows (not covered in this blog post). [Detailed Blog Post] | [Quiz with Answer] Introduction to SQL Error Actions – SQL in Sixty Seconds #014 Most people believe that when SQL Server encounters an error severity level 11 or higher the remaining SQL statements will not get executed. In addition, people also believe that if any error severity level of 11 or higher is hit inside an explicit transaction, then the whole statement will fail as a unit. While both of these beliefs are true 99% of the time, they are not true in all cases. It is these outlying cases that frequently cause unexpected results in your SQL code. To understand how to achieve consistent results you need to know the four ways SQL Error Actions can react to error severity levels 11-16: Statement Termination – The statement with the procedure fails but the code keeps on running to the next statement. Transactions are not affected. Scope Abortion – The current procedure, function or batch is aborted and the next calling scope keeps running. That is, if Stored Procedure A calls B and C, and B fails, then nothing in B runs but A continues to call C. @@Error is set but the procedure does not have a return value. Batch Termination – The entire client call is terminated. XACT_ABORT – (ON = The entire client call is terminated.) or (OFF = SQL Server will choose how to handle all errors.) [Detailed Blog Post] | [Quiz with Answer] Introduction to Basics of a Query Hint – SQL in Sixty Seconds #013 Query hints specify that the indicated hints should be used throughout the query. Query hints affect all operators in the statement and are implemented using the OPTION clause. Cautionary Note: Because the SQL Server Query Optimizer typically selects the best execution plan for a query, it is highly recommended that hints be used as a last resort for experienced developers and database administrators to achieve the desired results. [Detailed Blog Post] | [Quiz with Answer] Introduction to Hierarchical Query – SQL in Sixty Seconds #012 A CTE can be thought of as a temporary result set and are similar to a derived table in that it is not stored as an object and lasts only for the duration of the query. A CTE is generally considered to be more readable than a derived table and does not require the extra effort of declaring a Temp Table while providing the same benefits to the user. However; a CTE is more powerful than a derived table as it can also be self-referencing, or even referenced multiple times in the same query. A recursive CTE requires four elements in order to work properly: Anchor query (runs once and the results ‘seed’ the Recursive query) Recursive query (runs multiple times and is the criteria for the remaining results) UNION ALL statement to bind the Anchor and Recursive queries together. INNER JOIN statement to bind the Recursive query to the results of the CTE. [Detailed Blog Post] | [Quiz with Answer] Introduction to SQL Server Security – SQL in Sixty Seconds #011 Let’s get some basic definitions down first. Take the workplace example where “Tom” needs “Read” access to the “Financial Folder”. What are the Securable, Principal, and Permissions from that last sentence? A Securable is a resource that someone might want to access (like the Financial Folder). A Principal is anything that might want to gain access to the securable (like Tom). A Permission is the level of access a principal has to a securable (like Read). [Detailed Blog Post] | [Quiz with Answer] Please leave a comment explain which one was your favorite video as that will help me understand what works and what needs improvement. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: PostADay, SQL, SQL Authority, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology, Video

    Read the article

  • progressIndicator does not update till about 10 seconds after awakeFromNib occures

    - by theprojectabot
    I have been trying to get this one section of my UI to immediatly up date when the document loads into view. The awakeFromNib fires the pasted code and then starts a timer to repeat every 10 seconds... I load a default storage location: ~/Movies... which shows up immediately.. yet the network location that is saved in the document that gets pulled from the XML only seems to show up after the second firing of the - (void)updateDiskSpaceDisplay timer. I have set breakpoints and know that the ivars that contain the values that are being put into the *fileSystemAttributes is the network location right when the awakeFromNib occurs... Im confused why it magically appears after the second time firing instead of immediately displaying the write values. - (void)updateDiskSpaceDisplay { // Obtain information about the file system used on the selected storage path. NSError *error = NULL; NSDictionary *fileSystemAttributes = [[NSFileManager defaultManager] attributesOfFileSystemForPath:[[[self settings] containerSettings] storagePath] error:&error]; if( !fileSystemAttributes ) return; // Get the byte capacity of the drive. long long byteCapacity = [[fileSystemAttributes objectForKey:NSFileSystemSize] unsignedLongLongValue]; // Get the number of free bytes. long long freeBytes = [[fileSystemAttributes objectForKey:NSFileSystemFreeSize] unsignedLongLongValue]; // Update the level indicator, and the text fields to show the current information. [totalDiskSpaceField setStringValue:[self formattedStringFromByteCount:byteCapacity]]; [totalDiskSpaceField setNeedsDisplay:YES]; [usedDiskSpaceField setStringValue:[self formattedStringFromByteCount:(byteCapacity - freeBytes)]]; [usedDiskSpaceField setNeedsDisplay:YES]; [diskSpaceIndicator setMaxValue:100]; [diskSpaceIndicator setIntValue:(((float) (byteCapacity - freeBytes) / (float) byteCapacity) * 100.0)]; [diskSpaceIndicator display:YES]; } thoughts? my awakeFromNib: - (void)awakeFromNib { [documentWindow setAcceptsMouseMovedEvents:YES]; [documentWindow setDelegate:self]; [self updateSettingsDisplay]; [self updateDiskSpaceDisplay]; [self setDiskSpaceUpdateTimer:[NSTimer scheduledTimerWithTimeInterval:10.0 target:self selector:@selector(updateDiskSpaceDisplay) userInfo:NULL repeats:YES]]; [self setUpClipInfoTabButtons]; [self performSelector:@selector(setupEngineController) withObject:NULL afterDelay:0.1]; }

    Read the article

  • PHP script loading took over 10 seconds

    - by Misiur
    My again. I've promised to not come back today, but I've got another trouble. http://www.misiur.com/me/ - it took over 10 seconds to load. Whole site code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl" lang="pl"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>{site('title')}</title> <link rel="stylesheet" type="text/css" href="{site('themeDir')}/global.css" /> </head> <body> <div id="site"> <div id="footer"> <p>Site Managment System {site('version')} by <a href="http://www.misiur.com">Misiur</a>. Copyright &copy; 2010-{$currYear}.</p> </div> </div> </body> I think the trouble is in this piece of code: private function replaceFunc($subject) { foreach($this->func as $t) { preg_match_all('/\{'.$t.'\([a-zA-Z,\']+\)\}/i', $subject, $res); for($j = 0; $j < sizeof($res[0]); $j++) { preg_match('/\([a-zA-Z,\']+\)/i', $res[0][$j], $match); if($match > 0) { $prep = explode(", ", substr($match[0], 1, -1)); $args = array(); for($i = 0; $i < sizeof($prep); $i++) { $args[] = substr($prep[$i], 1, -1); } } else { $args = array(); } $subject = preg_replace('/\{'.$t.preg_quote($match[0]).'\}/i', call_user_func_array($t, $args), $subject); } } return $subject; } It has to find functions from array ($this-func), cut out arguments, and call function with them. I think that I've messed up. Help.

    Read the article

  • AJAX Div Retrieval every 60 seconds

    - by Sam
    Hello everyone! What I would like to do is retrieve the contents of a PHP file and insert it into a div every 60 seconds, basically refreshing the dynamic div. I've come up with the following code so far, however it doesn't seem to be working. The code is just like this, nothing extra, apart from the MYSQL login. PHP to grab: <?php $time = date("m/d/Y h:i:s a", time()); mysql_query("UPDATE djs SET requesttime='{$time}' WHERE username='{$djs['username']}'") or die(mysql_error()); $request_db = mysql_query("SELECT * FROM requests WHERE haveplayed='0'") or die(mysql_error()); echo "<table style=\"border:1px solid;width:99%;margin-left:auto;margin-right:auto;\" border=\"1\">"; echo "<tr><th>Title</th><th>Artist</th><th>Dedicated To...</th></tr>"; while($request = mysql_fetch_array( $request_db )) { echo "<tr><td style=\"width:33%;padding:1px;\">"; echo $request['SongName']; echo "</td><td style=\"width:33%;\">"; echo $request['Artist']; echo "</td><td style=\"width:33%;\">"; echo $request['DedicatedTo']; echo "</td></tr>"; } echo "</table>"; ?> The original PHP code is just the same, enclosed in a div with an id attribute of 'ajax_table'. The JavaScript is: // JavaScript Document var xmlHttp_moniter function moniter() { xmlHttp_moniter = GetXmlHttpObject_parcel() if(xmlHttp_moniter == null) { alert("browser does not support HTTP Request") return } var url="ajax_table.php?random=" + Math.random() xmlHttp_moniter.onreadystatechange = stateChanged xmlHttp_moniter.open("GET",url,true) xmlHttp_moniter.send(null) } function stateChanged() { if(xmlHttp_moniter.readyState==4 || xmlHttp_moniter.readyState == "complete") { document.getElementById("ajax_table").innerHTML = xmlHttp_moniter.responseText setTimeout('ajax_table()',60000); } } function GetXmlHttpObject_parcel() { var xmlHttp_moniter=null; try { xmlHttp_moniter=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp_moniter=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp_moniter=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp_moniter; } and that is on the page that is requesting the other php page.

    Read the article

  • App crashes after a few seconds

    - by Declan Scott
    when i launch my app, on trying to do something, it will crash after a couple of seconds. I have warnings of warning: incorrect implementation of "downloadTextViewCOntroller. I also have "method definiton for -timerFinished not found and"method definiton for -timerFinished not found" this is my .m plese help me. the .h is also t the bottom // // downloadTextViewController.m // downloadText // // Created by Declan Scott on 18/03/10. // Copyright MyCompanyName 2010. All rights reserved. // #import "downloadTextViewController.h" @implementation downloadTextViewController @synthesize start; -(IBAction)tapit { start.hidden = YES; } -(void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration { if (fabsf(acceleration.x) 2.0 || fabsf(acceleration.y) 2.0 || fabsf(acceleration.z) 2.0) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"This app was developed by Declan Scott and demonstrates NSURLConnection and NSMutableData" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; } } (NSString *) saveFilePath { NSArray *pathArray = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); return [[pathArray objectAtIndex:0] stringByAppendingPathComponent:@"savedddata.plist"]; } (void)applicationWillTerminate:(UIApplication *)application { NSArray *values = [[NSArray alloc] initWithObjects:textView.text,nil]; [values writeToFile:[self saveFilePath] atomically:YES]; [values release]; } (void)viewDidLoad { UIAccelerometer *accelerometer = [UIAccelerometer sharedAccelerometer]; accelerometer.delegate = self; accelerometer.updateInterval = 1.0f/60.0f; NSString *myPath = [self saveFilePath]; NSLog(myPath); BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:myPath]; if (fileExists) { NSArray *values = [[NSArray alloc] initWithContentsOfFile:myPath]; textView.text = [values objectAtIndex:0]; [values release]; } // notification UIApplication *myApp = [UIApplication sharedApplication]; // add yourself to the dispatch table [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillTerminate:) name:UIApplicationWillTerminateNotification object:myApp]; [super viewDidLoad]; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. - (IBAction)fetchData { loadingAlert = [[UIAlertView alloc] initWithTitle:@"Loading…\n\n\n\n" message:nil delegate:self cancelButtonTitle:@"Cancel Timer" otherButtonTitles:nil]; [loadingAlert show]; UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; activityView.frame = CGRectMake(139.0f-18.0f, 60.0f, 37.0f, 37.0f); [loadingAlert addSubview:activityView]; [activityView startAnimating]; timer = [NSTimer scheduledTimerWithTimeInterval:10.0f target:self selector:@selector(timerFinished) userInfo:nil repeats:NO]; NSURLRequest *downloadRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://simpsonatyapps.com/exampletext.txt"] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:1.0]; NSURLConnection *downloadConnection = [[NSURLConnection alloc] initWithRequest:downloadRequest delegate:self]; if (downloadConnection) downloadedData = [[NSMutableData data] retain]; else { // Error } } (void)connection:(NSURLConnection *)downloadConnection didReceiveData:(NSData *)data { [downloadedData appendData:data]; NSString *file = [[NSString alloc] initWithData:downloadedData encoding:NSUTF8StringEncoding]; textView.text = file; // get rid of alert [loadingAlert dismissWithClickedButtonIndex:-1 animated:YES]; [loadingAlert release]; /// add badge [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1]; } (void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; // Release any cached data, images, etc that aren't in use. } (void)viewDidUnload { // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; } (void)dealloc { [super dealloc]; } (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse { return nil; } @end // // downloadTextViewController.h // downloadText // // Created by Declan Scott on 18/03/10. // Copyright MyCompanyName 2010. All rights reserved. // import @interface downloadTextViewController : UIViewController { IBOutlet UITextView *textView; NSMutableData *downloadedData; UIAlertView *loadingAlert; NSTimer *timer; IBOutlet UIButton *start; } - (IBAction)fetchData; - (IBAction)tapIt; - (void)timerFinished; @property (nonatomic, retain) UIButton *start; @end

    Read the article

  • WMD editor freezes IE7 for 3 seconds on load

    - by dhruvbird
    Hello all, I am using the WMD editor's original code(not the stackoverflow version) since I need multiple of 'em on the same page and stackoverflow's version makes heavy use of element IDs internally since they aren't going to be having more than one editor instance per page. The code runs fin in FF 3.5, etc.. However, when I run it in IE8 (in IE7 compatibility mode), it freezes the whole browser for about 3 sec. before a new instance shows up. I tried profiling it with IE's dev. tools, and it seems that the getWidth() function on line 520 of the minified version of the code is taking up all the time. However, when I tried to hard-code the return (since it was always returning the same thing), the bottleneck shifted to the getHeight() function. I am attaching the code I am using to convert it to a jQuery plugin. jQuery.fn.wmd = function(params) { function createInstance(container, params) { /* Make sure WMD has finished loading */ if (!Attacklab || !Attacklab.wmd) { alert("WMD hasn't finished loading!"); return; } var defaultParams = { width : "600px", rows : 6, autogrow : false, preview : false, previewDivClassName: "wmd-preview-div" }; if (typeof(params) == "undefined") { var params = defaultParams; } else { var params = jQuery.extend({}, defaultParams, params); } /* Build the DOM elements */ var textarea = document.createElement("textarea"); textarea.style.width = params.width; textarea.rows = params.rows; jQuery(container).append(textarea); var previewDiv = document.createElement("div"); if (params.preview) { jQuery(previewDiv).addClass(params.previewDivClassName); jQuery(container).append(previewDiv); } /* Build the preview manager */ var panes = {input:textarea, preview:previewDiv, output:null}; var previewManager = new Attacklab.wmd.previewManager(panes); /* Build the editor and tell it to refresh the preview after commands */ var editor = new Attacklab.wmd.editor(textarea,previewManager.refresh); /* Save everything so we can destroy it all later */ var wmdInstance = {ta:textarea, div:previewDiv, ed:editor, pm:previewManager}; var wmdInstanceId = $(container).attr('postID'); wmdInstanceProcs.add(wmdInstanceId, wmdInstance); if (params.autogrow) { // $(textarea).autogrow(); } }; if (jQuery(this).html().length > 0) { var wmdInstanceId = jQuery(this).attr('postID'); var inst = wmdInstanceProcs.get(wmdInstanceId); jQuery(inst.ta).show(); } else { createInstance(this, params); } } jQuery.fn.unwmd = function(params) { var wmdInstanceId = $(this).attr('postID'); var inst = wmdInstanceProcs.get(wmdInstanceId); if (inst != null) { jQuery(inst.ta).hide(); } } wmdInstanceProcs = function() { var wmdInstances = { }; var getProc = function(wmdInstanceId) { var inst = wmdInstances[wmdInstanceId]; if (typeof(inst) != "undefined") { return inst; } else { return null; } }; var addProc = function(wmdInstanceId, wmdInstance) { wmdInstances[wmdInstanceId] = wmdInstance; }; return { add: addProc, get: getProc }; }(); Any help would be much appreciated.

    Read the article

  • run a function every x seconds in c++

    - by wyatt
    I'm trying to build a feed reader in C++, so I need the program to check for new feeds intermittently. However, the user needs still to be able to interact with the program, so the suggestion that I seem to keep finding, to have the system wait, doesn't work for me. Can anyone suggest a better solution, say a timer that runs in the background or something? Thanks, Charles

    Read the article

  • Execution time in nano seconds and related issues

    - by anup
    Hi All, I am using the following code to compute execution time in milli-secs. struct timespec tp; if (clock_gettime (CLOCK_REALTIME, &tp) == 0) return ((tp.tv_sec * 1000000000) + tp.tv_nsec); else return ; Can you please tell me whether this is correct? Let's name this function comptime_nano(). Now, I write the following code in main() to check execution times of following operations. unsigned long int a, b, s1, s3; a = (unsigned long int)(1) << 63; b = (unsigned long int)(1) << 63; btime = comptime_nano(); s1 = b >> 30; atime = comptime_nano(); printf ("Time =%ld for %lu\n", (atime - btime), s1); btime = comptime_nano(); s3 = a >> 1; atime = comptime_nano(); printf ("Time =%ld for %lu\n", (atime - btime), s3); To my surprise, the first operation takes about roughly 4 times more time than the second. Again, if I change the relative ordering of these operations, the respective timings change drastically. Please comment...

    Read the article

  • Display an image for a few seconds

    - by Wes
    I want to be able to display an image on the iPhone when the device is shaken. I can play a sound but also want to pop up an image at the same time. Any ideas on how to do this would be appreciated. thx, wes

    Read the article

  • Convert Unix Epoch Time to Seconds in SQL or .NET

    - by user293249
    First let me thank you all for your help. What I need is a function that takes in a EPOCH time stamp, like 1452.235687 and converts it to a readable timestamp like '01-01-1970 00:00:00'. More specifically I only need the time not the date. If at all possible I would prefer a .NET function instead of a SQL stored procedure. However an SQL stored procedure would work fine as well. Thank you again,

    Read the article

  • Converting jiffies to milli seconds

    - by EpsilonVector
    How do I manually convert jiffies to milliseconds and vice versa in Linux? I know kernel 2.6 has a function for this, but I'm working on 2.4 (homework) and though I looked at the code it uses lots of macro constants which I have no idea if they're defined in 2.4.

    Read the article

  • [r] Converting unix seconds in milliseconds to POSIXct/POSIXlt

    - by signalseeker
    Why do I see a difference when I convert a unix timestamp to datetime object in R? > as.POSIXlt(1268736919, origin="1970-01-01", tz="America/New_York") [1] "2010-03-16 06:55:19 EDT" > as.POSIXct(1268736919, origin="1970-01-01", tz="America/New_York") [1] "2010-03-16 11:55:19 EDT" The result from POSIXlt is actually correct. Also, is there a way to do this conversion without specifying the origin? Thanks

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >