Search Results

Search found 1558 results on 63 pages for 'bill seven'.

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

  • Avoiding null point exception in el in JSF

    - by Buddhika Ariyaratne
    I am developing a JSF application with JPA(EclipseLink 2.0) and Primefaces. I want to know is there any way to avoid null point exception when el calls a property of a null object. I have described the situation. I have Bill class. There may be no or more BillItem objects with a Bill objects. Each BillItem object have Objects like Make, Country, Manufacturer, etc objects. I am displaying several properties of a bill within a single JSF file like this. "#{billControlled.bill.billItem.modal.name}" But if a bill is not selected, or when there are no bill items for a selected bill, the properties accessing in the el are null. I can avoid this by creating new objects for every bill, for example, new make for a new bill item, etc or by creating new properties in the controller itself for all the properties. But that is a very long way and feel like rudimentory. Is there any good practice to avoid this null point exception in el in JSF?

    Read the article

  • My Mix10 coup de coeur

    - by guybarrette
    If you ask me what was my Mix10 coup de coeur, I’d have to say Bill Buxton.  I was privileged to spend an hour an a half in a small room with about twelve people and Bill Buxton.  This man has such a incredible background and he is so inspiring.  You could really tell that he is a researcher because as he was talking about something, you could see him thinking about something else and trying at the same time to cross reference that. Here’s a list of videos recorded at Mix.  The first one is the shortest one at 9 minutes. Bytes by MSDN (Interviewed by Tim Huckaby, a legend himself) Mix Day 2 Keynote (Last 1/4) An Hour with Bill Buxton (His Mix session) Bill Buxton & Microsoft Student Insiders at MIX10 Channel 9 Live at MIX10: Bill Buxton & Erik Meijer - Perspectives on Design var addthis_pub="guybarrette";

    Read the article

  • How to display SUM fields from a detailed table in a master table

    - by max
    What is the best approach to display the summery of DETAILED.Fields in its master table? E.g. I have a master table called 'BILL' with all the bill related data and a detailed table ('BILL_DETAIL') with the bill detailed related data, like NAME, PRICE, TAX, ... Now I want to list all BILLS, without the details, but with the sum of the PRICE and TAX stored in the detail table. Here is a simplified schema of that tables: TABLE BILL ---------- - ID - NAME - ADDRESS - ... TABLE BILL_DETAIL ----------------- - ID - BILLID - PORDUCT_NAME - PRICE - TAX - ... The retrieved table row should look like this: BILL.CUSTOMER_NAME, BILL.CUSTOMER_ADDRESS, sum(BILL_DETAIL.PRICE), sum(BILL.DETAIL.TAX), ... Any sugguestions?

    Read the article

  • [Hibernate] Problem with saveOrUpdate()

    - by kunkanwan
    Hi, I've problem with Hibernate. I have a class User class User { int id; String name; } where id is native generator in User.hbm.xml , and name is primary-key in DB. In my database , I saved some information about Users. Than, I want to connect with this information about User. For example in my DB i have row INSERT INTO User VALUES ('Bill'); Main.java User bill = new User(); bill.setName("Bill"); session.saveOrUpdate(bill); This code always trying insert bill to database , rather than update when row about Bill exists in DB... Could you help me ? Thank you for advance.

    Read the article

  • Refer to similar associated models with a common name

    - by Horace Loeb
    I have these models: class Bill < ActiveRecord::Base has_many :calls has_many :text_messages end class Call < ActiveRecord::Base belongs_to :bill end class TextMessage < ActiveRecord::Base belongs_to :bill end Now, in my domain calls and text messages are both "the same kind of thing" -- i.e., they're both "bill items". So I'd like some_bill.bill_items to return all calls and text messages associated with that bill. What's the best way to do this?

    Read the article

  • how to calculate a bill from several tables on mysql?

    - by Audel
    I'm using mysql to create an hotel booking system, but i am struggling a little bit to calculate the final bill. I need a SELECT command to get data from several tables and make some calculations. Basically I just need to get the 'night cost' from a table called 'room_types'. Then, use DATEDIFF function to get the difference of days between the 'checkin' and 'checkout' columns in the table 'room_booking' and multiply the difference with the night cost and display the total. These are the tables I would be using: are room_booking, room_types, booking, and room. One booking may have several room bookings, so Im looking for a table that looks something like this: +------------+------------+---------------+------------------+ | bookingid | Room price | nights stayed | total room price | +------------+------------+---------------+------------------+ | B001 | 30.00 | 4 | 120.00 | +------------+------------+---------------+------------------+ | B001 | 40.00 | 3 | 120.00 | +------------+------------+---------------+------------------+ booking id comes from table 'booking' room price from 'room_types', 'nights stayed' is calculated from the table room_booking, using the datediff command between checkin and checkout . I hope i was clear

    Read the article

  • Powershell script to delete sub folders and files if creation date is >7 days but maintain parent folders of sub folders and files <7 days old

    - by Mark
    I'm currently using the Powershell script below to delete all files directories and sub directories of "$dump_path" that are seven days or older based upon the creation date and not modified date. The problem with this script is this: If folder "A" is seven (or more) days old it will be deleted even if its sub folders and files are less then seven days old. What I would like this script to do is this: Delete all files from the root and in all sub folders of "$dump_path" that are seven or more days old but maintain the parent folder(s) of files and folders that are less than seven days old even if that means the parent folders are more than seven days old. If all subfolders and files are seven days or older than the parent folder then the parent can be deleted. Slightly obscure problem I know, but the intention is to have a 7 day retention period of all data in a 'sandbox' location of our shared areas. Also, an added bonus if it could generate a log of what it deletes and e-mails it out post deletion. Thank you for reading and I hope that all makes sense! Mark # set folder path $dump_path = "c:\temp" # set minimum age of files and folders $max_days = "-7" # get the current date $curr_date = Get-Date # determine how far back we go based on current date $del_date = $curr_date.AddDays($max_days) # delete the files and folders Get-ChildItem $dump_path | Where-Object { $_.CreationTime -lt $del_date } | Remove-Item -Recurse

    Read the article

  • WCF fault logging and SQL Exception 4060 error.

    - by Bill
    I have been attempting to compile/run a sample WCF application from Juval Lowy's website (author of Programming WCF Services & founder of IDesign) for several days. The example app utilizes Juval's ServiceModelEx library which logs faults/errors to a "WCFLogbook" SQL database. Unfortunately, when the sample app faults, I get the following error: SQL Exception 4060: "Cannot open database \"WCFLogbook\" requested by the login. The login failed.\r\nLogin failed for user 'Bill-PC\Bill'." I confirmed that the SQL WCFLogbook database has been created and have granted all of the appropriate permissions for my (Bill-PC\Bill) access to the database. Additionally port 8006 and port 1433 have been opened in the Firewall. TCP/IP has been enabled and "Allow remote connections to this server" has been checked. I am using the following endpoint within the App.Config file: <client> <endpoint name="LogbookTCP" address="net.tcp://Bill-PC:8006/LogbookManager" binding="netTcpBinding" contract="ILogbookManager" /> </client> Unfortunately SQL is a 'world' that I hadn't needed to venture into before now and I am terribly frustrated with my lack of success. Would anyone have any other suggestions on how to get this working? Have I missed anything?

    Read the article

  • Working for Bluetooth MultiPlayer game in Unity for windows Phone 8

    - by Seven 007
    I created a small racing game and i try to implement bluetooth multiplayer in to the game, By using multiplayer plugins for Android I completed for Android Platform. I don't even find any plugins for windows phone 8. So, I tried to do it on myself. msdn Example: Bluetooth App to App Communication But, that's not much useful. If anyone did the bluetooth multiplayer game for windows phone. Just guide me to achive the target. or else give some brief explanation/ links to do the bluetooth multiplayer games for windows phone 8 that may be helpful. Thanks, Seven 007

    Read the article

  • StackWrap4J Java wrapper

    - by Bill the Lizard
    The StackWrap4J 1.0.1 jar is now available! (See the changelog) Sample Code / Screen Shot The following code snippet was used to test the wrapper in the Android emulator: TextView text = (TextView)findViewById(R.id.output); StackWrapper stackWrap = new StackOverflow(); String displayText = null; try { Stats stats = stackWrap.getStats(); displayText = "Stack Overflow Statistics"; displayText += "\nTotal Questions: " + stats.getTotalQuestions(); displayText += "\nTotal Unanswered: " + stats.getTotalUnanswered(); displayText += "\nTotal Answers: " + stats.getTotalAnswers(); displayText += "\nTotal Comments: " + stats.getTotalComments(); displayText += "\nTotal Votes: " + stats.getTotalVotes(); displayText += "\nTotal Users: " + stats.getTotalUsers(); } catch(Exception e){ displayText = e.getMessage(); } text.setText(displayText); About StackWrap4J is a Java wrapper for the Stack Exchange API. It is designed to be easy to use, and intuitive to learn while providing the full functionality of the API. License StackWrap4J is available under the MIT license. Download StackWrap4J Platform StackWrap4J was built using Java 1.5 and tested on Sun's JVM. It should run on any implementation of the JVM (1.5 or later). It's also been tested on the Android emulator. It also runs under the Google App Engine. Code You can download the code from our SVN repository hosted on SourceForge. Documentation for the code is also available on the SourceForge site. Authors Bill Cruise Justin Nelson Contact Please feel free to leave feedback here in the Answers section or on the StackWrap4J project discussion forum. Alternatively: Bill is available at: lizard.bill (at) gmail.com Justin can be reached at: jjnguy13 (at) gmail.com Future Currently we are focusing on adding more tests and fixing bugs. We are also working on adding serialization so that our objects can be easily persisted, and throttling so that users of our library don't have to worry about breaking the terms of use of the API. Notes The latest build was tested against version 1.0 of the API on July 28th.

    Read the article

  • Convince developer to use IDE

    - by artjom
    There is a developer, lets call him John (currently on probationary period) in company(pretty small company approx. 10 persons, 3 developers, one of them works long in this company know business process around and can be consider as Team leader) who didn't want to use any IDE at all(he is using some text editor). Application this team working on is medium size Java application with Spring Hibernate technology stack and refactoring/adding new features to launch new version of that application in near future. John performance working without IDE on this application is lower then desirable, team leader's (lets call him Bill) assumption is this happens because John is not using IDE. Bill try to persuade John to use IDE, but this idea meets a lot of resistance and main reason is "I want to be in total control of what I am doing, so I need to write all code by myself". How can Bill convince John to try to use IDE? (considering the fact what Bill already protected John from company owner several complaints about John performance)

    Read the article

  • Producing an view of a text's revision history in Python

    - by hekevintran
    I have two versions of a piece of text and I want to produce an HTML view of its revision similar to what Google Docs or Stack Overflow displays. I need to do this in Python. I don't know what this technique is called but I assume that it has a name and hopefully there is a Python library that can do it. Version 1: William Henry "Bill" Gates III (born October 28, 1955)[2] is an American business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. Version 2: William Henry "Bill" Gates III (born October 28, 1955)[2] is a business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. He is American. The desired output: William Henry "Bill" Gates III (born October 28, 1955)[2] is an American business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. He is American. Using the diff command doesn't work because it tells me which lines are different but not which columns/words are different. $ echo 'William Henry "Bill" Gates III (born October 28, 1955)[2] is an American business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen.' > oldfile $ echo 'William Henry "Bill" Gates III (born October 28, 1955)[2] is a business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. He is American.' > newfile $ diff -u oldfile newfile --- oldfile 2010-04-30 13:32:43.000000000 -0700 +++ newfile 2010-04-30 13:33:09.000000000 -0700 @@ -1 +1 @@ -William Henry "Bill" Gates III (born October 28, 1955)[2] is an American business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. +William Henry "Bill" Gates III (born October 28, 1955)[2] is a business magnate, philanthropist, and chairman[3] of Microsoft, the software company he founded with Paul Allen. He is American.' > oldfile

    Read the article

  • Modeling a cellphone bill: should I use single-table inheritance or polymorphic associations?

    - by Horace Loeb
    In my domain: Users have many Bills Bills have many BillItems (and therefore Users have many BillItems through Bills) Every BillItem is one of: Call SMS (text message) MMS (multimedia message) Data Here are the properties of each individual BillItem (some are common): My question is whether I should model this arrangement with single-table inheritance (i.e., one "bill_items" table with a "type" column) or polymorphism (separate tables for each BillItem type), and why.

    Read the article

  • How to retrieve the file previews used by windows explorer in Windows vista and seven?

    - by user193655
    I am developing a Delphi documents management application, so somehow I am giving the user some functionality similar to windows explorer. I would like to know if there is a way to get the preview used by windows explorer. For example windows explorer creates a small thumbnail for a pdf document for example, and displays it when the user chooses to view "big icons". Is there a way to retrieve that preview? MyTImage := GiveMePreviewForFile('C:\Test\File.pdf');

    Read the article

  • testing Clojure in Maven

    - by Ralph
    I am new at Maven and even newer at Clojure. As an exercise to learn the language, I am writing a spider solitaire player program. I also plan on writing a similar program in Scala to compare the implementations (see my post http://stackoverflow.com/questions/2571267/modern-java-alternatives-closed). I have configured a Maven directory structure containing the usual src/main/clojure and src/test/clojure directories. My pom.xml file includes the clojure-maven-plugin. When I run "mvn test", it displays "No tests to run", despite my having test code in the src/test/clojure directory. As I misnaming something? Here is my pom.xml file: <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>SpiderPlayer</groupId> <artifactId>SpiderPlayer</artifactId> <version>1.0.0-SNAPSHOT</version> <inceptionYear>2010</inceptionYear> <packaging>jar</packaging> <properties> <maven.build.timestamp.format>yyMMdd.HHmm</maven.build.timestamp.format> <main.dir>org/dogdaze/spider_player</main.dir> <main.package>org.dogdaze.spider_player</main.package> <main.class>${main.package}.Main</main.class> </properties> <build> <sourceDirectory>src/main/clojure</sourceDirectory> <testSourceDirectory>src/main/clojure</testSourceDirectory> <plugins> <plugin> <groupId>com.theoryinpractise</groupId> <artifactId>clojure-maven-plugin</artifactId> <version>1.3.1</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>1.3</version> <executions> <execution> <goals> <goal>run</goal> </goals> <phase>generate-sources</phase> <configuration> <tasks> <echo file="${project.build.sourceDirectory}/${main.dir}/Version.clj" message="(ns ${main.package})${line.separator}"/> <echo file="${project.build.sourceDirectory}/${main.dir}/Version.clj" append="true" message="(def version &quot;${maven.build.timestamp}&quot;)${line.separator}"/> </tasks> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <version>2.1</version> <executions> <execution> <goals> <goal>single</goal> </goals> <phase>package</phase> <configuration> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef> </descriptorRefs> <archive> <manifest> <mainClass>${main.class}</mainClass> </manifest> </archive> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <redirectTestOutputToFile>true</redirectTestOutputToFile> <skipTests>false</skipTests> <skip>false</skip> </configuration> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> <skip>false</skip> </configuration> </execution> </executions> </plugin> </plugins> </build> <dependencies> <dependency> <groupId>commons-cli</groupId> <artifactId>commons-cli</artifactId> <version>1.2</version> <scope>compile</scope> </dependency> </dependencies> </project> Here is my Clojure source file (src/main/clojure/org/dogdaze/spider_player/Deck.clj): ; Copyright 2010 Dogdaze (ns org.dogdaze.spider_player.Deck (:use [clojure.contrib.seq-utils :only (shuffle)])) (def suits [:clubs :diamonds :hearts :spades]) (def ranks [:ace :two :three :four :five :six :seven :eight :nine :ten :jack :queen :king]) (defn suit-seq "Return 4 suits: if number-of-suits == 1: :clubs :clubs :clubs :clubs if number-of-suits == 2: :clubs :diamonds :clubs :diamonds if number-of-suits == 4: :clubs :diamonds :hearts :spades." [number-of-suits] (take 4 (cycle (take number-of-suits suits)))) (defstruct card :rank :suit) (defn unshuffled-deck "Create an unshuffled deck containing all cards from the number of suits specified." [number-of-suits] (for [rank ranks suit (suit-seq number-of-suits)] (struct card rank suit))) (defn deck "Create a shuffled deck containing all cards from the number of suits specified." [number-of-suits] (shuffle (unshuffled-deck number-of-suits))) Here is my test case (src/test/clojure/org/dogdaze/spider_player/TestDeck.clj): ; Copyright 2010 Dogdaze (ns org.dogdaze.spider_player (:use clojure.set clojure.test org.dogdaze.spider_player.Deck)) (deftest test-suit-seq (is (= (suit-seq 1) [:clubs :clubs :clubs :clubs])) (is (= (suit-seq 2) [:clubs :diamonds :clubs :diamonds])) (is (= (suit-seq 4) [:clubs :diamonds :hearts :spades]))) (def one-suit-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :ace, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :two, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :three, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :four, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :five, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :six, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :seven, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :eight, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :nine, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :ten, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :jack, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :queen, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs} {:rank :king, :suit :clubs}]) (def two-suits-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds}]) (def four-suits-deck [{:rank :ace, :suit :clubs} {:rank :ace, :suit :diamonds} {:rank :ace, :suit :hearts} {:rank :ace, :suit :spades} {:rank :two, :suit :clubs} {:rank :two, :suit :diamonds} {:rank :two, :suit :hearts} {:rank :two, :suit :spades} {:rank :three, :suit :clubs} {:rank :three, :suit :diamonds} {:rank :three, :suit :hearts} {:rank :three, :suit :spades} {:rank :four, :suit :clubs} {:rank :four, :suit :diamonds} {:rank :four, :suit :hearts} {:rank :four, :suit :spades} {:rank :five, :suit :clubs} {:rank :five, :suit :diamonds} {:rank :five, :suit :hearts} {:rank :five, :suit :spades} {:rank :six, :suit :clubs} {:rank :six, :suit :diamonds} {:rank :six, :suit :hearts} {:rank :six, :suit :spades} {:rank :seven, :suit :clubs} {:rank :seven, :suit :diamonds} {:rank :seven, :suit :hearts} {:rank :seven, :suit :spades} {:rank :eight, :suit :clubs} {:rank :eight, :suit :diamonds} {:rank :eight, :suit :hearts} {:rank :eight, :suit :spades} {:rank :nine, :suit :clubs} {:rank :nine, :suit :diamonds} {:rank :nine, :suit :hearts} {:rank :nine, :suit :spades} {:rank :ten, :suit :clubs} {:rank :ten, :suit :diamonds} {:rank :ten, :suit :hearts} {:rank :ten, :suit :spades} {:rank :jack, :suit :clubs} {:rank :jack, :suit :diamonds} {:rank :jack, :suit :hearts} {:rank :jack, :suit :spades} {:rank :queen, :suit :clubs} {:rank :queen, :suit :diamonds} {:rank :queen, :suit :hearts} {:rank :queen, :suit :spades} {:rank :king, :suit :clubs} {:rank :king, :suit :diamonds} {:rank :king, :suit :hearts} {:rank :king, :suit :spades}]) (deftest test-unshuffled-deck (is (= (unshuffled-deck 1) one-suit-deck)) (is (= (unshuffled-deck 2) two-suits-deck)) (is (= (unshuffled-deck 4) four-suits-deck))) (deftest test-shuffled-deck (is (= (set (deck 1)) (set one-suit-deck))) (is (= (set (deck 2)) (set two-suits-deck))) (is (= (set (deck 4)) (set four-suits-deck)))) (run-tests) Any idea why the test is not running? BTW, feel free to suggest improvements to the Clojure code. Thanks, Ralph

    Read the article

  • Ruby on Rails - nested attributes: How do I access the parent model from child model

    - by TMaYaD
    I have a couple of models like so class Bill < ActiveRecord::Base has_many :bill_items belongs_to :store accepts_nested_attributes_for :bill_items end class BillItem <ActiveRecord::Base belongs_to :product belongs_to :bill validate :has_enough_stock def has_enough_stock stock_available = Inventory.product_is(self.product).store_is(self.bill.store).one.quantity errors.add(:quantity, "only #{stock_available} is available") if stock_available < self.quantity end end The above validation so obviously doesn't work because when I'm reading the bill_items from nested attributes inside the bill form, the attributes bill_item.bill_id or bill_item.bill are not available before being saved. So how do I go about doing something like that?

    Read the article

  • Prolog Family tree

    - by Tania
    Hi I have a Question in prolog , I did it but its not showing answers When i ask about the brothers,sisters,uncles,aunts This is what I wrote, what's wrong ? /*uncle(X, Y) :– male(X), sibling(X, Z), parent(Z, Y).*/ /*uncle(X, Y) :– male(X), spouse(X, W), sibling(W, Z), parent(Z, Y).*/ uncle(X,Y) :- parent(Z,Y), brother(X,Z). aunt(X,Y) :- parent(Z,Y), sister(X,Z). sibling(X, Y) :- parent(Z, X), parent(Z, Y), X \= Y. sister(X, Y) :- sibling(X, Y), female(X). brother(X, Y) :- sibling(X, Y), male(X). parent(Z,Y) :- father(Z,Y). parent(Z,Y) :- mother(Z,Y). grandparent(C,D) :- parent(C,E), parent(E,D). aunt(X, Y) :– female(X), sibling(X, Z), parent(Z, Y). aunt(X, Y) :– female(X), spouse(X, W), sibling(W, Z), parent(Z, Y). male(john). male(bob). male(bill). male(ron). male(jeff). female(mary). female(sue). female(nancy). mother(mary, sue). mother(mary, bill). mother(sue, nancy). mother(sue, jeff). mother(jane, ron). father(john, sue). father(john, bill). father(bob, nancy). father(bob, jeff). father(bill, ron). sibling(bob,bill). sibling(sue,bill). sibling(nancy,jeff). sibling(nancy,ron). sibling(jell,ron). And one more thing, how do I optimize the rule of the brother so that X is not brother to itself.

    Read the article

  • JavaScript onchange, onblur, and focus weirdness in Firefox

    - by typoknig
    On my form I have a discount field that accepts a dollar amount to be taken off of the total bill (HTML generated in PHP): echo "<input id=\"discount\" class=\"text\" type=\"text\" name=\"discount\" onkeypress=\"return currency(this, event)\" onchange=\"currency_format(this)\" onfocus=\"on_focus(this)\" onblur=\"on_blur(this); calculate_bill()\"/><br/><br/>\n"; The JavaScript function calculate_bill calculates the bill and takes off the discount amount as long as the discount amount is less than the total bill: if(discount != ''){ if(discount - 0.01 > total_bill){ window.alert('Discount Cannot Be Greater Than Total Bill'); document.form.discount.focus(); } else{ total_bill -= discount; } } The problem is that even that when the discount is more than the total bill focus is not being returned to the discount field. I have tried calling the calculate_bill function with onchange but neither IE or Firefox will return focus to the discount field when I do it like that. When I call calculate_bill with onblur it works in IE, but still does not work in Firefox. I have attempted to use a confirmation box instead of an alert box as well, but that didn't work either (plus I don't want two buttons, I only an "OK" button). How can I ensure focus is returned to the discount field after a user has left that field by clicking on another field or tabbing IF the discount amount is larger than the total bill?

    Read the article

  • Forbes Announcing The World’s Top 20 Billionaires

    - by Suganya
    Forbes company recently conducted a survey to figure out the world’s Billionaires list and has released it listing the top 20 names of the Billionaires. The company says that for the third time in the last three years the world has a new richest man for this year. So it means that Bill Gates was beaten up by someone else in world. Who is the new richest man in the world?   Forbes.Com announced the richest man in world and this time it is not Bill Gates. But it is Carlos Slim Helu who is into Telecom industry. Carlos lives in Mexico and he had the third richest man’s place last year. Having shown a Net worth of $ 53.5 Billion, Carlos has increased $18.5 Billion in a year. Carlos swooped on the privatization of Mexico’s national telephone service during the last decade and now has achieved the world’s first richest man. Following Carlos, in the second position is Bill Gates with the Nett worth of $53 Billion. As Bill Gates requires no great introduction, lets move on to the next place. The third place is occupied by Warren Buffett followed by Mukesh Ambani and Lakshmi Mittal in fourth and fifth places respectively. The top 20 names of world’s richest people, their occupation and the Nett worth that they hold are S.No Name Nett Worth (in $ Billion) Source of Income 1 Carlos Slim Helu 53.5 Telecom 2 Bill Gates 53 Microsoft 3 Warren Buffett 47 Investments 4 Mukesh Ambani 29 Petrochemical, Oil and Gas 5 Lakshmi Mittal 28.7 Steel 6 Lawrence Ellison 28 Oracle 7 Bernard Arnault 27.5 Luxury Goods 8 Eike Batista 27 Mining, Oil 9 Amancio Ortega 25 Fashion, Retail 10 Karl Albrecht 23.5 Supermarkets 11 Ingvar Kamprad and Family 23 IKEA 12 Christy Walton and Family 22.5 Wal-Mart 13 Stefan Persson 22.4 H & M 14 Li Ka-shing 21 Diversified 15 Jim C. Walton 20.7 Wal-Mart 16 Alice Walton 20.6 Wal-Mart 17 Liliane Bettencourt 20 L’Oreal 18 S. Robson Walton 19.8 Wal-Mart 19 Prince Alwaleed bin Talal Alsaud 19.4 Diversified 20 David Thomson and Family 19 Thomson Reuters   Source: Forbes and Image Credit : kevindooley Join us on Facebook to read all our stories right inside your Facebook news feed.

    Read the article

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