Shelbyolinmarcella's Profile

55
Points

Questions
9

Answers
18

  • This works

    select concat(datediff(d, 0, cast(call_date as date)), id) from    (values ('26203','14-Aug-2020')) v(id, call_date); 

    Results

    4405526203 
    • 11 views
    • 4 answers
    • 0 votes
  • One option uses a recursive query. In standard SQL, you would phrase this as:

    with recursive cte (id, qty) (     select id, qty from mytable     union all     select id, qty - 1 from cte where qty > 0 ) select id from cte order by id 
    • 13 views
    • 1 answers
    • 0 votes
  • The sql query which you have shown in your post will give you answer_versions that belongs to those answer where project_id is 1 and the query you have from query builder will fetch all answer_versions regardless their related answer belongs to project 1 or not.

    But in result set you will have answers for some of answer_versions because you have applied filter in with() which just loads the related records.

    In order to get the results same as provided sql query you will need a filter on main clause instead of applying filter in with()

    $answers = AnswerVersion::query()->with('answer')             ->whereHas('answer.project', function ($query) use ($project) {                 $query->where('project_id' ,$project->id);            }); 
    • 16 views
    • 1 answers
    • 0 votes
  • Asked on September 1, 2020 in Mysql.

    If I understand you correctly you only have a single table that needs the year column, so assuming that yeartable would be the name of that table

    import pymysql import pandas as pd conn=pymysql.connect(host="localhost",user="root",password="",db="bulk") cursor=conn.cursor() cursor.execute("show tables") myresult=cursor.fetchall() for i in myresult:      print(i)      if (i == 'yeartable'):          query=('select text, imdburl, year from %s '%(i))      else:          query=('select text,imdburl from %s '%(i))      cursor.execute(query)      result=cursor.fetchall()      print(result)      my=pd.read_sql_query(query,conn)      my.to_csv("new.csv",index=False) 

    For a scalable solution you need to get some information on the table
    You can fetch all column names of a table like this:

    SELECT `COLUMN_NAME`  FROM `INFORMATION_SCHEMA`.`COLUMNS`  WHERE `TABLE_SCHEMA`='yourdatabasename'  AND `TABLE_NAME`='yourtablename'; 

    check for a column named year in the if from above instead of checking for yeartable and you should be good

    • 16 views
    • 2 answers
    • 0 votes
  • Asked on September 1, 2020 in Mysql.

    Read Chapter 12 Functions and Operators of the MySQL Reference Manual to learn what methods are available, and you will find the solution:

    • Parse the month name with STR_TO_DATE using specifier %b
    • Format the month as a 2-digit number with DATE_FORMAT using specifier %m
    • Combine with - and year with CONCAT()
    SELECT CONCAT(DATE_FORMAT(STR_TO_DATE(month, '%b'), '%m'), '-', year) AS desired_column   FROM mytable 
    • 16 views
    • 2 answers
    • 0 votes
  • Asked on September 1, 2020 in iOS.

    You can avoid the initial fire of your listener by modifying Observer to something like this:

    final class Observer<T> {     typealias Listener = (T) -> Void        var listener: Listener?     var value: T {         didSet {             listener?(value)         }     }      init(_ value: T) {         self.value = value     }      func bind(listener: Listener?) {         self.listener = listener     }          func bindAndFire(listener: Listener?) {         self.listener = listener         listener?(value)     } } 

    calling bind(listener:) function will only add the new listener without immediately calling it, while calling bindAndFire(listener:) will also fire the listener for the initial value.

    Or you can use a Bool parameter in bind(listener:) function to determine whether you want or you don’t want to fire the listener for the initial value:

    func bind(fire: Bool = false, listener: Listener?) {     self.listener = listener     if fire {         listener?(value)     } } 
    • 13 views
    • 1 answers
    • 0 votes
  • Asked on September 1, 2020 in iOS.

    You can try this

    func dismiss() {  UIView.animate(withDuration: 0.2, delay: 0, options: .curveEaseOut, animations: {      self.viewContainer.frame.origin.y = self.view.frame.height + 500      self.overlay.isHidden = true  }, completion: nil) } 
    • 18 views
    • 3 answers
    • 0 votes
  • Asked on September 1, 2020 in iOS.

    This looks like an issue with the App Store Connect configuration.

    Make sure that the product identifier exists in App Store Connect and is in status Ready to Submit, that the shared secret in the RevenueCat Dashboard matches the one for the account, that the bundle ID for the app matches the one in App Store Connect.

    I recommend checking out RevenueCat’s iOS Product Setup guide https://docs.revenuecat.com/docs/ios-products, and if the steps there don’t help, contact RevenueCat support at https://support.revenuecat.com.

    • 13 views
    • 1 answers
    • 0 votes
  • Asked on September 1, 2020 in CSS.

    Here is one:

    change fontsize to fontSize

    // Create Elements var images_names = ["Images/article_0.svg", "Images/article_1.svg", "Images/article_2.svg", "Images/article_3.svg", "Images/article_4.svg",   "Images/article_5.svg", "Images/article_6.svg", "Images/article_7.svg", "Images/article_8.svg" ] var i; for (i = 0; i < images_names.length; i++) {   // Create div   var divAnunci = document.createElement('div');   divAnunci.setAttribute('class', 'divAnunci');   // Create link   var linkvar = document.createElement('a');   linkvar.setAttribute('href', 'https://www.youtube.com/');   var text = document.createTextNode("Buy Now");   linkvar.appendChild(text);   // Create images   var img = document.createElement('img');   img.src = images_names[i];   img.setAttribute('onclick', 'two()');   // Create titol   var titol = document.createElement('p');   titol.setAttribute('class', 'titol');   var text = document.createTextNode("A very nice random title");   titol.appendChild(text);   // Create description   var descripcio = document.createElement('p');   descripcio.setAttribute('class', 'descripcio');   var text = document.createTextNode("A very nice random longer description");   descripcio.appendChild(text);   // Append titiol, descripcio, link and image to div   divAnunci.appendChild(titol);   divAnunci.appendChild(img);   divAnunci.appendChild(descripcio);   divAnunci.appendChild(linkvar);   // Append divanunci to main div   document.getElementById('container').appendChild(divAnunci); }  // Geometry function function resize_element(num) {   var i;   // Resize whole div   var elements = document.getElementsByClassName("divAnunci");   var widthsize = 100 / num - 0.1;   widthsize = widthsize.toString();   for (i = 0; i < elements.length; i++) {     elements[i].style.width = widthsize + "%";   }   // Change font titols   elements = document.getElementsByClassName("titol");   i = 0;   var fontsize = 2.2 * 4 / num;   fontsize = fontsize.toString();   for (i = 0; i < elements.length; i++) {     elements[i].style.fontSize = fontsize + "vw";     // elements[i].setAttribute('font-size',fontsize+"vw");   }   // Change font descripcions   elements = document.getElementsByClassName("descripcio");   i = 0;   var fontsize = 1.5 * 4 / num;   fontsize = fontsize.toString();   for (i = 0; i < elements.length; i++) {     elements[i].style.fontSize = fontsize + "vw";     // elements[i].setAttribute('font-size', fontsize+"vw");   } }
    body {   font-family: Arial, Helvetica, sans-serif; }   /* Contenidor que conte el header */  .header {   text-align: center;   padding: 32px;   position: sticky;   top: 0;   background-color: white; }   /* Contenidor que conte tots els anuncis */  #container {   display: flex;   flex-direction: row;   flex-wrap: wrap;   align-items: flex-start;   align-content: space-between; }   /* Contenidor que conforma anunci */  .divAnunci {   /* background-color: #f2ce6b; */   display: flex;   flex-direction: column;   align-items: center;   justify-content: center;   width: 24%; }   /* Imatge dels productes */  img {   width: 100%; }   /* Titol dels productes */  .titol {   font-size: 2.2vw; }   /* Descripcio dels productes */  .descripcio {   font-size: 1.5vw; }   /* Lik dels productes */  a {   width: 50%; }  a:link, a:visited {   background-color: #f44336;   color: white;   padding: 10px 10px;   text-align: center;   text-decoration: none;   display: inline-block; }  a:hover, a:active {   background-color: red; }
    <body>   <!-- Header -->   <div class="header">     <h1>NICE TITLE</h1>     <p>Click on the buttons to change the grid view.</p>     <button onclick="resize_element(2)">2</button>     <button onclick="resize_element(4)">4</button>     <button onclick="resize_element(8)">8</button>     <button onclick="resize_element(16)">16</button>   </div>    <div id="container">   </div>  </body>

    • 11 views
    • 1 answers
    • 0 votes
  • Asked on September 1, 2020 in CSS.

    You can do this also and change the margins according to your need.

    .sponsors-links {     display: flex; }  .sponsors-links a {     margin:10px}  .sponsors-links a:hover {     text-decoration: none; }  .sponsors-links img {     height: 25px;     width: 25px; }
    <div class="sponsors-links"> <a href="https://www.bigblueoceancleanup.org/" target="_blank"> <img class="social-icon" src="https://www.capebretoncares.com/images/sponsor-icons/icon_web.png"> </a> <a href="https://www.bigblueoceancleanup.org/" target="_blank"> <img class="social-icon" src="https://www.capebretoncares.com/images/sponsor-icons/icon_twitter.png"> </a> <a href="https://www.bigblueoceancleanup.org/" target="_blank"> <img class="social-icon" src="https://www.capebretoncares.com/images/sponsor-icons/icon_insta.png"> </a> <a href="https://www.bigblueoceancleanup.org/" target="_blank"> <img class="social-icon" src="https://www.capebretoncares.com/images/sponsor-icons/icon_facebook.png"> </a> <a href="https://www.bigblueoceancleanup.org/" target="_blank"> <img class="social-icon" src="https://www.capebretoncares.com/images/sponsor-icons/icon_youtube.png"> </a> </div>

    • 10 views
    • 4 answers
    • 0 votes