Jump to content

ballouta

Members
  • Posts

    625
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    California
  • Age
    34

ballouta's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hello I spent literally 5 hours creating the following regex for a friend of mine! (?s)(?=Configuration)(.*?)(?>onal\)\:) The regex is supposed to capture several lines from a static content that starts with the word Configuration and ends with the word (optional): This content has sometimes a new blank line and sometimes two empty lines. Is it possible you kindly assist me in modifying the above regex so it extracts all the text needed, at the same time it ignores all new/blank lines? Text Sample: Hello Configuration There is something here s bbye optional): Hoping for this output: Hello Configuration There is something here s bbye optional): We are using the function reg_match. Thank you
  2. Hi I am frustrated from this simple task, I've been testing this script for two hours trying to find the problem but no luck! My script reads a command line argument(ARGV[0]), then creates a directory named as #{ARGV[0]}, then it reads the DATA object (after the __END__ which looks below), and create those directories inside ARGV[0] __END__ app/views/layouts app/models app/controllers config db doc lib public/javascripts public/stylesheets public/images log note that I am using Notpad++ and i have EOL set to UNIX, so it is NOT supposed to cause any \n troubles My script creates what looks like directories, i can see them in my FTP but I can't delete any! when I asked my instructor about it, he said, review your code, lib (directory) is NOT like lib? so I am wondering where did the question mark come from? also note that I do NOT see ? when i use SSH client or FTP! i had to run another script to delete these weird directories this is my script require 'fileutils' include FileUtils if ARGV.empty? puts "__________________________________________ _ _" puts " " puts "USAGE: ruby script/generate.rb Your_Site_Name" puts "__________________________________________ _ _" elsif Dir.exists?("/home/students/myname/public_html/cis113/#{ARGV[0]}") puts "This directory already exist!" puts "Would you like to use the existing directory (Y/N)?" #I need help with this part later #read DATA and create directories else Dir.mkdir("/home/students/myname/public_html/cis113/#{ARGV[0]}") DATA.each do |line| FileUtils.mkpath ("/home/students/myname/public_html/cis113/#{ARGV[0]}/#{line}") end end help is highly appreciated
  3. Hello I have these relations FLIGHTS (flight-num, source-city, destination-city) DEPARTURES (flight-num, date, plane-type) BOOKINGS (passenger-name, flight-num, date, seat-number) How is it possible to find all cities that have nonstop to Paris? a bit of explanation is appreciated thank you
  4. I just finished studying your queries, thanks again I am thinking of how to wrie the same query without aggregators but with subqueries in the where clause I have these idea, If it is true, I am not sure yet hot to translate it to a query so the same query above without aggregator SELECT reviewer, COUNT(*) FROM BookAuthor ba INNER JOIN BookReview br ON ba.book = br.book WHERE ba.author = 'ggg' AND br.reviewer IN (SELECT author FROM bookauthor) GROUP BY reviewer HAVING COUNT(*) >= 2; I say: after joining the two tables on the same criteria above get a Distinct list of reviewers from the tuples (that are the result of the inner join) then the "inner join tuples" Except (difference) the "distinct list" will tell us who had reviewed 2 books or mores what do you think?
  5. Thank you, let me study your answers I really appreciate the help.
  6. May someone help me with Question no 2 please so I have the correct query for question # 1 which is Select reviewer, count(reviewer) From BookAuthor BA INNER JOIN BookReview BR ON BA.book = BR.book where BA.author = 'Charles Dickens' Group by reviewer Having count(reviewer) > 2 I need to convert it to subqueries in the where clause, thank you
  7. unfor this class didn't provide any kind of DB access to test our code, this is why it is difficult to wite queries for me as a beginner
  8. Select reviewer, count(reviewer) From BookAuthor BA INNER JOIN BookReview BR ON BA.book = BR.book where BA.author = 'Charles Dickens' Group by reviewer Having count(reviewer) > 2 this?
  9. this? Select author, count(reviewers) From BookAuthor BA INNER JOIN BookReview BR ON BA.book = BR.book where BA.author = 'Charles Dickens' Group by author Having count(reviewers) > 2
  10. so for question 1, would this query be correcy? Select author, count(reviewers) From BookAuthor BA INNER JOIN BookReview BR ON BA.book = BR.author where BA.author = 'Charles Dickens' Group by author Having count(reviewers) > 2
  11. For this first question I have Select author, count(reviewers) From BookAuthor BA, BookReview BR where BA.autgor = 'ballouta' Group by author Having count(reviewers) > 2
  12. consider these four relations BookAuthor (book, author, earnings) BookReference (book, referenceBook, times) BookReview (book, reviewer, score) BookPublish (book, year, price, num) *an author can review his book 1) I need a sql query that finds all the authors who reviewed more than two books written by 'ballouta' USING aggregators 2) I need a sql query that finds all the authors who reviewed more thna two books written by 'ballouta' with subqueries 3) Find all authors who have written exactly one book and reviewed more than one book 4) Find all reviewers who have reviewed everybook by 'ballouta' using Except' thank you so much
  13. Hello I have two tables, one called order_products with ten attriubtes, and the table products with many different attributes one of them is "weight" the original query selects all of the ten colums based on a given order number: $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "order_product WHERE order_id = '" . (int)$order_id . "'"); I am trying to modify the ablove query to get the weight of each product that (weight) is in products table, I wrote this query that worked well on phpMyAdmin and gave me the correct result,. However, when I use the query in the original context of OpenCart it has to have the $order_id avraible, and I wanna make sure I ahve the correct syntax, because writing the correct sytnax is not enough yet to test my code, I have to edit other arrays and stuff! thank you $query = $this->db->query("SELECT OP.order_product_id, OP.order_id, OP.product_id, OP.name, OP.model, OP.price, OP.total, OP.tax, OP.quantity, OP.subtract, P.weight FROM dmc9strorder_product OP, dmc9strproduct P WHERE OP.order_id = '" . (int)$order_id . "' AND OP.product_id = P.product_id" );
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.