<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nicoleta Ciauşu on Medium]]></title>
        <description><![CDATA[Stories by Nicoleta Ciauşu on Medium]]></description>
        <link>https://medium.com/@mehanix?source=rss-f447c00aa047------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ddt-jDAuWtd75T7VRQXFpQ.jpeg</url>
            <title>Stories by Nicoleta Ciauşu on Medium</title>
            <link>https://medium.com/@mehanix?source=rss-f447c00aa047------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 17:09:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mehanix/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to Land an Internship in Tech: Tips from a Successful Candidate]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@mehanix/how-to-land-an-internship-in-tech-tips-from-a-successful-candidate-651e2c264a7e?source=rss-f447c00aa047------2"><img src="https://cdn-images-1.medium.com/max/1600/0*Rpc4zFOXDfBE8RKQ" width="1600"></a></p><p class="medium-feed-snippet">With the recent turbulence going on in the Tech space, it&#x2019;s no surprise that getting an internship is tougher than ever. After going&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@mehanix/how-to-land-an-internship-in-tech-tips-from-a-successful-candidate-651e2c264a7e?source=rss-f447c00aa047------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@mehanix/how-to-land-an-internship-in-tech-tips-from-a-successful-candidate-651e2c264a7e?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/651e2c264a7e</guid>
            <category><![CDATA[internships]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[job-search]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Fri, 05 May 2023 21:31:33 GMT</pubDate>
            <atom:updated>2023-05-05T21:31:33.250Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Four things I learned while completing FreeCodeCamp challenges for a month]]></title>
            <link>https://medium.com/@mehanix/four-things-i-learned-while-completing-freecodecamp-challenges-for-a-month-add87f7713d0?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/add87f7713d0</guid>
            <category><![CDATA[html5]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bootstrap]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[freecodecamp]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Wed, 04 Jan 2017 18:03:09 GMT</pubDate>
            <atom:updated>2017-01-04T18:05:00.894Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LTW3ELkdjzjkQWhZ.png" /></figure><p>Journeying into web developing was one of the New Years’ Resolutions I was planning to make for 2017 — as I am the kind of person to wait for special occasions in order to delve into new things, even though I really want to do them (pretty much why I have been postponing going to the gym as well…)</p><p>I also am truly, inherently lazy.</p><p>However, thanks to finding about FreeCodeCamp, I pretty much kickstarted my way into (hopefully, one day) becoming a web developer.</p><p>Here are a few things I’ve learned so far:</p><h3>Web developing is hard.</h3><p>When I first took up FreeCodeCamp, I breezed through most of the tasks that were given very quickly, up to the Front End Development projects. Turns out, I’m pretty good at completing tasks, but absolutely suck when trying to put things into practice and giving them my own personal twist. I guess it helped lots that I had prior, albeit <em>very </em>basic, HTML experience, and as such I wasn’t completely clueless what was going on, that made the challenges easy to complete.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*6RtLMaW9W4aGROStkGk-9Q.png" /><figcaption>That dark green line bothers me more than it probably should.</figcaption></figure><p>Making <strong><em>whole pages</em></strong> though? As of right now, anything beyond vanilla Bootstrap is far out of my reach, and you can very clearly see that in the <a href="http://codepen.io/mehanix/full/pNmwvN/">CodePens that I make</a>. This is the reason why I skipped making<em> My Personal Portfolio Webpage </em>for now. I want it to showcase the things I am capable of, and right now I find that while I have the vision of what I want to build, I don’t master the tools of the trade quite yet.</p><p>Needless to say, my respect towards web developers and designers has grown a thousandfold after just 1 month of learning about the ins and outs of the job. Web developing truly is a domain that looks easier from an outsider’s perspective.</p><h3>Keeping a consistent schedule is even harder.</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/136/1*wfe0KIMc1mi7LgO4DXn93w.png" /></figure><p>Talking about consistency… I apparently work in short, brief bursts, of 25–50 challenges at a time. I’m not sure how much of it amounts to the way my free time is scheduled and how much to my own laziness or scatterbrained nature (I found myself forgetting about FCC during the weekdays and remembering about it on the weekends. Is it noticeable from that picture?)</p><p>This is definitely something that needs to be changed in order to boost my own productivity — and I’m currently experimenting with Android alerts to remind me about what to work on.</p><h3>Being part of a community is amazingly helpful.</h3><p>Definitely one of the things I expected the least when starting FCC was how helpful the entire community surrounding it is — from the Gitter chat to the forums themselves, people are incredibly nice and ‘noob-friendly’. What’s even better is that even you, as a beginner, can lend a hand and help others who know less than you. It is an incredibly rewarding feeling to be a part of these communities of like-minded people and be able to help.</p><p>I recommend anyone interested into coding to take a look into the FCC forums &amp; Gitter channel, even if not actually completing the course.</p><h3>Read about what others have to say.</h3><p>Finally, I found out that there are many free resources available online which help lots when trying to start web developing — this being one of the reasons I joined Medium to begin with! I’ll take this opportunity to note a few of the articles that I found to be particularly helpful:</p><ul><li><a href="https://hackernoon.com/10-things-i-learned-making-the-fastest-site-in-the-world-18a0e1cdf4a7#.ncm2k3cwt">10 things I learned making the fastest site in the world</a> by <a href="https://medium.com/u/f735d3b0f2f3">David Gilbertson</a></li><li><a href="https://medium.com/built-to-adapt/intro-to-the-8-point-grid-system-d2573cde8632#.lhwfe6fy1">Intro the 8-Point Grid System</a> by <a href="https://medium.com/u/7505a6d6a218">Elliot Dahl</a></li><li><a href="https://hackernoon.com/make-your-android-app-look-less-shitty-5dd63c4938f1#.cgctjzoul">Make your Android app look less shitty</a> by <a href="https://medium.com/u/d8f894da8975">Antonis Tsagaris</a></li><li><a href="https://hackernoon.com/should-a-programmer-learn-to-design-5101e1bd1025#.au4nizf9o">Should a Programmer learn to design?</a> by <a href="https://medium.com/u/8719effe3f9c">Eli</a></li></ul><p>To conclude, there are few things better in life than starting a new hobby and sticking to it, especially if it’s something that you’re passionate about. If you’ve got the slightest curiosity about web developing, I encourage you to try out FreeCodeCamp — you won’t regret it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=add87f7713d0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Let’s talk security: Salted password hashing in C#]]></title>
            <link>https://medium.com/@mehanix/lets-talk-security-salted-password-hashing-in-c-5460be5c3aae?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/5460be5c3aae</guid>
            <category><![CDATA[passwords]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Wed, 30 Nov 2016 11:54:46 GMT</pubDate>
            <atom:updated>2019-01-27T00:05:34.836Z</atom:updated>
            <content:encoded><![CDATA[<p>After my first experience last week with <a href="https://medium.com/@mehanix/a-detailed-guide-to-creating-a-simple-login-form-using-c-and-sql-5c941bbded4d#.1w2pxic1p">login forms and SQL</a>, stemmed by my curiosity about a proper login database, I thought: What about security?</p><p>It was obvious that the DB I wrote then was very vulnerable. So, how should I go about fixing it?</p><p>First, I looked up the definition of a few words: According to Wikipedia..</p><blockquote>A <strong>cryptographic hash function</strong> is a hash function which takes an input (or ‘message’) and returns a fixed-size alphanumeric string, which is called the <strong>hash value</strong> (sometimes called a <strong>message digest</strong>, a <strong>digital fingerprint</strong>, a <strong>digest</strong> or a <strong>checksum</strong>).</blockquote><blockquote>In cryptography, a <strong>salt</strong> is random data that is used as an <strong>additional input </strong>to a one-way function that “hashes” a password or passphrase. The primary function of salts is to <strong>defend against dictionary attacks</strong> or against its hashed equivalent, a pre-computed rainbow table attack.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/0*hkacXbTen8O4XD_O.png" /><figcaption>Even small changes in the input text provide a drastically different, yet fixed length, string of characters.</figcaption></figure><p>So, in simpler terms:</p><ul><li>A <em>hash function </em>is <strong>an one-way function</strong> (you cannot turn the transformed input back to the way it was) which transforms a string of characters into a fixed-length series of characters and numbers.</li><li>A <em>salt </em>is a <strong>series of random characters</strong> which are appended to the string before applying a hash function to it. The reason to this is to prevent dictionary attacks (attacks in which a lot of common passwords are tested)</li></ul><p>Now that that’s out of the way, let’s go around the steps we should take to improve the security of the previous application. For this tutorial, I’ll be using the following scheme:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*bk9f95VHgjnLdGABYn0MWw.png" /><figcaption>Credit: Taylor Hornby, adriancs</figcaption></figure><p>One difference compared to the previous article, where we set up the DB and the login interface, is that we&#39;ll talk about <em>storing passwords</em> first, as we can’t exactly validate them without having them stored somewhere in the first place.</p><h3>Storing passwords</h3><h4>1. Generate a long random salt using a CSPRNG.</h4><p>A <em>cryptographically secure pseudorandom number generator(CSPRNG) </em>is an algorithm that produces a pseudorandom sequence of bytes. What makes it cryptographically secure is that it is very hard for someone to distinguish its output from true randomness. <strong>Each password</strong> is going to have <strong>its own random salt</strong> attached to it.</p><p>In order to generate the random salt, we’ll be using <strong><em>RNGCryptoServiceProvider()</em></strong><em> </em>whose sole job is to generate random numbers. We’ll be storing these numbers in a <em>byte array. </em>What <strong><em>GetBytes </em></strong>does is place the bytes in the array given.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*kZ1LuVyItDqz_umq2-yDmw.png" /></figure><p>Now that we have our salt, it’s time to do the actual encryption!</p><h4>2. Concatenate the password to the salt and hash it with a hashing function.</h4><p>The hashing algorithm we’ll be using is called <strong>PBKDF2</strong>. The reason for picking this one is that it provides the advantage of <em>being slow by design</em>. That sounds weird, doesn’t it? It is more advantageous for a password encryption algorithm to be slow, because the slower it is, the more time it takes an attacker to try and brute-force. How slow the algorithm is determines how many passwords can an attacker attempt per minute.</p><p>Obviously, it is important that the algorithm is not so slow that it starts bothering the user, which is why we can configure how quick or slow it is.</p><p>The <strong><em>Rfc2989DeriveBytes </em></strong>class is going to be responsible for the hashing. 10000 represents the number of iterations the algorithm is going to perform (It will keep hashing the previous hash this number of times. This is what makes it slower by design).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*7i0RlBYvSDZpEz5rRlG6BQ.png" /></figure><p>Now it’s time to do the storing part. Using, yet again, a<strong> byte array</strong>, we’ll add the salt in front of the hashed password (this is called <strong>prepending</strong>). The size of the array is going to be 36 bytes, because both the hash and salt are fixed length: the hash is 20 bytes, and the salt 16.</p><p>Adding the salt in front of the hash is simply preference, it can be added anywhere in the string, technically speaking.</p><p>After adding the hashed password and its salt to the Byte array, we should <strong>convert it to a string</strong> and begin the next step!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/463/1*fQDAX5UIOddtB-Yh_7K8cA.png" /></figure><h4>3. Save both the hash and salt to the user’s database record.</h4><p>This step depends on the way you handle your database. What you should do is add the newly-formed string in the DB entry of the user.</p><p>I presented the way I handled my DB in <a href="https://medium.com/@mehanix/a-detailed-guide-to-creating-a-simple-login-form-using-c-and-sql-5c941bbded4d#.8q9fckk46">my previous article</a>, so i am not going to repeat myself. The only difference is that instead of sending the plaintext password to the DB, I instead send the <strong><em>savedPasswordHash </em></strong>string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*yQTqYfJz_HHRGq1HKPwV1A.png" /></figure><h3>Validating passwords</h3><h4>1. Retrieve the user’s salt and hash from the DB.</h4><p>Similarly to saving, retrieving is dependent on how you’ve handled your database. I described how I handled it in more detail <a href="https://medium.com/@mehanix/a-detailed-guide-to-creating-a-simple-login-form-using-c-and-sql-5c941bbded4d#.8q9fckk46">here</a>. What is changed is that the <strong>query </strong>does not look for the username and password, just the <strong>username </strong>(which is either unique in the DB or nonexistent at all).</p><h4>Edit (27/01/2019): As noted in the comment section, t<strong>his method of retrieving the user’s salt and hash from the DB is insecure. You should use parametrized queries here as well.</strong></h4><p>For integrity’s sake, I’ll leave this here, but I will update this section of the article with the proper way to do it in the future. Please refer to <a href="https://stackoverflow.com/questions/14171794/how-to-retrieve-data-from-a-sql-server-database-in-c">this StackOverflow post</a> for the right way to do it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/823/1*eIb75TpBARR_0BGmtqBe6Q.png" /></figure><h4>2. Concatenate the entered password to the salt and hash it.</h4><p>If the username exists in the database (there is a person who has registered with this username) it’s time we <strong>take </strong>the new password input,<strong> salt it with the salt from the original password, hash it,</strong> then <strong>compare </strong>it to the input the user entered when registering. If they match, we allow logging in.</p><p>Firstly, we get the saved password hash from the DB, then we turn it into bytes for easier manipulation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/1*DP2xWY_62TbjFO4kRKmeRg.png" /></figure><p>What we need to do now is <strong>hash </strong>the text input from the password textbox with the salt. We need to use the <strong>same function as before</strong> (so don’t change the number of iterations! You’ll get different results if you do and the passwords will show up as not matching even if they do). After hashing, place our new salted password hash in a byte array so we can begin the <strong>comparison </strong>of the stored and newly-formed hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*Zlze6VBzYJS4wGJdzcgt_A.png" /></figure><h4>3. Compare the hashed password in the DB with the entered one. If they match, grant access.</h4><p>We’re going to use a for loop to <strong>compare each byte</strong> of the saved hash and the entered hash. We’re starting from the 16th byte in the stored password because bytes 0–15 are occupied by the salt.</p><p>If there are no differences found between the stored hash and the new one, grant access! :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*flu44psAiVdeRJuP8OwGdg.png" /></figure><p>That’s all! I hope you found this article helpful. If you have any corrections to add, please tell me! I’m sure there are many ways to improve what I did here. ❤</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5460be5c3aae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a login form, using C# and SQL]]></title>
            <link>https://medium.com/free-code-camp/a-detailed-guide-to-creating-a-simple-login-form-using-c-and-sql-5c941bbded4d?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c941bbded4d</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[visual-studio]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Sat, 26 Nov 2016 22:00:10 GMT</pubDate>
            <atom:updated>2017-11-06T21:13:25.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5bIGafTbCbY3BG5akMJGgQ.jpeg" /></figure><p>I recently picked up a weekly C# course, and, since I find it interesting, I take my time during the weekend to expand on what is discussed there.</p><p>For example, this week we were taught how to create a login form:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/247/1*pUlHJnnUrxUGsvBs4uwe9w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*MmQB1UhLr8WBsYC9LDXlhg.png" /></figure><p>Now I’m not here to complain about the design, but the code we used is what bugged me. I know that the purpose of the lesson was to teach us how to open other forms and how to use pictureBoxes, not how to actually create a good login form, but it was so.. unrealistic.</p><p>As such, I decided to look into how to create a login form which actually logs you in and has somewhat of a database, you know?</p><p>Here’s how to do it:</p><p>In order to set up a login form, we need to create what is called a SQL database. To create it, you..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/487/1*VQMcwUirmAxnD7bM0iTohw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*XsijO6k16MP2yXPakXEojw.png" /><figcaption>Open the Server Explorer located on the left of the screen, right click Data Connections, then Add Connection. Select the data source as “Microsoft SQL Server Database File”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*SJYDUDz7QsRNMqMEy96eRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*AS1Ddo3TLAmc8J8gpYlfWg.png" /><figcaption>Then you press Browse and select the location where you want to save the DB. It is good practice to keep your DB in a separate folder.</figcaption></figure><p>There we go! Now our DB is up and running. The only problem is that it is currently empty. We need to add the login info (Username/Password) to the DB. In order to do this, we’ll be <strong>creating a table</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/353/1*SOkpHnZwHwnUSNnVzNEAJg.png" /><figcaption>Right click the Tables folder to create a table.</figcaption></figure><p>After creating the table, you’ll be greeted with this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yIOLx2OxNdlN_bF2rD0NLg.png" /><figcaption>Our fancy table editor</figcaption></figure><p>Here is where we’ll add the<strong> types of data</strong> we’re going to <strong>store </strong>in our table. For this tutorial, we’ll be using:</p><ul><li>username, type <strong>varchar[50]</strong>: where the usernames will be stored. The type varchar simply means “a string of characters of variable length”.</li><li>password, also type <strong>varchar[50]</strong>.</li></ul><p><strong>VERY IMPORTANT:</strong> For the sake of simplicity, I will not go through secure password keeping in this tutorial. I will be tackling this issue in a later post, which I will link to <a href="https://medium.com/@mehanix/lets-talk-security-salted-password-hashing-in-c-5460be5c3aae">here</a>. <strong>Please do NOT actually store your passwords in plaintext.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*Vna6nbMukdKjSC_KghhnpA.png" /></figure><p>After adding the columns, press the <strong>Update </strong>button to add them to the DB, then press Update Database. After that, right click the Tables folder and <strong>Refresh </strong>it so that the table now shows up in the DB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*-PsBjy67_9C5ncC3eqlQ7g.png" /></figure><p>For now, we’ll be adding a few usernames and passwords manually, in order to test logging in. <strong>I repeat, do NOT store passwords in plaintext in actual projects! Hash &amp; salt your passwords!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*Xph0LXXThXmJTryWHS1fYQ.png" /><figcaption>Test usernames and passwords added. Press Shift+Alt+R to refresh the table.</figcaption></figure><p>That’s it for setting up the database. Now, let’s get to the fun part! Actually coding the login button!</p><p>We’ll need to find the <strong>Connection String</strong> of the Database so we can connect our Login Form to it. You can find it by right clicking the DB name and pressing properties:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/270/1*4TiRIYCJdHC16dSCUFsPPw.png" /><figcaption>Here it is, in the Properties tab.</figcaption></figure><p>Here’s how we’re making it work:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*RrDbJrNbSnqZ2lCJuHr3EQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/937/1*LCym7su5KVdwiF4hajGbgw.png" /></figure><p>As you might have noticed, we’re using quite a few new elements here:</p><ul><li>The <strong>SqlConnection </strong>creates a new connection to the DB using a <strong>Connection String.</strong></li><li>With the <strong>SqlDataAdapter </strong>we communicate between the Sql DB and the <strong>DataTable</strong>.</li><li>In the <strong>DataTable </strong>we’re going to place what entries from the DB match what text the user entered in the username/password fields.</li><li>Finally, using the <em>sda.Fill(dtbl);</em> we’ll <strong>add </strong>the entries which match the query sent to the DB (=which elements in the table have the username and password the user wrote in the textBoxes) into the newly made DataTable.</li></ul><p>After doing these operations, if there’s at least 1 row in the DataTable (meaning there is a match found with the same username and password in the database) we <strong>allow </strong>the connection.</p><p>Now, we can log in. But how about registering? That’s a bit more tricky. We need to <strong>establish a connection</strong> to the SQL Server, and <strong>issue a query</strong> which inserts a new row into our table.</p><p>But, before that, we should make sure that there is no one with the same username already registered :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*0bw6OoWRxB8DtcNSbAFnwg.png" /></figure><p>The logic is the same as when checking the login creditentials, but this time we only look for a <strong>matching username in our table</strong>.</p><p>Now that that’s out of the way, let’s look into adding a new row into the DB!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*RJc68oP4lyPip5hiKZxLYQ.png" /></figure><p>This is a bit complicated. The way it works is:</p><ol><li>Write the query in the <strong>commString</strong>, where @val1 and @val2 are the user/password combination which is going to be added later.</li><li><strong>Connect </strong>to the database and <strong>create </strong>a new <strong>SqlCommand</strong>(this is safer because now we have control over the input so we can <strong>sanitize </strong>it)</li><li>Add the username and password in place of the val1, val2. This way we can <strong>avoid </strong>people writing SQL code in the textboxes and deleting my database.</li><li><strong>Open </strong>the connection and <strong>execute </strong>the query.</li></ol><p>That’s it! Now we’ve got an actual working login system, allowing for registration and which does not “forget” the registered accounts after closing the application.</p><p>Next time we’ll go through some security measures that can(and should) be added to our login form (hashing + salting passwords, further prevention of SQL injections).</p><p>You can find the code of this project <a href="https://github.com/mehanix/LoginFormTest">here</a>.</p><p>If this has been of any help to you, please press the ❤ button!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c941bbded4d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/a-detailed-guide-to-creating-a-simple-login-form-using-c-and-sql-5c941bbded4d">How to build a login form, using C# and SQL</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quick update to the simple Windows Forms app]]></title>
            <link>https://medium.com/@mehanix/quick-update-to-the-simple-windows-forms-app-c24baf0958a7?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/c24baf0958a7</guid>
            <category><![CDATA[csharp]]></category>
            <category><![CDATA[object-oriented]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Sat, 19 Nov 2016 12:44:50 GMT</pubDate>
            <atom:updated>2016-11-19T13:49:59.789Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@mehanix/windows-forms-applications-creating-a-simple-app-26fac4a4d84f#.t0xip67xe">As promised</a>, I added some extra functionality to the app, mostly tweaks or quality-of-life improvements that help make the application more user-friendly.</p><p>Here’s how it looks now:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/298/1*rYT5cxwW0XOW4pXpc4GfRw.png" /></figure><p>As you can see, there are not that many differences when it comes to the UI. I’ve added a button which <strong>searches </strong>the listBox for the information you entered in the textboxes, radio buttons and checkboxes and if there is an <strong>entry with the same data</strong>, it <strong>removes </strong>it.</p><p>The <strong>arrow buttons</strong> (that’s a placeholder texture..) on the right of the listBox are used for <strong>moving an item up and down the list</strong>.</p><p>As for the code, here’s what’s changed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*i2huX6bLU-4QE8TDKFTPMA.png" /></figure><p>Firstly, since the app needs to form strings for both the add and remove-from-text functions, I wrote a method which <strong>returns the formed string using the information</strong> from the textboxes, radio buttons, and checks. This provides much cleaner code as now, instead of writing the same thing twice, i can just call the function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*jOUjiwNazC68ExBI1Cpgzw.png" /><figcaption>Before…</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/1*xDOSx-TcPOsFom6ymgZ6tw.png" /><figcaption>After!</figcaption></figure><p>Another addition to the insertion method is <em>if(!listBox1.Items.Contains(item) </em>which <strong>prevents users from entering duplicates</strong> into the listBox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*TXfnP7xDBrfj0uHwNV_WYg.png" /></figure><p>The logic behind the “remove-entered” button is simple: using the <em>formString()</em> method we wrote earlier, we <strong>recreate </strong>the string and <strong>search </strong>for it in the listBox. If it is found, it is <strong>removed </strong>using the <em>listBox1.Items.Remove </em>method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*wJJMhTBHdaLPvh9wQds8xA.png" /></figure><p>This is the code for the button that enables <strong>moving items up the list</strong>. The new methods used in this code snipplet are <em>listBox1.Items.Insert(index, item) </em>which<strong> inserts</strong> the item at the selected position(but does not remove it from the list) and <em>listBox1.SetSelected(index, value)</em> which <strong>selects</strong> the new element in order to make repeatedly pressing the button easier.</p><p>Finally, <em>listBox1.Items.RemoveAt(index)</em> is used for <strong>removing the copy </strong>of the item we just moved(which is situated 2 positions below the item currently selected).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*L7E-VJdhqHbA8JdtxvQPZw.png" /></figure><p>The same logic is used for the <strong>moving items down the list </strong>button, except that we add instead of subtracting and the reverse, because we move the item <strong>further down</strong> the list.</p><p><a href="https://github.com/mehanix/addItemToListBox">Here</a> is a link to the source code. :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c24baf0958a7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Windows Forms Applications: Creating a simple app]]></title>
            <link>https://medium.com/@mehanix/windows-forms-applications-creating-a-simple-app-26fac4a4d84f?source=rss-f447c00aa047------2</link>
            <guid isPermaLink="false">https://medium.com/p/26fac4a4d84f</guid>
            <category><![CDATA[code]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Nicoleta Ciauşu]]></dc:creator>
            <pubDate>Fri, 18 Nov 2016 22:19:49 GMT</pubDate>
            <atom:updated>2016-11-18T22:22:06.393Z</atom:updated>
            <content:encoded><![CDATA[<p>In today’s C# lesson we’re going to learn a bit about the most basic things about programming using Windows Forms by creating a simple application which is going to take information from a few textboxes, checkboxes and radio buttons and add them into a listBox. Then, using a few buttons, we will add functionality to our app: adding an entry to the list, clearing the list, and removing the last element from the list.</p><p>Here is what the design of the application looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*w17e1m09hspzD3k-S252Pg.png" /></figure><p>Not exactly amazing, but this is not a design course.</p><p>The placement of the elements is pretty straight-forward. One interesting thing to note are the groupBoxes, which ..group the elements so you won’t have issues with having two radio buttons checked at the same time, for example. I find it really nifty that VS takes care of that for you.</p><p>As for the code..</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*jOUjiwNazC68ExBI1Cpgzw.png" /></figure><p>This is the code used for <strong>adding an item to the list</strong>. What this does, basically, is combining the strings taken from the textBoxes with the selected gender and whatever other traits the person picked and <strong>concatenating</strong> them into a big string which is then added into the listBox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/445/1*2DtRHWd5FmQsUhESxn-OiA.png" /></figure><p>This nifty code snipplet simply calls the method <strong>listBox1.Items.Clear(), </strong>which <strong>clears </strong>the entire listBox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*Jl8EQB43hGtLETSmJi1wWg.png" /></figure><p>Finally, using a <strong>try-catch</strong> to avoid trying to remove an element when there are no items in the listBox, we call the method <strong>listBox1.Items.RemoveAt(int index) </strong>to remove the last element.</p><p>That is all for today. In a future post, I will add some more functionality to the program.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26fac4a4d84f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>