Jump to content

ballouta

Members
  • Posts

    625
  • Joined

  • Last visited

Posts posted by ballouta

  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-numdate, plane-type)

    BOOKINGS (passenger-nameflight-numdate, 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. 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

  6. 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
     

  7. 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

  8. 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" );
    
  9. Hello Everyone

    I've installed wordpress already for a sex education website.

    I need to show a warning page before a visitor can proceed to the main website.

     

    I was wondering if there's a plugin that I can install for wordpress that shows a warning message/page before someone

    can entre the main website.

     

    If not, is this my best choice to create a custome HTML page, add the put the wanring text needed, then

    place two links for I agree & I don't agree , for example?

    but in this case, I have to move the wordress installation to another location right?

     

    thank you so much

     

  10. Thank you for ur reply

    I am asking specific questions because it is a homework and I am trying to solve it using some techniques

    I saw in class.

     

    i studies If Exists, this is why

    Moreover, I wanted to know

    if I say

     

    If exists (SELECT * FROM zipcodes where zip_code = zip_in)
    THEN
    

    how do i assign the arguments state and city OUT

    we never had such example in class

     

    thank you

  11. Hello

     

    If i run a Select query in a stored procedure,

    e.g. Select fname, lname from customers;

     

    does the query display the results automatically (command screen) on screen

    or some code should be written to fetch out the rows?

    I am NOT talking about PHP or java,

     

    Thank you

  12. Hello again!

     

    I am wondering if this SP can be solved starting with this statement:

    If exists (SELECT * FROM zipcodes where zip_code = zip_in)
    Then
    

     

    another thing i would like to know, can we user a cursor to fetch the City and State names?

     

    if yes how would the SP look like?

     

    I appreciate ur help

    thanks

×
×
  • 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.