Search Results

Search found 1511 results on 61 pages for 'brian d foy'.

Page 44/61 | < Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >

  • Updating UISearchDisplayController with Core Data results using GCD

    - by Brian Halpin
    I'm having trouble displaying the results from Core Data in my UISearchDisplayController when I implement GCD. Without it, it works, but obviously blocks the UI. In my SearchTableViewController I have the following two methods: - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString { // Tell the table data source to reload when text changes [self filterContentForSearchText:searchString]; // Return YES to cause the search result table view to be reloaded. return YES; } // Update the filtered array based on the search text -(void)filterContentForSearchText:(NSString*)searchText { // Remove all objects from the filtered search array [self.filteredLocationsArray removeAllObjects]; NSPredicate *predicate = [CoreDataMaster predicateForLocationUsingSearchText:@"Limerick"]; CoreDataMaster *coreDataMaster = [[CoreDataMaster alloc] init]; // Filter the array using NSPredicate self.filteredLocationsArray = [NSMutableArray arrayWithArray: [coreDataMaster fetchResultsFromCoreDataEntity:@"City" UsingPredicate:predicate]]; } You can probably guess that my problem is with returning the array from [coreDataMaster fetchResultsFromCoreDataEntity]. Below is the method: - (NSArray *)fetchResultsFromCoreDataEntity:(NSString *)entity UsingPredicate:(NSPredicate *)predicate { NSMutableArray *fetchedResults = [[NSMutableArray alloc] init]; dispatch_queue_t coreDataQueue = dispatch_queue_create("com.coredata.queue", DISPATCH_QUEUE_SERIAL); dispatch_async(coreDataQueue, ^{ NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entityDescription = [NSEntityDescription entityForName:entity inManagedObjectContext:self.managedObjectContext]; NSSortDescriptor *nameSort = [[NSSortDescriptor alloc] initWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObjects:nameSort, nil]; [fetchRequest setEntity:entityDescription]; [fetchRequest setSortDescriptors:sortDescriptors]; // Check if predicate is set if (predicate) { [fetchRequest setPredicate:predicate]; } NSError *error = nil; NSArray *fetchedManagedObjects = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error]; for (City *city in fetchedManagedObjects) { [fetchedResults addObject:city]; } NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[NSArray arrayWithArray:fetchedResults] forKey:@"results"]; [[NSNotificationCenter defaultCenter] postNotificationName:@"fetchResultsComplete" object:nil userInfo:userInfo]; }); return [NSArray arrayWithArray:fetchedResults]; } So the thread hasn't finished executing by the time it returns the results to self.filteredLocationsArray. I've tried added a NSNotification which passes the NSDictionary to this method: - (void)updateSearchResults:(NSNotification *)notification { NSDictionary *userInfo = notification.userInfo; NSArray *array = [userInfo objectForKey:@"results"]; self.filteredLocationsArray = [NSMutableArray arrayWithArray:array]; [self.tableView reloadData]; } I've also tried refreshing the searchViewController like [self.searchDisplayController.searchResultsTableView reloadData]; but to no avail. I'd really appreciate it if someone could point me in the right direction and show me where I might be going wrong. Thanks

    Read the article

  • Why do I get "mysql_query(): supplied argument is not a valid"

    - by Brian Ojeda
    Why do I get a "mysql_query(): supplied argument is not a valid" for the first... $r = mysql_query($q, $connection); In the following code... $bId = trim($_POST['bId']); $title = trim($_POST['title']); $story = trim($_POST['story']); $q = "SELECT * "; $q .= "FROM " . DB_NAME . ".`blog` "; $q .= "WHERE `blog`.`id` = {$bId}"; $r = mysql_query($q, $connection); //confirm_query($r); if (mysql_num_rows($r) == 1) { $q = "UPDATE " . DB_NAME . ".`blog` SET `title` = '{$title}', `story` = '{$story}' WHERE `id` = {$bId}"; $r = mysql_query($q, $connection); if (mysql_affected_rows() == 1) { //Successful $data['success'] = true; $date['errors'] = false; $date['message'] = "You are the Greatest!"; } else { //Fail $data['success'] = false; $data['error'] = true; $date['message'] = "You can't do it fool!"; } } I also get an "mysql_num_rows(): supplied argument is not a valid MySQL result resource" error too. Side notes: I am using 1&1 Hosting (worst hosting ever), custom .htaccess file with one line text to enable PHP 5.2 (only why with 1&1 Hosting).

    Read the article

  • How can I bind a javascript dialog using Knockout?

    - by Brian
    I've got a list of data in an observableArray and I want to show it in a javascript dialog window (I'm using jQuery.blockUI if it matters). Unfortunately the dialog seems to come unbound after the page is loaded. The dialog initializes correctly (the data is displayed), but it isn't updating with changes. There are no Javascript errors and I've moved the binding to after the dialog is generated and added to the document (no effect). I've also tried calling ko.applyBinding on the main div that makes up the dialog but that, for some reason, causes part of the main page to hide (the DOM is there, but they are hidden). EDIT: I've created a project on jsfiddle that reproduces the problem. The main culprit seems to be wrapping the content of the dialog in a div. If I show the content directly it seems to work (of course I can't do that, the wrappers provide a common style for our dialogs). I'm recovering from the flu and could easily be missing something obvious, but I've been trying all day and nothing is coming to me. Any ideas?

    Read the article

  • WebView and HTML5 <video>

    - by brian moore
    I'm piecing together a cheapo app that amongst other things "frames" some of our websites... Pretty simple with the WebViewClient... until I hit the video. The video is done as HTML5 elements, and these work fine and dandy on Chrome, iPhones, and now that we fixed the encoding issues it works great on Android... in the native browser. Now the rub: WebView doesn't like it. At all. I can click on the poster image, and nothing happens. Googling, I found http://www.codelark.com/2010/05/12/android-viewing-video-from-embedded-webview/ which is close, but seems to be based on a 'link' (as in a href...) instead of a video element. (onDownloadListener does not appear to get invoked on video elements...) I also see references to overriding onShowCustomView, but that seems to not get called on video elements... nor does shouldOverrideUrlLoading.. I would rather not get into "pull xml from the server, reformat it in the app".. by keeping the story layout on the server, I can control the content a bit better without forcing people to keep updating an app. So if I can convince WebView to handle tags like the native browser, that would be best. I'm clearly missing something obvious.. but I have no clue what.

    Read the article

  • Java Best Practice for type resolution at runtime.

    - by Brian
    I'm trying to define a class (or set of classes which implement the same interface) that will behave as a loosely typed object (like JavaScript). They can hold any sort of data and operations on them depend on the underlying type. I have it working in three different ways but none seem ideal. These test versions only allow strings and integers and the only operation is add. Adding integers results in the sum of the integer values, adding strings concatenates the strings and adding an integer to a string converts the integer to a string and concatenates it with the string. The final version will have more types (Doubles, Arrays, JavaScript-like objects where new properties can be added dynamically) and more operations. Way 1: public interface DynObject1 { @Override public String toString(); public DynObject1 add(DynObject1 d); public DynObject1 addTo(DynInteger1 d); public DynObject1 addTo(DynString1 d); } public class DynInteger1 implements DynObject1 { private int value; public DynInteger1(int v) { value = v; } @Override public String toString() { return Integer.toString(value); } public DynObject1 add(DynObject1 d) { return d.addTo(this); } public DynObject1 addTo(DynInteger1 d) { return new DynInteger1(d.value + value); } public DynObject1 addTo(DynString1 d) { return new DynString1(d.toString()+Integer.toString(value)); } } ...and similar for DynString1 Way 2: public interface DynObject2 { @Override public String toString(); public DynObject2 add(DynObject2 d); } public class DynInteger2 implements DynObject2 { private int value; public DynInteger2(int v) { value = v; } @Override public String toString() { return Integer.toString(value); } public DynObject2 add(DynObject2 d) { Class c = d.getClass(); if(c==DynInteger2.class) { return new DynInteger2(value + ((DynInteger2)d).value); } else { return new DynString2(toString() + d.toString()); } } } ...and similar for DynString2 Way 3: public class DynObject3 { private enum ObjectType { Integer, String }; Object value; ObjectType type; public DynObject3(Integer v) { value = v; type = ObjectType.Integer; } public DynObject3(String v) { value = v; type = ObjectType.String; } @Override public String toString() { return value.toString(); } public DynObject3 add(DynObject3 d) { if(type==ObjectType.Integer && d.type==ObjectType.Integer) { return new DynObject3(Integer.valueOf(((Integer)value).intValue()+((Integer)value).intValue())); } else { return new DynObject3(value.toString()+d.value.toString()); } } } With the if-else logic I could use value.getClass()==Integer.class instead of storing the type but with more types I'd change this to use a switch statement and Java doesn't allow switch to use Classes. Anyway... My question is what is the best way to go about something thike this?

    Read the article

  • Is closing/disposing an SqlDataReader needed if you are already closing the sqlconnection?

    - by Brian
    I noticed This question, but my question is a bit more specific. Is there any advantage to using using (SqlConnection conn = new SqlConnection(conStr)) { using (SqlCommand command = new SqlCommand()) { // dostuff } } instead of using (SqlConnection conn = new SqlConnection(conStr)) { SqlCommand command = new SqlCommand(); // dostuff } Obviously it does matter run more than one command with the same connection, since closing an SqlDataReader is more efficient than closing and reopening a connection (calling conn.Close();conn.Open(); will also free up the connection). I see many people insist that failure to close the DataReader means leaving open connection resources around, but doesn't that only apply if you don't close the connection?

    Read the article

  • Error using MVCContrib TestHelper

    - by Brian McCord
    While trying to implement the second answer to a previous question, I am receiving an error. I have implemented the methods just as the post shows, and the first three work properly. The fourth one (HomeController_Delete_Action_Handler_Should_Redirect_If_Model_Successfully_Delete) gives this error: Could not find a parameter named 'controller' in the result's Values collection. If I change the code to: actual .AssertActionRedirect() .ToAction("Index"); it works properly, but I don't like the "magic string" in there and prefer to use the lambda method that the other poster used. My controller method looks like this: [HttpPost] public ActionResult Delete(State model) { try { if( model == null ) { return View( model ); } _stateService.Delete( model ); return RedirectToAction("Index"); } catch { return View( model ); } } What am I doing wrong?

    Read the article

  • Twitter @anywhere API problems in firefox only

    - by Brian Scott
    I've implemented a simple example of the Twitter @anywhere api to display user hovercards. The example works great in Internet Explorer and Chrome. However, whenever I the page loads in Firefox I receive the following message in an alert window: To set up @anywhere, please provide a client ID Surely if the results are correct in Chrome and IE then everything must be setup correctly? Here is a simple code block which I've tested recreates the problem in Firefox only: <script src="http://platform.twitter.com/anywhere.js?id=WMg5kRMlIw807lRTsktnNQ&amp;v=1" type="text/javascript" > </script> <script type="text/javascript"> twttr.anywhere(onAnywhereLoad); function onAnywhereLoad(twitter) { twitter().hovercards(); }); </script>

    Read the article

  • How to format a string as a telephone number in C#

    - by Brian G
    I have a string "1112224444' it is a telephone number. I want to format as 111-222-4444 before I store it in a file. It is on a datarecord and I would prefer to be able to do this without assigning a new variable. I was thinking: String.Format("{0:###-###-####}", i["MyPhone"].ToString() ); but that does not seem to do the trick. ** UPDATE ** Ok. I went with this solution Convert.ToInt64(i["Customer Phone"]).ToString("###-###-#### ####") Now its gets messed up when the extension is less than 4 digits. It will fill in the numbers from the right. so 1112224444 333 becomes 11-221-244 3334 Any ideas?

    Read the article

  • navigate all items in a wpf tree view

    - by Brian Leahy
    I want to be able to traverse the visual ui tree looking for an element with an ID bound to the visual element's Tag property. I'm wondering how i do this. Controls don't have children to traverse. I started using LogicalTreeHelper.GetChildren, which seems to work as intended, up until i hit a TreeView control... then LogicalTreeHelper.GetChildren doesnt return any children. Note: the purpose is to find the visual UI element that corresponds to the data item. That is, given an ID of the item, Go find the UI element displaying it. Edit: I am apparently am not explaining this well enough. I am binding some data objects to a TreeView control and then wanting to select a specific item programaticly given that business object's ID. I dont see why it's so hard to travers the visual tree and find the element i want, as the data object's ID is in the Tag property of the appropriate visual element. I'm using Mole and I am able to find the UI element with the appropriate ID in it's Tag. I just cannot find the visual element in code. LogicalTreeHelper does not traverse any items in the tree. Neither does ItemContainerGenerator.ContainerFromItem retrieve anything for items in the tree view.

    Read the article

  • Why is passing a string literal into a char* arguament only sometimes a compiler error?

    - by Brian Postow
    I'm working in a C, and C++ program. We used to be compiling without the make-strings-writable option. But that was getting a bunch of warnings, so I turned it off. Then I got a whole bunch of errors of the form "Cannot convert const char* to char* in argmuent 3 of function foo". So, I went through and made a whole lot of changes to fix those. However, today, the program CRASHED because the literal "" was getting passed into a function that was expecting a char*, and was setting the 0th character to 0. It wasn't doing anything bad, just trying to edit a constant, and crashing. My question is, why wasn't that a compiler error? In case it matters, this was on a mac compiled with gcc-4.0.

    Read the article

  • TFS no release folder in build folder

    - by brian b
    I have a tfs build that works fine on the client, but when executed on the server, no actual binaries get created. When I go to the folder: \[MyServer]\builds[BuildName], I see BuildLog.txt ErrorsWarningsLog.txt Release.txt I expect to see a big \Release folder full of my dlls, but I get nothing. The error log reports no problems up until we ask the build to copy the binaries to our staging server. If I comment those out, I get no errors. CustomizableOutDir is true, DropLocation is set to something sensible BuildDirectoryPath is set to something sensible But no matter what, I just don't get any dlls built. Our local TFS guy is baffled too. Any suggestions?

    Read the article

  • Low-level Keyboard Hooks/SendInput with Winkey+L possible? (workstation lockout is intercepted in Vi

    - by Brian Jorgensen
    I work on a project called UAWKS (Unofficial Apple Wireless Keyboard Support) that helps Windows users use Apple's bluetooth keyboard. One of the main goals of UAWKS is to swap the Cmd key (which behaves as Winkey in Windows) with Ctrl, allowing users to do Cmd+C for copy, Cmd+T for new tab, etc. It is currently developed using AutoHotkey, which worked pretty well under Windows XP. However, on Vista and Windows 7, Cmd+L causes problems: Regardless of low-level keyboard hooks, Winkey+L is always intercepted by Windows and normally locks the workstation... You can disable workstation locking with this registry hack, but pressing Winkey+L still can't be rebound in AHK Pressing Winkey+L leaves Winkey in the Keydown state until the next (additional) Winkey Up. Simulating a Keyup event doesn't seem to work either! It seems that Winkey+L is a special chord that messes everything else up. I've looked through the AHK source code, and they try to address this problem in SendKey() in keyboard_mouse.cpp (near line 883 in v1.0.48.05), but it doesn't work. I wrote up my own low-level keyboard hook application in C#, and I see the same problem. Has anyone else run into this? Is there a workaround?

    Read the article

  • PHP String Encoding Error

    - by Brian
    I'm trying to get the following code to output an IMG tag with the URL for Google Static Maps API http://code.google.com/apis/maps/documentation/staticmaps/#Imagesizes embedded in there... the result is that everything except the $address is being output successfully... what am I doing wrong? function event_map_img($echo = true){ global $post; $address = get_post_meta($post->ID, 'date_address', true); if($echo): echo '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />'; else: return '<img src="'.'http://maps.google.com/maps/api/staticmap?center='.$address.'&zoom=14&size=700x512&maptype=roadmap&markers=color:blue|label:X|'.$address.'&sensor=false" />'; endif; }

    Read the article

  • PHP post request to retrieve JSON

    - by Brian
    I'm trying to write some simple php code that will make a post request and then retrieve a JSON result from the server. It seemed simple to me, but the below code simply doesn't open a connection. $port = 2057; $path = "/validate/"; $request = "value1=somevalue&value2=somevalue&value3=somevalue"; $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $server\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($request) . "\r\n"; $http_request .= "\r\n"; $http_request .= $request; $response = ''; if( false == ( $fs = @fsockopen($server, $port) ) ) { die ('Could not open socket'); } fwrite($fs, $http_request); while ( !feof($fs) ) { $response .= fgets($fs, 1160); } fclose($fs); In addition I've tried a more simple approach with: $handle = fopen('http://localhost:2057/validate/?'.$request, "r"); or $response = file_get_contents('http://localhost:2057/validate/' . $request); but both of these approaches just time out. I'm trying to connect to a development server I'm running in Visual Studio, so I'm not sure if that has anything to do with the timeout/connection issues. Open to any suggestions here as long as they are built in PHP.

    Read the article

  • FluentNHibernate: mapping a Version property

    - by Brian
    How do I map a Version property using conventions (e.g. IClassConvention, AutomapperConfiguration)? public abstract class Entity { ... public virtual int? Version { get; protected set; } ... } <class ...> <version name="Version" column="version" generated="never" type="Int32" unsaved-value="0" /> </class>

    Read the article

  • Parallel Tasking Concurrency with Dependencies on Python like GNU Make

    - by Brian Bruggeman
    I'm looking for a method or possibly a philosophical approach for how to do something like GNU Make within python. Currently, we utilize makefiles to execute processing because the makefiles are extremely good at parallel runs with changing single option: -j x. In addition, gnu make already has the dependency stacks built into it, so adding a secondary processor or the ability to process more threads just means updating that single option. I want that same power and flexibility in python, but I don't see it. As an example: all: dependency_a dependency_b dependency_c dependency_a: dependency_d stuff dependency_b: dependency_d stuff dependency_c: dependency_e stuff dependency_d: dependency_f stuff dependency_e: stuff dependency_f: stuff If we do a standard single thread operation (-j 1), the order of operation might be: dependency_f -> dependency_d -> dependency_a -> dependency_b -> dependency_e \ -> dependency_c For two threads (-j 2), we might see: 1: dependency_f -> dependency_d -> dependency_a -> dependency_b 2: dependency_e -> dependency_c Does anyone have any suggestions on either a package already built or an approach? I'm totally open, provided it's a pythonic solution/approach. Please and Thanks in advance!

    Read the article

  • Difference of two series in MySQL

    - by Brian
    I have a table with the following fields in MySQL: date, Value, Type. Type can be either exports or imports. I want a query that returns the trade deficit (exports-imports) for each month. Is this possible with a single query?

    Read the article

  • PHP: How can I eliminate quotes around output from CSV file?

    - by brian johnson
    This code: <?php $curl=curl_init(); curl_setopt ($curl,CURLOPT_URL,"http://download.finance.yahoo.com/d/quotes.csv?s=XIN&f=l1c1p2rj1y&e=.csv"); curl_setopt ($curl,CURLOPT_HEADER,0); ob_start(); curl_exec ($curl); curl_close ($curl); $data=ob_get_clean(); $data = explode(",",$data); foreach ($data as $results) echo "<td>$results</td>"; ?> yields these results in my browser: 2.80 +0.02 "+0.72%" 1.85 204.2M 1.44 How can I have this PHP code above eliminate the quotations around the "+0.72%" so the end result is just: 0.72% ?

    Read the article

  • How do I make this nested for loop, testing sums of cubes, more efficient?

    - by Brian J. Fink
    I'm trying to iterate through all the combinations of pairs of positive long integers in Java and testing the sum of their cubes to discover if it's a Fibonacci number. I'm currently doing this by using the value of the outer loop variable as the inner loop's upper limit, with the effect being that the outer loop runs a little slower each time. Initially it appeared to run very quickly--I was up to 10 digits within minutes. But now after 2 full days of continuous execution, I'm only somewhere in the middle range of 15 digits. At this rate it may end up taking a whole year just to finish running this program. The code for the program is below: import java.lang.*; import java.math.*; public class FindFib { public static void main(String args[]) { long uLimit=9223372036854775807L; //long maximum value BigDecimal PHI=new BigDecimal(1D+Math.sqrt(5D)/2D); //Golden Ratio for(long a=1;a<=uLimit;a++) //Outer Loop, 1 to maximum for(long b=1;b<=a;b++) //Inner Loop, 1 to current outer { //Cube the numbers and add BigDecimal c=BigDecimal.valueOf(a).pow(3).add(BigDecimal.valueOf(b).pow(3)); System.out.print(c+" "); //Output result //Upper and lower limits of interval for Mobius test: [c*PHI-1/c,c*PHI+1/c] BigDecimal d=c.multiply(PHI).subtract(BigDecimal.ONE.divide(c,BigDecimal.ROUND_HALF_UP)), e=c.multiply(PHI).add(BigDecimal.ONE.divide(c,BigDecimal.ROUND_HALF_UP)); //Mobius test: if integer in interval (floor values unequal) Fibonacci number! if (d.toBigInteger().compareTo(e.toBigInteger())!=0) System.out.println(); //Line feed else System.out.print("\r"); //Carriage return instead } //Display final message System.out.println("\rDone. "); } } Now the use of BigDecimal and BigInteger was delibrate; I need them to get the necessary precision. Is there anything other than my variable types that I could change to gain better efficiency?

    Read the article

  • What exactly can "Full Control" with SharePoint Designer accomplish?

    - by Brian L.
    I've been brought in as an intern to develop a SharePoint site. My team won't authorize the budget for Visual Studio and I don't have physical or remote access to the SharePoint server (running Windows SharePoint Services 3.0 a.k.a. WSS) on the back-end. So what exactly can I do? I'm a pretty decent programmer when it comes to web technologies like PHP, JS and the obvious HTML and CSS. In an environment like this locked-down SharePoint though, I'm stumped trying to figure out how much control I have with MS's definition of "Full Control". If I figured out a way to write some C#, I'm pretty sure I could handle my own, but as I said no Visual Studio for me. Any good ideas of features that people will use on a site built with the limited functionality of WSS and SharePoint Designer with "Full Control"? Can I somehow manipulate the default Web Parts into something cool or useful? Are there Ajax tricks I can do to accomplish something on the back-end? Thanks in advance, I'm new to StackOverflow and very anxious to get involved here!

    Read the article

  • What is the best method for implementing mouse wheel activity in Delph1 VCL forms?

    - by Brian Frost
    As a long time user of Delphi 7, I've rolled my own mouse wheel handling in a few controls but lately I've noticed that some recent applications only need the mouse cursor to be placed over a control (e.g a list box or tree view) for the mouse wheel activity to cause that control to scroll. This feels nice (as opposed to having to click focus a control before it responds to the wheel. Now I've moved to Delphi 2010 I'm wondering what is the 'correct' behaviour? And what can I use in Delphi that avoids me having to bodge this with my own solutions now? Thanks.

    Read the article

< Previous Page | 40 41 42 43 44 45 46 47 48 49 50 51  | Next Page >