<?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: Varun Hegde</title>
    <description>The latest articles on DEV Community by Varun Hegde (@varuntumbe).</description>
    <link>https://dev.to/varuntumbe</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%2F434143%2F5d5c0502-1891-4c94-8861-42b282f4c269.png</url>
      <title>DEV Community: Varun Hegde</title>
      <link>https://dev.to/varuntumbe</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/varuntumbe"/>
    <language>en</language>
    <item>
      <title>How do i convert the following code to transaction in Node.js?</title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Wed, 13 Jan 2021 07:12:49 +0000</pubDate>
      <link>https://dev.to/varuntumbe/how-do-i-convert-the-following-code-to-transaction-in-node-js-3bcp</link>
      <guid>https://dev.to/varuntumbe/how-do-i-convert-the-following-code-to-transaction-in-node-js-3bcp</guid>
      <description>&lt;p&gt;I have written this async function which calls bunch of async functions inside which executes INSERT or SELECT statements and each function needs the output from the previous one. There's a lot of of INSERT operation so its taking lot of time.&lt;/p&gt;

&lt;p&gt;code --&lt;br&gt;
async writeDataseq(bno, pno, textArr) {&lt;br&gt;
const pageNoTablePacket = await this.writeToPageNoTable(bno, pno);&lt;br&gt;
try {&lt;br&gt;
  let pgId = pageNoTablePacket.insertId;&lt;br&gt;
  if (pgId == 0) {&lt;br&gt;
    pgId = await this.getPgId(bno, pno);&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;for (let index = 0; index &amp;lt; textArr.length; index++) {&lt;br&gt;
    let leftWord = null;&lt;br&gt;
    let rightWord = null;&lt;br&gt;
    let word = textArr[index];&lt;br&gt;
    if (index - 1 &amp;gt;= 0) {&lt;br&gt;
      leftWord = textArr[index - 1];&lt;br&gt;
    }&lt;br&gt;
    if (index + 1 &amp;lt; textArr.length) {&lt;br&gt;
      rightWord = textArr[index + 1];&lt;br&gt;
    }&lt;br&gt;
    const wordPacket = await this.writeWordToDb(word);&lt;br&gt;
    let wordId = wordPacket.insertId;&lt;br&gt;
    if (wordId == 0) {&lt;br&gt;
      wordId = await this.getWordId(word);&lt;br&gt;
    }&lt;br&gt;
    const wordInstPacket = await this.writeWordInst(wordId, pgId);&lt;br&gt;
    const wordContextPacket = await this.writeWordContext(&lt;br&gt;
      wordInstId,&lt;br&gt;
      leftWord,&lt;br&gt;
      rightWord&lt;br&gt;
    );&lt;br&gt;
  }&lt;br&gt;
  //every operation finished&lt;br&gt;
  return 'everything done successfully';&lt;br&gt;
} catch (error) {&lt;br&gt;
  throw Error(error);&lt;br&gt;
}&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;I am using Mysql database and am using node-mysql driver. I want to commit everything at once in the end to make it fast. How can I achieve this ?&lt;/p&gt;

&lt;p&gt;Thanks in advance.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>I am trying to match this text with regexp but getting error</title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Thu, 26 Nov 2020 04:24:41 +0000</pubDate>
      <link>https://dev.to/varuntumbe/i-am-trying-to-match-this-text-with-regexp-but-getting-error-60d</link>
      <guid>https://dev.to/varuntumbe/i-am-trying-to-match-this-text-with-regexp-but-getting-error-60d</guid>
      <description>&lt;p&gt;string : ----------------Page (0) Break----------------&lt;br&gt;
(it can have any number inside parenthesis)&lt;/p&gt;

&lt;p&gt;pattern : /?&amp;lt;=-{16}Page ()(\d+)(?=) Break-{16})/g&lt;/p&gt;

&lt;p&gt;usage : &lt;/p&gt;

&lt;p&gt;if(line.search( /?&amp;lt;=-{16}Page ()(\d+)(?=) Break-{16})/g )!=-1)&lt;br&gt;
{&lt;br&gt;
     console.log(line);&lt;br&gt;
}  &lt;/p&gt;

&lt;p&gt;error : SyntaxError: Invalid regular expression: /?&amp;lt;=-{16}Page ()(\d+)(?=) Break-{16})/: Nothing to repeat&lt;/p&gt;

&lt;p&gt;Any help would be appreciated.&lt;br&gt;
Thank You&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
    </item>
    <item>
      <title>Asynchronous Javascript</title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Thu, 29 Oct 2020 04:17:45 +0000</pubDate>
      <link>https://dev.to/varuntumbe/asynchronous-javascript-3ag3</link>
      <guid>https://dev.to/varuntumbe/asynchronous-javascript-3ag3</guid>
      <description>&lt;p&gt;I have some trivial doubts regarding Asynchronous functions.&lt;/p&gt;

&lt;p&gt;1) When await keyword is encountered in async function, what does js exactly do ?&lt;br&gt;
does it skip the whole function and goes to next next instruction outside the function or will it try to execute rest of the code in async ( i personally think the first one as whatever inside a async func is supposed to be executed after the asynchronous instruction)&lt;/p&gt;

