tag:blogger.com,1999:blog-80334591653216931192024-03-12T20:47:15.791-07:00Coding MomentsVladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.comBlogger14125tag:blogger.com,1999:blog-8033459165321693119.post-52407942785524743732019-04-12T21:03:00.001-07:002019-04-12T21:03:31.580-07:00Good friend penguinV<h3 style="text-align: center;">
Two birds with one "Pull"</h3>
<div>
<br /></div>
<div>
As previously said, I was working on OpenCV bug (you can find some details <a href="https://codingmoments1618.blogspot.com/2019/04/two-different-frames-of-same.html" target="_blank">here</a>). The bug was not something to spend more than 2-3 days on, but the problem that was there - compilation time. OpenCV project is a set of C/C++ files (and CUDA ;-) ), which is supposed to be compiled with "cmake" to generate library(ies), containing compiled code. Everything sounded pretty decent, until the moment when I realized that I would need to compile the entire folder with a bit more than a lot of different modules of different shapes and colours to make any changes to the existing code and test it. And just because the modules with reference one-another, creating a web of dependencies, I would need to compile the whole thing every time, not some of the modules independently ("video" module, "java", "core" etc.). It'd be okay if not the fact that every compilation would take 20 minutes. Not nice. So, I switched to the projects that I worked on previously - <a href="https://github.com/ihhub/penguinV" target="_blank">penguinV</a>.</div>
<div>
The new <a href="https://github.com/ihhub/penguinV/issues/346" target="_blank">issue</a> that I found was thrilling - implementation of <u>another</u> feature for EdgeDection algorithm. This time, it was optional median and Gaussian filtering for an image, before it would try to find positive and negative edges.</div>
<div>
I implemented the algorithm the way that the owner of the repo asked (I hope I did it correctly; if not, there is always a possibility to change and resubmit the work) and implemented my own way of approaching the Gaussian task. I found a couple articles, which stated that Gaussian distribution algorithm is not the only way how one can get Gaussian kernel, but there's also an option of using well-known Pascal's triangle to get a line of normally distributed values (<a href="http://rastergrid.com/blog/2010/09/efficient-gaussian-blur-with-linear-sampling/" target="_blank">source</a>). And this algorithm works just a bit faster than the <a href="https://homepages.inf.ed.ac.uk/rbf/HIPR2/gsmooth.htm" target="_blank">original</a>. I also was asked by the owner of the repo (<a href="https://github.com/ihhub" target="_blank">ihhub</a>) to fix another issue alongside (<a href="https://github.com/ihhub/penguinV/issues/414" target="_blank">issue</a>). More details can be found in the PR :)<br /> <br /> Thank you for your attention! </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<a href="https://github.com/ihhub/penguinV/issues/346" target="_blank">Issue #1</a></div>
<div>
<a href="https://github.com/ihhub/penguinV/issues/414" target="_blank">Issue #2</a></div>
<div>
<a href="https://github.com/ihhub/penguinV/pull/424" target="_blank">Pull Request</a></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-84790846760834560642019-04-05T18:35:00.001-07:002019-04-05T18:42:04.550-07:00Two Different Frames of Same VidioCapture<h3 style="height: 0px; text-align: center;">
OpenCV Challenge</h3>
<div>
<br /></div>
<div>
I believe, this bug is going to be one of the most challenging I have worked on. Not because of complexity of the work, not because of the scale involved, but because the part of the code is brand new to me.</div>
<div>
<div class="code">
STDMETHODIMP SourceReaderCB::OnReadSample(HRESULT hrStatus, DWORD dwStreamIndex, DWORD dwStreamFlags, LONGLONG llTimestamp, IMFSample *pSample)
<br />
{
<br />
CV_UNUSED(llTimestamp);
<br />
HRESULT hr = 0;
<br />
cv::AutoLock lock(m_mutex);
<br />
if (SUCCEEDED(hrStatus))
<br />
{
<br />
if (pSample)
<br />
<br />
CV_LOG_DEBUG(NULL, "videoio(MSMF): got frame at " << llTimestamp);
<br />
IMFSample* prev = m_lastSample.Get();
<br />
if (prev)
<br />
{
<br />
CV_LOG_DEBUG(NULL, "videoio(MSMF): drop frame (not processed)");
<br />
}
<br />
m_lastSample = pSample;
<br />
}
<br />
}
<br />
else
<br />
{
<br />
CV_LOG_WARNING(NULL, "videoio(MSMF): OnReadSample() is called with error status: " << hrStatus);
<br />
}
</div>
<br />
Sooo, here we have a function... which takes 5 parameters... one of which seems to be a pointer... and then magic happens inside of the function.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<img border="0" data-original-height="370" data-original-width="600" height="246" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMgDzXOeHqUkb8qv2A8qihVLQJPEprVyUJLlKVj-Wtmygorp6VMjYQu1UULLZcnm_-kMmdMfkrBYWHHsgoh3RmxCPKmOYHLnrxLyn5genbvMkQ1cWpKoiWnIEHfaREC5r_JSiPTbCpr7A/s400/1qi98d.jpg" width="400" /><br /><a href="https://imgflip.com/memetemplate/104987965/Woosh-cat" target="_blank">https://imgflip.com/memetemplate/104987965/Woosh-cat</a></div>
<br />
<br />
But first, let me refresh your memory on the issue itself. The <a href="https://github.com/opencv/opencv/issues/14044" target="_blank">bug</a> crawls in <a href="https://github.com/opencv/opencv" target="_blank">OpenCV</a> repo, and it concerns VideoStream: when a user plugs in an external video cam (it is supposed to have MSMF (Microsoft Media Foundation) background), takes a number of frames from the stream and, before one would take another frame, plugs out the cam, the OpenCV read() function will return a flag signaling about unsuccessful frame take, but it would also return non-empty frame, which logically would need to be empty.<br />
The bug is in C++ style of the code and shouldn't be so hard to spot. Yet, the fact that we are dealing with MSMF implies that the deep inside in the .cpp logic, the code will take forms of the one we can see in <windows.h> and such.<br />
“<i>It's a dangerous business, Frodo, going out your door. You step onto the road, and if you don't keep your feet, there's no knowing where you might be swept off to.</i>” (LotR).<br /> The piece of the code from the above is the one responsible for throwing an error upon trying to read a frame while having the camera being unplugged. <br /><br /><br />
Here's the piece of the code that can produce the issue:<br />
<br />
<div class="code">
VideoCapture m_camera;<br />
Mat m_originalFrame;<br />
<br />
m_camera.open(1 + CAP_MSMF); // Note manual change in the type of the camera<br />
bool success = m_camera.read(m_originalFrame);<br />
if (success)<br />
{<br />
cout << "Success\n";<br />
cout << "Please unplugged your camera \n";<br />
imshow("UNplugged your camera", m_originalFrame);<br />
waitKey();<br />
success = m_camera.read(m_originalFrame);<br />
if (!success || m_originalFrame.empty())<br />
{<br />
cout << "second non success\n";<br />
m_camera.release();<br />
}<br />
else<br />
{<br />
cout << "If camera is unplugged you shouldn't read this message";<br />
}<br />
}<br />
<br /></div>
And the replicated issue can be seen on the following image:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO1y4-dv0zVv9u-UNtN4dY8ZR4hbRcDCn-ao1WVFsWsm9hQqaZOTzkuYIZhodpOVvTot2zN7_poY2K_k6pmk-K2VwBJetCnpUucGLz_sphp6nHnSF_afwXk3zE1d-0I8Qi2Gc47Li3RGs/s1600/test.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="857" data-original-width="1600" height="342" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjO1y4-dv0zVv9u-UNtN4dY8ZR4hbRcDCn-ao1WVFsWsm9hQqaZOTzkuYIZhodpOVvTot2zN7_poY2K_k6pmk-K2VwBJetCnpUucGLz_sphp6nHnSF_afwXk3zE1d-0I8Qi2Gc47Li3RGs/s640/test.png" width="640" /></a></div>
<br />
<br />
As to what approach should I take to fix this, I am currently thinking about looking for a default entity and the value it should take and try to return it instead of non-empty frame.<br />
<br />
Issue can be found <a href="https://github.com/opencv/opencv/issues/14044" target="_blank">here</a>.<br />
<br />
<br />
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-84857867105055389262019-03-29T19:18:00.004-07:002019-03-29T19:18:57.241-07:00penguingV Enhancement. Deploy<h3 style="text-align: center;">
Sending PR</h3>
<div>
Big game, big play, big problems, big solutions. Here we came to the point when "good-first-issue" is not good enough for us, and working on something of higher scale looks much more <strike>intimidating</strike> exciting! </div>
<div>
In my last <a href="https://codingmoments1618.blogspot.com/2019/03/penguingv-enhancement.html">post</a> I described the issue I was working on, so let's jump to the solution. </div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiai5aJPd7FNxfHZcxsOwZYVObdpYQYC9oJNSndbO3A6MGENGTxafKvlgilvF1HkL1Bb7lP2KPAwvgnFsgeJvXUdRXKA1RxKmG_zugKEVzBMCF0RPwL319Kl_24Z_V6F4bkmqUePt9-dlg/s1600/1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="531" data-original-width="1271" height="266" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiai5aJPd7FNxfHZcxsOwZYVObdpYQYC9oJNSndbO3A6MGENGTxafKvlgilvF1HkL1Bb7lP2KPAwvgnFsgeJvXUdRXKA1RxKmG_zugKEVzBMCF0RPwL319Kl_24Z_V6F4bkmqUePt9-dlg/s640/1.png" width="640" /></a></div>
<div>
<br /></div>
<div>
The above is the screenshot of the proposed solution to templating the EdgeDetection class. Previously, the class was using "Point"s based on "double" values (double x, double y). The proposed solution uses "T" as a generic type instead of hardcoded "double" and "PointBase2D<>" template instead of "Point2d" type based on "double".<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKICn-1-afEwrncgu_hsU1p4KH53-SUaHL7oEAdgv0MEq5KaK9XapGZDpphpwyQPPiPvzdVBRDkQW4j8NN7yKUON-d7UpgaB3BksrGqVhMxlcrKY8FlWD2R-cEgdRcLjHjI3resEEu57c/s1600/2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="489" data-original-width="1411" height="220" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKICn-1-afEwrncgu_hsU1p4KH53-SUaHL7oEAdgv0MEq5KaK9XapGZDpphpwyQPPiPvzdVBRDkQW4j8NN7yKUON-d7UpgaB3BksrGqVhMxlcrKY8FlWD2R-cEgdRcLjHjI3resEEu57c/s640/2.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Previously, the class' implementation was separated among ".h" and ".cpp" files, and because implementation code for some of the functions was relatively long, I decided to keep the way of things as they were and don't write everything into one ".h" file (which is possible thanks to template explicit instantiation to get rid of unresolved linker issues). </div>
<div>
The trick in this feature implementation was to not "go out of the boundaries" - the project is relatively big and templating one class might cause the need in templating another one, so it can use the first one, and then templating the third one so it can use the second etc. I was trying my best to keep the changes in reasonable boundaries and only applied template to EdgeDetection class and modified a tiny math file by adding a few getters.<br /></div>
<div>
<br /></div>
<div>
Issue can be found <a href="https://github.com/ihhub/penguinV/issues/328">here</a>.</div>
<div>
Pull request can be found <a href="https://github.com/ihhub/penguinV/pull/418">here</a>.</div>
<div>
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-24188738119049164052019-03-22T10:36:00.003-07:002019-03-22T10:36:58.516-07:00penguingV Enhancement<h3 style="text-align: center;">
Good ol' C++ and Image Processing</h3>
<div>
The <a href="https://github.com/ihhub/penguinV/issues/328">issue</a> that was listed in <a href="https://github.com/ihhub/penguinV">penguinV</a>'s repository asks for a slight improvement on their already implemented <span style="background-color: white;"><span style="color: blue; font-family: Courier New, Courier, monospace;">EdgeDetection()</span></span> algorithm, which currently works with <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">double</span> values. The improvement must template the algorithm so the work can be done with 'float's as well.<br />
Well, templating the class with all of its methods is not that hard, separating headers (<a href="https://github.com/ihhub/penguinV/blob/master/src/edge_detection.h">.h</a>) from implementation (<a href="https://github.com/ihhub/penguinV/blob/master/src/edge_detection.cpp">.cpp</a>) of a templated class is not that tricky (by the way, I have recently found a <a href="https://www.codeproject.com/Articles/48575/How-to-define-a-template-class-in-a-h-file-and-imp">beautiful tutorial</a> on how it can bee done in 3(!) different ways), but making sure that at the time of comparison/assignment of a <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">double</span> to <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">int</span> (and vise-versa) the data won't be truncated because of differences in bit sizes - that can be a bit time-consuming. As of now, the algorithm uses <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">uint32_t</span> (unsigned 32-bit integer) as its integer type to be able to hold/pass data from/to <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">double</span> variables (truncating decimals, obviously), but with switch to <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">float,</span> the <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">uint16_t</span> will need to be used.</div>
<div>
The coding-side of problem gets introduced here in desire to provide flexibility to a user of the <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">EdgeDetection</span>, when the user would only pick either <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">double</span> or <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">float</span>, and integer component would be chosen automatically at the run-time. Yet, as I recently found out, there is no such a thing as run-time function's types declaration, so the following is not possible: </div>
<div>
</div>
<div class="code">
template<typename T = double>
<br />
<div>
</div>
class EdgeDetection
<br />
<div>
</div>
{
<br />
<div>
</div>
private:
<br />
<div>
</div>
...
<br />
<div>
</div>
typedef std::conditional<std::is_same<T, double>::value, uint32_t, uint16_t>::type _UINT;
<br />
}</div>
<div>
<br /></div>
<div>
This part <span style="background-color: white;"><span style="color: blue; font-family: Courier New, Courier, monospace;">std::is_same<T, double></span></span> would return <span style="color: blue;"><span class="kw1" style="background-color: white; font-family: "dejavusansmono" , "dejavu sans mono" , "courier" , monospace; font-size: 12.8px; line-height: 1.1em; margin: 0px; padding: 0px; white-space: nowrap;">inline</span><span style="background-color: white; font-family: "dejavusansmono" , "dejavu sans mono" , "courier" , monospace; font-size: 12.8px; white-space: nowrap;"> </span><span class="kw4" style="background-color: white; font-family: "dejavusansmono" , "dejavu sans mono" , "courier" , monospace; font-size: 12.8px; line-height: 1.1em; margin: 0px; padding: 0px; white-space: nowrap;">constexpr</span><span style="background-color: white; font-family: "dejavusansmono" , "dejavu sans mono" , "courier" , monospace; font-size: 12.8px; white-space: nowrap;"> </span><span class="kw4" style="background-color: white; font-family: "dejavusansmono" , "dejavu sans mono" , "courier" , monospace; font-size: 12.8px; line-height: 1.1em; margin: 0px; padding: 0px; white-space: nowrap;">bool</span> </span>value and so we would be able to determine if <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">uint32_t</span> or <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">uint16_t</span> should be used, but <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">std::is_same<></span> will be able to return something only at the run-time, so we cannot declare an object of type <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">_UINT</span> before the <span style="background-color: white; color: blue; font-family: Courier New, Courier, monospace;">std::is_same<></span> is done.</div>
<div>
The solution to this can probably be the implementation of so-called "<a href="https://en.wikipedia.org/wiki/Visitor_pattern">visitor pattern</a>", which, basically, separates the object structure from its algorithm, allowing us to use "<a href="https://en.wikipedia.org/wiki/Double_dispatch">double dispach</a>" to split the run-time flow in two different streams (for <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">double</span>s and <span style="background-color: white; color: blue; font-family: "Courier New", Courier, monospace;">float</span>s in or example). I will try to apply the pattern and see if it is something we can do the workaround with.</div>
<div>
<br /></div>
<div>
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-67288865215635479682019-03-15T19:58:00.000-07:002019-03-15T19:58:33.824-07:00Deep Into Issues<h3 style="text-align: center;">
In search of the best bugs</h3>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyUJBvVlE5xl49lYXhOHc5Im9CXtpR6FxCicVbV420GW4CZl9y1J9flPEd2HQMJM64wTgNyJMBWDhpP4vLDjaqyJ7KSDGUoh3nG4SYMxqp8H5FuDMqVosbekoYsy7ka8Gy7TUWLGRaj4/s1600/jordan-opel-555217-unsplash.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1202" data-original-width="1600" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhyyUJBvVlE5xl49lYXhOHc5Im9CXtpR6FxCicVbV420GW4CZl9y1J9flPEd2HQMJM64wTgNyJMBWDhpP4vLDjaqyJ7KSDGUoh3nG4SYMxqp8H5FuDMqVosbekoYsy7ka8Gy7TUWLGRaj4/s320/jordan-opel-555217-unsplash.jpg" width="320" /></a></div>
<div style="text-align: center;">
<br /></div>
<div>
I've been looking for a couple projects that I might be able to contribute to. Time period - 2 weeks for each. Level of difficulty - intermediate. Excitement - beyond limits. </div>
<div>
After a couple of decent hours spent on looking for no less decent projects to work on, I decided to come back to the one that I have already worked on - <a href="https://github.com/ihhub/penguinV">penguinV</a> (you can read about this project in one of my previous <a href="https://codingmoments1618.blogspot.com/2019/03/good-first-issue-implementation-part-34.html">posts</a>) - and choose one, that I haven't worked with before - <a href="https://github.com/opencv/opencv">opencv</a>. OpenCV is an open source project, which is implemented in C++ and Python and is widely used in various computer vision projects. </div>
<div>
The issues that I would like to focus on have different backgrounds, one is an enhancement, and the other is a bug fix. I believe I should be able to manage to finish both of them on time, even having a tight schedule this semester and working on 3 big projects at the same time. </div>
<div>
Wish me luck and wait for the updates :)</div>
<div>
<br /></div>
<div>
<a href="https://github.com/ihhub/penguinV/issues/328">Issue #1</a></div>
<div>
<a href="https://github.com/opencv/opencv/issues/14044">Issue #2</a></div>
<div>
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-90903073044234449292019-03-06T17:13:00.002-08:002019-03-06T17:13:52.480-08:00"Good first issue". Finale.<h3 style="text-align: center;">
Status: completion</h3>
<div>
Four pull request have been submitted and work seems to be done, so let's recall what we've been working on:<br /><ul>
<li><a href="https://github.com/AVMf/avmf">AVM</a><i><a href="https://github.com/AVMf/avmf">f</a> </i>(Averaging Variable Method framework).</li>
<li><a href="https://github.com/mochajs/mocha">MochaJS</a></li>
<li><a href="https://github.com/ihhub/penguinV">PenguinV</a></li>
<li><a href="https://github.com/schemaanalyst/schemaanalyst">schemaanalyst</a></li>
</ul>
<div>
1) AVM<i>f</i>. I believe I should give more detailed 'inside' to this and next projects (MochaJS), since at the time of writing respective <a href="https://codingmoments1618.blogspot.com/2019/02/good-first-issue-search-part-24.html">post</a> the work wasn't progressing at desired tempo. </div>
<div>
<br /> <div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZhJnMuId_Pxm1RcIrqL2NEYDgv3AH9q-ELToCpRS1kZJyUTloD1x6lfuurRGYkR_BrvWnSiEFjobtGzrxABF3MhuomJRN7wIUF2t47yoHGD4UFX96pRe8Hg9mUnoVinXy1eAPLko-8-0/s1600/scr5.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="827" data-original-width="1255" height="420" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZhJnMuId_Pxm1RcIrqL2NEYDgv3AH9q-ELToCpRS1kZJyUTloD1x6lfuurRGYkR_BrvWnSiEFjobtGzrxABF3MhuomJRN7wIUF2t47yoHGD4UFX96pRe8Hg9mUnoVinXy1eAPLko-8-0/s640/scr5.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIlsidddkMRM415f78WAWZvKvOn27eHJ3YNipEyFblpp1OgjKodfNVFYEla2uqhUOJ1BUk8oMsx66SRflF7ddIvY1HGQgDqKFI_QGK15k8f4hvQXt-3M5RZToZDiQHbXOs1hECAEEN-cg/s1600/scr6.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="795" data-original-width="1195" height="424" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIlsidddkMRM415f78WAWZvKvOn27eHJ3YNipEyFblpp1OgjKodfNVFYEla2uqhUOJ1BUk8oMsx66SRflF7ddIvY1HGQgDqKFI_QGK15k8f4hvQXt-3M5RZToZDiQHbXOs1hECAEEN-cg/s640/scr6.png" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
The community welcomed me - a newcomer - nicely and with understanding. The issue was to add tool's logo to README.md and a brief list of features that the tool is capable of. I did my research and found the most recent <a href="http://eprints.whiterose.ac.uk/104204/1/c43.pdf">article</a> that was dating October 2018, which contains a good detailed explanation of the possibilities of AVM<i>f</i>. All I needed to do is to read it and boil it down to the list, which would give an idea of what the tool is for. The community gave me green light on using it as a source and so I did.<br /> The logo has been added, the list has been created, PR submitted, tests passed, but there hasn't been any reply as of today yet.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Link to the <a href="https://github.com/AVMf/avmf/issues/17">issue</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
Link to the <a href="https://github.com/AVMf/avmf/pull/19">PR</a>.<br /><br />2) MochaJS. The issue - adding a logo to the community's <u><a href="https://mochajs.org/">site</a>,</u> not README.md as I though before. This very fact forced me to set up the environment for the contributions (they use <a href="https://www.11ty.io/">Eleventy</a> as a static site generator and self-explanatory <a href="https://npm.im/markdown-magic">markdown-magic</a>). I found out the the site (index.html) getch generated from <a href="https://github.com/vrozin/mocha/blob/issue-3705/docs/index.md">index.md</a>, which loads 3 different '.md' components to construct its content. So I thought 'heck, why not?' and added a new component, which would dynamically load the requested logo on the site upon build.<br /><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Uhjd9tF7GsMw_sVRRmliaqgLTfFwz4GcEewWri9Qn2bjh9rMovwG9LB5ncB3wUADxARVhhNxu6rVRHoxAM4x5U7iTgl0QJKbBcIyBpn5iwB8c5HAHpZgrFPMFWxfEoywreRCjucPzo4/s1600/scr7.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="967" data-original-width="1593" height="388" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5Uhjd9tF7GsMw_sVRRmliaqgLTfFwz4GcEewWri9Qn2bjh9rMovwG9LB5ncB3wUADxARVhhNxu6rVRHoxAM4x5U7iTgl0QJKbBcIyBpn5iwB8c5HAHpZgrFPMFWxfEoywreRCjucPzo4/s640/scr7.png" width="640" /></a></div>
<div style="text-align: center;">
index.md</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
In the highlighted area you can notice the file '<a href="https://github.com/vrozin/mocha/blob/issue-3705/docs/_includes/honorableMentions.md">honorableMentions.md</a>'. It is the one that I created to be loaded with requested logo in it. Let's take a look at the content:<br /><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOPVR96QUr7DT1op-ylNEYRZBSarFjtFM1xOOwhlf3NZfeqcAVwQAlb-T0UQil8vhpy9iY1Etnx5Enyo9UaAU2KmiA0wfvgTD5w2qSKN3wfaXTZbSXvHk9ueM5wN-R02Z3bP2u4wnwBW0/s1600/scr8.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="971" data-original-width="1483" height="418" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiOPVR96QUr7DT1op-ylNEYRZBSarFjtFM1xOOwhlf3NZfeqcAVwQAlb-T0UQil8vhpy9iY1Etnx5Enyo9UaAU2KmiA0wfvgTD5w2qSKN3wfaXTZbSXvHk9ueM5wN-R02Z3bP2u4wnwBW0/s640/scr8.png" width="640" /></a></div>
<div style="text-align: center;">
honorableMentions.md</div>
<div style="text-align: left;">
<br /></div>
<br />
<div class="separator" style="clear: both; text-align: left;">
Here, I load the pic file from an 'assets' folder. Even though there is only one file, I do it in a loop, since there's a possibility that the community decides to mention other individuals/companies, so the functionality is already there, they will just need to slightly modify it.</div>
<div class="separator" style="clear: both; text-align: left;">
But there appeared a problem: another person came in two days after I had submitted my PR for review, and sent his PR to fix the very same issue. I mean, I don't mind, but I highly doubt he didn't see that other people already were working on that. Not nice. </div>
<div class="separator" style="clear: both; text-align: left;">
PR has been submitted, no response yet.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Link to the <a href="https://github.com/mochajs/mocha/issues/3705">issue</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
Link to the <a href="https://github.com/mochajs/mocha/pull/3749">PR</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
3) penguinV. There haven't been any updates since the moment after the issue was closed. The detailed report on it and my frustration can be found in my post <a href="https://codingmoments1618.blogspot.com/2019/03/good-first-issue-implementation-part-34.html">here</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
As a side-note, I'd like to say that I am seriously considering contributing to this project because of the following reasons: the community is welcoming and helpful, the tool uses something that I would like to research about (CUDA and OpenCL).</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
Link to the <a href="https://github.com/ihhub/penguinV/issues/321">issue</a>.<br />
Link to the <a href="https://github.com/ihhub/penguinV/pull/401">PR</a>.<br />
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
4) schemaanalytic. No update as well. The PR's been submitted, but no reply has been gotten yet. I will follow up with the community, asking if there's anything else that they would like to fix in the opened issue. Some of the details for this fix can be found in my previous <a href="https://codingmoments1618.blogspot.com/2019/03/good-first-issue-final-chapter-part-44.html">post</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div style="text-align: left;">
Link to the <a href="https://github.com/schemaanalyst/schemaanalyst/issues/10">issue</a>.</div>
<div style="text-align: left;">
Link to the <a href="https://github.com/schemaanalyst/schemaanalyst/pull/16">PR</a>.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
</div>
</div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-34455562532930279762019-03-06T15:24:00.000-08:002019-03-06T15:24:41.866-08:00"Good first issue", the final chapter. Part 4/4.<h3 style="text-align: center;">
Status: success?</h3>
<div>
<br /></div>
<div style="text-align: center;">
<img alt="SchemaAnalyst - a mutation testing tool for relational database schemas" height="200" src="https://github.com/schemaanalyst/logo/raw/master/schemaanalyst-logo-gh.png" width="200" /></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
The fourth and the final 'Good first issue' fix that I worked with was for <a href="https://github.com/schemaanalyst/schemaanalyst">schemaanalyst </a> project, which focuses on work with relational DB schema, ensuring integrity of the data and intended data acceptance/rejection criteria. The issue was relatively simple - to make style of some of the table data be matching with style of examples, containing this data.</div>
<div>
<br /></div>
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nxBiuhjYjrJbYQyVv4QGkPU4dYRFR82i9_UsEM8xSr7vXYB9cb9ObpGkB4bKwebmfDpskaS9BSr8mTJ_VhORFFbqb7f2VIFlHUet3pK6g4kkmh_M_cV7OIMCwKKEQNJeUsmEv03Fg5s/s1600/scr3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="859" data-original-width="1271" height="432" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg7nxBiuhjYjrJbYQyVv4QGkPU4dYRFR82i9_UsEM8xSr7vXYB9cb9ObpGkB4bKwebmfDpskaS9BSr8mTJ_VhORFFbqb7f2VIFlHUet3pK6g4kkmh_M_cV7OIMCwKKEQNJeUsmEv03Fg5s/s640/scr3.png" width="640" /></a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
The fix was pretty easy to do and not time consuming one. The markup allows usage of backticks in tables, so I made the styles being matching.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzUNjck77mG2xQtTn3FPR3kGglY4Wh7TlDSjYEBaSjKgYfs4fik0bGXdaO00WmXpcPPIazCXM3esUDNmI-0UcLk68zHWwXN8Yvq1YW0os8kdBTnRmh9QqlQJzzp83KghK3ER_MAd6rYKk/s1600/scr4.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="860" data-original-width="1233" height="444" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzUNjck77mG2xQtTn3FPR3kGglY4Wh7TlDSjYEBaSjKgYfs4fik0bGXdaO00WmXpcPPIazCXM3esUDNmI-0UcLk68zHWwXN8Yvq1YW0os8kdBTnRmh9QqlQJzzp83KghK3ER_MAd6rYKk/s640/scr4.png" width="640" /></a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
However, the community haven't replied yet, so I am wondering if the fix is to accepted in the nearest time or not.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
The link to the <a href="https://github.com/schemaanalyst/schemaanalyst/issues/10">issue</a>.</div>
<div style="text-align: left;">
The link to the <a href="https://github.com/schemaanalyst/schemaanalyst/pull/16">PR</a>.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-90629469064327014162019-03-06T14:32:00.000-08:002019-03-06T14:58:34.300-08:00"Good first issue", implementation. Part 3/4.<h3 style="text-align: center;">
Status: Success</h3>
<div>
The third issue, in my list of open source issues I have worked with, will be a fix in a <a href="https://github.com/ihhub/penguinV/blob/master/README.md">README.md</a> for <a href="https://github.com/ihhub/penguinV" target="_blank">penguinV</a> project (C++ image processing library, which focuses on work with heterogeneous systems. It works with <a href="https://en.wikipedia.org/wiki/CUDA">CUDA</a> and <a href="https://en.wikipedia.org/wiki/OpenCL">OpenCL</a>). </div>
<div>
The fix would require a simple modernization of a landing page in the repo, just so it would have a better user experience. No special requests have been mentioned, so it was up to the developer to provide creativity and suggest a few changes.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy6D-GqwSpqeFt20TRFTcG9VEvuYeloqOvvRvRjKsUmYlVOFUuJ3r-0mSpVByKlA4vUATuQIVD2p8ETvfVIQu0lNH0fb4hc5TxjpofCpVIZgMAqXtKjJDiNhUsK2ZmFcLwjbFOJ_CrOMk/s1600/scr1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="845" data-original-width="1281" height="422" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhy6D-GqwSpqeFt20TRFTcG9VEvuYeloqOvvRvRjKsUmYlVOFUuJ3r-0mSpVByKlA4vUATuQIVD2p8ETvfVIQu0lNH0fb4hc5TxjpofCpVIZgMAqXtKjJDiNhUsK2ZmFcLwjbFOJ_CrOMk/s640/scr1.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
The first thing that I noticed, was a lack of hyperlinks in descriptions of the tool, so I modified those mentions of the docs that appeared there (just simple markup links to the Master repo). I also wanted to practice with <span style="background-color: white; font-family: "courier new" , "courier" , monospace;">git rebase</span>, so after all necessary commits have been done locally (just a bit more than a lot of them), I squashed all the commits that I had into one by running <span style="background-color: white; font-family: "courier new" , "courier" , monospace;">git rebase -i HEAD~10</span>. The command would pick up 10 commits preceding the commit with HEAD pointer on it and open interactive rebasing window where we can specify that we want to 'squash' all commits after 'picking' the first one. </div>
<div>
After pushing the lonely squashed commit to my origin repo and reviewing the changes, I was asked to make a few modifications to the commit; but the requester (and the owner of the repo at the same time) did the change by oneself, also fixing my typo along the way. And then, something interesting happened. As I introduced a hint for contributors, they can start by looking at 'Help Wanted' and 'Good First Issue' links, I got an idea of styling these two phrases in the way how actual tags are styled, so I was discussing this possibility with <a href="https://github.com/ihhub">@ihhub</a>. @ihhub suggested to do the change and asked me to do it while @ihhub would be on the phone. And here I knew, here it was, my opportunity to find out how well I know git and how fast can execute all <u>necessary</u> commands. Well, it was faster than if a toddler would do it. I hope. Anyways, I did the change required by adding <kbd></kbd> tags to 'Help Wanted' and 'Good First Issue' and was ready to submit, but git would complain that I didn't have the recent updates, so I can't possible push (the ones added by @ihhub). So, I didn't find a better way but to replicate the changes in my own commit, rebase, and force push it, deleting the commits of @ihhub. It did work, but seemed very amateur, so I have set up my personal goal now - to find out how to add changes without deleting others' commits.<br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj10GcnIIQdsVhWH53ANagG5kOtEnSp52esczKXYo9j8X_2YDuJWQZKyvSF1AU3MIsweUzAIqvffcVbxkF5zgHVrqmWErJeKhSD4Q2G6bMbRFFYOfH3P6BfUtQWTxBQmlauJrqez8T5L4g/s1600/scr2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em; text-align: center;"><img border="0" data-original-height="857" data-original-width="1245" height="440" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj10GcnIIQdsVhWH53ANagG5kOtEnSp52esczKXYo9j8X_2YDuJWQZKyvSF1AU3MIsweUzAIqvffcVbxkF5zgHVrqmWErJeKhSD4Q2G6bMbRFFYOfH3P6BfUtQWTxBQmlauJrqez8T5L4g/s640/scr2.png" width="640" /></a></div>
<div>
<br />
<br />
The community is incredibly welcoming, and, despite me doing rebase, @ihhub asked if I'd like to work on something of my taste! :)<br />
<br /></div>
<div>
Link to the <a href="https://github.com/ihhub/penguinV/issues/321">issue</a>.<br />
Link to the <a href="https://github.com/ihhub/penguinV/pull/401">PR</a>.</div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-23532948127188184742019-02-22T15:41:00.001-08:002019-02-22T15:41:14.749-08:00"Good-first-issue" search. Part 2/4.<h3 style="text-align: center;">
Status: in progress</h3>
<div>
First issues have been spotted and the work is progressing in full speed. The issues are similar in their nature, which makes it easier for me to pick an approach to solve them. I have found two beautiful projects to contribute to: <a href="https://github.com/mochajs/mocha" target="_blank">MochaJS</a> and <a href="https://github.com/AVMf/avmf" target="_blank">AVMFramework</a>. The first is a JavaScript test framework, and the second is a Java framework implementation for Alternating Variable Method, a heuristic local search algorithm. </div>
<div>
<br /></div>
<div style="text-align: center;">
<img alt="Image result for mochajs" height="200" src="https://js.foundation/wp-content/uploads/sites/33/2017/02/mocha.png" width="175" /></div>
<div>
The issue I am working on at Mocha is an update of the Mocha's site, so it would include an extra badge of one of the sponsors that the team got acquired recently. The issue can be found <a href="https://github.com/mochajs/mocha/issues/3705" target="_blank">here</a>.</div>
<div>
<br /></div>
<div>
</div>
<div style="text-align: center;">
<img alt="AVMf Logo" height="227" src="https://camo.githubusercontent.com/0355fac8d9443af156998749083a61e7c5fec75a/687474703a2f2f61766d6672616d65776f726b2e6f72672f696d616765732f61766d662e706e67" width="400" /></div>
<div style="text-align: left;">
The Alternating Variable Method framework currently has an issue with documentation. They require an update of the Readme file, so it would also be displaying the logo and a list of the features that the tool can offer, so anyone entering the repo, could decide if AVM<i>f</i> is something they would want to work with. The details on the issue can be found <a href="https://github.com/AVMf/avmf/issues/17" target="_blank">here</a>.</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-81416508752056186672019-02-15T14:21:00.000-08:002019-02-15T14:21:28.479-08:00"Good-first-issue" for a "good-first-experience". Part 1/4.<h3 style="text-align: center;">
Status: In active search</h3>
<div>
What I have recently found out is the cornerstone of an open source development is not only to be able to contribute to a project, it is also to know what project one should contribute to.<br /> I've been searching mostly on <a href="https://codetribute.mozilla.org/" target="_blank">Codetribute</a>, which is a Mozilla's owned web portal to manage open source contributions.<br /><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTYQP3KXIibMHbSy7uZkLk589y7zycjPyXViO_j4QpcNG-XZLyIZvr4RCVfCuhRDkYzAz9sbCDPr2kC7fmWau-oyIUGvaIqRXTrnweggchHf4IqHa7x4JeisGwih45-MWosTV-DQuA4m4/s1600/aaa.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="843" data-original-width="1600" height="336" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjTYQP3KXIibMHbSy7uZkLk589y7zycjPyXViO_j4QpcNG-XZLyIZvr4RCVfCuhRDkYzAz9sbCDPr2kC7fmWau-oyIUGvaIqRXTrnweggchHf4IqHa7x4JeisGwih45-MWosTV-DQuA4m4/s640/aaa.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
After a couple of hours of searching for <i>the</i> bug, the only and the best, I noticed that the list of the current issues in there is sorted by dates of recent updates only, which makes it harder to find a newly created bug to contribute to, since updated old ones (and sometimes very old ones) get pushed to the top of the list as well. I find it a little challenging for myself (at least for now) to be trying to go over dozens of comments for a specific issue and trying to fix it, when other people have been working on it for a while already.<br /><br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZGUuyk-eT9OwmSm8HTgStmgQr8aFjZjKWgopqmP9qHNTwyVKaVhK98TkK8CWDoCYkqKBTRyzlF0VnmYr6roQ-tEeXQ1zBbkEGKXrli9VVROyo1PgcpALGKvTB29mBZlfIVg9Vp1wnMuo/s1600/bbb.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="777" data-original-width="1600" height="310" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZGUuyk-eT9OwmSm8HTgStmgQr8aFjZjKWgopqmP9qHNTwyVKaVhK98TkK8CWDoCYkqKBTRyzlF0VnmYr6roQ-tEeXQ1zBbkEGKXrli9VVROyo1PgcpALGKvTB29mBZlfIVg9Vp1wnMuo/s640/bbb.png" width="640" /></a></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
But let's move the technicalities aside. The job that lays ahead is to find a project to contribute. As per Jatin's recommendation (you can find Jatin's blog <a href="https://jatinkumar.home.blog/" target="_blank">here</a>), there is an interesting project that can get under my radar of interest - <a href="https://github.com/TEAMMATES/teammates" target="_blank">Teammates</a>. The project focuses on online web evaluation for peer students; it uses Java, JS, and Angular. I personally think that a project of this size is a great opportunity for contributing, so I will definitely try my luck with it.</div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
<div>
<br /></div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-52558827760295218412019-02-03T17:26:00.000-08:002019-02-03T21:31:43.572-08:00Choosing Projects To Work On<h2 style="height: 0px; text-align: center;">
And the journey into the Open Source world begins</h2>
<div>
<br /></div>
<div>
How should a person start one's experience with open source projects? Well, the answer to this question probably won't be trivial - with oneself.<br />
When contributing to an open source project, we need to know our own skill set and what we are capable of, what we would like to learn and/or research; and, on a base of that analysis, we will be able to narrow down those specific projects, getting the crème fouettée of them, something that we can and <i>would</i> <i>like</i> to put our attention on.</div>
<h4 style="text-align: center;">
Closer to the the matter please</h4>
<div>
Alright, to be specific, for me the true joy dwells into low- and high-level back-end programming languages. Please, don't take me wrong, there are incredibly interesting and powerful front end languages as well, it just happened that I don't find myself incredibly excited while working with them. Well, what am I going to be looking for? Something low, something of <a href="https://en.wikipedia.org/wiki/Cross-platform_software" target="_blank">cross-platform</a> type possibly. If I were to put it into more precise words: <a href="https://en.wikipedia.org/wiki/C_(programming_language)" target="_blank">C</a>, <a href="https://en.wikipedia.org/wiki/C%2B%2B" target="_blank">C++</a>, <a href="https://en.wikipedia.org/wiki/C_Sharp_(programming_language)" target="_blank">C#</a> (yes, I love "C", don't you c?), <a href="https://en.wikipedia.org/wiki/Java_(programming_language)" target="_blank">Java</a>, <a href="https://en.wikipedia.org/wiki/Android_software_development" target="_blank">Android SD</a> using Java. These are programming languages that I know (to some extent) and treasure (to the highest extent), but the list is not limited to them only; I'd love to also take a brief look at such languages as <a href="https://en.wikipedia.org/wiki/Rust_(programming_language)" target="_blank">Rust</a> and <a href="https://en.wikipedia.org/wiki/Lua_(programming_language)" target="_blank">Lua</a>.<br />
<h4 style="text-align: center;">
Alright, a bit more closer please</h4>
</div>
<div>
Now, thinking about what projects to contribute to, I found the following 4 interesting examples:</div>
<div>
<ul>
<li>C/C++: Open Source Computer Vision Library - <a href="https://github.com/opencv/opencv" target="_blank">opencv</a>.</li>
<li>C++: Machine Learning Framework - <a href="https://github.com/tensorflow/tensorflow" target="_blank">tensorflow</a>.</li>
<li>Rust/Lua: <a href="https://github.com/ggez/ggez" target="_blank">ggez</a> - lightweight cross-platform game framework for making 2D games.</li>
<li>Rust: The Servo Parallel Browser Engine Project - <a href="https://github.com/servo/servo" target="_blank">servo</a>.</li>
</ul>
<div>
My interest was peaked specifically by these 4 because of different reasons: opencv is a library, which I currently work with, so I would love to get to know it a little bit more and add something useful to it as well. Tensorflow seems to me a great opportunity to broaden my limited knowledge of machine learning algorithms. And ggez and servo should be great challenges for me personally - to learn completely new for me technology and get familiar with it enough so I would be able to perform a fix one or more bugs. I am not quite sure about my abilities of contributing to the projects, which work with programming languages I am not familiar with, but I will definitely give it a try since it will provide a great personal experience with real-life projects. </div>
<div>
<br />
<br /></div>
</div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-60373254676103691702019-01-27T19:21:00.000-08:002019-01-27T19:22:17.790-08:00Mastering Git<h4 style="text-align: center;">
What to focus on?</h4>
Today is a scary day. Today is the day of admitting one's faults and learning what I was supposed to long ago. So let's dig into learning curve all together by looking at a couple of <a href="https://git-scm.com/" target="_blank"><span style="font-family: "courier new" , "courier" , monospace;">Git</span></a> functions I personally have never used before, which though, for some of you, might already be very familiar, so I will try to bring more interesting information about them to peak everyone's interest.<br />
What are the two functions that we will be looking at? Shall it be <span style="font-family: "courier new" , "courier" , monospace;">git fetch</span> and <span style="font-family: "courier new" , "courier" , monospace;">git tag</span>.<br />
<h4 style="text-align: center;">
Let's play Fetch</h4>
<div>
The purpose of <span style="font-family: "courier new" , "courier" , monospace;">git fetch</span> is to download commits, files, etc. from a remote repo into user's local one (from <a href="https://git-scm.com/book/en/v2/Appendix-C%3A-Git-Commands-Sharing-and-Updating-Projects" target="_blank">here</a>, and <a href="https://www.atlassian.com/git/tutorials/syncing/git-fetch" target="_blank">here</a>). How is it different from <span style="font-family: "courier new" , "courier" , monospace;">git pull</span> then? Well, <span style="font-family: "courier new" , "courier" , monospace;">git fetch</span> does not necessary merge the content with the user's repo, but <span style="font-family: "courier new" , "courier" , monospace;">git pull</span> does. The way to imagine it would be <span style="font-family: "courier new" , "courier" , monospace;">git pull</span> = <span style="font-family: "courier new" , "courier" , monospace;">git fetch</span> + <span style="font-family: "courier new" , "courier" , monospace;">git merge</span>.</div>
<div>
<br />
Here is a graphical representation of the above:</div>
<div style="text-align: center;">
<img height="269" src="https://i.stack.imgur.com/zUInQ.png" width="320" /></div>
<div style="text-align: center;">
<a href="https://i.stack.imgur.com/zUInQ.png" target="_blank">Source</a></div>
<div style="text-align: center;">
<br /></div>
<div style="text-align: left;">
There are quite a few ways to run the command:</div>
<div style="text-align: left;">
<ul>
<li><span style="font-family: "courier new" , "courier" , monospace;">git fetch<span style="background-color: white; white-space: pre-wrap;"> [<options>] [<repository> [<refspec>…]]</span></span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git fetch<span style="background-color: white; white-space: pre-wrap;"> [<options>] <group></span></span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git fetch<span style="background-color: white; white-space: pre-wrap;"> --multiple [<options>] [(<repository> | <group>)…]</span></span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git fetch<span style="background-color: white; white-space: pre-wrap;"> -</span></span><span style="background-color: white; font-family: "courier new" , "courier" , monospace; white-space: pre-wrap;">-all [<options>]/</span></li>
</ul>
<div>
And some of the interesting options for the command are:</div>
<div>
<ul>
<li><span style="font-family: "courier new" , "courier" , monospace;">--all </span>- fetches all repos</li>
<li><span style="font-family: "courier new" , "courier" , monospace;">--depth=<depth> </span>- limits fetching to a particular number of commits</li>
<li><span style="font-family: "courier new" , "courier" , monospace;">-k<br />--keep </span>- keeps downloaded package</li>
<li><span style="font-family: "courier new" , "courier" , monospace;">--multiple </span>- allows multiple repositories/groups to be specified as parameters</li>
<li><span style="font-family: "courier new" , "courier" , monospace;">-q<br />--quiet </span>- silences any internally used git command; progress does not get <br /> reported to standard error stream</li>
<li><span style="font-family: "courier new" , "courier" , monospace;">--progress </span>- progress status gets reported on the standard error stream</li>
</ul>
</div>
<div>
<span style="font-family: "times" , "times new roman" , serif;"><span style="white-space: pre-wrap;"> Examples of the usage can be found <a href="https://www.atlassian.com/git/tutorials/syncing/git-fetch" target="_blank">here</a>.</span></span></div>
<h4 style="text-align: center;">
Let' tag it</h4>
<div>
Tagging is a process of creating a "bookmark", a label at a specific point of time, which represents the version at which the project is present. It can look like any of the following: v1.0, v0.1, v1.8.9-rls, etc. In order to see the current tags available, you can type <span style="font-family: "courier new" , "courier" , monospace;">git tag, </span><span style="font-family: "courier new" , "courier" , monospace;">git tag -l</span> or <span style="font-family: "courier new" , "courier" , monospace;">git tag --list</span><span style="font-family: "times" , "times new roman" , serif;"> (<a href="https://git-scm.com/book/en/v2/Git-Basics-Tagging" target="_blank">source</a>).</span></div>
<div>
<span style="font-family: "times" , "times new roman" , serif;"> In case if the are quite a few tags in the project, the list can be narrowed down by specifying which ones we want to see. For instance: </span><span style="font-family: "courier new" , "courier" , monospace;">git tag -l "2.95.*"</span><span style="font-family: "times" , "times new roman" , serif;">. </span></div>
<div>
<span style="font-family: "times" , "times new roman" , serif;"> There are to types of the tags present in </span><span style="font-family: "courier new" , "courier" , monospace;">Git</span><span style="font-family: "times" , "times new roman" , serif;">:</span></div>
<div>
<ul>
<li><b>Lightweight</b> - they are somewhat similar to pointers to specific commits and don't take up much space.</li>
<li><b>Annotated</b> - stored as objects; they contain tagger's name, date, message, they can be signed and valued.</li>
</ul>
<div>
Examples of creating lightweight tags:</div>
</div>
<div>
<ol>
<li><span style="font-family: "courier new" , "courier" , monospace;">git tag v0.1</span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git tag v1.0-rls</span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git tag v2.4.1</span></li>
</ol>
<div>
<br /></div>
</div>
<div>
Examples of creating annotated tags:</div>
<div>
<ol>
<li><span style="font-family: "courier new" , "courier" , monospace;">git tag -a v1.5 -m "here comes a mandatory message for the tag"</span></li>
<li><span style="font-family: "courier new" , "courier" , monospace;">git tag -a v1.5.1</span> - after that command with no message body provided, <br /> Git will open an editor</li>
</ol>
<div>
If you want to see a detailed information on an annotated tag, then git show should run:<br />
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span>
<span style="font-family: "courier new" , "courier" , monospace;">git show v1.5</span></div>
</div>
<div>
<div>
</div>
<div>
The function will display the following metadata:</div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> tag v1.5</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Tagger: Vlad Rozin <vlad.rozin@example.com></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Date: Sun Jan 27 10:10:00 2019 -0700</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> my version 1.5</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> commit fd10a5aaa817ec66f44789001618690a93761618</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Author: Mike Tyson <mike.tyson@example.com></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> Date: Mon Jan 28 01:52:11 2019 -0700</span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"><br /></span></div>
<div>
<span style="font-family: "courier new" , "courier" , monospace;"> changed the version number</span></div>
</div>
<div>
<span style="font-family: "times" , "times new roman" , serif;"><span style="white-space: pre-wrap;"><br /></span></span></div>
<div>
<br /></div>
</div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com2tag:blogger.com,1999:blog-8033459165321693119.post-39416583167400903342019-01-26T22:12:00.001-08:002019-01-30T11:01:56.182-08:00FilerJS experience<h3 style="text-align: center;">
</h3>
<h3 style="text-align: center;">
Release 0.1</h3>
<div>
Today, I would like to tell you about my so far best amateur usage of <span style="font-family: "courier new" , "courier" , monospace;">Git</span> as a part of "<a href="https://ict.senecacollege.ca/course/osd600?q=course/osd600" target="_blank">Open Source Development</a>" class assignment submission, and I what knowledge I have acquired from it.<br />
<h4 style="text-align: center;">
Well, let's start from the beginning.</h4>
</div>
<div>
The task was to provide a fix to one of the JS files in <a href="https://github.com/filerjs/filer" target="_blank">Filer</a> project files. The "fix" was introduced to all class attendees as a mere move from using "var" (function-scope) upon variable declaration, to "let and "const" (block-scope), which were introduced in <a href="http://es6-features.org/" target="_blank">ES6</a>. The main idea of the assignment was to practice with such incredibly needful in programmers' lives <span style="font-family: "courier new" , "courier" , monospace;">Git</span> commands and try (only try) to master them.<br />
<div style="text-align: center;">
<img alt="Sean Bean Lord Of The Rings | ONE DOES NOT SIMPLY DO THE NEEDFUL | image tagged in sean bean lord of the rings | made w/ Imgflip meme maker" height="179" src="https://i.imgflip.com/2s50m9.jpg" width="320" /></div>
</div>
<div style="text-align: left;">
<br /></div>
<div>
The file <a href="https://github.com/filerjs/filer/blob/master/tests/spec/fs.watch.spec.js" target="_blank">fs.watch.prec.js</a> had been randomly chosen as my personal firing field and the issue report/assignment request has been submitted via GitHub. After a prompt response with notification from my professor that I had just gotten assigned to issue #666, the learning process started.<br />
<h4 style="text-align: center;">
So, what was done?</h4>
<div>
The change was destined to happen on my local machine; therefore, the original project was supposed to be <a href="https://help.github.com/articles/fork-a-repo/" target="_blank">forked</a> to account before any change would happen. After that, the repo has been <a href="https://help.github.com/articles/cloning-a-repository/" target="_blank">cloned</a> on my local machine, the pwd assigned to the root of the newly cloned directory, and all dependencies installed by running <span style="font-family: "courier new" , "courier" , monospace;">npm install</span>. At this point of time, I already read a couple articles about <span style="font-family: "courier new" , "courier" , monospace;">Git</span>'s branches, the fact of which give a bit of courage to try creating branch <span style="font-family: "courier new" , "courier" , monospace;">issue-666</span> myself. While in <span style="font-family: "courier new" , "courier" , monospace;">issue-666</span>, the code was changed with super user-friendly <a href="https://code.visualstudio.com/" target="_blank">VS Code</a> and </div>
<div>
here came the time for testing. </div>
<div>
<a href="https://eslint.org/" target="_blank">Eslint</a> took some time while installing after running <span style="font-family: "courier new" , "courier" , monospace;">npm install eslint</span><span style="font-family: "times" , "times new roman" , serif;">, which gave me some extra time to brew 4th cup of tea and reading a bit more about testing in general. Eslint allows users to discover problems in their JS code without executing it. The linting tool is standalone and pluggable. Isn't it nice? When the installer finished, and the cup was half-empty/half-full, I ran </span><span style="font-family: "courier new" , "courier" , monospace;">npm run test:manual</span><span style="font-family: "times" , "times new roman" , serif;">, switched to </span><span style="font-family: "courier new" , "courier" , monospace;">localhost:1234</span><span style="font-family: "times" , "times new roman" , serif;"> in my browser, and real-time test started its batch job (<a href="https://github.com/filerjs/filer/blob/develop/CONTRIBUTING.md#how-to-contribute" target="_blank">source of the steps</a>).</span></div>
<div>
<span style="font-family: "times" , "times new roman" , serif;"><br /></span> And here's where I have gotten the first issue:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5aUY4Vtfit8opg-S-fyH_enuTrBTariSE3tKUuhHoKYUV9DklbNnwDSw2frEg6aiKHmPEpo9Z5VUrFvUsakv9bWo9yIeH_wJF7mBEW4_Pa_tMMvb1Se70xjZgUKSjzPODvUcC1LeNKlg/s1600/issue666testing.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="836" data-original-width="1600" height="334" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh5aUY4Vtfit8opg-S-fyH_enuTrBTariSE3tKUuhHoKYUV9DklbNnwDSw2frEg6aiKHmPEpo9Z5VUrFvUsakv9bWo9yIeH_wJF7mBEW4_Pa_tMMvb1Se70xjZgUKSjzPODvUcC1LeNKlg/s640/issue666testing.jpg" width="640" /></a></div>
<div>
</div>
<div>
There was something wrong with one of the many "watcher" instances that I recently re-declared with "const" keyword. </div>
<div>
</div>
<div>
I tried to find which instance I should exactly look for:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3wV0GK2mF0AFBXSrzIyZ-c6yrYRA0ad8BuV7wBV3rgJfQRxE1tnACIyXI_C__Vf7tY9vwQsXH02M664ytJM39bWWfnSLEvMA0i7brVCzVo_09HF93kTvjx0JRZneZSTq6WGNguBbCM6Q/s1600/issue666testing2%2528after_change%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="611" data-original-width="1101" height="353" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3wV0GK2mF0AFBXSrzIyZ-c6yrYRA0ad8BuV7wBV3rgJfQRxE1tnACIyXI_C__Vf7tY9vwQsXH02M664ytJM39bWWfnSLEvMA0i7brVCzVo_09HF93kTvjx0JRZneZSTq6WGNguBbCM6Q/s640/issue666testing2%2528after_change%2529.jpg" width="640" /></a></div>
<div>
</div>
<div>
And it gave me a hint to look at line 28, where I successfully forgot to put "const" keyword. </div>
<div>
<br /></div>
<div>
After fixing it, the test ran as intended:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI5rf4pY5jTWx76cjEsUNsSuIwuHTv4cSPPMCa_UvQGSlqhNjDIb_MtjMlfbHk4VGz0CM5zFSAAiMYNkCFc2yHcNG6QM3miHerBf0W84vFnM7_l-bxPlh39N6TUcWm8Y1KGvwyNt3lQT8/s1600/issue666testing2%2528after_change2%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="609" data-original-width="1103" height="352" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhI5rf4pY5jTWx76cjEsUNsSuIwuHTv4cSPPMCa_UvQGSlqhNjDIb_MtjMlfbHk4VGz0CM5zFSAAiMYNkCFc2yHcNG6QM3miHerBf0W84vFnM7_l-bxPlh39N6TUcWm8Y1KGvwyNt3lQT8/s640/issue666testing2%2528after_change2%2529.jpg" width="640" /></a></div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXHEZlB1iLdgmTx_3d5EMVbSXp92cvspJnB39KYHWlm-DNJXSZmeqccv9cSOOqyzskKNci8Br-xAOvMAOAeAe18ke4G0UdP7pblfmaHGX_pbzbERcpENyBtdfcplQ94g1Pui424xydjeE/s1600/issue666testing2%2528after_change3%2528testsGUIone_skipped%2529%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="822" data-original-width="1600" height="328" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXHEZlB1iLdgmTx_3d5EMVbSXp92cvspJnB39KYHWlm-DNJXSZmeqccv9cSOOqyzskKNci8Br-xAOvMAOAeAe18ke4G0UdP7pblfmaHGX_pbzbERcpENyBtdfcplQ94g1Pui424xydjeE/s640/issue666testing2%2528after_change3%2528testsGUIone_skipped%2529%2529.jpg" width="640" /></a></div>
<div>
<br /></div>
<div>
I wanted to find out why one of the tests was skipped, so I checked the file once again, only to find that another issue was assigned to <span style="font-family: "courier new" , "courier" , monospace;">fs.watch</span>, and the issue has been worked on:</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJm1PXEnaWjG71FDxYNtfjf6fNvLZ8l6Foox2wTEBzFJszcVyHMc3OZQtlV1nFl6-jVKzjMIcgFL6AdABpvhAsPkqIRDljaEPvJiK5FwJGrKffAtsIlR4WaPRw3504jsvqmuihXcEAyhQ/s1600/issue666testing2%2528after_change3%2528testsGUIone_skipped_explained%2529%2529.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="955" data-original-width="1549" height="394" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJm1PXEnaWjG71FDxYNtfjf6fNvLZ8l6Foox2wTEBzFJszcVyHMc3OZQtlV1nFl6-jVKzjMIcgFL6AdABpvhAsPkqIRDljaEPvJiK5FwJGrKffAtsIlR4WaPRw3504jsvqmuihXcEAyhQ/s640/issue666testing2%2528after_change3%2528testsGUIone_skipped_explained%2529%2529.jpg" width="640" /></a></div>
<div>
<br /></div>
<div>
After all the steps above, the code was added to a commit, and <a href="https://help.github.com/articles/pushing-to-a-remote/" target="_blank">pushed</a> to my forked repo, and <a href="https://help.github.com/articles/about-pull-requests/" target="_blank">pull request</a> has been sent to the original repository.</div>
<div>
<br /></div>
<div>
Looking at one of the previous pr's (<a href="https://github.com/filerjs/filer/pull/498" target="_blank">#498</a>), I think I started associating every pull request as more of a separate ticket, standalone task, which gets worked on.</div>
<div>
<br /></div>
<div>
My pull request: <a href="https://github.com/filerjs/filer/pull/680">https://github.com/filerjs/filer/pull/680</a></div>
<div>
My filed issue: <a href="https://github.com/filerjs/filer/issues/666">https://github.com/filerjs/filer/issues/666</a><br />
My reviewed PR: <a href="https://github.com/filerjs/filer/pull/709">https://github.com/filerjs/filer/pull/709</a></div>
<div>
Slack's activity: <a href="https://seneca-open-source.slack.com/archives/C8WKYE7E3/p1548533735024200">https://seneca-open-source.slack.com/archives/C8WKYE7E3/p1548533735024200</a></div>
<div>
<br /></div>
</div>
Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0tag:blogger.com,1999:blog-8033459165321693119.post-29831705485875534672019-01-20T18:20:00.002-08:002019-01-20T18:22:38.953-08:00Node.js: fs.open() Today, I would like to take a look at one of the widely used functions of <a href="https://github.com/nodejs/node">Node.js</a>' <a href="https://github.com/nodejs/node/blob/master/lib/fs.js">fs</a> library - <span style="background-color: white; color: #6f42c1; font-family: , "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">open()</span>, and its synchronous version - <span style="background-color: white; color: #6f42c1; font-family: , "consolas" , "liberation mono" , "menlo" , "courier" , monospace; font-size: 12px; white-space: pre;">openSync()</span>.<br />
<br />
The function's purpose is to open a file, specified by a path (the first mandatory parameter of the function). The code of the function is following (<a href="https://nodejs.org/api/fs.html#fs_fs_open_path_flags_mode_callback">source</a>):<br />
<div class="code">
function open(path, flags, mode, callback) {<br />
path = toPathIfFileURL(path);<br />
validatePath(path);<br />
if (arguments.length < 3) {<br />
callback = flags;<br />
flags = 'r';<br />
mode = 0o666;<br />
} else if (typeof mode === 'function') {<br />
callback = mode;<br />
mode = 0o666;<br />
}<br />
const flagsNumber = stringToFlags(flags);<br />
if (arguments.length >= 4) {<br />
mode = validateMode(mode, 'mode', 0o666);<br />
}<br />
callback = makeCallback(callback);<br />
<br />
const req = new FSReqCallback();<br />
req.oncomplete = callback;<br />
<br />
binding.open(pathModule.toNamespacedPath(path),<br />
flagsNumber,<br />
mode,<br />
req);<br />
}
</div>
<br />
<br />
Parameters "flags" and "mode" are optional. Parameter "callback" is mandatory to have. The default values for "flags" and "mode" are 'r' (open file for reading, an exception gets raised if file doesn't exist), "0o666" (readable/writable) respectively.<br />
<br />
<br />
Now, let's take a look at the synchronous version of the function (<a href="https://github.com/nodejs/node/blob/6b7b8276d196ea5a0e6dcee4e63c548b7938e8f4/lib/fs.js#L439">source</a>):<br />
<div class="code">
function openSync(path, flags, mode) {<br />
path = toPathIfFileURL(path);<br />
validatePath(path);<br />
const flagsNumber = stringToFlags(flags || 'r');<br />
mode = validateMode(mode, 'mode', 0o666);<br />
<br />
const ctx = { path };<br />
const result = binding.open(pathModule.toNamespacedPath(path),<br />
flagsNumber, mode,<br />
undefined, ctx);<br />
handleErrorFromBinding(ctx);<br />
return result;<br />
}</div>
<br />
Here, only "path" would be the required parameter, and "flags" and "mode" are optional and still have the same defaults. The function will be executed in synchronous manner, blocking the thread from further execution (until the function is finished).<br />
<br />
Examples of usage:<br />
1. To open a file to read. An exception gets thrown if the file does not exist.<br />
<div class="code">
const fs = require('fs');<br />
fs.open('file1.txt', 'r', (err) => {console.log(err);});
</div>
<br />
<br />
2. To open a file for reading and appending. The file is to be created if doesn't exist:<br />
<div class="code">
const fs = require('fs');<br />
fs.open('file1.txt', 'a+', (err) => {console.log(err);});
</div>
<br />
<br />
3. To open a file synchronously in 'read' mode:<br />
<div class="code">
const fs = require('fs');<br />
fs.openSync('file1.txt');</div>
<br />
More detailed information regarding possible flags to use, can be found <a href="https://nodejs.org/api/fs.html#fs_file_system_flags">here</a>.Vladimir Rozinhttp://www.blogger.com/profile/08421378870875210951noreply@blogger.com0