<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: owais 7osha</title>
    <description>The latest articles on DEV Community by owais 7osha (@o7osha).</description>
    <link>https://dev.to/o7osha</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F879599%2Fed9e90ee-e1c7-416b-a818-c3107b54786b.png</url>
      <title>DEV Community: owais 7osha</title>
      <link>https://dev.to/o7osha</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/o7osha"/>
    <language>en</language>
    <item>
      <title>How to solve Problem with date method in the Yii2?</title>
      <dc:creator>owais 7osha</dc:creator>
      <pubDate>Sun, 19 Jun 2022 21:45:28 +0000</pubDate>
      <link>https://dev.to/o7osha/how-to-solve-problem-with-date-method-in-the-yii2-4m92</link>
      <guid>https://dev.to/o7osha/how-to-solve-problem-with-date-method-in-the-yii2-4m92</guid>
      <description>&lt;p&gt;0&lt;/p&gt;

&lt;p&gt;Have timestamp for the task in the MySQL - 1654423473. &lt;a href="https://babyapk.com/genshin-impact-mod-apk/"&gt;https://babyapk.com/genshin-impact-mod-apk/&lt;/a&gt; correctly transforming this timestamp into the GMT: Sunday, 5 June 2022 г., 10:04:33. That is date of task creation. Using this Yii2 method I outputting this data in the view - ` public function getWasOnSite() {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$timePeriod = strtotime('now') - strtotime($this-&amp;gt;dt_add);
return \Yii::$app-&amp;gt;formatter-&amp;gt;asDuration($timePeriod);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;br&gt;
` And expecting some days, minutes, etc, but seeing this -1450 years, 11 months, 30 days, 17 hours, 3 minutes, 45 seconds ago&lt;/p&gt;

&lt;p&gt;How to remake into the correct variant?&lt;/p&gt;

</description>
      <category>yii22</category>
    </item>
    <item>
      <title>Flask Mail Type Error: missing 1 required positional argument: 'message' on Mail.send(msg)</title>
      <dc:creator>owais 7osha</dc:creator>
      <pubDate>Sun, 19 Jun 2022 21:39:12 +0000</pubDate>
      <link>https://dev.to/o7osha/flask-mail-type-error-missing-1-required-positional-argument-message-on-mailsendmsg-4h60</link>
      <guid>https://dev.to/o7osha/flask-mail-type-error-missing-1-required-positional-argument-message-on-mailsendmsg-4h60</guid>
      <description>&lt;p&gt;0&lt;/p&gt;

&lt;p&gt;Getting this error "TypeError: _MailMixin.send() missing 1 required positional argument: 'message'" when trying to email a forgot password message via flask-mail. Feel like I'm following the model to a tee, but I'm obviously missing something.&lt;/p&gt;

&lt;p&gt;Here is the relevant code:&lt;/p&gt;

&lt;p&gt;Init.py&lt;/p&gt;

&lt;p&gt;app.config['MAIL_SERVER']='smtp.mailtrap.io'&lt;br&gt;
    app.config['MAIL_PORT'] = 2525&lt;br&gt;
    app.config['MAIL_USERNAME'] = 'e1f8a312670b7d'&lt;br&gt;
    app.config['MAIL_PASSWORD'] = '7a56dfdd316300'&lt;br&gt;
    app.config['MAIL_USE_TLS'] = True&lt;br&gt;
    app.config['MAIL_USE_SSL'] = False&lt;br&gt;
    mail = Mail(app)&lt;br&gt;
models.py&lt;/p&gt;

&lt;p&gt;class User(db.Model,UserMixin):&lt;br&gt;
    id = db.Column(db.Integer, primary_key=True)&lt;br&gt;
    email = db.Column(db.String(150), unique = True)&lt;br&gt;
    password = db.Column(db.String(150))&lt;br&gt;
    username = db.Column(db.String(150))&lt;br&gt;
    birthdate = db.Column(db.Date)&lt;br&gt;
    gender_id = db.Column(db.Integer)&lt;br&gt;
    createDate = db.Column(db.DateTime(timezone = true),default = func.now())&lt;br&gt;
    token = db.Column(db.String(32), nullable=False, unique=False)&lt;br&gt;
    notes = db.relationship('tbl_note')&lt;br&gt;
views.py The code is failing on the line mail.send(msg)&lt;/p&gt;

&lt;p&gt;if request.method =="POST":&lt;br&gt;
        user = User.query.filter_by(email = form.email.data).first()&lt;br&gt;
        if user:&lt;br&gt;
            #generate new token&lt;br&gt;
            token = str(uuid4()).replace('-','')&lt;br&gt;
            #update user token in db&lt;br&gt;
            user.token = token&lt;br&gt;
            db.session.add(user)&lt;br&gt;
            db.session.commit()&lt;br&gt;
            link = 'http://' + getenv('DOMAIN') + url_for(&lt;br&gt;
                    'update_password',&lt;br&gt;
                    email=my_user.email, token=token)&lt;br&gt;
            msg = Message('Password Reset Request',&lt;br&gt;
                  sender='&lt;a href="mailto:noreply@demo.com"&gt;noreply@demo.com&lt;/a&gt;',&lt;br&gt;
                  recipients=[user.email])&lt;br&gt;
            msg.body = 'To reset your password, visit the &lt;a href="https://apkhobby.com/total-conquest-mod-apk/"&gt;following link&lt;/a&gt;: ' + link +&lt;br&gt;&lt;br&gt;
            '. If you did not make this request then simply ignore this email and no changes will be made.'&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        Mail.send(msg)
        flash('We have sent an email to change your password. [Please check](https://apkhobby.com/total-conquest-mod-apk/) your Spam folder if not found.', category = 'success')
        return redirect(url_for('auth.login'))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>flask</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How can I subtract from inventory using Stripe Elements</title>
      <dc:creator>owais 7osha</dc:creator>
      <pubDate>Sun, 19 Jun 2022 21:34:03 +0000</pubDate>
      <link>https://dev.to/o7osha/how-can-i-subtract-from-inventory-using-stripe-elements-1d85</link>
      <guid>https://dev.to/o7osha/how-can-i-subtract-from-inventory-using-stripe-elements-1d85</guid>
      <description>&lt;p&gt;0&lt;/p&gt;

&lt;p&gt;I was using a pre-SCA Stripe integration in my webapp that used Checkout. The flow basically:&lt;/p&gt;

&lt;p&gt;Did \Stripe\Order::create against a selected SKU and quantity so that I ensured that inventory was &lt;a href="//httpS://minimilitiaapkmod.net/"&gt;still available&lt;/a&gt; (for products with 'finite' quantity)&lt;/p&gt;

&lt;p&gt;Then an \Stripe\Order::retrieve and $order-&amp;gt;pay using the token passed back to me by Checkout in the client.&lt;/p&gt;

&lt;p&gt;I've rebuilt my integration with an SCA-compliant flow, now with Stripe Elements, for a better UX.&lt;/p&gt;

&lt;p&gt;However, I don't see how I can check against inventory when using Elements. There doesn't seem to be a way to use Elements with a similar Order, Retrieve, Pay flow.&lt;/p&gt;

&lt;p&gt;Can anyone that's got a similar Elements based integration point me toward how to making sure I don't oversell products with limited quantity.&lt;/p&gt;

&lt;p&gt;TIA.&lt;/p&gt;

</description>
      <category>stripe</category>
    </item>
  </channel>
</rss>
