Search Results

Search found 7146 results on 286 pages for 'john price'.

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

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 35c / hour, compared with 85c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say $1 / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • Amazon EC2 spot instances - is there a catch ?

    - by gareth_bowles
    I needed to start a new EC2 instance today and decided to try out the new spot instances, where you can reduce your instance cost by bidding on the maximum per-hour price you're prepared to pay. Since today's spot price was only 3.5c / hour, compared with 8.5c / hour for an on-demand instance, I was wondering: if I just bid a really high price, say 10c / hour, can I effectively be sure of getting a much cheaper long-running instance than an on-demand instance (since the spot instances are only charged by the current spot price) ? I suppose it's theoretically possible for the spot price to go over the on-demand price, but as far as I can tell from the data on the AWS site, the spot price has always been well below that.

    Read the article

  • SQL: Add counters in select

    - by etarvt
    Hi, I have a table which contains names: Name ---- John Smith John Smith Sam Wood George Wright John Smith Sam Wood I want to create a select statement which shows this: Name 'John Smith 1' 'John Smith 2' 'Sam Wood 1' 'George Wright 1' 'John Smith 3' 'Sam Wood 2' In other words, I want to add separate counters to each name. Is there a way to do it without using cursors?

    Read the article

  • What is the effect of this order_by clause?

    - by bread
    I don't understand what this order_by clause is doing and whether I need it or not: select c.customerid, c.firstname, c.lastname, i.order_date, i.item, i.price from items_ordered i, customers c where i.customerid = c.customerid group by c.customerid, i.item, i.order_date order by i.order_date desc; This produces this data: 10330 Shawn Dalton 30-Jun-1999 Pogo stick 28.00 10101 John Gray 30-Jun-1999 Raft 58.00 10410 Mary Ann Howell 30-Jan-2000 Unicycle 192.50 10101 John Gray 30-Dec-1999 Hoola Hoop 14.75 10449 Isabela Moore 29-Feb-2000 Flashlight 4.50 10410 Mary Ann Howell 28-Oct-1999 Sleeping Bag 89.22 10339 Anthony Sanchez 27-Jul-1999 Umbrella 4.50 10449 Isabela Moore 22-Dec-1999 Canoe 280.00 10298 Leroy Brown 19-Sep-1999 Lantern 29.00 10449 Isabela Moore 19-Mar-2000 Canoe paddle 40.00 10413 Donald Davids 19-Jan-2000 Lawnchair 32.00 10330 Shawn Dalton 19-Apr-2000 Shovel 16.75 10439 Conrad Giles 18-Sep-1999 Tent 88.00 10298 Leroy Brown 18-Mar-2000 Pocket Knife 22.38 10299 Elroy Keller 18-Jan-2000 Inflatable Mattress 38.00 10438 Kevin Smith 18-Jan-2000 Tent 79.99 10101 John Gray 18-Aug-1999 Rain Coat 18.30 10449 Isabela Moore 15-Dec-1999 Bicycle 380.50 10439 Conrad Giles 14-Aug-1999 Ski Poles 25.50 10449 Isabela Moore 13-Aug-1999 Unicycle 180.79 10101 John Gray 08-Mar-2000 Sleeping Bag 88.70 10299 Elroy Keller 06-Jul-1999 Parachute 1250.00 10438 Kevin Smith 02-Nov-1999 Pillow 8.50 10101 John Gray 02-Jan-2000 Lantern 16.00 10315 Lisa Jones 02-Feb-2000 Compass 8.00 10449 Isabela Moore 01-Sep-1999 Snow Shoes 45.00 10438 Kevin Smith 01-Nov-1999 Umbrella 6.75 10298 Leroy Brown 01-Jul-1999 Skateboard 33.00 10101 John Gray 01-Jul-1999 Life Vest 125.00 10330 Shawn Dalton 01-Jan-2000 Flashlight 28.00 10298 Leroy Brown 01-Dec-1999 Helmet 22.00 10298 Leroy Brown 01-Apr-2000 Ear Muffs 12.50 While if I remove the order_by clause completely, as in this query: select c.customerid, c.firstname, c.lastname, i.order_date, i.item, i.price from items_ordered i, customers c where i.customerid = c.customerid group by c.customerid, i.item, i.order_date; I get these results: 10101 John Gray 30-Dec-1999 Hoola Hoop 14.75 10101 John Gray 02-Jan-2000 Lantern 16.00 10101 John Gray 01-Jul-1999 Life Vest 125.00 10101 John Gray 30-Jun-1999 Raft 58.00 10101 John Gray 18-Aug-1999 Rain Coat 18.30 10101 John Gray 08-Mar-2000 Sleeping Bag 88.70 10298 Leroy Brown 01-Apr-2000 Ear Muffs 12.50 10298 Leroy Brown 01-Dec-1999 Helmet 22.00 10298 Leroy Brown 19-Sep-1999 Lantern 29.00 10298 Leroy Brown 18-Mar-2000 Pocket Knife 22.38 10298 Leroy Brown 01-Jul-1999 Skateboard 33.00 10299 Elroy Keller 18-Jan-2000 Inflatable Mattress 38.00 10299 Elroy Keller 06-Jul-1999 Parachute 1250.00 10315 Lisa Jones 02-Feb-2000 Compass 8.00 10330 Shawn Dalton 01-Jan-2000 Flashlight 28.00 10330 Shawn Dalton 30-Jun-1999 Pogo stick 28.00 10330 Shawn Dalton 19-Apr-2000 Shovel 16.75 10339 Anthony Sanchez 27-Jul-1999 Umbrella 4.50 10410 Mary Ann Howell 28-Oct-1999 Sleeping Bag 89.22 10410 Mary Ann Howell 30-Jan-2000 Unicycle 192.50 10413 Donald Davids 19-Jan-2000 Lawnchair 32.00 10438 Kevin Smith 02-Nov-1999 Pillow 8.50 10438 Kevin Smith 18-Jan-2000 Tent 79.99 10438 Kevin Smith 01-Nov-1999 Umbrella 6.75 10439 Conrad Giles 14-Aug-1999 Ski Poles 25.50 10439 Conrad Giles 18-Sep-1999 Tent 88.00 10449 Isabela Moore 15-Dec-1999 Bicycle 380.50 10449 Isabela Moore 22-Dec-1999 Canoe 280.00 10449 Isabela Moore 19-Mar-2000 Canoe paddle 40.00 10449 Isabela Moore 29-Feb-2000 Flashlight 4.50 10449 Isabela Moore 01-Sep-1999 Snow Shoes 45.00 10449 Isabela Moore 13-Aug-1999 Unicycle 180.79 I'm not sure what the order_by is doing here and if it's having the intended effects.

    Read the article

  • C++ reading and writing and writing files

    - by user320950
    Write a program that processes a list of items purchased with a receipt List in itemlist.txt just items different numbers Prices in pricelist.txt have items and prices in them, different # Make file output file that has receipt Print message saying program ran- have not done If item not in pricelist, report error, count errors display at end Don't know how many items or prices Close file and clear because of running many these files many times This program wont write to the files like so the above is what i have to do #include<iostream>`enter code here` #include<fstream> #include<cstdlib> #include<iomanip> using namespace std; int main() { ifstream in_stream; // reads itemlist.txt ofstream out_stream1; // writes in items.txt ifstream in_stream2; // reads pricelist.txt ofstream out_stream3;// writes in plist.txt ifstream in_stream4;// read recipt.txt ofstream out_stream5;// write display.txt double price=' ',curr_total=0.0; int wrong=0; int itemnum=' '; char next; in_stream.open("ITEMLIST.txt", ios::in); // list of avaliable items out_stream1.open("listWititems.txt", ios::out); // list of avaliable items in_stream2.open("PRICELIST.txt", ios::in); out_stream3.open("listWitdollars.txt", ios::out); in_stream4.open("display.txt", ios::in); out_stream5.open("showitems.txt", ios::out); in_stream.setf(ios::fixed); while(!in_stream.eof()) { in_stream >> itemnum; cin.clear(); cin >> next; } out_stream1.setf(ios::fixed); while (!out_stream1.eof()) { out_stream1 << itemnum; cin.clear(); cin >> next; } in_stream2.setf(ios::fixed); in_stream2.setf(ios::showpoint); in_stream2.precision(2); while (!in_stream2.eof()) // reads file to end of file { while((price== (price*1.00)) && (itemnum == (itemnum*1))) { in_stream2 >> itemnum >> price; itemnum++; price++; curr_total= price++; in_stream2 >> curr_total; cin.clear(); // allows more reading cin >> next; return itemnum, price; } } out_stream3.setf(ios::fixed); out_stream3.setf(ios::showpoint); out_stream3.precision(2); while (!out_stream3.eof()) // reads file to end of file { while((price== (price*1.00)) && (itemnum == (itemnum*1))) { out_stream3 << itemnum << price; itemnum++; price++; curr_total= price++; out_stream3 << curr_total; cin.clear(); // allows more reading cin >> next; return itemnum, price; } } in_stream4.setf(ios::fixed); in_stream4.setf(ios::showpoint); in_stream4.precision(2); while (!in_stream4.eof()) { in_stream4 >> itemnum >> price >> curr_total; cin.clear(); cin >> next; } out_stream5.setf(ios::fixed); out_stream5.setf(ios::showpoint); out_stream5.precision(2); out_stream5 <<setw(5)<< " itemnum " <<setw(5)<<" price "<<setw(5)<<" curr_total " <<endl; // sends items and prices to receipt.txt out_stream5 << setw(5) << itemnum << setw(5) <<price << setw(5)<< curr_total; // sends items and prices to receipt.txt out_stream5 << " You have a total of " << wrong++ << " errors " << endl; in_stream.close(); // closing files. out_stream1.close(); in_stream2.close(); out_stream3.close(); in_stream4.close(); out_stream5.close(); system("pause"); }

    Read the article

  • Are there no downsides to NetApp SAN solutions other than price?

    - by flashkube
    We have pretty much decided on a NetApp solution for our first SAN. Given that, I've been tasked with finding as much reason not to go with NetApp as I can. We like to do this A) so we know what we're getting into and B) so we aren't clouded by the inevitable post vendor demo euphoria. I have scoured the internet for cons and can only find one: price. Have you had a nightmare experience with NetApp that you just want to get off your chest? Please, only people with NetApp experience. Thank you!

    Read the article

  • Case insensitive duplicates SQL

    - by hdx
    So I have a users table where the user.username has many duplicates like: username and Username and useRnAme john and John and jOhn That was a bug and these three records should have been only one. I'm trying to come up with a SQL query that lists all of these cases ordered by their creation date, so ideally the result should be something like this: username jan01 useRnAme jan02 Username jan03 john feb01 John feb02 jOhn feb03 Any suggestions will be much appreciated

    Read the article

  • nested form collection_select new value overwriting previous selected values

    - by bharath
    Nested form <%= nested_form_for(@bill) do |f| %> <p><%= f.link_to_add "Add Product", :bill_line_items %> </p> Partial of bill line items <%= javascript_include_tag 'bill'%> <%= f.hidden_field :bill_id %> <%- prices = Hash[Product.all.map{|p| [p.id, p.price]}].to_json %> <%= f.label :product_id %> <%= f.collection_select :product_id ,Product.all,:id,:name, :class => 'product', :prompt => "Select a Product", input_html: {data: {prices: prices}}%> <br/ > <%= f.label :price, "price"%> <%= f.text_field :price, :size=>20, :class =>"price" %><br/> bill.js jQuery(document).ready(function(){ jQuery('.product').change(function() { var product_id = jQuery(this).val(); var price = eval(jQuery(this).data("prices"))[product_id]; jQuery('.price').val(price); }); }); Rails 3.2 Issue: Second click on Add Product & on selecting the product When we select the second product the price of second product is overwriting on the price of the first selected product. Request help.

    Read the article

  • problem processing xml in flex3

    - by john
    Hi All, First time here asking a question and still learning on how to format things better... so sorry about the format as it does not look too well. I have started learning flex and picked up a book and tried to follow the examples in it. However, I got stuck with a problem. I have a jsp page which returns xml which basically have a list of products. I am trying to parse this xml, in other words go through products, and create Objects for each product node and store them in an ArrayCollection. The problem I believe I am having is I am not using the right way of navigating through xml. The xml that is being returned from the server looks like this: <?xml version="1.0" encoding="ISO-8859-1"?><result type="success"> <products> <product> <id>6</id> <cat>electronics</cat> <name>Plasma Television</name> <desc>65 inch screen with 1080p</desc> <price>$3000.0</price> </product> <product> <id>7</id> <cat>electronics</cat> <name>Surround Sound Stereo</name> <desc>7.1 surround sound receiver with wireless speakers</desc> <price>$1000.0</price> </product> <product> <id>8</id> <cat>appliances</cat> <name>Refrigerator</name> <desc>Bottom drawer freezer with water and ice on the door</desc> <price>$1200.0</price> </product> <product> <id>9</id> <cat>appliances</cat> <name>Dishwasher</name> <desc>Large capacity with water saver setting</desc> <price>$500.0</price> </product> <product> <id>10</id> <cat>furniture</cat> <name>Leather Sectional</name> <desc>Plush leather with room for 6 people</desc> <price>$1500.0</price> </product> </products></result> And I have flex code that tries to iterate over products like following: private function productListHandler(e:JavaFlexStoreEvent):void { productData = new ArrayCollection(); trace(JavaServiceHandler(e.currentTarget).response); for each (var item:XML in JavaServiceHandler(e.currentTarget).response..product ) { productData.addItem( { id:item.id, item:item.name, price:item.price, description:item.desc }); } } with trace, I can see the xml being returned from the server. However, I cannot get inside the loop as if the xml was empty. In other words, JavaServiceHandler(e.currentTarget).response..product must be returning nothing. Can someone please help/point out what I could be doing wrong. My JavaServiceHandler class looks like this: package com.wiley.jfib.store.data { import com.wiley.jfib.store.events.JavaFlexStoreEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.net.URLLoader; import flash.net.URLRequest; public class JavaServiceHandler extends EventDispatcher { public var serviceURL:String = ""; public var response:XML; public function JavaServiceHandler() { } public function callServer():void { if(serviceURL == "") { throw new Error("serviceURL is a required parameter"); return; } var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, handleResponse); loader.load(new URLRequest(serviceURL)); // var httpService:HTTPService = new HTTPService(); // httpService.url = serviceURL; // httpService.resultFormat = "e4x"; // httpService.addEventListener(Event.COMPLETE, handleResponse); // httpService.send(); } private function handleResponse(e:Event):void { var loader:URLLoader = URLLoader(e.currentTarget); response = XML(loader.data); dispatchEvent(new JavaFlexStoreEvent(JavaFlexStoreEvent.DATA_LOADED) ); // var httpService:HTTPService = HTTPService(e.currentTarget); // response = httpService.lastResult.product; // dispatchEvent(new JavaFlexStoreEvent(JavaFlexStoreEvent.DATA_LOADED) ); } } } Even though I refer to this as mine and it is not in reality. This is from a Flex book as a code sample which does not work, go figure. Any help is appreciated. Thanks john

    Read the article

  • Query Access and VB.NET

    - by yae
    Hi all: I have 2 tables: "products" and "pieces" PRODUCTS idProd product price PIECES id idProdMain idProdChild quant idProdMain and idProdChild are vinculated with the table: "products". Other considerations is that 1 product can have some pieces and 1 product can be a piece. Price product equal a sum of quantity * price of all their pieces. EXAMPLE: TABLE PRODUCTS (idProd - product - price) 1 - Computer - 300€ 2 - Hard Disk - 100€ 3 - Memory - 50€ 4 - Main Board - 100€ 5 - Software - 50€ 6 - CDroms 100 un. - 30€ TABLE PIECES (id - idProdMain - idProdChild - Quant.) 1 - 1 - 2 - 1 2 - 1 - 3 - 2 3 - 1 - 4 - 1 WHAT I NEED? I need update the price of the main product when the price of the product child (piece) is changed. Following the previous example, if I change the price of this product "memory" (is a piece too) to 60€, then product "Computer" will must change his price to 320€ How I can do it using queries? Already I have tried this to obatin the price of the main product, but not runs. This query not returns any value SELECT Sum(products.price*pieces.quant) AS Expr1 FROM products LEFT JOIN pieces ON (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdMain) WHERE (((pieces.idProdMain)=5));

    Read the article

  • Permission problem - users can't access main index.php anymore

    - by JMan
    From /var/www, I executed "chmod -R 774 ." and now none of my .php scripts are accessible. From my browser, when I type in mydomain.com or mydomain.com/test2.php or mydomain.com/test.php, I get the 403 Forbidden error msg. So, I changed the permissions of 3 of the .php scripts to 775, but this didn't help either. Here is the output from "ls -la /var/www": drwxrwxr-- 6 john wheel 4096 2010-09-29 17:38 . drwxr-xr-x 14 root root 4096 2010-09-27 21:15 .. -rwxrwxr-x 1 john wheel 3353 2010-09-29 05:29 index.php -rwxrwxr-x 1 john wheel 124 2010-09-27 23:12 .htaccess -rwxrwxr-x 1 john john 34 2010-09-29 17:39 test2.php -rwxrwxr-x 1 john john 26 2010-09-28 22:08 test.php The .htaccess file does a URL mod_rewrite so typing in index.php is not needed. Thanks for your help.

    Read the article

  • How to get the last element by date of each "type" in LINQ or TSQL

    - by Mauro
    Imagine to have a table defined as CREATE TABLE [dbo].[Price]( [ID] [int] NOT NULL, [StartDate] [datetime] NOT NULL, [Price] [int] NOT NULL ) where ID is the identifier of an action having a certain Price. This price can be updated if necessary by adding a new line with the same ID, different Price, and a more recent date. So with a set of a data like ID StartDate Price 1 01/01/2009 10 1 01/01/2010 20 2 01/01/2009 10 2 01/01/2010 20 How to obtain a set like the following? 1 01/01/2010 20 2 01/01/2010 20

    Read the article

  • Excel cell references not updating when referenced cells are sorted.

    - by Robert Kerr
    There are two tables, each with 75 entries. Each entry in the 2nd table calls an entry in the first table a parent. One of my 2nd table columns contains the "Parent Price", referencing the Price column in the first table, such as "=E50". Table 1 Id Price 1001 79.25 1002 8.99 1003 24.50 Table 2 Id Price Parent Price 2001 50.00 =B2 2002 2.81 =B3 2003 12.00 =B4 The problem is when I sort the first table, none of the second table's "Parent Price" references are updated, and still point to the =E50 cell, which is no longer the correct parent. I don't want to have to name the cells if possible. What style of formula do I enter in the parent price column so that they properly track the cells in the referenced table?

    Read the article

  • Help Me With This Access Query

    - by yae
    I have 2 tables: "products" and "pieces" PRODUCTS idProd product price PIECES id idProdMain idProdChild quant idProdMain and idProdChild are related with the table: "products". Other considerations is that 1 product can have some pieces and 1 product can be a piece. Price product equal a sum of quantity * price of all their pieces. "Products" table contains all products (p EXAMPLE: TABLE PRODUCTS (idProd - product - price) 1 - Computer - 300€ 2 - Hard Disk - 100€ 3 - Memory - 50€ 4 - Main Board - 100€ 5 - Software - 50€ 6 - CDroms 100 un. - 30€ TABLE PIECES (id - idProdMain - idProdChild - Quant.) 1 - 1 - 2 - 1 2 - 1 - 3 - 2 3 - 1 - 4 - 1 WHAT I NEED? I need update the price of the main product when the price of the product child (piece) is changed. Following the previous example, if I change the price of this product "memory" (is a piece too) to 60€, then product "Computer" will must change his price to 320€ How I can do it using queries? Already I have tried this to obatin the price of the main product, but not runs. This query not returns any value: SELECT Sum(products.price*pieces.quant) AS Expr1 FROM products LEFT JOIN pieces ON (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdMain) WHERE (((pieces.idProdMain)=5)); MORE INFO The table "products" contains all the products to sell that it is in the shop. The table "pieces" is to take a control of the compound products. To know those who are the products children. For example of compound product: computers. This product is composed by other products (motherboard, hard disk, memory, cpu, etc.)

    Read the article

  • insert multiple elements in string in python

    - by Anurag Sharma
    I have to build a string like this { name: "john", url: "www.dkd.com", email: "[email protected]" } where john, www.dkd.com and [email protected] are to be supplied by variables I tried to do the following s1 = "{'name:' {0},'url:' {1},'emailid:' {2}}" s1.format("john","www.dkd.com","[email protected]") I am getting the following error Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: "'name" Dont able to understand what I am doing wrong

    Read the article

  • Jqyery Bugs?? Long decimal number after two numbers multiply...

    - by Jerry
    Hi all I am working on a shopping site and I am trying to calculate the subtotal of products. I got my price from a array and quantity from getJSON response array. Two of them multiply comes to my subtotal. I can change the quantity and it will comes out different subtotal. However,when I change the quantity to certain number, the final subtotal is like 259.99999999994 or some long decimal number. I use console.log to check the $price and $qty. Both of them are in the correct format ex..299.99 and 6 quantity.I have no idea what happen. I would appreciate it if someone can help me about it. Here is my Jquery code. $(".price").each(function(index, price){ $price=$(this); //get the product id and the price shown on the page var id=$price.closest('tr').attr('id'); var indiPrice=$($price).html(); //take off $ indiPrice=indiPrice.substring(1) //make sure it is number format var aindiPrice=Number(indiPrice); //push into the array productIdPrice[id]=(aindiPrice); var url=update.php $.getJSON( url, {productId:tableId, //tableId is from the other jquery code which refers to qty:qty}, productId function(responseProduct){ $.each(responseProduct, function(productIndex, Qty){ //loop the return data if(productIdPrice[productIndex]){ //get the price from the previous array we create X Qty newSub=productIdPrice[productIndex]*Number(Qty); //productIdPrice[productIndex] are the price like 199.99 or 99.99 // Qty are Quantity like 9 or 10 or 3 sum+=newSub; newSub.toFixed(2); //try to solve the problem with toFixed but didn't work console.log("id: "+productIdPrice[productIndex]) console.log("Qty: "+Qty); console.log(newSub); **//newSub sometime become XXXX.96999999994** }; Thanks again!

    Read the article

  • Compare rows between 2 tables

    - by arthur
    I am new to SQL and I need to build a database for a grocery store(not real, just a course assignment) i have two fields from two different tables - supplied price - the price that the store buys from the supplier and price that is given to the customers How can I make a constraint that insures that supplied price is lower then the price that is given to the customers? The relevant tables that I have are: CREATE TABLE Supplied_Products( [Supplier ID] Int NOT NULL Foreign Key References Suppliers, [Product ID] Int NOT NULL Foreign Key References Products, Price Float NOT NULL, CHECK (Price0), Constraint PK_Supplied_Products PRIMARY KEY([Supplier ID] ,[Product ID]) ) CREATE TABLE Products( [Product-ID] Int NOT NULL PRIMARY KEY, [Product Name] Varchar(20) NOT NULL, Price Float NOT NULL, [Category-Name] Varchar(20) NOT NULL Foreign Key References Categories, [Weight] Float NOT NULL, [Is Refrigirated] Varchar(1) DEFAULT 'N' CHECK ([Is Refrigirated] in('Y','N')),/* Is Refrigirated can be only Y-yes or N-no*/ CHECK (Price 0) )

    Read the article

  • Jquery Bugs?? Long decimal number after two numbers multiply...

    - by Jerry
    Hi all I am working on a shopping site and I am trying to calculate the subtotal of products. I got my price from a array and quantity from getJSON response array. Two of them multiply comes to my subtotal. I can change the quantity and it will comes out different subtotal. However,when I change the quantity to certain number, the final subtotal is like 259.99999999994 or some long decimal number. I use console.log to check the $price and $qty. Both of them are in the correct format ex..299.99 and 6 quantity.I have no idea what happen. I would appreciate it if someone can help me about it. Here is my Jquery code. $(".price").each(function(index, price){ $price=$(this); //get the product id and the price shown on the page var id=$price.closest('tr').attr('id'); var indiPrice=$($price).html(); //take off $ indiPrice=indiPrice.substring(1) //make sure it is number format var aindiPrice=Number(indiPrice); //push into the array productIdPrice[id]=(aindiPrice); var url=update.php $.getJSON( url, {productId:tableId, //tableId is from the other jquery code which refers to qty:qty}, productId function(responseProduct){ $.each(responseProduct, function(productIndex, Qty){ //loop the return data if(productIdPrice[productIndex]){ //get the price from the previous array we create X Qty newSub=productIdPrice[productIndex]*Number(Qty); //productIdPrice[productIndex] are the price like 199.99 or 99.99 // Qty are Quantity like 9 or 10 or 3 sum+=newSub; newSub.toFixed(2); //try to solve the problem with toFixed but didn't work console.log("id: "+productIdPrice[productIndex]) console.log("Qty: "+Qty); console.log(newSub); **//newSub sometime become XXXX.96999999994** }; Thanks again!

    Read the article

  • PHP: prepared statement, IF statement help needed

    - by JGreig
    I have the following code: $sql = "SELECT name, address, city FROM tableA, tableB WHERE tableA.id = tableB.id"; if (isset($price) ) { $sql = $sql . ' AND price = :price '; } if (isset($sqft) ) { $sql = $sql . ' AND sqft >= :sqft '; } if (isset($bedrooms) ) { $sql = $sql . ' AND bedrooms >= :bedrooms '; } $stmt = $dbh->prepare($sql); if (isset($price) ) { $stmt->bindParam(':price', $price); } if (isset($sqft) ) { $stmt->bindParam(':price', $price); } if (isset($bedrooms) ) { $stmt->bindParam(':bedrooms', $bedrooms); } $stmt->execute(); $result_set = $stmt->fetchAll(PDO::FETCH_ASSOC); What I notice is the redundant multiple IF statements I have. Question: is there any way to clean up my code so that I don't have these multiple IF statements for prepared statements?

    Read the article

  • mysql left join

    - by user1019538
    I have two table one is index and another is the price structure as under table : index : column : trandate ,indexcode Table : price : Column: trandate,symbol,price i want to know the missing price. I issue the query select i.trandate,i.indexcode,p.trandate,p.price from index i left join price p on i.trandate = p.trandate where p.symbol='ABC' and indexcode="New" the above query does not show the null date even though various price in missing in price table. Only reason i understand is that the index table does not have the symbol field that's why...but as per theory if you want to show all the rows of one table and only the match value of another table then use the left or right join query...please anybody can help

    Read the article

  • Another Spring + Hibernate + JPA question

    - by Albinoswordfish
    I'm still struggling with changing my Spring Application to use Hibernate with JPA to do database activities. Well apparently from a previous post I need an persistence.xml file. However do I need to make changes to my current DAO class? public class JdbcProductDao extends Dao implements ProductDao { /** Logger for this class and subclasses */ protected final Log logger = LogFactory.getLog(getClass()); public List<Product> getProductList() { logger.info("Getting products!"); List<Product> products = getSimpleJdbcTemplate().query( "select id, description, price from products", new ProductMapper()); return products; } public void saveProduct(Product prod) { logger.info("Saving product: " + prod.getDescription()); int count = getSimpleJdbcTemplate().update( "update products set description = :description, price = :price where id = :id", new MapSqlParameterSource().addValue("description", prod.getDescription()) .addValue("price", prod.getPrice()) .addValue("id", prod.getId())); logger.info("Rows affected: " + count); } private static class ProductMapper implements ParameterizedRowMapper<Product> { public Product mapRow(ResultSet rs, int rowNum) throws SQLException { Product prod = new Product(); prod.setId(rs.getInt("id")); prod.setDescription(rs.getString("description")); prod.setPrice(new Double(rs.getDouble("price"))); return prod; } } } Also my Product.Java is below public class Product implements Serializable { private int id; private String description; private Double price; public void setId(int i) { id = i; } public int getId() { return id; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String toString() { StringBuffer buffer = new StringBuffer(); buffer.append("Description: " + description + ";"); buffer.append("Price: " + price); return buffer.toString(); } } I guess my question would be, How would my current classes change after using Hibernate + JPA with an Entity Manager

    Read the article

  • Rails 3: How not to include column's name in a validation message without plugins ?

    - by Misha Moroshko
    I have the following validation: validates_presence_of :price, :message => "my message" and I get the following error when the price is blank: Price my message Is there a way not to include the column name (price) in the message ? I tried to do: validates_presence_of :price, :message => "^ my message" as suggested here, but it didn't work for me. I got the following message: Price ^ my message

    Read the article

  • Help Me With This MS-Access Query

    - by yae
    I have 2 tables: "products" and "pieces" PRODUCTS idProd product price PIECES id idProdMain idProdChild quant idProdMain and idProdChild are related with the table: "products". Other considerations is that 1 product can have some pieces and 1 product can be a piece. Price product equal a sum of quantity * price of all their pieces. "Products" table contains all products (p EXAMPLE: TABLE PRODUCTS (idProd - product - price) 1 - Computer - 300€ 2 - Hard Disk - 100€ 3 - Memory - 50€ 4 - Main Board - 100€ 5 - Software - 50€ 6 - CDroms 100 un. - 30€ TABLE PIECES (id - idProdMain - idProdChild - Quant.) 1 - 1 - 2 - 1 2 - 1 - 3 - 2 3 - 1 - 4 - 1 WHAT I NEED? I need update the price of the main product when the price of the product child (piece) is changed. Following the previous example, if I change the price of this product "memory" (is a piece too) to 60€, then product "Computer" will must change his price to 320€ How I can do it using queries? Already I have tried this to obtain the price of the main product, but not runs. This query not returns any value: SELECT Sum(products.price*pieces.quant) AS Expr1 FROM products LEFT JOIN pieces ON (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdChild) AND (products.idProd = pieces.idProdMain) WHERE (((pieces.idProdMain)=5)); MORE INFO The table "products" contains all the products to sell that it is in the shop. The table "pieces" is to take a control of the compound products. To know those who are the products children. For example of compound product: computers. This product is composed by other products (motherboard, hard disk, memory, cpu, etc.)

    Read the article

  • How to get notified of changes on a read only table? (I.e., Price drop notifications.)

    - by mirthlab
    Let's say I have these tables/models: Product - id - last_updated_date - name - price User - id - name Wishlist - id - user_id - product_id The Product table has a few million records and is being updated automatically each night via a data import (inserting into a new table, dropping the old one). I basically have read-only access to that table/model. If a product is on a user's wishlist and the price drops, I'd like to be able to notify that user. What methods can be used to do this? I have a couple of ideas: Keep track of the Product.last_updated_date in the wishlist model and periodically poll the product table to see if it has been updated. This sounds like a horrible/non-scaleable solution. Some sort of Postgres View or Function that triggers when the Product table is updated? I'm new to postgres so I'm not yet sure if this is even possible. Something amazing that you will suggest that I haven't thought of :) Any help in the right direction is greatly appreciated!

    Read the article

  • Why did the following linq to sql query generate a subquery?

    - by Xaisoft
    I did the following query: var list = from book in books where book.price > 50 select book; list = list.Take(50); I would expect the above to generate something like: SELECT top 50 id, title, price, author FROM Books WHERE price > 50 but it generates: SELECT [Limit1].[C1] as [C1] [Limit1].[id] as [Id], [Limit1].[title] as [title], [Limit1].[price] as [price], [Limit1].[author] FROM (SELECT TOP (50) [Extent1].[id] as as [Id], [Extent1].[title] as [title], [Extent1].[price] as [price], [Extent1].[author] as [author] FROM Books as [Extent1] WHERE [Extent1].[price] > 50 ) AS [Limit1] Why does the above linq query generate a subquery and where does the C1 come from?

    Read the article

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