Search Results

Search found 2396 results on 96 pages for 'alex nauda'.

Page 83/96 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Rails nil can't be coerced into Float

    - by alex
    After adding items, attempting to view my cart leads me to this error: nil can't be coerced into Float with the math line in this method in my line_item model highlighted: def total_price product.price * quantity end line items create action def create product = Product.find(params[:product_id]) @line_item = @cart.add_product(product.id) @line_item.quantity = params[:quantity] view <div id= "text_field"><%= text_field_tag 'quantity' %> </div> <%= button_to 'Add to Cart', line_items_path(:product_id => product) %> This has held me back for a couple days. (I'm new). Thanks.

    Read the article

  • Easy way to apply a function to an array

    - by alex
    I am aware of array_walk() and array_map(). However when using the former like so (on an old project) it failed array_walk($_POST, 'mysql_real_escape_string'); Warning: mysql_real_escape_string() expects parameter 2 to be resource, string given. So I went with this slightly more ugly version foreach($_POST as $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } So why didn't the first way work? What is the best way to map values of an array to a function?

    Read the article

  • How to make an element slide with the viewport as it scrolls?

    - by alex
    I've Googled for this but must be using the wrong keywords. Basically I want to use the effect that Magento and now Stack Overflow uses. That is, there is an element in a column, and when you scroll down, it sticks to the top of the viewport. And once scrolled up again, it goes back into the normal page flow. This Ask A Question is a good page for example. Scroll down and watch the "How to Format" element come down (might need to make your viewport smaller if you have a large screen to see the effect). I've noticed it is setting position: fixed in the CSS. The JavaScript however is obfuscated. What's the easiest way to achieve this effect? Is there a jQuery plugin available?

    Read the article

  • Is RIA Services right for our Silverlight app at this point?

    - by Alex
    Hi, I'm looking at Silverlight architectures and RIA Services looks interesting, but I am a bit concerned about its prelease status and how the feature set will change. We need our client app to be as responsive as possible over a slow network link, so a high priority is a solid sync system for pushing model state changes from the client back to the server. Will RIA Services help us in this regard or will I have to roll my own logic to do this ? Are there any other frameworks that can assist with this? Is the feature set involved in these requirements liable to change much in the next couple of months? If it makes any difference, our frontend is 100% Silverlight, so we dont need to worry about exposing SOAP APIs from the server or anything like that. It appears to me that RIA so far is a bit more mature for Silverlight use. Is this correct?

    Read the article

  • Improving the efficiency of multiple concurrent Core Animation animations

    - by Alex
    I have a view in my app that is very similar to the month view in the built-in Calendar app. There's a subview that holds the individual cells (a custom UIView subclass that draws text into its layer), and when the user navigates to the next "month", I create the new cells and slide the view to show them. When the animation stops, I remove the old, hidden cells and set things up so it's ready to go for the next animation. This all works nicely. However, I'd like to animate the cells' text color, as in the Calendar app, so that the outgoing ones transition to a lighter color and the incoming ones transition to a darker color. The problems is that I can have as many as 70 cells, so doing individual animations is very slow -- between 5-10 fps on my iPhone 3GS. I'm trying to find a less computationally intense way of doing this. My reading of the Shark results is that the majority of the time is spent redrawing the text for each frame for each frame. This makes sense, since text rendering is hardly the cheapest operation. I've considered creating a second view -- one holding the "outgoing" state and one holding the "incoming" state and using a single opacity animation to gradually reveal the updated cells while both are sliding. I'm concerned that instead of having 70 cells, I'll have 140, which seems like a lot of views. So, is that too many views or would there be a better way of doing this?

    Read the article

  • Formatting currency within a specific precision range

    - by Alex Prose
    I am trying to format currency that will always contain 2 decimal digits, but if there are extra digits of accuracy to display up to five. As an example: for value = 5.0 display: $5.00 for value = 5.023 display: $5.023 for value = 5.333333333333333 display: $5.33333 I have been playing with the .ToString() formatting, but I can't seem to find the right match of options. Clarification: I want to show from 2-5 decimals, truncating zeros after the second digit. for value = 5.000000000000000 display: $5.00 for value = 5.333333333333333 display: $5.33333

    Read the article

  • How to make compareTo sort a list alphabetically?

    - by Alex
    Hi How do I change my code so that it lists the elements in alphabetical order from a to z. Right now it's ordering from z to a. I can't figure it out and am stuck :-/ String sName1 = ((Address)o).getSurname().toLowerCase(); String sName2 = (this.surname).toLowerCase(); int result = (sName1).compareTo(sName2); return result; Thanks :)

    Read the article

  • How to exit a process run with C++ if it takes more than 5 seconds?

    - by Alex
    I'm implementing a checking system in C++. It runs executables with different tests. If the solution is not correct, it can take forever for it to finish with certain hard tests. That's why I want to limit the execution time to 5 seconds. I'm using system() function to run executables: system("./solution"); .NET has a great WaitForExit() method, what about native C++?. I'm also using Qt, so Qt-based solutions are welcome. So is there a way to limit external process' execution time to 5 seconds? Thanks

    Read the article

  • iDevice for Dummies: Can a device be assigned multiple provisions (Personal/Enterprise)?

    - by Alex
    Hi guys, Is it possible to assign multiple provisions to an iDevice? To be honest, I'm not sure if I'm using the correct terminology, but basically, I'm developing an iPad app for a company and I've only been testing it in the simulator because I don't have a registration to the developer program and they haven't setup their enterprise registration yet either. And I'm sure you all know how limited the simulator is... I don't really care about the $99 it costs to join, but what I'm worried about is having my iDevices locked permanently to my personal registration and unable to switch back and forth to the enterprise registration. I'd appreciate it if someone can explain to me how the registrations work. And keep in mind, I'm a dummy. :) Thanks in advance!

    Read the article

  • More than one unique key for HashMap problem (Java)

    - by Alex Cheng
    This question is a continuation of this thread: In short: To solve my problem, I want to use Map<Set<String>, String>. However, after I sort my data entries in Excel, remove the unnecessary parameters, and the following came out: flow content ==> content content flow content ==> content depth distance flow content ==> content depth within flow content ==> content depth within distance flow content ==> content within flow content ==> content within distance I have more than one unique key for the hashmap if that is the case. How do I go around this... anyone have any idea? I was thinking of maybe Map<Set <String>, List <String>> so that I can do something like: Set <flow content>, List <'content content','content depth distance','content depth within ', ..., 'content within distance'> But because I am parsing the entries line by line I can't figure out the way how to store values of the same repeated keys (flow content) into the same list and add it to the map. Anyone have a rough logic on how can this be done in Java? Thanks in advance.

    Read the article

  • how to get the PageFormat from a Java.awt.print.PrinterJob

    - by Alex
    Hi, I'm trying to use the PageFormat information to modify my javax.swing based printout prior to printing it. I am stumped as to how I can get the PageFormat from the PrintJob (which is obtained using getPrinterJob() and printDialog()). I know there is the getPageFormat method, but I can't figure out how to get the PrintRequestAttributeSet (which is not the printJob.getPrintService().getPrintAttributes()). Honestly, all I really want to know is the width and height of the page. Any ideas on how I can do that? Thanks.

    Read the article

  • How do I put these: @{$subset}, [@ext_subset], [$last_item] in PHP?

    - by Alex
    I'm having trouble translating a subroutine from Perl to PHP (I'm new to Perl). The entire subroutine is as follows: sub find_all_subsets { if (1 == scalar (@_)) {return [@_]} else { my @all_subsets = () ; my $last_item = pop (@_) ; my @first_subsets = find_all_subsets (@_) ; foreach my $subset (@first_subsets) { push (@all_subsets, $subset) ; my @ext_subset = @{$subset} ; push (@ext_subset, $last_item) ; push (@all_subsets, [@ext_subset]) ; } push (@all_subsets, [$last_item]) ; return (@all_subsets) ; } } My problem is that I really don't quite understand the Perl syntax, so I'm having trouble writing these @{$subset}, [@ext_subset] and [$last_item] in PHP. Thanks and sorry if the question is stupid.

    Read the article

  • How would I best make this SEO_able?

    - by alex
    I have a search engine that searches albums. For each music album, I have a page. So, the work flow goes like this: People search for music titles The search engine displays a list of albums. People click on an album to go to a details page. I want google to index my front page and the details page. I want the details page to be highly ranked. How can I build a sitemap for this? By the way, I have about 5 million albums (but I want the top 1000 ones to be highly ranked on google)

    Read the article

  • compare date split across colums

    - by alex-tech
    Greetings. I am querying tables from Microsoft SQL 2008 which have date split across 3 columns: day, month and year. Unfortunately, I do not have control over this because data is coming in to the database daily from a 3rd party source in that format. I need to add between to a where clause so user can pull records within a range. Would be easy enough if date was in a single column but finding it nearly impossible when its split across three columns. To display the date, I am doing a CAST( CAST(year as varchar(4)) + '-' + CAST(month as varchar(2)) + '-' + CAST(day as varchar(2)) as date) AS "date"` in a select. I tried to put it as a parameter for datediff function or just the regular between but get no results. Thanks for any help.

    Read the article

  • TableView Background image going over cell textLabel

    - by Alex Trott
    Currently my tableview looks like this: as you can see, cell.textLabel and cell.detailTextLable both load this background, and i can't work out how to get them to stop loading the background, and for it only to be the backing on the cell. Here's my current code to change the cell: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { [cell setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"tableCell.png"]]]; } How can i get round this problem? Thanks in advance.

    Read the article

  • Empty files generated from running `mysqldump` using PHP

    - by alex
    I keep getting empty files generated from running $command = 'mysqldump --opt -h localhost -u username -p \'password\' dbname > \'backup 2009-04-15 09-57-13.sql\''; command($command); Anyone know what might be causing this? My password has strange characters in it, but works fine with connecting to the db. I've ran exec($command, $return) and outputted the $return array and it is finding the command. I've also ran it with mysqldump > file.sql and the file contains Usage: mysqldump [OPTIONS] database [tables] OR mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...] OR mysqldump [OPTIONS] --all-databases [OPTIONS] For more options, use mysqldump --help So it would seem like the command is working.

    Read the article

  • In a Windows forms application, how can I use a listbox in a DataGridView coloumn instead of a combo

    - by Alex
    I'm working on a windows forms application that uses a DataGridView. Some of the cells contain a DataGridViewComboBox. In some cases, I have several values to display in the combobox. For that scenario, it would be better to use a ListBox instead of a ComboBox. Is it possible to use a multi-column listbox within a DataGridView instead of a ComboBox? If so, can you point me in the right direction? Thanks much. Al D.

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >