Search Results

Search found 3459 results on 139 pages for 'if modified since'.

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

  • Syncing with Address Book: Last modified property in ABPerson/ABRecord

    - by Oliver
    I'm syncing data from the Address Book into a Core Data database and I've nearly got it working perfectly. The only issue remaining is checking for changes and modifications on startup and reflecting the changes inside Core Data. Currently, I simply check the ID of each ABRecord and see if it is already in Core Data. Of course, this only works in the case of new contacts and not changed information inside an existing contact. One solution would be to go through each contact already in the database and check each property against the Address Book. The down side of this is that it's really slow. One method that would work is if the ABRecord had a last modified date. I could then store the date inside the Core Data database and check on startup to see if I need to update the contact. However, I can't find anything like this in the documentation. Any ideas?

    Read the article

  • Hashing a python method to regenerate output when method is modified

    - by Seth Johnson
    I have a python method that has a deterministic result. It takes a long time to run and generates a large output: def time_consuming_method(): # lots_of_computing_time to come up with the_result return the_result I modify time_consuming_method from time to time, but I would like to avoid having it run again while it's unchanged. [Time_consuming_method only depends on functions that are immutable for the purposes considered here; i.e. it might have functions from Python libraries but not from other pieces of my code that I'd change.] The solution that suggests itself to me is to cache the output and also cache some "hash" of the function. If the hash changes, the function will have been modified, and we have to re-generate the output. Is this possible or a ridiculous idea? If this isn't a terrible idea, is the best implementation to write f = """ def ridiculous_method(): a = # # lots_of_computing_time return a """ , use the hashlib module to compute a hash for f, and use compile or eval to run it as code?

    Read the article

  • Hashing a python function to regenerate output when the function is modified

    - by Seth Johnson
    I have a python function that has a deterministic result. It takes a long time to run and generates a large output: def time_consuming_function(): # lots_of_computing_time to come up with the_result return the_result I modify time_consuming_function from time to time, but I would like to avoid having it run again while it's unchanged. [time_consuming_function only depends on functions that are immutable for the purposes considered here; i.e. it might have functions from Python libraries but not from other pieces of my code that I'd change.] The solution that suggests itself to me is to cache the output and also cache some "hash" of the function. If the hash changes, the function will have been modified, and we have to re-generate the output. Is this possible or ridiculous? Updated: based on the answers, it looks like what I want to do is to "memoize" time_consuming_function, except instead of (or in addition to) arguments passed into an invariant function, I want to account for a function that itself will change.

    Read the article

  • Collection was modified; enumeration operation may not execute

    - by Rita
    I have the below code. I am trying to remove the record and it is throwing Exception when it is removing the Record. "Collection was modified; enumeration operation may not execute." Any ideas on how to get rid of the message. Appreciate your time. //validClaimControlNo has valid ClaimControl Numbers. List<string> validClaimControlNo = new List<string>(); int count = 0; foreach (List<Field> f in records) { foreach (Field fe in f) { if (i == 0) if (!(validClaimControlNo.Contains(fe.Value))) { //if this claim is not in the Valid list, Remove that Record records.RemoveAt(count); } i++; } i = 0; count++; }

    Read the article

  • Git on live Windows Server - Trying to pull from the repo but local files already modified

    - by Chris
    I have my Git repository hosted at github.com. I would like to push updates and such to github.com and then log into my Windows server and do a git pull to get my changes (that are verified to work on my local machine. Ideally I should have another server setup as my local machine settings are different from the live server. But I'm cheap.). It seems like whenever I try to do a git pull on the server, the files seem to get modified somehow since the last pull. And so I am unable to get the update as git says I need to commit my local (Windows server) changes. How can I use git like I want to? Or is there a better way?

    Read the article

  • How to retrieve jQuery modified innerHTML from C#

    - by Buzzedword
    Hey guys. I'm trying to access the innerHTML of a span tag modified by jQuery using C#. This is my first project shunning the AJAX libs in favor of jQuery, so I'm not sure how I can get the codebehind to recognize the manipulated innerHTML. I've set all the spans I want to tap into with runat="server", but all I pull are the values I've set when the page was designed. What steps should I be taking to enable communication between the client-side and my codebehind, and am I even using the best practice here?

    Read the article

  • Modified jQuery innerfade sluggish

    - by Jay Hankins
    HI. I am using the jQuery innerfade plugin to scroll through some images on my site. Innerfade is sluggish to move on Firefox 3.6.3, and IE 8. IE 8 is much worse than Firefox, and Chrome runs smoothly. Can you analyze my code to see what the problem is? I've used the modified innerfade from here: http://www.stylephp.com/2009/01/17/customizing-jquery-innerfade-plug-in-adding-controls-navigation-and-caption/ My sites are here: Without bg image: http://dl.dropbox.com/u/145908/doozie2/index.html With bg image: http://dl.dropbox.com/u/145908/doozie2/index2.html Removing my background image fixes the situation; it's not that big of a file. I don't understand why that is an issue. I am using a technique to resize the image to fit the browser window, as you can see in the CSS. Thanks so much. P.S. Sorry, I'm a new user so I can't post more than one link. Please copy and paste the address between <.

    Read the article

  • WCF Callback Contract InvalidOperationException: Collection has been modified

    - by mrlane
    We are using a WCF service with a Callback contract. Communication is Asynchronous. The service contract is defined as: [ServiceContract(Namespace = "Silverlight", CallbackContract = typeof(ISessionClient),SessionMode = SessionMode.Allowed)] public interface ISessionService With a method: [OperationContract(IsOneWay = true)] void Send(Message message); The callback contract is defined as [ServiceContract] public interface ISessionClient With methods: [OperationContract(IsOneWay = true, AsyncPattern = true)] IAsyncResult BeginSend(Message message, AsyncCallback callback, object state); void EndSend(IAsyncResult result); The implementation of BeginSend and EndSend in the callback channel are as follows: public void Send(ActionMessage actionMessage) { Message message = Message.CreateMessage(_messageVersion, CommsSettings.SOAPActionReceive, actionMessage, _messageSerializer); lock (LO_backChannel) { try { _backChannel.BeginSend(message, OnSendComplete, null); } catch (Exception ex) { _hasFaulted = true; } } } private void OnSendComplete(IAsyncResult asyncResult) { lock (LO_backChannel) { try { _backChannel.EndSend(asyncResult); } catch (Exception ex) { _hasFaulted = true; } } } We are getting an InvalidOperationException: "Collection has been modified" on _backChannel.EndSend(asyncResult) seemingly randomly, and we are really out of ideas about what is causing this. I understand what the exception means, and that concurrency issues are a common cause of such exceptions (hence the locks), but it really doesn't make any sense to me in this situation. The clients of our service are Silverlight 3.0 clients using PollingDuplexHttpBinding which is the only binding available for Silverlight. We have been running fine for ages, but recently have been doing a lot of data binding, and this is when the issues started. Any help with this is appreciated as I am personally stumped at this time.

    Read the article

  • Modify code to change timestamp timezone in sitemap

    - by Aahan Krish
    Below is the code from a plugin I use for sitemaps. I would like to know if there's a way to "enforce" a different timezone on all date variable and functions in it. If not, how do I modify the code to change the timestamp to reflect a different timezone? Say for example, to America/New_York timezone. Please look for date to quickly get to the appropriate code blocks. Code on Pastebin. <?php /** * @package XML_Sitemaps */ class WPSEO_Sitemaps { ..... /** * Build the root sitemap -- example.com/sitemap_index.xml -- which lists sub-sitemaps * for other content types. * * @todo lastmod for sitemaps? */ function build_root_map() { global $wpdb; $options = get_wpseo_options(); $this->sitemap = '<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n"; $base = $GLOBALS['wp_rewrite']->using_index_permalinks() ? 'index.php/' : ''; // reference post type specific sitemaps foreach ( get_post_types( array( 'public' => true ) ) as $post_type ) { if ( $post_type == 'attachment' ) continue; if ( isset( $options['post_types-' . $post_type . '-not_in_sitemap'] ) && $options['post_types-' . $post_type . '-not_in_sitemap'] ) continue; $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM $wpdb->posts WHERE post_type = %s AND post_status = 'publish' LIMIT 1", $post_type ) ); // don't include post types with no posts if ( !$count ) continue; $n = ( $count > 1000 ) ? (int) ceil( $count / 1000 ) : 1; for ( $i = 0; $i < $n; $i++ ) { $count = ( $n > 1 ) ? $i + 1 : ''; if ( empty( $count ) || $count == $n ) { $date = $this->get_last_modified( $post_type ); } else { $date = $wpdb->get_var( $wpdb->prepare( "SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = %s ORDER BY post_modified_gmt ASC LIMIT 1 OFFSET %d", $post_type, $i * 1000 + 999 ) ); $date = date( 'c', strtotime( $date ) ); } $this->sitemap .= '<sitemap>' . "\n"; $this->sitemap .= '<loc>' . home_url( $base . $post_type . '-sitemap' . $count . '.xml' ) . '</loc>' . "\n"; $this->sitemap .= '<lastmod>' . htmlspecialchars( $date ) . '</lastmod>' . "\n"; $this->sitemap .= '</sitemap>' . "\n"; } } // reference taxonomy specific sitemaps foreach ( get_taxonomies( array( 'public' => true ) ) as $tax ) { if ( in_array( $tax, array( 'link_category', 'nav_menu', 'post_format' ) ) ) continue; if ( isset( $options['taxonomies-' . $tax . '-not_in_sitemap'] ) && $options['taxonomies-' . $tax . '-not_in_sitemap'] ) continue; // don't include taxonomies with no terms if ( !$wpdb->get_var( $wpdb->prepare( "SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = %s AND count != 0 LIMIT 1", $tax ) ) ) continue; // Retrieve the post_types that are registered to this taxonomy and then retrieve last modified date for all of those combined. $taxobj = get_taxonomy( $tax ); $date = $this->get_last_modified( $taxobj->object_type ); $this->sitemap .= '<sitemap>' . "\n"; $this->sitemap .= '<loc>' . home_url( $base . $tax . '-sitemap.xml' ) . '</loc>' . "\n"; $this->sitemap .= '<lastmod>' . htmlspecialchars( $date ) . '</lastmod>' . "\n"; $this->sitemap .= '</sitemap>' . "\n"; } // allow other plugins to add their sitemaps to the index $this->sitemap .= apply_filters( 'wpseo_sitemap_index', '' ); $this->sitemap .= '</sitemapindex>'; } /** * Build a sub-sitemap for a specific post type -- example.com/post_type-sitemap.xml * * @param string $post_type Registered post type's slug */ function build_post_type_map( $post_type ) { $options = get_wpseo_options(); ............ // We grab post_date, post_name, post_author and post_status too so we can throw these objects into get_permalink, which saves a get_post call for each permalink. while ( $total > $offset ) { $join_filter = apply_filters( 'wpseo_posts_join', '', $post_type ); $where_filter = apply_filters( 'wpseo_posts_where', '', $post_type ); // Optimized query per this thread: http://wordpress.org/support/topic/plugin-wordpress-seo-by-yoast-performance-suggestion // Also see http://explainextended.com/2009/10/23/mysql-order-by-limit-performance-late-row-lookups/ $posts = $wpdb->get_results( "SELECT l.ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt FROM ( SELECT ID FROM $wpdb->posts {$join_filter} WHERE post_status = 'publish' AND post_password = '' AND post_type = '$post_type' {$where_filter} ORDER BY post_modified ASC LIMIT $steps OFFSET $offset ) o JOIN $wpdb->posts l ON l.ID = o.ID ORDER BY l.ID" ); /* $posts = $wpdb->get_results("SELECT ID, post_content, post_name, post_author, post_parent, post_modified_gmt, post_date, post_date_gmt FROM $wpdb->posts {$join_filter} WHERE post_status = 'publish' AND post_password = '' AND post_type = '$post_type' {$where_filter} ORDER BY post_modified ASC LIMIT $steps OFFSET $offset"); */ $offset = $offset + $steps; foreach ( $posts as $p ) { $p->post_type = $post_type; $p->post_status = 'publish'; $p->filter = 'sample'; if ( wpseo_get_value( 'meta-robots-noindex', $p->ID ) && wpseo_get_value( 'sitemap-include', $p->ID ) != 'always' ) continue; if ( wpseo_get_value( 'sitemap-include', $p->ID ) == 'never' ) continue; if ( wpseo_get_value( 'redirect', $p->ID ) && strlen( wpseo_get_value( 'redirect', $p->ID ) ) > 0 ) continue; $url = array(); $url['mod'] = ( isset( $p->post_modified_gmt ) && $p->post_modified_gmt != '0000-00-00 00:00:00' ) ? $p->post_modified_gmt : $p->post_date_gmt; $url['chf'] = 'weekly'; $url['loc'] = get_permalink( $p ); ............. } /** * Build a sub-sitemap for a specific taxonomy -- example.com/tax-sitemap.xml * * @param string $taxonomy Registered taxonomy's slug */ function build_tax_map( $taxonomy ) { $options = get_wpseo_options(); .......... // Grab last modified date $sql = "SELECT MAX(p.post_date) AS lastmod FROM $wpdb->posts AS p INNER JOIN $wpdb->term_relationships AS term_rel ON term_rel.object_id = p.ID INNER JOIN $wpdb->term_taxonomy AS term_tax ON term_tax.term_taxonomy_id = term_rel.term_taxonomy_id AND term_tax.taxonomy = '$c->taxonomy' AND term_tax.term_id = $c->term_id WHERE p.post_status = 'publish' AND p.post_password = ''"; $url['mod'] = $wpdb->get_var( $sql ); $url['chf'] = 'weekly'; $output .= $this->sitemap_url( $url ); } } /** * Build the <url> tag for a given URL. * * @param array $url Array of parts that make up this entry * @return string */ function sitemap_url( $url ) { if ( isset( $url['mod'] ) ) $date = mysql2date( "Y-m-d\TH:i:s+00:00", $url['mod'] ); else $date = date( 'c' ); $output = "\t<url>\n"; $output .= "\t\t<loc>" . $url['loc'] . "</loc>\n"; $output .= "\t\t<lastmod>" . $date . "</lastmod>\n"; $output .= "\t\t<changefreq>" . $url['chf'] . "</changefreq>\n"; $output .= "\t\t<priority>" . str_replace( ',', '.', $url['pri'] ) . "</priority>\n"; if ( isset( $url['images'] ) && count( $url['images'] ) > 0 ) { foreach ( $url['images'] as $img ) { $output .= "\t\t<image:image>\n"; $output .= "\t\t\t<image:loc>" . esc_html( $img['src'] ) . "</image:loc>\n"; if ( isset( $img['title'] ) ) $output .= "\t\t\t<image:title>" . _wp_specialchars( html_entity_decode( $img['title'], ENT_QUOTES, get_bloginfo('charset') ) ) . "</image:title>\n"; if ( isset( $img['alt'] ) ) $output .= "\t\t\t<image:caption>" . _wp_specialchars( html_entity_decode( $img['alt'], ENT_QUOTES, get_bloginfo('charset') ) ) . "</image:caption>\n"; $output .= "\t\t</image:image>\n"; } } $output .= "\t</url>\n"; return $output; } /** * Get the modification date for the last modified post in the post type: * * @param array $post_types Post types to get the last modification date for * @return string */ function get_last_modified( $post_types ) { global $wpdb; if ( !is_array( $post_types ) ) $post_types = array( $post_types ); $result = 0; foreach ( $post_types as $post_type ) { $key = 'lastpostmodified:gmt:' . $post_type; $date = wp_cache_get( $key, 'timeinfo' ); if ( !$date ) { $date = $wpdb->get_var( $wpdb->prepare( "SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type = %s ORDER BY post_modified_gmt DESC LIMIT 1", $post_type ) ); if ( $date ) wp_cache_set( $key, $date, 'timeinfo' ); } if ( strtotime( $date ) > $result ) $result = strtotime( $date ); } // Transform to W3C Date format. $result = date( 'c', $result ); return $result; } } global $wpseo_sitemaps; $wpseo_sitemaps = new WPSEO_Sitemaps();

    Read the article

  • Help:Graph contest problem: maybe a modified Dijkstra or another alternative algorithm

    - by newba
    Hi you all, I'm trying to do this contest exercise about graphs: XPTO is an intrepid adventurer (a little too temerarious for his own good) who boasts about exploring every corner of the universe, no matter how inhospitable. In fact, he doesn't visit the planets where people can easily live in, he prefers those where only a madman would go with a very good reason (several millions of credits for instance). His latest exploit is trying to survive in Proxima III. The problem is that Proxima III suffers from storms of highly corrosive acids that destroy everything, including spacesuits that were especially designed to withstand corrosion. Our intrepid explorer was caught in a rectangular area in the middle of one of these storms. Fortunately, he has an instrument that is capable of measuring the exact concentration of acid on each sector and how much damage it does to his spacesuit. Now, he only needs to find out if he can escape the storm. Problem The problem consists of finding an escape route that will allow XPTOto escape the noxious storm. You are given the initial energy of the spacesuit, the size of the rectangular area and the damage that the spacesuit will suffer while standing in each sector. Your task is to find the exit sector, the number of steps necessary to reach it and the amount of energy his suit will have when he leaves the rectangular area. The escape route chosen should be the safest one (i.e., the one where his spacesuit will be the least damaged). Notice that Rodericus will perish if the energy of his suit reaches zero. In case there are more than one possible solutions, choose the one that uses the least number of steps. If there are at least two sectors with the same number of steps (X1, Y1) and (X2, Y2) then choose the first if X1 < X2 or if X1 = X2 and Y1 < Y2. Constraints 0 < E = 30000 the suit's starting energy 0 = W = 500 the rectangle's width 0 = H = 500 rectangle's height 0 < X < W the starting X position 0 < Y < H the starting Y position 0 = D = 10000 the damage sustained in each sector Input The first number given is the number of test cases. Each case will consist of a line with the integers E, X and Y. The following line will have the integers W and H. The following lines will hold the matrix containing the damage D the spacesuit will suffer whilst in the corresponding sector. Notice that, as is often the case for computer geeks, (1,1) corresponds to the upper left corner. Output If there is a solution, the output will be the remaining energy, the exit sector's X and Y coordinates and the number of steps of the route that will lead Rodericus to safety. In case there is no solution, the phrase Goodbye cruel world! will be written. Sample Input 3 40 3 3 7 8 12 11 12 11 3 12 12 12 11 11 12 2 1 13 11 11 12 2 13 2 14 10 11 13 3 2 1 12 10 11 13 13 11 12 13 12 12 11 13 11 13 12 13 12 12 11 11 11 11 13 13 10 10 13 11 12 8 3 4 7 6 4 3 3 2 2 3 2 2 5 2 2 2 3 3 2 1 2 2 3 2 2 4 3 3 2 2 4 1 3 1 4 3 2 3 1 2 2 3 3 0 3 4 10 3 4 7 6 3 3 1 2 2 1 0 2 2 2 4 2 2 5 2 2 1 3 0 2 2 2 2 1 3 3 4 2 3 4 4 3 1 1 3 1 2 2 4 2 2 1 Sample Output 12 5 1 8 Goodbye cruel world! 5 1 4 2 Basically, I think we have to do a modified Dijkstra, in which the distance between nodes is the suit's energy (and we have to subtract it instead of suming up like is normal with distances) and the steps are the ....steps made along the path. The pos with the bester binomial (Energy,num_Steps) is our "way out". Important : XPTO obviously can't move in diagonals, so we have to cut out this cases. I have many ideas, but I have such a problem implementing them... Could someone please help me thinking about this with some code or, at least, ideas? Am I totally wrong?

    Read the article

  • IE7 relative/absolute positioning bug with dynamically modified page content

    - by Matthias Hryniszak
    Hi, I was wondering if there's anyone having an idea how to tackle with the following problem in IE7: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>IE7 absolute positioning bug</title> <style type="text/css"> #panel { position: relative; border: solid 1px black; } #spacer { height: 100px; } #footer { position: absolute; bottom: 0px; } </style> <script type="text/javascript"> function toggle() { var spacer = document.getElementById("spacer"); var style = "block"; if (spacer.style.display == "block" || spacer.style.display == "") { style = "none"; } spacer.style.display = style; } </script> </head> <body> <div id="panel"> <button onclick="toggle();">Click me</button> <br /><br /><br /> <div id="spacer"></div> <div id="footer">This is some footer</div> </div> </body> </html> When you run this in IE7 you'll see that the "footer" element stays after modifying the CSS for "panel". The same example tested in IE8, FF and Chrome behaves exactly as expected. I've already tried updating the element's class but this does not work if the browser's window has been opened maximized and no further size changes were made to the window (which is about 90% of the use cases we have for our product.... :( ) I'm stuck with a CSS-based solution however I think that I can make an exception in this case if it can easily be made IE7-specific (which means that other browsers will behave in a standard way with this). Please help!

    Read the article

  • Squid proxy not serving modified html content

    - by Matthew
    I'm trying to use squid to modify the page content of web page requests. I followed the upside-down-ternet tutorial which showed instructions for how to flip images on pages. I need to change the actual html of the page. I've been trying to do the same thing as in the tutorial, but instead of editing the image I'm trying to edit the html page. Below is a php script I'm using to try to do it. All jpg images get flipped, but the content on the page does not get edited. The edited index.html files written contain the edited content, but the pages the users receive don't contain the edited content. #!/usr/bin/php <?php $temp = array(); while ( $input = fgets(STDIN) ) { $micro_time = microtime(); // Split the output (space delimited) from squid into an array. $temp = split(' ', $input); //Flip jpg images, this works correctly if (preg_match("/.*\.jpg/i", $temp[0])) { system("/usr/bin/wget -q -O /var/www/cache/$micro_time.jpg ". $temp[0]); system("/usr/bin/mogrify -flip /var/www/cache/$micro_time.jpg"); echo "http://127.0.0.1/cache/$micro_time.jpg\n"; } //Don't edit files that are obviously not html. $temp[0] contains url of file to get elseif (preg_match("/(jpg|png|gif|css|js|\(|\))/i", $temp[0], $matches)) { echo $input; } //Otherwise, could be html (e.g. `wget http://www.google.com` downloads index.html) else{ $time = time() . microtime(); //For unique directory names $time = preg_replace("/ /", "", $time); //Simplify things by removing the spaces mkdir("/var/www/cache/". $time); //Create unique folder system("/usr/bin/wget -q --directory-prefix=\"/var/www/cache/$time/\" ". $temp[0]); $filename = system("ls /var/www/cache/$time/"); //Get filename of downloaded file //File is html, edit the content (this does not work) if(preg_match("/.*\.html/", $filename)){ //Get the html file contents $contentfh = fopen("/var/www/cache/$time/". $filename, 'r'); $content = fread($contentfh, filesize("/var/www/cache/$time/". $filename)); fclose($contentfh); //Edit the html file contents $content = preg_replace("/<\/body>/i", "<!-- content served by proxy --></body>", $content); //Write the edited file $contentfh = fopen("/var/www/cache/$time/". $filename, 'w'); fwrite($contentfh, $content); fclose($contentfh); //Return the edited page echo "http://127.0.0.1/cache/$time/$filename\n"; } //Otherwise file is not html, don't edit else{ echo $input; } } } ?>

    Read the article

  • Ethics and Law of modified LGPL code deployment in a commercial software

    - by dr. evil
    First bit of the question: What are the legal requirements of LGPL code during the deployment of a commercial product? Software package should include LGPL licence file Anything else? Shall we add a line to our "software agreement text" where you need to click next in the installer ? Second bit, Is there any known / accepted ways of distributing the changed library. Since it's LGPL anything derived from it should be licenced under LGPL. But what about after that? Shall we just send a copy to the original author? Shall we put it in our website so people can download? Or ship the source code with the product? Or just put a note that saying "e-mail us for the source code of this library".

    Read the article

  • Executing a modified expression

    - by Sam
    I found this brief demo: http://msdn.microsoft.com/en-us/library/bb546136.aspx Which discusses modifying an expression. However the code starts with a Expression<Func<string, bool>> and ends up with a Expression so it's not complete. How do I take that expression and make it typed as Expression<Func<string,bool>> again? All the examples I have have found on executing an expression all involve dynamically created expressions which is not what this case has. Here the original expression is defined at compile time. And the code I want to write to do this won't know much about the expression, ideally as little as possible. I definately can't see how I would know what "Paramaters" to pass to Expression.LambdaExpression... In my particular case I want to search for any references to a particular propery of type A and swap them out with a reference to a property of type B then pass the expression to a call to IEnumerable.Where. ie. p=>p.Name == "Sam" where P is Foo1 becomes p=>p.FirstName == "Sam" where p is Foo2

    Read the article

  • aother option for modified preorder tree traversal algorithm

    - by poldo
    Hi, been searching for a while now and can't seem to find an alternative solution. I need the tree traversal algorithm in such a way that a node can have more than 1 parent, if it's possilbe (found a great article here: Storing Hierarchical Data in a Database). Are there any algorithms so that, starting from a root node, we can determine the sequence and dependencies of nodes (currently reading topological sorting)? thanks in advance!

    Read the article

  • Can a GeneralPath be modified?

    - by Dov
    java2d is fairly expressive, but requires constructing lots of objects. In contrast, the older API would let you call methods to draw various shapes, but lacks all the new features like transparency, stroke, etc. Java has fairly high costs associated with object creation. For speed, I would like to create a GeneralPath whose structure does not change, but go in and change the x,y points inside. path = new GeneralPath(GeneralPath.WIND_EVEN_ODD, 10); path.moveTo(x,y); path.lineTo(x2, y2); double len = Math.sqrt((x2-x)*(x2-x) + (y2-y)*(y2-y)); double dx = (x-x2) * headLen / len; double dy = (y-y2) * headLen / len; double dx2 = -dy * (headWidth/headLen); double dy2 = dx * (headWidth/headLen); path.lineTo(x2 + dx + dx2, y2 + dy + dy2); path.moveTo(x2 + dx - dx2, y2 + dy - dy2); path.lineTo(x2,y2); This one isn't even that long. Imagine a much longer sequence of commands, and only the ones on the end are changing. I just want to be able to overwrite commands, to have an iterator effectively. Does that exist?

    Read the article

  • Default Object being modified because of LINQ Query

    - by msarchet
    I'm doing the following code to filter a list of objects before it gets sent off to be printed. Dim printList As New List(Of dispillPatient) For Each pat As dispillPatient In patList If (From meds In pat.Medication Select meds Where meds.Print = True).Count > 0 Then Dim patAdd As New dispillPatient patAdd = pat patAdd.Medication = DirectCast((From meds In pat.Medication Select meds Where meds.Print = True).ToList, List(Of dispillMedication)) printList.Add(patAdd) End If Next What is happening is patList, which is my initial list, for every dispillPatient inside of it, that specific patients Medication object (which is another list), is being shorten to the list that is returned to the patAdd object. I think this has something to do with both the way that .NET makes the copy of my pat object when I do patAdd = pat and the LINQ query that I'm using. Has anyone had a similar issue before and\or what can I do to keep my initial list from getting truncated. Thanks

    Read the article

  • Error Message, "The Controls collection cannot be modified because the control contains code blocks"

    - by Gogster
    I'm receiving this error on a page that previously worked fine, in fact the only change I've made to the page recently was to add another asp:TextBox and asp:RequiredFieldValidator control. The page already had numerous ASP.NET controls on it, so I cannot see why these extra controls would make a difference, anyway I shall post the code below and hopefully you can see what the error is: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="MeetingGenerator.ascx.cs" Inherits="usercontrols_MeetingGenerator" %> <%@ Register TagPrefix="cc1" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %> <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> <div style="width:498px;height:425px;background-color:#033b2a;text-align:center;padding-top:20px;"> <asp:Label ID="lblDone" CssClass="done" runat="server"></asp:Label> <asp:Panel id="pnlAddReport" runat="server"> <div> <img src="../images/banners/add-meeting.png" alt="Add Report" /> </div> <p> <asp:ValidationSummary ID="ValidationSummary" CssClass="validationsummary" runat="server" /> <asp:TextBox ID="txtTitle" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender1" TargetControlID="txtTitle" WatermarkCssClass="watermark" WatermarkText=" Meeting title" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvTitle" ControlToValidate="txtTitle" Text="" ErrorMessage="Please enter the title" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvTitle1" ControlToValidate="txtTitle" Text="" ErrorMessage="Please enter the title" Display="None" InitialValue=" Meeting title" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtDate" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="ceDate" TargetControlID="txtDate" Format="dd/MM/yyyy" runat="server"> </cc1:CalendarExtender> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender2" TargetControlID="txtDate" WatermarkCssClass="watermark" WatermarkText=" Meeting Date" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvDate" ControlToValidate="txtDate" Text="" ErrorMessage="Please select the meeting date" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvDate1" ControlToValidate="txtDate" Text="" ErrorMessage="Please select the meeting date" Display="None" InitialValue=" Meeting Date" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtMeetingTime" BorderStyle="None" Width="250px" Height="22px" MaxLength="5" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="tweMeetingTime" TargetControlID="txtMeetingTime" WatermarkCssClass="watermark" WatermarkText=" Time (HH:MM)" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="txtMeetingTime" Text="" ErrorMessage="Please enter the meeting time" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="RequiredFieldValidator11" ControlToValidate="txtMeetingTime" Text="" ErrorMessage="Please enter the meeting time" Display="None" InitialValue=" Time (HH:MM)" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:TextBox ID="txtLocation" BorderStyle="None" CssClass="watermark" Width="250px" Height="22px" runat="server"></asp:TextBox> <cc1:TextBoxWatermarkExtender ID="TextBoxWatermarkExtender3" TargetControlID="txtLocation" WatermarkCssClass="watermark" WatermarkText=" Location" runat="server"></cc1:TextBoxWatermarkExtender> <asp:RequiredFieldValidator ID="rfvLocation" ControlToValidate="txtLocation" Text="" ErrorMessage="Please enter the location" Display="None" InitialValue="" runat="server"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvLocation1" ControlToValidate="txtLocation" Text="" ErrorMessage="Please enter the location" Display="None" InitialValue=" Location" runat="server"></asp:RequiredFieldValidator> </p> <p> <asp:ImageButton ID="btnAddMeeting" ImageUrl="/images/buttons/addmeeting-btn.gif" runat="server" OnClick="btnAddMeeting_Click" /> </p> <p> </p> </asp:Panel> </div> <%@ Master Language="C#" MasterPageFile="/masterpages/Master.master" AutoEventWireup="true" %> <asp:content ContentPlaceHolderId="additionalhead" runat="server"> </asp:content> <asp:content ContentPlaceHolderId="additionalbody" runat="server"> <umbraco:Macro Alias="AddMeeting" runat="server"></umbraco:Macro> </asp:content> <asp:content ContentPlaceHolderId="bodyContent" runat="server"> </asp:content> <%@ Master Language="C#" AutoEventWireup="true" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title><umbraco:Item field="title" runat="server"></umbraco:Item></title> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script> <script type="text/javascript" src="/js/jQueryString-2.0.2-Min.js"></script> <link rel="stylesheet" type="text/css" href="/css/Styles.css" /> <link rel="stylesheet" type="text/css" href="/css/Layout.css" /> <link rel="stylesheet" type="text/css" href="/css/Forms.css" /> <script type="text/javascript" language="javascript"> $(document).ready(function () { $('#uploadAgenda').hide(); $('#uploadMinutes').hide(); $('#<%=txtSearchEAA.ClientID%>').val('Search EAA'); var st = $.getQueryString({ ID:"search" }); if (st != '') { $('#<%=txtSearchEAA.ClientID%>').val(st); }; $('#<%=txtSearchEAA.ClientID%>').click(function() { $('#<%=txtSearchEAA.ClientID%>').val(''); }); }); </script> <script type="text/C#" runat="server"> protected void btnSearch_Click(object sender, EventArgs e) { Response.Redirect("/members/search-results?search=" + txtSearchEAA.Text); } </script> <asp:ContentPlaceHolder id="additionalhead" runat="server"></asp:ContentPlaceHolder> <umbraco:Item field="AdditionalHead" runat="server"></umbraco:Item> </head> <body style="background-color:#e5e5e5;"> <script runat="server"> protected void btnLogout_Click(object sender, EventArgs e) { FormsAuthentication.SignOut(); Response.Redirect("/login"); } </script> <form id="form1" runat="server"> <asp:ContentPlaceHolder id="additionalbody" runat="server"></asp:ContentPlaceHolder> <div class="wrapper"> <div class="content"> <div class="banner"> <div class="bannerSearchSpacer"> <a href="/home"><h1><span>EAA</span></h1></a> </div> <div class="aboutEAA"> &nbsp; </div> <div class="bannerSearchAligns"> <div class="searchbox"> <asp:TextBox ID="txtSearchEAA" CssClass="watermark" Width="155px" runat="server"></asp:TextBox> </div> <div class="searchButton"> <asp:ImageButton ID="imbSearch" ImageUrl="/images/buttons/go.gif" OnClick="btnSearch_Click" runat="server" /> </div> <div style="clear:both;"></div> </div> <div class="loginBox"> <dl> <dt>Hello</dt> <dd><umbraco:Macro Alias="MemberName" runat="server"></umbraco:Macro></dd> <dt>Arena</dt> <dd><umbraco:Macro Alias="MemberArena" runat="server"></umbraco:Macro></dd> </dl> <div><asp:ImageButton ID="btnLogout" ImageUrl="/images/buttons/logout.gif" runat="server" OnClick="btnLogout_Click" /></div> </div> <div style="clear:both;"></div> </div> <div id="contentarea"> <div class="menuLeft"> <div class="menuPlaceholder"> <umbraco:Macro Alias="DynamicMenu" runat="server"></umbraco:Macro> </div> </div> <div class="mainBody"> <asp:ContentPlaceHolder id="bodyContent" runat="server"></asp:ContentPlaceHolder> </div> <div style="clear:both;"></div> </div> </div> </div> </form> <umbraco:Macro Alias="MemberAnalytics" runat="server"></umbraco:Macro> </body> </html>

    Read the article

  • DSP - How are frequency amplitudes modified using DFT?

    - by Trap
    I'm trying to implement a DFT-based equalizer (not FFT) for the sole purpose of learning. To check if it works I took an audio signal, analyzed it and then resynthesized it again with no modifications made to the frequency spectrum. So far so good. Now I tried to silence some frequency bands, just by setting their amplitudes to zero before resynthesis, but definitely it's not the way to go. What I get is a rather distorted signal. I'm using the so-called 'standard way of calculating the DFT' which is by correlation. I first tried to modify the real part amplitudes only, then modifying both the real and imaginary part amplitudes. I also tried to convert the DFT output to polar notation, then modifying the magnitude and convert back to rectangular notation, but none of this is working. Can someone show me what I'm doing wrong? I tried to find info on this subject in the internet but couldn't find any. Thanks in advance.

    Read the article

  • Git merge of same and externally modified file

    - by neduma
    I have inherited some code (from zip file) from a developer and git initialzed, made changes and set of check-ins progressively. Now, the same developer released the same code with his changes and gave me the another zip file. How do i merge my changes which i have it my git repo and his recent changes from the second zip file contents? Ideally, i would like to have the code which should be accumalation of both my changes and the developer recent changes. I tried to create branch b1 from my master branch and applied second zip file contents on top of that. committed those files in the branch and did 'git checkout master; git merge b1' - but, i do not get my changes, only his changes in my master branch.

    Read the article

  • Why can final object be modified?

    - by Matt McCormick
    I came across the following code in a code base I am working on: public final class ConfigurationService { private static final ConfigurationService INSTANCE = new ConfigurationService(); private List providers; private ConfigurationService() { providers = new ArrayList(); } public static void addProvider(ConfigurationProvider provider) { INSTANCE.providers.add(provider); } ... INSTANCE is declared as final. Why can objects be added to INSTANCE? Shouldn't that invalidate the use of final. (It doesn't). I'm assuming the answer has to do something with pointers and memory but would like to know for sure.

    Read the article

  • JQuery Access Elements in Modified DOM

    - by Bernhard
    Hi there, im trying since a long term to use events on elements in my dom which has been added asynchronus. I´ve read something about bind but is there a different Way to etablish something like this? For Example I have this situation. $.getJQUERY(myUrl, {var:value}, function(i, data){ $.each(data.values, function(value){ $("body").append('<div id="div_no_'+i+'">'+value+'</div>); // Here i dont want to place the EventListeners }) }); $("div_no_1").click(function(){ // do something }); Could someone help me to find a way to etablish something like this?? Thank you in advance Great Bernhard

    Read the article

  • Not Seeing Ajax Requests In Firebug If Header Has Been Modified

    - by FluidFoundation
    Hey braintrust, I'm making an ajax call using jQuery's library to an api, which requires a username and password encoded to base64 be added to the header. here's a basic example: $.ajax({ type: "GET", contentType: 'application/json', beforeSend:function(xhr){ xhr.setRequestHeader("Authentication", "Basic " + base64EncodedValue); } url: 'https://api.company.com/uri/', complete: function(result) { alert(result); } }); But when this fires off, I get a black alert box, so it doesn't appear as if something is coming back. There is no log in the Firebug console that a get ajax request was done. However, if I remove the beforeSend option, I do see the ajax request get logged, but the request gets back a 'not authorized', so it definitely hit the right place. Any ideas on why it's not showing up in Firebug so I can verify the headers are being sent out correctly?

    Read the article

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