Search Results

Search found 52182 results on 2088 pages for 'something for the weekend'.

Page 12/2088 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • ruby block and returning something from block

    - by dorelal
    I am using ruby 1.8.7. p = lambda { return 10;} def lab(block) puts 'before' puts block.call puts 'after' end lab p Above code output is before 10 after I refactored same code into this def lab(&block) puts 'before' puts block.call puts 'after' end lab { return 10; } Now I am getting LocalJumpError: unexpected return. To me both the code are doing same thing. Yes in the first case I am passing a proc and in the second case I am passing a block. But &block converts that block into proc. So proc.call should behave same. And yes I have seen this post http://stackoverflow.com/questions/2325471/using-return-in-a-ruby-block

    Read the article

  • Google Maps or Open Street or Something Else

    - by clifgray
    I have been working on a concept for a while for a sports related website where users can record a location on a map and put that location into a category for a sport and then rate it by a metric or two. I want these metrics displayed on the map but then I want a link or button to view a full page description. I know that this is possible with Google Maps but I don't know a lot about Open Street Maps or other options. I am expecting around 50,000 views a day and am curious as to what the best option would be.

    Read the article

  • iPhoneOS Core Data migration: moving something from an entity into a file

    - by Tim Sullivan
    I have a scenario where I'm moving the contents of a blob stored in a core data entity into a file. I need a way to export that data during a migration, where I know the entity that's being converted and save the blob to a file, writing the location of that file into the converted entity's appropriate attribute. I can't seem to find a way to do this. The docs regarding the Three Stage Migration seem to indicate what can be done, but I'm not sure where to define things, or what exactly to define.

    Read the article

  • how to handle .something in the url

    - by dorelal
    I am using rails 2.3.5 . I have a resource for event. map.resources :events respond_to do |format| format.html format.js { render :text => @event.to_json, :layout => false } end It is a public site and sometimes I get urls like http://domain.com/events/14159-international-hardware-show-2010+91+"prashant"+2010+OR+email+OR+data+OR+base+-ALIBA.BACOM&hl=en&ct=clnk I keep getting hoptoad exception email. How do I handle such cases?

    Read the article

  • Official way to ask jQuery wait for all images to load before executing something

    - by Simon_Weaver
    In jQuery when you do this: $(function() { alert("DOM is loaded, but images not necessarily all loaded"); }); It waits for the DOM to load and executes your code. If all the images are not loaded then it still executes the code. This is obviously what we want if we're initializing any DOM stuff such as showing or hiding elements or attaching events. Let's say though that I want some animation and I don't want it running until all the images are loaded. Is there an official way in jQuery to do this? The best way I have is to use <body onload="finished()">, but I don't really want to do that unless I have to. Note: There is a bug in jQuery 1.3.1 in Internet Explorer which actually does wait for all images to load before executing code inside $function() { }. So if you're using that platform you'll get the behavior I'm looking for instead of the correct behavior described above.

    Read the article

  • Looking to reimplement build toolchain from bash/grep/sed/awk/(auto)make/configure to something more

    - by wash
    I currently maintain a few boxes that house a loosely related cornucopia of coding projects, databases and repositories (ranging from a homebrew *nix distro to my class notes), maintained by myself and a few equally pasty-skinned nerdy friends (all of said cornucopia is stored in SVN). The vast majority of our code is in C/C++/assembly (a few utilities are in python/perl/php, we're not big java fans), compiled in gcc. Our build toolchain typically consists of a hodgepodge of make, bash, grep, sed and awk. Recent discovery of a Makefile nearly as long as the program it builds (as well as everyone's general anxiety with my cryptic sed and awking) has motivated me to seek a less painful build system. Currently, the strongest candidate I've come across is Boost Build/Bjam as a replacement for GNU make and python as a replacement for our build-related bash scripts. Are there any other C/C++/asm build systems out there worth looking into? I've browsed through a number of make alternatives, but I haven't found any that are developed by names I know aside from Boost's. (I should note that an ability to easily extract information from svn commandline tools such as svnversion is important, as well as enough flexibility to configure for builds of asm projects as easily as c/c++ projects)

    Read the article

  • How to check if something is stored in CoreData

    - by Terrel Gibson
    Hi I want to be able to tore some information in core data and but i am unsure of how to check if the file was saved properly. I tried using NSLog but it returns null when its called. I have a dictionary which has a uniqueID and a title which I want to save. I pass this in along with the context of the database. I then sort the database to check if it has any duplicates or not, if not then I add the file. +(VacationPhoto*) photoWithFlickrInfo: (NSDictionary*) flickrInfo inManagedObjectContext: (NSManagedObjectContext*) context{ //returns the dictionary NSLog(@"Photo To Store =%@", flickrInfo); VacationPhoto * photo = nil; NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@"VacationPhoto"]; request.predicate = [NSPredicate predicateWithFormat:@"uniqueID = %@", [flickrInfo objectForKey:FLICKR_PHOTO_ID]]; NSSortDescriptor * descriptor = [NSSortDescriptor sortDescriptorWithKey:@"title" ascending:YES]; request.sortDescriptors = [NSArray arrayWithObject:descriptor]; NSError *error = nil; NSArray *matches = [context executeFetchRequest:request error:&error]; if (!matches || [matches count] > 1) { // handle error } else if ( [matches count] == 0){ photo.title = [flickrInfo objectForKey:FLICKR_PHOTO_TITLE]; //Returns NULL when called NSLog(@"title = %@", photo.title); photo.uniqueID = [flickrInfo objectForKey:FLICKR_PHOTO_ID]; //Returns NULL when called NSLog(@"ID = %@", photo.uniqueID); } else { //If photo already exists this is called photo = [matches lastObject]; } return photo; }

    Read the article

  • trying to append a list, but something breaks

    - by romunov
    I'm trying to create an empty list which will have as many elements as there are num.of.walkers. I then try to append, to each created element, a new sub-list (length of new sub-list corresponds to a value in a. When I fiddle around in R everything goes smooth: list.of.dist[[1]] <- vector("list", a[1]) list.of.dist[[2]] <- vector("list", a[2]) list.of.dist[[3]] <- vector("list", a[3]) list.of.dist[[4]] <- vector("list", a[4]) I then try to write a function. Here is my feeble attempt that results in an error. Can someone chip in what am I doing wrong? countNumberOfWalks <- function(walk.df) { list.of.walkers <- sort(unique(walk.df$label)) num.of.walkers <- length(unique(walk.df$label)) #Pre-allocate objects for further manipulation list.of.dist <- vector("list", num.of.walkers) a <- c() # Count the number of walks per walker. for (i in list.of.walkers) { a[i] <- nrow(walk.df[walk.df$label == i,]) } a <- as.vector(a) # Add a sublist (length = number of walks) for each walker. for (i in i:num.of.walkers) { list.of.dist[[i]] <- vector("list", a[i]) } return(list.of.dist) } > num.of.walks.per.walker <- countNumberOfWalks(walk.df) Error in vector("list", a[i]) : vector size cannot be NA

    Read the article

  • How to do something firstly when the asp.net server start

    - by Edwin Tai
    Hi all I need an interface that can be run firstly when the application start. We can write some code in Application_Start of global.ascx. Is there any other method to finish it after some configurations in web.config,i don't wanna write any code in global.ascx You know,we can implement the Interface 'IHttpModule' to diy each request. But the interface is not fix to application start. which one is i wanna? Thanks

    Read the article

  • PHP/MySQL: Check if something 'belongs-to' something else?

    - by Nebs
    I have two tables: Stores and Items. The relationship is: Stores 1---* Items In PHP/MySQL what would be the best (fastest/simplest) way to check if a particular item belongs to a particular store. In other words given for example: $store_id = 1; $item_id = 12; I want to check if item 12 belongs to store 1 (and not some other store). I usually do a select on Items matching both the store_id and item_id and limit the results to 1. Then check how many rows (0 or 1) were returned with mysql_num_rows. Is there a better way? Update: Both tables have an "id" column. The Items table has a "store_id" column.

    Read the article

  • jQuery animation if load() returns something different...

    - by Dan LaManna
    setInterval(function() { var prevTopArticle = $("#toparticles table:first").html(); $("#toparticles").load("myurloffeed.com/topfeed", function() { alternateBG(); var newTopArticle = $("#toparticles table:first").html(); if (prevTopArticle!=newTopArticle) { $("#toparticles table:first").effect("highlight", {color:"#faffc4"}, 2000); } }); }, 8000); So it sets the current first table item to a variable, loads the toparticles div with the tables off the url, and if they are different it will perform the highlight effect, however it does the highlight effect anyway, completely unsure why it isn't working.

    Read the article

  • Something like a manual refresh is needed angularjs, and a $digest() iterations error

    - by Tony Ennis
    (post edited again, new comments follow this line) I'm changing the title of this posting since it was misleading - I was trying to fix a symptom. I was unable to figure out why the code was breaking with a $digest() iterations error. A plunk of my code worked fine. I was totally stuck, so I decided to make my code a little more Angular-like. One anti-pattern I had implemented was to hide my model behind my controller by adding getters/setters to the controller. I tore all that out and instead put the model into the $scope since I had read that was proper Angular. To my surprise, the $digest() iterations error went away. I do not exactly know why and I do not have the intestinal fortitude to put the old code back and figure it out. I surmise that by involving the controller in the get/put of the data I added a dependency under the hood. I do not understand it. edit #2 ends here. (post edited, see EDIT below) I was working through my first Error: 10 $digest() iterations reached. Aborting! error today. I solved it this way: <div ng-init="lineItems = ctrl.getLineItems()"> <tr ng-repeat="r in lineItems"> <td>{{r.text}}</td> <td>...</td> <td>{{r.price | currency}}</td> </tr </div> Now a new issue has arisen - the line items I'm producing can be modified by another control on the page. It's a text box for a promo code. The promo code adds a discount to the lineItem array. It would show up if I could ng-repeat over ctrl.getLineItems(). Since the ng-repeat is looking at a static variable, not the actual model, it doesn't see that the real line items have changed and thus the promotional discount doesn't get displayed until I refresh the browser. Here's the HTML for the promo code: <input type="text" name="promo" ng-model="ctrl.promoCode"/> <button ng-click="ctrl.applyPromoCode()">apply promo code</button> The input tag is writing the value to the model. The bg-click in the button is invoking a function that will apply the code. This could change the data behind the lineItems. I have been advised to use $scope.apply(...). However, since this is applied as a matter of course by ng-click is isn't going to do anything. Indeed, if I add it to ctrl.applyPromoCode(), I get an error since an .apply() is already in progress. I'm at a loss. EDIT The issue above is probably the result of me fixing of symptom, not a problem. Here is the original HTML that was dying with the 10 $digest() iterations error. <table> <tr ng-repeat="r in ctrl.getLineItems()"> <td>{{r.text}}</td> <td>...</td> <td>{{r.price | currency}}</td> </tr> </table> The ctrl.getLineItems() function doesn't do much but invoke a model. I decided to keep the model out of the HTML as much as I could. this.getLineItems = function() { var total = 0; this.lineItems = []; this.lineItems.push({text:"Your quilt will be "+sizes[this.size].block_size+" squares", price:sizes[this.size].price}); total = sizes[this.size].price; this.lineItems.push({text: threads[this.thread].narrative, price:threads[this.thread].price}); total = total + threads[this.thread].price; if (this.sashing) { this.lineItems.push({text:"Add sashing", price: this.getSashingPrice()}); total = total + sizes[this.size].sashing; } else { this.lineItems.push({text:"No sashing", price:0}); } if(isNaN(this.promo)) { this.lineItems.push({text:"No promo code", price:0}); } else { this.lineItems.push({text:"Promo code", price: promos[this.promo].price}); total = total + promos[this.promo].price; } this.lineItems.push({text:"Shipping", price:this.shipping}); total = total + this.shipping; this.lineItems.push({text:"Order Total", price:total}); return this.lineItems; }; And the model code assembled an array of objects based upon the items selected. I'll abbreviate the class as it croaks as long as the array has a row. function OrderModel() { this.lineItems = []; // Result of the lineItems call ... this.getLineItems = function() { var total = 0; this.lineItems = []; ... this.lineItems.push({text:"Order Total", price:total}); return this.lineItems; }; }

    Read the article

  • a linq query to find something

    - by rap-uvic
    Hi, I have object A which contains multiple instances of object B, which in turn contains multiple instances of object C. I need to write a function which, given Object A needs search through instances of objects B and objects C and find a particular object C. How would I do this using LINQ?

    Read the article

  • vba excel: do something every time a certain variable is changed

    - by every_answer_gets_a_point
    im doing a bunch of stuff to the variable St For i = 1 To 30000 Randomize e1 = Rnd e2 = Rnd z1 = Sqr(-2 * Log(e1)) * Cos(2 * 3.14 * e2) z2 = Sqr(-2 * Log(e1)) * Sin(2 * 3.14 * e2) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z1) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T + sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) St = So * Exp((r - (sigma ^ 2) / 2) * T - sigma * Sqr(T) * z2) C = C + Application.WorksheetFunction.Max(St - K, 0) Next i how do i get notified every time the variable changes?

    Read the article

  • Execute something on application startup?

    - by Nick Brooks
    I have a class in my application which handles all the controls and all the functions and variables are stored in it. How can I add a function which handles the application startup to it? So basically I need to handle 'applicationDidFinishLaunching' in my class as well as in the application delegate. How do I do that?

    Read the article

  • iOS Core Data migration: moving something from an entity into a file

    - by Tim Sullivan
    I have a scenario where I'm moving the contents of a blob stored in a core data entity into a file. I need a way to export that data during a migration, where I know the entity that's being converted and save the blob to a file, writing the location of that file into the converted entity's appropriate attribute. I can't seem to find a way to do this. The docs regarding the Three Stage Migration seem to indicate what can be done, but I'm not sure where to define things, or what exactly to define.

    Read the article

  • How to move something from a virtual dpad on-screen

    - by Kriegalex
    Hello everyone, I've started a little game, and so far I'm moving a little guy with onKeyDown() and the DPAD from Android Emulator. Now what I want to do is to add 4 buttons on the screen (like in a GAMEBOY emulator for example) and these buttons should move my little guy. With a clickListener and onClick() (or touchListener and onTouch()), it's ok for one move but how to do if I want that my little guy continues moving when I stay clicked on the button ??? Buttons are enough or should I make a 4 arrows soft keyboard or anything else ?? Thanks

    Read the article

  • Serializing Request.Form to a Dictionary or something

    - by André Alçada Padez
    Hi i need to pass my Request.Form as a parameter, but first i have to add some key/value pairs to it. I get the exception that the Collection is readonly. I've tried: System.Collections.Specialized.NameValueCollection myform = Request.Form; and i get the same error. and i've tried: foreach(KeyValuePair<string, string> pair in Request.Form) { Response.Write(Convert.ToString(pair.Key) + " - " + Convert.ToString(pair.Value) + "<br />"); } to test if i can pass it one by one to another dictionary, but i get: System.InvalidCastException: Specified cast is not valid. some help, anyone? Thanx

    Read the article

  • Is something wrong with this php GD code?

    - by ThinkingInBits
    if ($img = @imagecreatefromjpeg('./images/upload/13/1.JPG')) { imagejpeg($img, $path, 100); imagedestroy($img); } else { die ("image was not created or saved"); } I'm getting the message: Warning: imagejpeg(): 8 is not a valid Image resource in C:\xampp\htdocs\invivid\libraries\photograph_classes.php on line 276 Warning: imagedestroy(): 8 is not a valid Image resource in C:\xampp\htdocs\invivid\libraries\photograph_classes.php on line 277 The image is being created initially, we know this from the if statement, but why doesn't imagejpeg or imagedestroy work properly?

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >