Search Results

Search found 4215 results on 169 pages for 'andrew price'.

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

  • can't update rails model

    - by Tristan
    Hi there, I'm rather new to rails. I have a controller that's attempting to update a model using the following code: @test = Product.find(1) @test.increment!(:price) It does successfully retrieve the Product from the database, but does not update the price attribute. Does anyone know why this might be the case, or how I could get more feedback on what the problem is? Thanks a bunch! Tristan edit: price is an integer with value 0. I get the same problem when I set the price with @test.price=50 and then @test.save .

    Read the article

  • Intersecting boundaries with lucene

    - by Silvio Donnini
    I'm using Lucene, and I'm trying to find a way to index and retrieve documents that have a ranged property. For example I have: Document 1: Price:[30 TO 50] Document 2: Price:[45 TO 60] Document 3: Price:[60 TO 70] And I would like to search for all the documents whose ranges intersect a specific interval, in the above example, if I search for Price in [55 TO 65] I should get Document 2 and Document 3 as results. I don't think NumericRangeQueries alone would do the trick, I need to work on the index with something similar to R-trees, but are they implemented in Lucene? Also, I suppose that what I need should be a subclass of MultiTermQuery, because the query Price in [55 TO 65] has two boundaries, but I don't see anything suitable among MultiTermQuery's subclasses. Any help is appreciated, thanks, Silvio P.S. I'm using Lucene 2.9.0, but I can update to the latest release if needed.

    Read the article

  • Pulling data from a text file to generate a report

    - by Edmond
    Have a program in Access, using VBA. I need to come up with an If statement to pull data from a text file. The data is a list of procedures and prices. I have to pull the prices from the text file to show in a report how much each procedure costs. ID PID M1 M2 M3 Total 1 11120390(procedure) 2 180(price) 360 180 540 1080(total Price) 3 2 1 3 6(Units sold) 4 5 200(Price) 200 600 800 1600(total price) 6 1 3 4 8(Units Sold) 7 11120390(procedure) The table in the text file is setup like this and I need to Pull the procedure number and the price of each procedure from the text file.

    Read the article

  • Editting ForeignKey from "child" table

    - by profuel
    I'm programming on py with django. I have models: class Product(mymodels.Base): title = models.CharField() price = models.ForeignKey(Price) promoPrice = models.ForeignKey(Price, related_name="promo_price") class Price(mymodels.Base): value = models.DecimalField(max_digits=10, decimal_places=3) taxValue = models.DecimalField("Tax Value", max_digits=10, decimal_places=3) valueWithTax = models.DecimalField("Value with Tax", max_digits=10, decimal_places=3) I want to see INPUTs for both prices when editing product, but cannot find any possibility to do that. inlines = [...] works only from Price to Product, which is stupid in this case. Thanx for adnvance.

    Read the article

  • Jquery .Filter Function Question

    - by Matias
    Hi Guys, This is kindof a simple question, however, I don´t seem to figure out how to do it: I´ve got a slider filtering some stuff $("#price").slider( { range: true, step: 5, change: function(e,ui) { $('total').filter(function(index) { return ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1))); }).parents('div.item').hide(); } }); Basically, I want an array with index of each of elements which have been filtered so I can reuse them for other purpose. I was thinking of editing filter function to something like: $('total').filter(function(index) { var matches = ( ($("#price").slider("values", 0)) <= $(this).text() <= ($("#price").slider("values", 1))); return matches; }.myFunction(matches){ //do some stuff here with matched elements } This is not correct, your help is greatly appreciated.

    Read the article

  • Query a column and a calculation of columns at the same time PostgreSQL

    - by pablo
    Hi I have two tables, Products and BundleProducts that have o2o relation with BaseProducts. A BundleProduct is a collection of Products using a m2m realtion to the Products table. Products has a price column and the price of a BundleProduct is calculated as the sum of the prices of its Products. BaseProducts have columns like name and description so I can query it to get both Products and BundleProducts. Is it possible to query and sort by price both for the price column of the Products and calculated price of the BundleProducts? Thanks

    Read the article

  • Rails creating and updating 2 model records simultaneously

    - by LearnRails
    I have 2 tables product and history product table id name type price location 1 abc electronics $200 aisle1 history table id product_id status 1 1 price changed from $200 to $180 Whenever the product price or location is updated by a user by hitting the update button, 1) the changes should be automatically be reflected in the history status column without the user having to enter that manually. if the price is updated from 200 to 180 then a new history row will be created with new id and the status column will say ' price changed from $200 to $180' if the location is updated from aisle1 to aisle 2 then status displays ' loc changed from ailse1 to aisle 2' I tried to @product = Product.new(params[:product]) @history= History.new(params[:history]) if @product.save @history.new(attributes) == I am not sure of whether this approach is correct I would really appreciate if someone could tell me how the history can be automatically updated in this case.

    Read the article

  • Update query (access & vb.net)

    - by yae
    Hi: I have to update some fields of a table of access according to the value of parameter. If this paramter is "true" I need to update. Table idInvoice price percentageTax1 tax1 percentageTax2 tax2 total Example values: idinvoice: 12300 price: 100 € percentageTax1: 10 % tax1= 10€ percentageTax2: 5 % tax2: 5€ total: 115 € (result: 100€+10€+5€) Ok. If the parameter on that I have commented before is "true" I must update the percentages and then update the total. I need to replace the "old" percentages by new percent. Ok I can do it in 3 queries: update invocies set percentageTax1=20,tax1=price *(percentageTax1/100) where idInvoice=@number and percentageTax1=10 update invocies set percentageTax2=7,tax2=price *(percentageTax2/100) where idInvoice=@number and percentageTax2=5 update invocies set total=price+tax1+tax2 where idInvoice=@number . But my question is: is there any an alternative to do this in 1 query?

    Read the article

  • Parsing with BeautifulSoup, error message TypeError: coercing to Unicode: need string or buffer, NoneType found

    - by Samsun Knight
    so I'm trying to scrape an Amazon page for data, and I'm getting an error when I try to parse for where the seller is located. Here's my code: #getting the html request = urllib2.Request('http://www.amazon.com/gp/offer-listing/0393934241/') opener = urllib2.build_opener() #hiding that I'm a webscraper request.add_header('User-Agent', 'Mozilla/5 (Solaris 10) Gecko') #opening it up, putting into soup form html = opener.open(request).read() soup = BeautifulSoup(html, "html5lib") #parsing for the seller info sellers = soup.findAll('div', {'class' : 'a-row a-spacing-medium olpOffer'}) for eachseller in sellers: #parsing for price price = eachseller.find('span', {'class' : 'a-size-large a-color-price olpOfferPrice a-text-bold'}) #parsing for shipping costs shippingprice = eachseller.find('span' , {'class' : 'olpShippingPrice'}) #parsing for condition condition = eachseller.find('span', {'class' : 'a-size-medium'}) #parsing for seller name sellername = eachseller.find('b') #parsing for seller location location = eachseller.find('div', {'class' : 'olpAvailability'}) #printing it all out print "price, " + price.string + ", shipping price, " + shippingprice.string + ", condition," + condition.string + ", seller name, " + sellername.string + ", location, " + location.string I get the error message, pertaining to the 'print' command at the end, "TypeError: coercing to Unicode: need string or buffer, NoneType found" I know that it's coming from this line - location = eachseller.find('div', {'class' : 'olpAvailability'}) - because the code works fine without that line, and I know that I'm getting NoneType because the line isn't finding anything. Here's the html from the section I'm looking to parse: <*div class="olpAvailability"> In Stock. Ships from WI, United States. <*br/><*a href="/gp/aag/details/ref=olp_merch_ship_9/175-0430757-3801038?ie=UTF8&amp;asin=0393934241&amp;seller=A1W2IX7T37FAMZ&amp;sshmPath=shipping-rates#aag_shipping">Domestic shipping rates</a> and <*a href="/gp/aag/details/ref=olp_merch_return_9/175-0430757-3801038?ie=UTF8&amp;asin=0393934241&amp;seller=A1W2IX7T37FAMZ&amp;sshmPath=returns#aag_returns">return policy</a>. <*/div> (but without the stars - just making sure the HTML doesn't compile out of code form) I don't see what's the problem with the 'location' line of code, or why it's not pulling the data I want. Help?

    Read the article

  • Use Session state within pLinq queries

    - by Dima
    Hi, I have a fairly simple Linq query (simplified code): dim x = From Product In lstProductList.AsParallel Order By Product.Price.GrossPrice Descending Select Product Product is a class. Product.Price is a child class and GrossPrice is one of its properties. In order to work out the price I need to use Session("exchange_rate"). So for each item in lstProductList there's a function that does the following: NetPrice=NetPrice * Session("exchange_rate") (and then GrossPrice returns NetPrice+VatAmount) No matter what I've tried I cannot access session state. I have tried HttpContext.Current - but that returns Nothing. I've tried Implements IRequiresSessionState on the class (which helps in a similar situation in generic http handlers [.ashx]) - no luck. I'm using simple InProc session state mode. Exchange rate has to be user specific. What can I do? I'm working with: web development, .Net 4, VB.net Step-by-step: page_load (in .aspx) dim objSearch as new SearchClass() dim output = objSearch.renderProductsFound() then in objSearch.renderProductsFound: lstProductList.Add(objProduct(1)) ... lstProductList.Add(objProduct(n)) dim x = From Product In lstProductList.AsParallel Order By Product.Price.GrossPrice Descending Select Product In Product.Price.GrossPrice Get : return me.NetPrice+me.VatAmount In Product.Price.NetPrice Get: return NetBasePrice*Session("exchange_rate") Again, simplified code, too much to paste in here. Works fine if I unwrap the query into For loops.

    Read the article

  • Jquery and XML - How to add the value of nodes

    - by Matias
    Hi Experts, This may be a simple question though can´t figure out how to do it. I am parsing an XML with Jquery Ajax. It contains dates and rates The XML looks something like <rate> <date>Today</date> <price>66</price> </rate> <rate> <date>Tomorrow</date> <price>99</price> </rate> I simply want to figure out how to calculate the total price of both days Today and Tomorrow. Thought that by using Javascript Number it will simply return the total value of the nodes.. $(xml).find("rate").each(function() { $(this).find("price").each(function() { $("#TOTALPRICE").append(Number($(this).text())); } } //output is: 6699 However, it´s just concatenating the values both not adding them. //output is: 6699 I greatly appreciate your help !! Thanks

    Read the article

  • jQuery changing fields to substring of related field

    - by Katherine
    Another jquery calculation question. I've this, which is sample code from the plugin site that I am playing with to get this working: function recalc(){ $("[id^=total_item]").calc( "qty * price", { qty: $("input[name^=qty_item_]"), price: $("input[name^=price_item_]"), }, function (s){ return s.toFixed(2);}, function ($this){ var sum = $this.sum(); $("#grandTotal").val( // round the results to 2 digits sum.toFixed(2) ); } ); } Changes in the price fields cause the totals to update: $("input[name^=price_item_]").bind("keyup", recalc); recalc(); Problem is I won't know the value of the price fields, they will be available to me only as a substring of values entered by the user, call it 'itemcode'. There will be a variable number of items, based on a php query. I've come up with this to change the price based on the itemcode: $("input[name^='itemcode_item_1']").keyup(function () { var codeprice = this.value.substring(2,6); $("input[name^='price_item_1']").val(codeprice); }); $("input[name^='itemcode_item_2']").keyup(function () { var codeprice = this.value.substring(2,6); $("input[name^='price_item_2']").val(codeprice); }); However while it does that, it also stops the item_total from updating. Also, I feel there must be a way to not need to write a numbered function for each item on the list. However when I just use $("input[name^='itemcode_item_']") updating any itemcode field updates all price fields, which is not good. Can anyone point me in the right direction? I know I am a bit clueless here, but javascript of any kind is not my thing.

    Read the article

  • How do I show information to users belonging to different groups (web) in modx

    - by Gaurav Sharma
    Hello Everyone, I have created a website using modx evolution v1.0.2. The website that I have developed has 12 different types of users (categorized in groups). Each user will be shown a different price depending on the group to which he belongs. Till now I have been able to fetch the group name of current logged in user (created a snippet for that), but how can I achieve the above mentioned functionality so that each user should be able to see only the price that I have coded according to his group. For example: If a user is associated with the 'ocassional' group then he should be shown the price as , say, 50 bucks and if a user is associated with the 'regular' group then he should be shown the price as, say, 40 bucks I can easily do this by coding a single snippet for every product's variant, but there are a lot of variants (more than 100 and growing). I have created a resource(page) for every product and it's variant. Every variant has a price. It is this price that I want to be shown according to the logged in user group membership. I hope I am able to explain my query clearly. Please help me do this functionality. Thanks

    Read the article

  • How does Select statement works in a Dynamic Linq Query?

    - by Richard77
    Hello, 1) I've a Product table with 4 columns: ProductID, Name, Category, and Price. Here's the regular linq to query this table. public ActionResult Index() { private ProductDataContext db = new ProductDataContext(); var products = from p in db.Products where p.Category == "Soccer" select new ProductInfo { Name = p.Name, Price = p.Price} return View(products); } Where ProductInfo is just a class that contains 2 properties (Name and Price). The Index page Inherits ViewPage - IEnumerable - ProductInfo. Everything works fine. 2) To dynamicaly execute the above query, I do this: Public ActionResult Index() { var products = db.Products .Where("Category = \"Soccer\"") .Select(/* WHAT SOULD I WRITE HERE TO SELECT NAME & PRICE?*/) return View(products); } I'm using both 'System.Lind.Dynamic' namespace and the DynamicLibrary.cs (downloaded from ScottGu blog). Here are my questions: What expression do I use to select only Name and Price? (Most importantly) How do I retrieve the data in my view? (i.e. What type the ViewPage inherits? ProductInfo?)

    Read the article

  • database design suggestion needed

    - by JMSA
    I need to design a table for daily sales of pharmaceutical products. There are hundreds of types of products available {Name, code}. Thousands of sales-persons are employed to sell those products{name, code}. They collect products from different depots{name, code}. They work in different Areas - Zones - Markets - Outlets, etc. {All have names and codes} Each product has various types of prices {Production Price, Trade Price, Business Price, Discount Price, etc.}. And, sales-persons are free to choose from those combination to estimate the sales price. The problem is, daily sales requires huge amount of data-entry. Within couple of years there may be gigabytes of data (if not terabytes). If I need to show daily, weekly, monthly, quarterly and yearly sales reports there will be various types of sql queries I shall need. This is my initial design: Product {ID, Code, Name, IsActive} ProductXYZPriceHistory {ID, ProductID, Date, EffectDate, Price, IsCurrent} SalesPerson {ID, Code, Name, JoinDate, and so on..., IsActive} SalesPersonSalesAraeaHistory {ID, SalesPersonID, SalesAreaID, IsCurrent} Depot {ID, Code, Name, IsActive} Outlet {ID, Code, Name, AreaID, IsActive} AreaHierarchy {ID, Code, Name, PrentID, AreaLevel, IsActive} DailySales {ID, ProductID, SalesPersonID, OutletID, Date, PriceID, SalesPrice, Discount, etc...} Now, apart from indexing, how can I normalize my DailySales table to have a fine grained design that I shall not need to change for years to come? Please show me a sample design of only the DailySales data-entry table (from which all types of reports would be queried) on the basis of above information. I don't need a detailed design advice. I just need an advice regarding only the DailySales table. Is there any way to break this particular table to achieve granularity?

    Read the article

  • SQL command to get field of a maximum value, without making two select

    - by António Capelo
    I'm starting to learn SQL and I'm working on this exercise: I have a "books" table which holds the info on every book (including price and genre ID). I need to get the name of the genre which has the highest average price. I suppose that I first need to group the prices by genre and then retrieve the name of the highest.. I know that I can get the results GENRE VS COST with the following: select b.genre, round(avg(b.price),2) as cost from books b group by b.genre; My question is, to get the genre with the highest AVG price from that result, do I have to make: select aux.genre from ( select b.genre, round(avg(b.price),2) as cost from books b group by b.genre ) aux where aux.cost = (select max(aux.cost) from ( select b.genre, round(avg(b.price),2) as cost from books l group by b.genre ) aux); Is it bad practice or isn't there another way? I get the correct result but I'm not confortable with creating two times the same selection. I'm not using PL SQL so I can't use variables or anything like that.. Any help will be appreciated. Thanks in advance!

    Read the article

  • background image not showing in html

    - by Registered User
    I am having following css <!DOCTYPE html > <html> <head> <meta charset="utf-8"> <title>Black Goose Bistro Summer Menu</title> <link href='http://fonts.googleapis.com/css?family=Marko+One' rel='stylesheet' type='text/css'> <style> body { font-family: Georgia, serif; font-size: 100%; line-height: 175%; margin: 0 15% 0; background-image:url(images/bullseye.png); } #header { margin-top: 0; padding: 3em 1em 2em 1em; text-align: center; } a { text-decoration: none; } h1 { font: bold 1.5em Georgia, serif; text-shadow: .1em .1em .2em gray; } h2 { font-size: 1em; text-transform: uppercase; letter-spacing: .5em; text-align: center; } dt { font-weight: bold; } strong { font-style: italic; } ul { list-style-type: none; margin: 0; padding: 0; } #info p { font-style: italic; } .price { font-family: Georgia, serif; font-style: italic; } p.warning, sup { font-size: small; } .label { font-weight: bold; font-variant: small-caps; font-style: normal; } h2 + p { text-align: center; font-style: italic; } ); </style> </head> <body> <div id="header"> <h1>Black Goose Bistro &bull; Summer Menu</h1> <div id="info"> <p>Baker's Corner, Seekonk, Massachusetts<br> <span class="label">Hours: Monday through Thursday:</span> 11 to 9, <span class="label">Friday and Saturday;</span> 11 to midnight</p> <ul> <li><a href="#appetizers">Appetizers</a></li> <li><a href="#entrees">Main Courses</a></li> <li><a href="#toast">Traditional Toasts</a></li> <li><a href="#dessert">Dessert Selection</a></li> </ul> </div> </div> <div id="appetizers"> <h2>Appetizers</h2> <p>This season, we explore the spicy flavors of the southwest in our appetizer collection.</p> <dl> <dt>Black bean purses</dt> <dd>Spicy black bean and a blend of mexican cheeses wrapped in sheets of phyllo and baked until golden. <span class="price">$3.95</span></dd> <dt class="newitem">Southwestern napoleons with lump crab &mdash; <strong>new item!</strong></dt> <dd>Layers of light lump crab meat, bean and corn salsa, and our handmade flour tortillas. <span class="price">$7.95</span></dd> </dl> </div> <div id="entrees"> <h2>Main courses</h2> <p>Big, bold flavors are the name of the game this summer. Allow us to assist you with finding the perfect wine.</p> <dl> <dt class="newitem">Jerk rotisserie chicken with fried plantains &mdash; <strong>new item!</strong></dt> <dd>Tender chicken slow-roasted on the rotisserie, flavored with spicy and fragrant jerk sauce and served with fried plantains and fresh mango. <strong>Very spicy.</strong> <span class="price">$12.95</span></dd> <dt>Shrimp sate kebabs with peanut sauce</dt> <dd>Skewers of shrimp marinated in lemongrass, garlic, and fish sauce then grilled to perfection. Served with spicy peanut sauce and jasmine rice. <span class="price">$12.95</span></dd> <dt>Grilled skirt steak with mushroom fricasee</dt> <dd>Flavorful skirt steak marinated in asian flavors grilled as you like it<sup>*</sup>. Served over a blend of sauteed wild mushrooms with a side of blue cheese mashed potatoes. <span class="price">$16.95</span></dd> </dl> </div> <div id="toast"> <h2>Traditional Toasts</h2> <p>The ultimate comfort food, our traditional toast recipes are adapted from <a href="http://www.gutenberg.org/files/13923/13923-h/13923-h.htm"><cite>The Whitehouse Cookbook</cite></a> published in 1887.</p> <dl> <dt>Cream toast</dt> <dd>Simple cream sauce over highest quality toasted bread, baked daily. <span class="price">$3.95</span></dd> <dt>Mushroom toast</dt> <dd>Layers of light lump crab meat, bean and corn salsa, and our handmade flour tortillas. <span class="price">$6.95</span></dd> <dt>Nun's toast</dt> <dd>Onions and hard-boiled eggs in a cream sauce over buttered hot toast. <span class="price">$6.95</span></dd> <dt>Apple toast</dt> <dd>Sweet, cinnamon stewed apples over delicious buttery grilled bread. <span class="price">$6.95</span></dd> </dl> </div> <div id="dessert"> <h2>Dessert Selection</h2> <p>Be sure to save room for our desserts, made daily by our own <a href="http://www.jwu.edu/college.aspx?id=19510">Johnson & Wales</a> trained pastry chef.</p> <dl> <dt class="newitem">Lemon chiffon cake &mdash; <strong>new item!</strong></dt> <dd>Light and citrus flavored sponge cake with buttercream frosting as light as a cloud. <span class="price">$2.95</span></dd> <dt class="newitem">Molten chocolate cake</dt> <dd>Bubba's special dark chocolate cake with a warm, molten center. Served with or without a splash of almond liqueur. <span class="price">$3.95</span></dd> </dl> </div> <p class="warning"><sup>*</sup> We are required to warn you that undercooked food is a health risk.</p> </body> </html> but the background image does not appear in body tag you can see background-image:url(images/bullseye.png); this html page is bistro.html and the directory in which it is contained there is a folder images and inside images folder I have a file bullseye.png .I expect the png to appear in background.But that does not happen. For sake of question I am posting the image here also Let me know if the syntax of css wrong? following is image http://i.stack.imgur.com/YUKgg.png

    Read the article

  • entity framework insert bug

    - by tmfkmoney
    I found a previous question which seemed related but there's no resolution and it's 5 months old so I've opened my own version. http://stackoverflow.com/questions/1545583/entity-framework-inserting-new-entity-via-objectcontext-does-not-use-existing-e When I insert records into my database with the following it works fine for a while and then eventually it starts inserting null values in the referenced field. This typically happens after I do an update on my model from the database although not always after I do an update. I'm using a MySQL database for this. I have debugged the code and the values are being set properly before the save event. They're just not getting inserted properly. I can always fix this issue by re-creating the model without touching any of my code. I have to recreate the entire model, though. I can't just dump the relevant tables and re-add them. This makes me think it doesn't have anything to do with my code but something with the entity framework. Does anyone else have this problem and/or solved it? using (var db = new MyModel()) { var stocks = from record in query let ticker = record.Ticker select new { company = db.Companies.FirstOrDefault(c => c.ticker == ticker), price = Convert.ToDecimal(record.Price), date_stamp = Convert.ToDateTime(record.DateTime) }; foreach (var stock in stocks) { if (stock.company != null) { var price = new StockPrice { Company = stock.company, price = stock.price, date_stamp = stock.date_stamp }; db.AddToStockPrices(price); } } db.SaveChanges(); }

    Read the article

  • Help with MySQL query... Need help ordering a group of rows

    - by user156814
    I can tell it best by explaining the query I have, and what I need. I need to be able to get a group of items from the database, grouped by category, manufacturer, and year made. The groupings need to be sorted based on total amount of items within the group. This part is done with the query below. Secondly, I need to be able to show an image of the most expensive item out of the group, which is why I use MAX(items.current_price). I thought MAX() gets the ENTIRE row corresponding to the largest column value. I was wrong, as MAX only gets the numeric value of the largest price. So the query doesnt work well for that. SELECT items.id, items.year, items.manufacturer, COUNT(items.id) AS total, MAX(items.current_price) AS price, items.gallery_url, FROM ebay AS items WHERE items.primary_category_id = 213 AND items.year <> '' AND items.manufacturer <> '' AND items.bad_item <> 1 GROUP BY items.primary_category_id, items.manufacturer, items.year ORDER BY total DESC, price ASC LIMIT 10 if that doesnt explain it well, the results should be something like this id 10548 year 1989 manufacturer bowman total 451 price 8500.00 (The price of the most expensive item in the table/ not the price of item 10548) gallery_url http://ebay.xxxxx (The image of item 10548) A little help please. Thanks

    Read the article

  • user enter data to different arrays

    - by user2900469
    This is fragment of my code (arrays as you can see): double[] Price; String[] names; int[] Quantity; Price = new double[5]; names = new String[5]; Quantity = new int[5]; Price[1] = 3.10; Price[2] = 7.80; Price[3] = 0.20; names[1] = "Ballpen"; names[2] = "Notebook"; names[3] = "Envelope"; Quantity[1] = 20; Quantity[2] = 5; Quantity[3] = 140; I enter data to arrays by myself in this case. Now i want to change my code so that my program asks user for names, price and quantity (using the Scanner class). After user enter data, program keep this in three different arrays. I dont know how to transfer data from user to arrays. I would be grateful for some example code or any help.

    Read the article

  • Groupby distinct how can I do that?

    - by Christophe Debove
    Hello, <?xml version="1.0"?> <Products> <product> <productId >1</productId> <textdate>11/11/2011</textdate> <price>200</price> </product> <product> <productId >6</productId> <textdate>11/11/2011</textdate> <price>100</price> </product> <product> <productId >1</productId> <textdate>16/11/2011</textdate> <price>290</price> </product> </Products> I've this xml and I want an xslt transformation that regroup product something like this : { product 1 : 11/11/2011 - 200 16/11/2011 - 290 } { product 6 11/11/2011 - 100 } I work with xslt 1.0 Asp .net C# XslCompiledTransformation

    Read the article

  • <h:selectOneMenu> ValueChangeListener Problem

    - by Ehsun
    I have two <h:selectOneMenu> tags on my form like this: <h:outputText value="#{lbls.incomeType}:"/> <h:selectOneMenu id="incomeType" label="#{lbls.incomeType}" onchange="submit();" valueChangeListener="#{price.earnTypeValueChanged}" immediate="true"> <f:selectItems value="#{price.earnTypes}"/> <f:converter converterId="ir.khorasancustoms.EarnTypeConverter"/> </h:selectOneMenu> <h:message for="incomeType" infoClass="info" errorClass="error" warnClass="warning" fatalClass="fatal"/> <h:outputText value="#{lbls.earnAttribute}:"/> <h:selectOneMenu id="earnAttribute" label="#{lbls.earnAttribute}" value="#{price.price.earnAttribute}"> <f:selectItems value="#{price.earnAttributes}"/> <f:converter converterId="ir.khorasancustoms.EarnAttributeConverter"/> </h:selectOneMenu> <h:message for="incomeType" infoClass="info" errorClass="error" warnClass="warning" fatalClass="fatal"/> <h:messages globalOnly="true" layout="table" infoClass="info" warnClass="warning" errorClass="error" fatalClass="fatal"/> <h:button value="#{lbls.cancel}" outcome="index"/> <h:commandButton value="#{lbls.ok}" action="#{price.save}"/> the handler in the bean looks like this: public void earnTypeValueChanged(ValueChangeEvent event) { EarnType newEarnType = (EarnType) event.getNewValue(); earnAttributes = newEarnType.getAttributes(); FacesContext.getCurrentInstance().renderResponse(); } Everything works fine, except the user needs to press the OK button twice because the first one fires the earnTypeValueChanged. How is that caused and how can I fix it? Update 1: public void earnTypeValueChanged(ValueChangeEvent event) { EarnType oldEarnType = (EarnType) event.getOldValue(); EarnType newEarnType = (EarnType) event.getNewValue(); earnAttributes = newEarnType.getAttributes(); if (!newEarnType.equals(oldEarnType)) { FacesContext.getCurrentInstance().renderResponse(); } }

    Read the article

  • Is CDS a valid analogy for pointers? [closed]

    - by Flinkman
    So.. bear with me. I just found an analogy to c++ pointers and CDS. This clip describes CDS(Credit Default Swaps). http://www.youtube.com/watch?v=KPNdYtrlgaU#t=120s "Here we know we have an instrument of a particular financial instrument that is demonstrably dangerous, it creates long chains of risk which are vulnerable to the failure of individual trader or market partipants, in that chain and these instruments in an affect permit the creation of vicious spirals. In which the CDS price interact with the bound price, the market price and you can have a downward spiral." What my ears are telling me: "Don't create dependences that will create long chains of crashing systems." Update: Trying to clarify with something that is closer to the readers. If I change the words: instrument = construct financial = language trader = object market partipants = c structs CDS price = uptime bound price = outcome market price = ROI(return on incestment) The quote become more understandable. Look: "Here we know we have construct of a particular language construct that is demonstrably dangerous, it creates long chains of risk which are vulnerable to the failure of individual object or structs in that chain and these system in an affect permit the creation of vicious spirals. In which the uptime interact with the outcome, the ROI and you can have a downward spiral."

    Read the article

  • Weird behaviour with Scanner#nextFloat

    - by James P.
    Running the following in Eclipse initially caused Scanner to not recognize carriage returns in the console effectively blocking further input: price = sc.nextFloat(); Adding this line before the code causes Scanner to accept 0,23 (french notation) as a float: Locale.setDefault(Locale.US); This is most probably due to regional settings in Windows XP Pro. When the code is run again 0,23 is still accepted and entering 0.23 causes it to throw a java.util.InputMismatchException. Any explanation as to why this is happening? Also is there a workaround or should I just use Float#parseFloat? Edit: import java.util.Locale; import java.util.Scanner; public class NexFloatTest { public static void main(String[] args) { //Locale.setDefault(Locale.US); //Locale.setDefault(Locale.FRANCE); // Gives fr_BE on this system System.out.println(Locale.getDefault()); float price; String uSDecimal = "0.23"; String frenchDecimal = "0,23"; Scanner sc = new Scanner(uSDecimal); try{ price = sc.nextFloat(); System.out.println(price); } catch (java.util.InputMismatchException e){ e.printStackTrace(); } try{ sc = new Scanner(frenchDecimal); price = sc.nextFloat(); System.out.println(price); } catch (java.util.InputMismatchException e){ e.printStackTrace(); } String title = null; System.out.print("Enter title:"); try{ title = sc.nextLine(); // This line is skippe } catch(java.util.NoSuchElementException e ){ e.printStackTrace(); } System.out.print(title); } }

    Read the article

  • Dynamic Array of Objects Sans Vector Class

    - by Connor Black
    I am doing a homework assignment for my summer OO class and we need to write two classes. One is called Sale and the other is called Register. I've written my Sale class; here's the .h file: enum ItemType {BOOK, DVD, SOFTWARE, CREDIT}; class Sale { public: Sale(); // default constructor, // sets numerical member data to 0 void MakeSale(ItemType x, double amt); ItemType Item(); // Returns the type of item in the sale double Price(); // Returns the price of the sale double Tax(); // Returns the amount of tax on the sale double Total(); // Returns the total price of the sale void Display(); // outputs sale info private: double price; // price of item or amount of credit double tax; // amount of sales tax double total; // final price once tax is added in. ItemType item; // transaction type }; For the Register class we need to include a dynamic array of Sale objects in our member data. We cannot use the vector class. How is this done? Here's my 'Register' '.h' class Register{ public: Register(int ident, int amount); ~Register(); int GetID(){return identification;} int GetAmount(){return amountMoney;} void RingUpSale(ItemType item, int basePrice); void ShowLast(); void ShowAll(); void Cancel(); int SalesTax(int n); private: int identification; int amountMoney; };

    Read the article

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