&lt;p&gt;2) Javascript has single thread and event based model. so if it encounters asynchronous code, i have read that it works in the background executing other instruction. what does executing in the background mean (if only it has single thread)?&lt;/p&gt;

&lt;p&gt;3) If in a code every instruction is depends on result of previous async function ,doesn’t executing in both synchronously and asynchronously becomes same ?&lt;/p&gt;

&lt;p&gt;Kindly answer these question whenever you have time.&lt;/p&gt;

&lt;p&gt;Thanks in advance.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>customizing the flask admin page </title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Tue, 15 Sep 2020 09:50:49 +0000</pubDate>
      <link>https://dev.to/varuntumbe/customizing-the-flask-admin-page-54d8</link>
      <guid>https://dev.to/varuntumbe/customizing-the-flask-admin-page-54d8</guid>
      <description>&lt;p&gt;I want add another button with those delete and edit icons in flask admin template and want to send that row data for some route as post request. i know to that i have to edit in admin/model/list.html template. But i am not getting how to add this functionalities.&lt;br&gt;
Please help.&lt;br&gt;
Thanks in advance.&lt;/p&gt;

</description>
      <category>python</category>
      <category>flask</category>
    </item>
    <item>
      <title>Getting Error in SqlAlchemy</title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Fri, 28 Aug 2020 05:30:58 +0000</pubDate>
      <link>https://dev.to/varuntumbe/getting-error-in-sqlalchemy-2m0j</link>
      <guid>https://dev.to/varuntumbe/getting-error-in-sqlalchemy-2m0j</guid>
      <description>&lt;p&gt;I was trying to define one to many relationship in sqlalchemy in flask.&lt;br&gt;
This are my model.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Storm(db.Model):
    __tablename__='storm'
    __table_args__ (
        db.UniqueConstraint('name','year'),
    )
    id=db.Column(db.Integer,primary_key=True)
    name=db.Column(db.String(50),nullable=False)
    year=db.Column(db.Integer,nullable=False)
    cat=db.Column(db.String(50))
    pos=db.realationship('Position',backref='storm_info',lazy=True)

    def __repr__(self):
        return '&amp;lt;storm_name : {},storm_year : {}&amp;gt;'.format(self.name,self.year)

class Position(db.Model):
    lat=db.Column(db.Float)
    longi=db.Column(db.Float)
    storm_id=db.Column(db.Integer,db.ForeignKey('storm.id'),nullable=False)
    pressure-db.Column(db.Float)

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I want compound uniqueness for name and year.&lt;br&gt;
but i am getting this error - &lt;br&gt;
NameError: name '&lt;strong&gt;table_args&lt;/strong&gt;' is not defined.&lt;br&gt;
can anyone please suggest what is the problem and how i can define it ?&lt;br&gt;
and whats the difference between this and defining by declarative model?&lt;br&gt;
Thanks in advance&lt;/p&gt;

</description>
      <category>python</category>
      <category>flask</category>
      <category>sqlalchemy</category>
    </item>
    <item>
      <title>Config Error with Mongodb-Atlas and flask-MongoAlchemy </title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Sat, 15 Aug 2020 10:50:43 +0000</pubDate>
      <link>https://dev.to/varuntumbe/config-error-with-mongodb-atlas-and-flask-mongoalchemy-3dpp</link>
      <guid>https://dev.to/varuntumbe/config-error-with-mongodb-atlas-and-flask-mongoalchemy-3dpp</guid>
      <description>&lt;p&gt;I did put password of that user in the field and i have tried all possible combination with dbname.I dont know which dbname it is referring to. I have searched many places, didnt get any answers. Can some one please help me how to configure.&lt;/p&gt;

&lt;p&gt;app.config['DEBUG']=True&lt;br&gt;
app.config['MONGOALCHEMY_CONNECTION_STRING']='mongodb+srv://user: &lt;br&gt;
&lt;a class="comment-mentioned-user" href="https://dev.to/test"&gt;@test&lt;/a&gt;
.usvae.mongodb.net/?retryWrites=true&amp;amp;w=majority'&lt;br&gt;
db=MongoAlchemy(app)&lt;br&gt;
This is my configeration. This is the error i am getting&lt;/p&gt;

&lt;p&gt;raise ImproperlyConfiguredError("You should provide a database name " flask_mongoalchemy.ImproperlyConfiguredError: You should provide a database name (the MONGOALCHEMY_DATABASE setting)&lt;/p&gt;

&lt;p&gt;Thanks in advance&lt;/p&gt;

</description>
      <category>flask</category>
      <category>python</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>Looking for projects</title>
      <dc:creator>Varun Hegde</dc:creator>
      <pubDate>Mon, 27 Jul 2020 13:02:45 +0000</pubDate>
      <link>https://dev.to/varuntumbe/looking-for-projects-39n3</link>
      <guid>https://dev.to/varuntumbe/looking-for-projects-39n3</guid>
      <description>&lt;p&gt;I recently learnt javascript and I know html ,css and bootstrap I wanted a beginner friendly projects (open source is even better) where I can learn more.&lt;br&gt;
Please guide me. &lt;br&gt;
Thank in advance&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
