tag:blogger.com,1999:blog-49340869909193448322024-03-27T10:44:05.505-07:00Coding TipsLearn Coding Tips, Technology, Data Science, AI, Machine Learning @ 123mylist.comUnknownnoreply@blogger.comBlogger27125tag:blogger.com,1999:blog-4934086990919344832.post-38701670353387625822023-05-10T08:31:00.003-07:002023-05-10T08:31:25.720-07:00Resolve Selenium error - Chrome opening Settings tab to reset settings on launch<p style="text-align: left;">Recently I was creating a new Java with Selenium project on a new windows system. I was trying to use ChromeDriver for this project. </p><p style="text-align: left;">I wrote the hello world sample code by lifting it off from the <a href="https://www.selenium.dev/documentation/" rel="nofollow" target="_blank">official selenium website</a>. After typing all the codes and doing the project setup, when I was ready to launch, I hit "Run" button on my Eclipse IDE, and voila the browser launched!</p><p>But soon my fantasy turned to dust when I saw that instead of opening the URL on the browser, Chrome window was displaying me a weird error like the one shown below:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8GBS5ja07QpcMxElrIGu4WTEGwZLJpIRBnIEm6Ati_rweLcuUZprgt9P1SYEvTP9yXZzD6dwETB776ifQ2vWyMC63q0s42jxKFfpyC30EZEOEN4FDvFjLB5xyox4R76PAgOh23R4epR1gNpCXh9xM-_HgZnAwZmPqi8Q62XF4LNQkpgqU09ri-2zyJQ/s1148/ChromeTriggeredReset1.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="540" data-original-width="1148" height="302" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8GBS5ja07QpcMxElrIGu4WTEGwZLJpIRBnIEm6Ati_rweLcuUZprgt9P1SYEvTP9yXZzD6dwETB776ifQ2vWyMC63q0s42jxKFfpyC30EZEOEN4FDvFjLB5xyox4R76PAgOh23R4epR1gNpCXh9xM-_HgZnAwZmPqi8Q62XF4LNQkpgqU09ri-2zyJQ/w640-h302/ChromeTriggeredReset1.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;">Here, the Chrome window was displaying a prompt to reset the settings. Even when i was clicking on Reset settings and trying to proceed further, nothing was happening.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Due to this. I was unable to launch the URL which was mentioned in the Selenium Project codes.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Thankfully I solved the problem using the below steps. I was using Windows 8.1 on my system, so these steps are applicable only for Windows-based systems only.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><ul style="text-align: left;"><li>I opened Run window by pressing "Windows + R" button.</li><li>Then I typed "regedit.exe" in the run window to open Registry Editor. </li><li>In Registry Editor, I navigated to the following path as you may see in the below screenshot: <b style="color: var(--black-800); font-family: var(--ff-mono); font-size: var(--_pr-code-fs); font-style: inherit; font-variant-caps: inherit; font-variant-ligatures: inherit; white-space: inherit;">HKEY_CURRENT_USER\Software\Google\Chrome\TriggeredReset</b></li></ul></div><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEL_Os6ifM4-ih7HjgvqXoA05lxwwSUU8VCC6JVFJGF1itS5yKPE17JKA8CyeU45LWJRLD_n3VQha580LKLx6iIS0eHk2Thd5IO4jOfb5z1qxrAjRjRnpm7vEISCa5SX_ozFnYxRXzTUD9P67Zt3bWH0H8MARZVBwjzGYjEty-Dwo5Xv_PzA47zb4MbQ/s798/ChromeTriggeredReset.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="283" data-original-width="798" height="226" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhEL_Os6ifM4-ih7HjgvqXoA05lxwwSUU8VCC6JVFJGF1itS5yKPE17JKA8CyeU45LWJRLD_n3VQha580LKLx6iIS0eHk2Thd5IO4jOfb5z1qxrAjRjRnpm7vEISCa5SX_ozFnYxRXzTUD9P67Zt3bWH0H8MARZVBwjzGYjEty-Dwo5Xv_PzA47zb4MbQ/w640-h226/ChromeTriggeredReset.PNG" width="640" /></a></div><br /><p><br /></p><p></p><ul style="text-align: left;"><li>Here, there was a folder titled "TriggeredReset" in the left sidebars, I right-clicked on the folder and clicked on "Delete".</li><li>Post this, I closed Registry Editor, closed all instances of Chrome Browser, and restarted my Eclipse IDE. </li><li>Now I re-ran the project and voila, the project started working fine now.</li></ul><p></p><p><br /></p><p>If you are also facing a similar issue, then you can try these steps and let me know if it worked for you.</p><p>Happy coding!</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-43677223467260970852022-11-17T10:09:00.001-08:002022-11-20T05:33:28.828-08:00How to recover deleted files in Hadoop HDFS<div>While working with files in Hadoop HDFS, you may come across situations wherein you accidentally deleted a file or a folder from Hadoop HDFS.</div><div><br /></div><div>If you did this mistake, then do not worry. You can still recover your file from Trash.</div><div><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhThQdRPmu3z0BKeO4DUjCWEKVuw8TMOo7tRgaLGI1vy22ydp0q5t1ubzF3h8yBTrWZ6U_J8S1syu4oB-IQVbLCWycv58_Td09MzZ1jJjcgKamIbJsRtrdf20cjufkzK9lH1lynR8F3Uu1fM-eghE8_JQW0PVK1FbftPT0sLLT-SBkiPzpT6vUh4oD1A/s620/hadoop.logo.tr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="485" data-original-width="620" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhThQdRPmu3z0BKeO4DUjCWEKVuw8TMOo7tRgaLGI1vy22ydp0q5t1ubzF3h8yBTrWZ6U_J8S1syu4oB-IQVbLCWycv58_Td09MzZ1jJjcgKamIbJsRtrdf20cjufkzK9lH1lynR8F3Uu1fM-eghE8_JQW0PVK1FbftPT0sLLT-SBkiPzpT6vUh4oD1A/s320/hadoop.logo.tr.jpg" width="320" /></a></div><br /><div><br /></div><div><br /></div><div>In Hadoop, trash folder is located at the below path</div><div><br /></div><blockquote><div><b>/users/<your username>/.Trash</b></div></blockquote><div><br /></div><div><br /></div><div>When you delete any folder or a file, it will be moved to this folder with the original path. You can go to that path by navigating further inside the Trash folder and retrieve it by moving it or copying it back to the original path.</div><div><br /></div><div>Remember that this will work only if you have deleted the file or folders using the usual -rm command.</div><div><br /></div><div>If you had used <b>-skiptrash</b> command at the time of deleting the folder then it will be permanently deleted from the folder and you will not be able to recover it from HDFS trash folder.</div><div><br /></div><div>Also, remember that the files moved to Trash folders are automatically deleted after a certain time period say 30 minutes or whatever is being configured for your Hadoop environment by your Hadoop Administrator. These values are set in site-core.xml file. </div><div><br /></div><div>By default, these values are set as zero so that files are not automatically purged from trash and are instead deleted when your Hadoop Administrator deletes them manually as part of periodic maintenance or cleanup activity.</div><div><br /></div><div>Hope this post helps you recover some of your important files.</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-84498759498215735232022-10-30T10:47:00.001-07:002022-10-30T10:47:28.172-07:00Common Hadoop commands and their usage<p>Apache Hadoop as per their official definition is a Java based framework that is used for distributed processing of large data sets across a cluster of computers using simple programming models.</p><p><br /></p><p>While working with Hadoop, you may need to use many file automation commands to work with files in the Hadoop file system. Here is the list of commonly used Hadoop commands along with their usage examples for your reference.</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgokkteT7CbPuTAuNn_noMGXspasJzogYyUBPcU95M4zXOLGjgQSe5EtEa7mRLqQ1ucIvbXkbcBlyOAk9O-1GxvPzGCgvmlsay6WYaDS-1zpP_aUorGxq1Dbz2dVz3hTM1aJWVU29dN2LTm3JOXO7Y7EFVWg6feBpMH0_RaghAmgIlaW0Qbw_QrYnV0Jw/s620/hadoop.logo.tr.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="485" data-original-width="620" height="250" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgokkteT7CbPuTAuNn_noMGXspasJzogYyUBPcU95M4zXOLGjgQSe5EtEa7mRLqQ1ucIvbXkbcBlyOAk9O-1GxvPzGCgvmlsay6WYaDS-1zpP_aUorGxq1Dbz2dVz3hTM1aJWVU29dN2LTm3JOXO7Y7EFVWg6feBpMH0_RaghAmgIlaW0Qbw_QrYnV0Jw/s320/hadoop.logo.tr.jpg" width="320" /></a></div><br /><p><br /></p><p><b>1. mkdir: </b></p><p>This command is used to create a new folder or directory</p><p><b>Example: hadoop fs -mkdir new_folder</b></p><p>The above example command will create a new directory with the name "new_folder"</p><p><br /></p><p><br /></p><p><b>2. ls: </b></p><p>This command is used to view the list of files and directories present in the current location. In addition to the list, it also displays some attributes such as file size, permissions, owner, modified date etc.</p><p><b>Example: hadoop fs -ls</b></p><p><br /></p><p><br /></p><p><b>3. cp: </b></p><p>This command is used to copy files and folders from a source to a destination path.</p><p><b>Example: hadoop fs -cp <source path> <destination path></b></p><p><br /></p><p><br /></p><p><b>4. mv: </b></p><p>This command is used to move files and folders from a source to a destination path</p><p><b>Example: hadoop fs -mv <source path> <destination path></b></p><p><br /></p><p><br /></p><p><b>5. copyFromLocal: </b></p><p>This command is used to copy files from local system to HDFS</p><p><b>Example: hadoop fs -copyFromLocal <source local file path> <destination path in HDFS></b></p><p><br /></p><p><br /></p><p><b>6. copyToLocal: </b></p><p>This command is used to copy files from HDFS to local file system</p><p><b>Example: hadoop fs -copyToLocal <source HDFS path> <destination local file path></b></p><p><br /></p><p><br /></p><p><b>7. moveFromLocal: </b></p><p>This command is used to move files from local system to HDFS</p><p><b>Example: hadoop fs -moveFromLocal <source local file path> <destination path in HDFS></b></p><p><br /></p><p><br /></p><p><b>8. moveToLocal: </b></p><p>This command is used to move files from HDFS to local file system</p><p><b>Example: hadoop fs -moveToLocal <source HDFS path> <destination local file path></b></p><p><br /></p><p><br /></p><p><b>9. rm: </b></p><p>This command is used to remove/delete the file from HDFS</p><p><b>Example: hadoop fs -rm <file path></b></p><p><br /></p><p><br /></p><p><b>10. chmod: </b></p><p>This command is used to change the file permission associated with the file or directory.</p><p><b>Example: hadoop fs -chmod -r <file name></b></p><p><br /></p><p><br /></p><p>I hope these commands are helpful to you. Do let me know your thoughts in the comments.</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-9385659984130791402022-10-09T11:04:00.006-07:002022-10-09T11:04:43.314-07:00Java program to check for palindrome<p>Hey guys, welcome back to this new post where we will learn how to write a java program to identify a palindromic sequence. This is one of the most commonly asked interview questions in Java coding interviews.</p><p><br /></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwJjHOGbs96VIGhJBP2OYF6IdWMSRPRohlC-wEffwqjOjA9p8TDS6Qu3B03s3brJ0QgtYvyfDu4_8_VlTlS5JSaoFDiAsSPuEiznG8s7X7jLZQL3mwZJ1WX9gPm_RhEoT8wi6bHqQO7AArOK9K63C0T0zWnBGOX7yct2A64IoAYnCD-tAVd87ceKRdyw/s435/cb88-java-logo-001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="244" data-original-width="435" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjwJjHOGbs96VIGhJBP2OYF6IdWMSRPRohlC-wEffwqjOjA9p8TDS6Qu3B03s3brJ0QgtYvyfDu4_8_VlTlS5JSaoFDiAsSPuEiznG8s7X7jLZQL3mwZJ1WX9gPm_RhEoT8wi6bHqQO7AArOK9K63C0T0zWnBGOX7yct2A64IoAYnCD-tAVd87ceKRdyw/s16000/cb88-java-logo-001.jpg" /></a></div><br /><p><br /></p><p>Palindrome is nothing but a sequence of characters that is equal to the set of characters obtained by reversing the string. </p><p>For. e.g. if there is a string called "NITIN". If we reverse this string, the resulting string will be "NITIN". Here both the original string and the reversed string of characters are the same. Hence this is an example of a palindromic sequence of characters.</p><p><br /></p><p>Let us try to write a Java program to identify if a given string is palindrome or not:</p><p>We can do it via 2 approaches. </p><p></p><ol style="text-align: left;"><li>Java program by iterating the string and then comparing the reversed string</li><li>Java program by reversing the string via inbuilt Java StringBuilder API and then comparing the reversed string.</li></ol><p></p><p><br /></p><p><b><u>Approach 1:</u></b></p><p><span style="font-family: monospace;">package test;</span></p><p><span style="font-family: monospace;">public class Palindrome2 {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>public static void main(String[] args) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>// Java program to check string for palindrome</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String origStr = "nitin";</span></p><p><span style="font-family: monospace;"><br /></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String revStr = "";</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>for (int i = 0; i < origStr.length(); i++) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>revStr = revStr + origStr.charAt(origStr.length() - i - 1);</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><br /></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>if (origStr.equalsIgnoreCase(revStr)) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.println("Palindrome");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>} else {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.println("Not Palindrone");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;">}</span></p><p><br /></p><p><b><u><br /></u></b></p><p><b><u><br /></u></b></p><p><b><u>Approach 2:</u></b></p><p><span style="font-family: monospace;">package test;</span></p><p><span style="font-family: monospace;">public class Palindrome {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>public static void main(String[] args) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>// Java program to check string for palindrome</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String origStr = "aaloyolaA";</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>StringBuilder strB = new StringBuilder(origStr);</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String revStr = strB.reverse().toString();</span></p><p><span style="font-family: monospace;"><br /></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>if (origStr.equalsIgnoreCase(revStr)) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.println("Palindrone");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>} else {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.println("Not palindrome");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;">}</span></p><p><br /></p><p>Hope these 2 program helps you understand the approach to solve this question. Happy programming.</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-18204766212438575582022-10-08T00:33:00.008-07:002022-10-08T00:47:55.802-07:00Java program to capitalize first letter of every word in a sentence<p> Hello readers,</p><p>Today i came across an elementary interview question on Java where the user was given a sentence and he was asked to capitalize the first letter of each word in the sentence.</p><p>For e.g.</p><p>If the input text was <b>"this is java program".</b></p><p>Then the output should be <b>"This Is Java Program".</b></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2PM8O5nNjlGpzJ76NvX7hCNe1yPJZ0xwq-kkGj0uWI82iw_mKYZ370nPoxDFGUPojGo8djCH8GmbySLWmFIRkzI2V_NIXca9LrmuzMOtkpocUj1ucQnjTMiWuRgdULYph8csnMdP32kMU0jXQUpdhnERZJPX7adjyzozkZodysr5syJPKjJdwrKYdUQ/s435/cb88-java-logo-001.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="244" data-original-width="435" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2PM8O5nNjlGpzJ76NvX7hCNe1yPJZ0xwq-kkGj0uWI82iw_mKYZ370nPoxDFGUPojGo8djCH8GmbySLWmFIRkzI2V_NIXca9LrmuzMOtkpocUj1ucQnjTMiWuRgdULYph8csnMdP32kMU0jXQUpdhnERZJPX7adjyzozkZodysr5syJPKjJdwrKYdUQ/s16000/cb88-java-logo-001.jpg" /></a></div><br /><p><br /></p><p>Let's try to solve this in this blog post.</p><p>There are 2 ways which comes to my mind as of now:</p><p><b><br /></b></p><p><b>Approach 1: Iterating character by character and capitalizing the first letter:</b></p><p><span style="font-family: monospace;">package test;</span></p><p><span style="font-family: monospace;">public class Test {</span></p><p><span style="font-family: monospace;"><br /></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>public static void main(String[] args) {</span></p><p><span style="font-family: monospace; white-space: pre;"> </span><span style="font-family: monospace;">String inputStr="this is java program";</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String[] splitText=inputStr.split(" ");</span><span style="font-family: monospace; white-space: pre;"> </span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>for(int i=0;i<splitText.length;i++) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>for(int j=0;j<splitText[i].length();j++) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>if(j==0) </span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>{</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String firstChar=""+splitText[i].charAt(j);</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.print(firstChar.toUpperCase());</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}else {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.print(splitText[i].charAt(j));<span style="white-space: pre;"> </span></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.print(" ");<span style="white-space: pre;"> </span></span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span><span style="font-family: monospace; white-space: pre;"> </span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;">}</span></p><div><br /></div><p><br /><b><u>
Approach 2: Using an Optimized approach </u></b></p><p><span style="font-family: monospace;">package test;</span></p><p><span style="font-family: monospace;">public class Test {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>public static void main(String[] args) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String inputStr="this is java program";</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String splitText[]=inputStr.split(" ");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>for(int i=0;i<splitText.length;i++) {</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>//Capitalizing the first letter</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String firstLetter=(splitText[i].charAt(0)+"").toUpperCase();</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>//Printing the rest letters</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>String restLetter=splitText[i].substring(1);</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>System.out.print(firstLetter+restLetter+" ");</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;"><span style="white-space: pre;"> </span>}</span></p><p><span style="font-family: monospace;">}</span></p><p> </p><p>Hope these approaches help you crack your next coding interview. All the best!</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-89532146887092073452022-10-04T10:28:00.000-07:002022-10-04T10:28:06.267-07:00Types of SQL commandsIf you are a data analyst or a software engineer, you must be definitely using SQL queries for your data related requirements. In this post, let's take a look at the various types of SQL commands along with their examples.<div><br></div><div>There are 4 major categories or types of SQL commands. These are:</div><div><br></div><div>1. Data Definition Language (DDL)</div><div>2. Data Manipulation Language (DML)</div><div>3. Data Control Language (DCL)</div><div>4. Transaction Control Language (TCL)</div><div><br></div><div><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidGPIgTqVEOexzMm7rIissb_dVqCL3eRcBL0B-9kWS79LHTvm7ZLQ3cJRiaMPINpmNCodbGk2KKTOfJe2hDDuFGlCpLSywxnLCImNVuvbZGKwK9FHD2SzlJEeo1k86t3cPeoCkcrYuQCou/s1600/1664904469975737-0.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;">
<img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidGPIgTqVEOexzMm7rIissb_dVqCL3eRcBL0B-9kWS79LHTvm7ZLQ3cJRiaMPINpmNCodbGk2KKTOfJe2hDDuFGlCpLSywxnLCImNVuvbZGKwK9FHD2SzlJEeo1k86t3cPeoCkcrYuQCou/s1600/1664904469975737-0.png" width="400">
</a>
</div><br></div><div><br></div><div>Let's take a look at each of the types.</div><div><br></div><div><b>1. Data Definition Language</b></div><div><br></div><div>This type comprises of SQL commands which are used to define the the data. Example SQL commands in this category are</div><div>a. CREATE</div><div>b. ALTER</div><div>c. DROP</div><div>d. RENAME</div><div>e. TRUNCATE</div><div>f. COMMENT</div><div><br></div><div><br></div><div><b>2. Data Manipulation Language</b></div><div><br></div><div>This category of SQL commands are used to manipulate the data. Some of the examples of this category of SQL commands are:</div><div><br></div><div>a. SELECT</div><div>b. INSERT</div><div>c. UPDATE</div><div>d. DELETE</div><div>e. MERGE</div><div>f. CALL</div><div>g. EXPLAIN PLAN</div><div>h. LOCK TABLE</div><div><br></div><div><br></div><div><br></div><div><b>3. Data Control Language</b></div><div><br></div><div>This category of commands are used to control the access of data. The examples of this type of commands are</div><div><br></div><div>a. GRANT</div><div>b. REVOKE</div><div><br></div><div><br></div><div><b>4. Transaction Control Language</b></div><div><br></div><div>This category of commands are used to control the SQL transactions. Some of the examples of this type of commands are:</div><div><br></div><div>a. COMMIT</div><div>b. ROLLBACK</div><div>c. SAVEPOINT</div><div>d. SET</div><div>e. TRANSACTION</div><div><br></div><div>Hope you found this article useful. Let me know your thoughts on comments below.</div><div><br></div><div><br></div><div><br></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-27477911155775754282022-07-27T11:51:00.006-07:002022-07-27T11:56:21.171-07:00How to scan complete website for broken links for free<p>If you manage a large blog or website with multiple pages, then chances are there there might be some broken links within your website. This may accumulate over a period of time and may negatively impact the SEO scores of your website ultimately impacting your search rankings in major search engines.</p><p>Testing every web page manually for broken links may appear easy at first, but becomes time consuming and boring when there are numerous pages to be checked.</p><p>To automate this process, there are some free online tools available over the internet which can scan your website for broken links such as 404 errors. But the catch is, most of those free tools tend to scan only limited links say a 100 or 200 links, and beyond that, it is usually a paid service. </p><p>In order to solve this, I came across a cool solution using a python based utility called <b>LinkChecker </b>using which you can scan your whole website without worrying about the number limit of links to be scanned. It can recursively scan the whole website without your intervention and will also display the list of links having errors.</p><p><br /></p><p>To scan your website for broken links, follow these steps:</p><p><b><br /></b></p><p><b>Prerequisite:</b> Ensure you have Python 3 installed on your machine. If not then you can install it using <a href="https://www.anaconda.com/products/distribution" rel="nofollow" target="_blank">Anaconda Distribution</a> which automatically installs Python on your machine along with some Python IDEs like Jupyter or Spyder. (Though we may not require these IDEs for our purpose here)</p><p><br /></p><p>Open your terminal or Anaconda Command Prompt (Powershell) and install Linkchecker. Use the command:</p><blockquote><p><b>pip install linkchecker</b> </p></blockquote><p> </p><p>Once it is installed, you can type the below command in your terminal to scan the website.<br /></p><blockquote><b>linkchecker https://www.websitename.com</b></blockquote><br />Replace the website name with your website or blog's URL.<p></p><p><br /></p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSsUZcAMgMrnZuGT7mIWQWuPjEn_tGbkLUyTH4qWD_QFWEDc8nylyeh9PLAxwa9TL9Yj19ayskBmJonroTRt0QVuI3ZkqUb4kYtTMIlfjBpvYdFjLoB5t1F6_VvU0sl8S06v0MZuhoIXqQK_nNBcfDc6D8cADvrkg0RndsjE5n4D_EJkhiwsPeG_9Dw/s674/Linkchecker.PNG" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="373" data-original-width="674" height="354" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSsUZcAMgMrnZuGT7mIWQWuPjEn_tGbkLUyTH4qWD_QFWEDc8nylyeh9PLAxwa9TL9Yj19ayskBmJonroTRt0QVuI3ZkqUb4kYtTMIlfjBpvYdFjLoB5t1F6_VvU0sl8S06v0MZuhoIXqQK_nNBcfDc6D8cADvrkg0RndsjE5n4D_EJkhiwsPeG_9Dw/w640-h354/Linkchecker.PNG" width="640" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;"></td></tr></tbody></table><br /><p><br /></p><p>This command will start the Linkchecker utility which will start scanning your website for broken links in multiple threads. The console will also display a list of links that are having errors along with other statistical parameters such as the number of links currently in the queue and the ones already scanned.</p><p>Moreover, if you want to know the details of the link scanned, then you can use verbose mode in the command as shown below:</p><blockquote><p><b>linkchecker http://www.website.com -v</b></p></blockquote><p>Similarly, if you want to log all the links in any specified format such as CSV or HTML, you can also specify the output format as per below example:</p><p></p><blockquote style="font-weight: bold;">linkchecker http://www.website.com -v --output=csv</blockquote><p> </p><p>The complete list of options can be found on their <a href="https://linkchecker.github.io/linkchecker/man/linkchecker.html#output-options" rel="nofollow" target="_blank">documentation page.</a></p><p style="font-weight: bold;"> </p><p>I hope you find this tutorial helpful! Let me know your thoughts</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-68896111768295945432022-07-26T11:40:00.006-07:002022-07-26T11:42:00.037-07:00What is GraphQL and why should you use it<p>If you are a regular user or a developer of APIs, then you must be familiar with SOAP APIs or REST APIs. In commonly used APIs like the ones listed, over a period of time, when new features get added, the payload tends to increase. With the increase in payload, API performance tends to suffer a lot.</p><p><br /></p><p>But did you know that GraphQL can brilliantly solve this problem?</p><p><br /></p><p><b>GraphQL is basically a query language of APIs, originally developed by Facebook and very well adopted by Industry pioneers such as Github, Pinterest, Yelp, etc. </b></p><p>Using GraphQL, you can define the structure of the data which you want and the server will return only the requested data as a response.</p><p>This significantly helps tune up performance thus improving the response time of APIs.</p><p><br /></p><p>It's a must-use for applications involving large payloads and responses, where users may want a limited set of data as per their needs and want to reduce the current response time of the system.</p><p>Here is an interesting example that I got to read at <a href="https://www.cosmicjs.com/blog/graphql-vs-rest-a-quick-guide" rel="nofollow" target="_blank">CosmicJs</a></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2a-Ff3LZA8akbzpTgM88XmXDMl2erTlOy9KjHVLYXuxopbNOz3-n510O1uCXuTMIrFP6zqcpiR7vSXa25llgghA8OK4WEf885kbM1LE4SLMgYwPsT_cKTZNmaXv1dv2Pl3mzU1lYG2BW7uIUfyBLqvlqIgXSk4_WA9_fu1xZkN0YQsGnLlcQ6JZ6zsA/s726/7d9a6f90-7080-11eb-87a2-9be5e90cdf74-GraphQLvsRest%20-%20Copy.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="508" data-original-width="726" height="448" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj2a-Ff3LZA8akbzpTgM88XmXDMl2erTlOy9KjHVLYXuxopbNOz3-n510O1uCXuTMIrFP6zqcpiR7vSXa25llgghA8OK4WEf885kbM1LE4SLMgYwPsT_cKTZNmaXv1dv2Pl3mzU1lYG2BW7uIUfyBLqvlqIgXSk4_WA9_fu1xZkN0YQsGnLlcQ6JZ6zsA/w640-h448/7d9a6f90-7080-11eb-87a2-9be5e90cdf74-GraphQLvsRest%20-%20Copy.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;"><br /></div><div class="separator" style="clear: both; text-align: left;">Hope this helps you get the gist of GraphQL.</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><br /></div><br /><p><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-1222796622427173322021-11-06T08:28:00.004-07:002022-09-25T07:28:52.359-07:00Easy way to handle timezone in SaaS Web Application<p> When you are building a SaaS Web app, you are likely to have users from different timezone.</p><p>Handling time storing logic usually comes to your mind at the end. However, if not handled well, it can cause sleepless nights for you...Just kidding...</p><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwpTa9e5kV2jaZT5dk1NSqNkDN8hmTkjR7fOvpKrdYWNlQ52Ogu7w4sM181KbjHinBFYxp8LZuUQzbzxsaWPJ9pddWvQe9onr7tbjNLRQnjvrnc4R5-bw6rrxgMgheFHJaT41df2XWrUyaXV2DZAChHQiH9nKCbPfhMacX3VwIngUUabThSzI-gYjaqg/s506/pexels-stas-knop-1537268.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" data-original-height="338" data-original-width="506" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwpTa9e5kV2jaZT5dk1NSqNkDN8hmTkjR7fOvpKrdYWNlQ52Ogu7w4sM181KbjHinBFYxp8LZuUQzbzxsaWPJ9pddWvQe9onr7tbjNLRQnjvrnc4R5-bw6rrxgMgheFHJaT41df2XWrUyaXV2DZAChHQiH9nKCbPfhMacX3VwIngUUabThSzI-gYjaqg/s16000/pexels-stas-knop-1537268.jpg" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;"></td></tr></tbody></table><p><br /></p><p>Here is the approach you need to follow the handle timezone logic.</p><p><br /></p><p>1. On the Server side, initialize your server to work on the "UTC" timezone. So that you don't have to manually convert the time every time you create the Date & Time object.</p><p>In Spring MVC, It can be easily done by initializing it using Spring Configuration. </p><p><code><br /></code></p><p><code>
@Configuration </code></p><p><code>public class LocaleConfig { </code></p><p><code> <span> </span>@PostConstruct
public void init() { </code></p><p><code><span> </span><span> </span><span> </span> TimeZone.setDefault(TimeZone.getTimeZone("UTC")); </code></p><p><code> } </code></p><p><code>}
</code>
</p><p> </p><p>I am sure all other servers would be having a similar mechanism to initialize timezone at the time of startup.</p><p><br /></p><p>2. This will ensure the date & time stamp is always is stored and retrieved from database in UTC format.</p><p><br /></p><p>3. Now on Front end, you can convert the UTC time to be displayed in the local timezone of the user's browser. This can be done using this simple javascript:</p><p><br /></p><p><span style="font-family: monospace;">var dt = new Date('2021-07-24T20:37:26.007' + 'Z');</span></p><p><span style="font-family: monospace;">console.log(dt1.toLocaleString());</span></p><p><span style="font-family: monospace;"><br /></span></p>Hope this solves your timezone headache. It took me whole day of research to finally understand this simple logic.Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-66563078780208188892021-11-02T23:37:00.005-07:002021-11-02T23:37:56.139-07:00Quick Linux commands for Apache2 serverHere are some quick to remember Linux commands for controlling Apache2 server.<div><br /></div><div><br /></div><div>1. Starting an Apache2 server.</div><div><br /></div><div>"sudo service apache2 start"</div><div><br /></div><div><br /></div><div>2. Restarting an Apache2 server:</div><div><br /></div><div>"sudo service apache2 restart"</div><div><br /></div><div><br /></div><div>3. Stoping an Apache2 server:</div><div><br /></div><div>"sudo service apache2 stop"</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-62005719793620520662021-09-07T07:11:00.010-07:002021-09-07T07:17:33.713-07:00Email validation in Java using OWASP standards<p>Hello friends,</p><p>If you are building an application with form inputs, you may come across scenarios where you might be required to validate the email entered by the user.</p><p>In this post, let me share an easy way to do email validation.<span></span></p><a name='more'></a><p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV4o4LdVhCWTXbp8jHMbhbKFI-iyAtEPF4ebW-SiEacpsLS2cb-4_PG0q4vFu4Pj-d1vfcPFFV3HJROLk7l_Ex3GOcJa5Tld_CjK2glykWxTWYv9kirCX9YpDlTI3-0N6WGwaGInIbSoLJ/s1000/email-logo.jpg" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="1000" data-original-width="1000" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhV4o4LdVhCWTXbp8jHMbhbKFI-iyAtEPF4ebW-SiEacpsLS2cb-4_PG0q4vFu4Pj-d1vfcPFFV3HJROLk7l_Ex3GOcJa5Tld_CjK2glykWxTWYv9kirCX9YpDlTI3-0N6WGwaGInIbSoLJ/s320/email-logo.jpg" width="320" /></a></div><br /><div class="separator" style="clear: both; text-align: center;"><br /></div><p>Depending on your use case, you can start email validation in the most basic way. </p><p></p><ol style="text-align: left;"><li>First, you can do a simple check if the "@" character is present in your email or not.</li><li>If you want to add more complexity to the validation, you may compare it against a regex with the "@" and "." characters.</li><li>Similarly, you can add validation to compare it against special characters as well to try out various scenarios of users trying to enter an invalid email.</li></ol><div>In this post, we will use the regex pattern used by <a href="https://owasp.org/www-community/OWASP_Validation_Regex_Repository" target="_blank">OWASP validation</a>.</div><div><br /></div><div><br /></div><div><b><u>Java Code:</u></b></div><div><br /></div><p></p>
<p>
<code>
import java.util.regex.Matcher; </code></p><p><code>import java.util.regex.Pattern; </code></p><p><code> public class MainClass { </code></p><p><code> <span> </span>private static final String regex = "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$"; </code></p><p><code><br /></code></p><p><code> public static void main(String[] args) { </code></p><p><code> String email = "lewis@gmail.com."; </code></p><p><code> // initialize the Pattern object </code></p><p><code> Pattern pattern = Pattern.compile(regex); </code></p><p><code> // initialize the Matcher object </code></p><p><code> Matcher matcher = pattern.matcher(email); </code></p><p><code> System.out.println("Is the given Email Valid? " + matcher.matches()); </code></p><p><code> } </code></p><p><code>}
</code>
</p>
<p> </p><p><br /></p><p><b><u>Output:</u></b></p><p><code>Is the given Email Valid? false</code></p><p><br /></p><p>Hope you found this code useful for your email validation needs. One thing to remember, though this regex uses the pattern given as per OWASP standard which covers almost most of the use cases. But still, it may not guarantee perfect validation for every scenario. </p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-78896429917472465322021-09-05T05:19:00.005-07:002021-09-05T05:35:23.628-07:00List of Machine Learning Algorithms<h4 style="text-align: left;"> <div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZFdHYRnSeqJ1WPqk_mY4JgksImn-nqj6zuhDEjqNwBnzg0858tzbzMimIMojVzvscu5o8j9SM2Udpt0gLDF02NS4jUagvyKKpL45SrcrvCaiAcGnVzQUcZKvADPaYs1NCr0AxOpfFoWw3/s512/4290391.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="512" data-original-width="512" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZFdHYRnSeqJ1WPqk_mY4JgksImn-nqj6zuhDEjqNwBnzg0858tzbzMimIMojVzvscu5o8j9SM2Udpt0gLDF02NS4jUagvyKKpL45SrcrvCaiAcGnVzQUcZKvADPaYs1NCr0AxOpfFoWw3/s320/4290391.png" width="320" /></a></div><br /></h4><h4 style="text-align: left;"><br /></h4><h4 style="text-align: left;">Clustering:</h4><p></p><ol style="text-align: left;"><li>K Means</li><li>K Medians</li><li>BIRCH</li><li>Fuzzy C-Means</li><li>Fuzzy K-Modes</li><li>Mini Batch K-Means</li><li>DBSCAN</li><li>Fuzzy Clustering</li><li>Mean-Shift</li><li>Optics Algorithm</li><li>Expectation Maximization</li><li>Hierarchical Clustering</li><li>Minimum Spanning Tree</li></ol><div><br /></div><h4 style="text-align: left;">Dimensionality Reduction:</h4><div><ol style="text-align: left;"><li>PCA Algorithm</li><li>PCR Algorithm</li><li>PLSR Algorithm</li><li>Sammon Algorithm</li><li>MDS Algorithm</li><li>Projection Pursuit</li><li>LDA Algorithm</li><li>ICA Algorithm</li><li>NMF Algorithm</li><li>RDA Algorithm</li><li>MDA Algorithm</li><li>PLSDA Algorithm</li><li>QDA Algorithm</li><li>CCA Algorithm</li><li>Diffusion Map</li></ol><div><br /></div></div><h4 style="text-align: left;">Regression:</h4><div><ol style="text-align: left;"><li>Ordinary Least Squares Regression</li><li>Linear Regression</li><li>Logistics Regression</li><li>Stepwise Regression</li><li>MARS Algorithm</li><li>Locally Estimated Scatterplot Smoothing</li></ol><div><br /></div></div><h4 style="text-align: left;">Decision Tree</h4><div><ol style="text-align: left;"><li>Conditional Decision Trees</li><li>Decision Stump</li><li>C4.5 and C5.0</li><li>CHAID</li><li>CART</li><li>ID3</li><li>M5</li></ol><div><br /></div></div><h4 style="text-align: left;">Bayesian</h4><div><br /></div><div><ol style="text-align: left;"><li>AODE</li><li>Naive Bayes</li><li>Gaussian Naive Bayes</li><li>Multinomial Naive Bayes</li><li>Bayesian Belief Network</li><li>Bayesian Network</li></ol><div><br /></div></div><h4 style="text-align: left;">Reinforcement Learning</h4><div><ol style="text-align: left;"><li>Q Learning</li><li>SARSA Algorithm</li><li>Deep Q-Network</li><li>Learning Automata</li><li>DDPG Algorithm</li><li>NAF Algorithm</li><li>A3C Algorithm</li><li>TRPO Algorithm</li><li>PPO Algorithm</li><li>Constructing Skill Trees</li></ol><div><br /></div></div><h4 style="text-align: left;">ANNs:</h4><div><ol style="text-align: left;"><li>Perceptron</li><li>MLP Algorithm</li><li>Back-Propagation</li><li>Stochastic Gradient Descent</li><li>Hopfield Network</li><li>RBFN Algorithm</li></ol><div><br /></div></div><h4 style="text-align: left;">ARL:</h4><div><br /></div><div><ol style="text-align: left;"><li>Apriori Algorithm</li><li>Eclat Algorithm</li><li>FP Growth Algorithm</li></ol><div><br /></div></div><h4 style="text-align: left;">Regularization:</h4><div><ol style="text-align: left;"><li>Ridge Regression</li><li>Elastic NEt</li><li>LASSO</li><li>LARS</li></ol><div><br /></div><h4 style="text-align: left;">Emsemble:</h4></div><div><ol style="text-align: left;"><li>GBDT</li><li>GBRT</li><li>Boosting</li><li>Bagging</li><li>AdaBoost</li><li>Random Forest</li><li>Blending Algorithm</li><li>Stacked Generalization</li><li>Gradient Boosting Machines</li></ol><div><br /></div></div><h4 style="text-align: left;">Instance Based:</h4><div><ol style="text-align: left;"><li>Learning Vector Quantization</li><li>K Nearest Neighbor</li><li>Self-Organizing Map</li><li>Locally Weighted Learning</li><li>Support Vector Machines</li></ol><div><br /></div><h4 style="text-align: left;">Deep Learning</h4></div><div><ol style="text-align: left;"><li>CNN</li><li>RNNs</li><li>LSTMs</li><li>Stacked Auto Encoders</li><li>Deep Boltzmann Machine</li><li>Deep Belief Networks</li></ol><div><br /></div></div><h4 style="text-align: left;">Rule System:</h4><div><ol style="text-align: left;"><li>Cubist</li><li>OneR</li><li>ZeroR</li><li>Ripper</li></ol><div><br /></div><h4 style="text-align: left;">Other ML Algorithms:</h4></div><div><ol style="text-align: left;"><li>ALOPEX</li><li>CN2 Algorithm</li><li>FastICA</li><li>Feature Selection Algorithm</li><li>Linde Buzo Gray Algorithm</li><li>Forward Backward Algorithm</li><li>Algorithm Accuracy Evaluation</li><li>Performance Measures</li><li>Optimization Algorithm</li><li>Dynamic Time Warping</li><li>Local Outlier Factor</li><li>Logic Learning Machine</li><li>Markov Chain Monte Carlo</li><li>T Distributed Stochastic Neighbor Embedding</li><li>Wake Sleep Algorithm</li><li>Prefrontal Cortex Basal Ganglia Working Memory.</li><li>LogitBoost</li><li>Sparse PCA</li><li>Structured kNN</li><li>WMA Algorithm</li><li>GeneRec</li><li>Leabra</li><li>RProp</li></ol></div><p></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-15370922877596724422021-08-31T09:56:00.008-07:002021-08-31T09:57:21.460-07:00Easy way to remember 8 primitive types in Java<p></p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg5sr9IVfsS8Z9j02gcoPHIeh5FFmEYa7zhnxunwbRRWNISg2ZZb9aLulEHDRuccOie5KrJRQ9654JFAF_AoB2bUv0zKWoZ6WP4k9_UEOfc7MnhtVGIKXHqW7Xd23all7h6iM2Mj6WH_cz/s374/java+primitives.PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="345" data-original-width="374" height="295" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgg5sr9IVfsS8Z9j02gcoPHIeh5FFmEYa7zhnxunwbRRWNISg2ZZb9aLulEHDRuccOie5KrJRQ9654JFAF_AoB2bUv0zKWoZ6WP4k9_UEOfc7MnhtVGIKXHqW7Xd23all7h6iM2Mj6WH_cz/s320/java+primitives.PNG" width="320" /></a></div><br /> Hey friends,<p></p><p>Just happened to be revisiting the iconic book "<b><i>Head First Java"</i></b> and found those.</p><p>Though you need not remember these if you have been coding in Java for a while. However sometimes, Software Engineers get asked about the 8 primitive types in Java.</p><p>Here is the simple trick to remember these.</p><p><b></b></p><blockquote><b>B</b>e <b>C</b>areful! <b>B</b>ears <b>S</b>houldn't <b>I</b>ngest <b>L</b>arge <b>F</b>urry <b>D</b>ogs.</blockquote><p></p><p></p><ol style="text-align: left;"><li>Boolean</li><li>Char</li><li>Byte</li><li>Short</li><li>Int</li><li>Long</li><li>Float</li><li>Double.</li></ol><p></p><p>Share it with your friends and spread the word!</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-37400132192910917522021-06-30T12:27:00.005-07:002021-06-30T12:27:53.725-07:00Visual Studio Code - Shortcut Key Commands<p> </p><p></p><ol style="text-align: left;"><li>Indentation: Shift + Alt + F</li></ol><p></p><p><br /></p><p><br /></p><p><br /></p><p><b><u>Extra Extension based Shortcuts to enhance productivity:</u></b></p><p>1. HTML5 Boiler Plate Code - Install html5 boilerpate extension. Restart Visual Studio Code. Type "html" in the html file. Select "html5-boilerplate" option from the suggestions.</p><p><br /></p><p><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-66360740454648209262021-05-22T23:53:00.005-07:002021-05-22T23:58:57.900-07:00Quick command to take MySQL database backup in Linux<p>Hey friends,</p><p>As a database administrator, you must be required to take periodic backup of your database from time to time. Sometime it might be routine backup or sometime you may be required to take a backup if you are going to do some major structural changes to the database.</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwzaGEGkp_aH3yOuylTtQt6uchsmwjGf63wiOIlODedTGCZKQRCzawORXFNR3OZsyrLWO8zqQRGz4SKzcUZsS24W-vQOo_57Jw3y5nMJW4EHuro5pZUOXGLfcZsfhke1ScsOZ8_LGO6KRn/s700/mysql.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="256" data-original-width="700" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwzaGEGkp_aH3yOuylTtQt6uchsmwjGf63wiOIlODedTGCZKQRCzawORXFNR3OZsyrLWO8zqQRGz4SKzcUZsS24W-vQOo_57Jw3y5nMJW4EHuro5pZUOXGLfcZsfhke1ScsOZ8_LGO6KRn/s320/mysql.jpg" width="320" /></a></div><br /><p><br /></p><p>Here is the backup command you should keep handy in order to take MySQL database backup in Linux.</p><p><br /></p><blockquote><p><b>sudo mysqldump -u [username] -p [database_name] > [backup_filename.sql]</b></p></blockquote><p><br /></p><p>The above command is the basic syntax for taking backup of a single database. Here is an example where the user is logged in to mysql database as a "root" user, "database_name" is the name of the database which you would like to backup and "filedump.sql" is the file name of the mysql backup dump which needs to be created.</p><p> </p><blockquote><p><b>sudo mysqldump -u root -p database_name > filedump.sql</b></p></blockquote><p> </p><p>Once you hit this command, it creates the dump file in the same folder where you are currently logged in.</p><p> </p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-28002103906869084502021-05-15T04:44:00.010-07:002021-05-15T04:51:17.179-07:00Perform complete Website Audit for Free using Lighthouse<p style="text-align: justify;">While working on an assignment towards improving the SEO of a website, we came across an open source tool to help you perform complete Website Audit for free.</p><p style="text-align: justify;"><b>Yes, It is Lighthouse!</b></p><h3 style="text-align: justify;"><b>Introduction:</b></h3><p style="text-align: justify;">Lighthouse is a Free and Open source tool by Google developed to help Developers build quality web pages which confirms to latest standards of Web development. It is equipped to perform audit by emulating the user from both Mobile as well as Desktop devices.</p><p style="text-align: justify;">Lighthouse can be accessed directly in Chrome without the need to install any additional extension. This tool can be used to do audit of live websites in production as well as the webpages in your local development environment. As long as the webpage can be accessed from your Chrome browser, you can easily audit it.</p><p style="text-align: justify;"><br /></p><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxo5JJiERvwE414d99Ke4VM9mMRkU4Rjfi8GEZvNoBJVn2f-kIWmUmd7obvItWyhYwHi4boK1Vc-xW0NvW_yxq-M_nCm1cvbyQQcLP4J50ui2cQMEibfXkZc05zR0mIwBiEG6Vh28KUnsb/s670/Google+Lighthouse.PNG" style="margin-left: auto; margin-right: auto; text-align: center;"><img border="0" data-original-height="670" data-original-width="664" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxo5JJiERvwE414d99Ke4VM9mMRkU4Rjfi8GEZvNoBJVn2f-kIWmUmd7obvItWyhYwHi4boK1Vc-xW0NvW_yxq-M_nCm1cvbyQQcLP4J50ui2cQMEibfXkZc05zR0mIwBiEG6Vh28KUnsb/w396-h400/Google+Lighthouse.PNG" width="396" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Google Lighthouse</td></tr></tbody></table><p style="text-align: justify;"><br /></p><h3 style="text-align: justify;"><b>Features Overview:</b></h3><p style="text-align: justify;">At the moment it helps you audit your webpages in the following categories:</p><p></p><ul style="text-align: left;"><li style="text-align: justify;"><b>Performance:</b></li></ul><div style="text-align: justify;">This score helps you access the performance of your webpage against the benchmark standards. The audit is based on various data points such as the time at which your first text or image is loaded or painted, time it takes for your website to become fully interactive, speed index, total blocking time, time taken by the largest text or image to be painted or loaded, etc. </div><div style="text-align: justify;"><br /></div><ul style="text-align: left;"><li style="text-align: justify;"><b>Accessibility:</b></li></ul><div style="text-align: justify;">It assesses your webpage against various <a href="https://web.dev/lighthouse-accessibility/" target="_blank">accessibility checklist</a> and provides you a weighted composite score. The various data points used to arrive this score include Navigation, ARIA attributes, Names and Labels, Contrast, Tables and Lists, Best practices, Audio and Video, Internationalization and Localization and some other checklist related to navigation controls and focus.</div><div style="text-align: justify;"><br /></div><div><ul style="text-align: left;"><li style="text-align: justify;"><b>Best Practices</b></li></ul><div style="text-align: justify;">This score provides an assessment on the conformance of website code quality, website configurations, external requests and many other parameters against the industry best practices in web development.</div><div style="text-align: justify;"><br /></div><ul style="text-align: left;"><li style="text-align: justify;"><b>SEO:</b></li></ul><div style="text-align: justify;">This metric helps to audit your web page to ensure you are following all the SEO best practices in order to optimize your webpage rankings in search engine results. This is by far the most important metric for a web developer. The better the SEO score, better are the chances that the website will appear in the first few results of the search engine. The boost in search rankings eventually lead to increased traffic ultimately leading to improvement in sales figures.</div><div style="text-align: justify;"><br /></div><ul style="text-align: left;"><li style="text-align: justify;"><b>Progressive Web App:</b></li></ul><div style="text-align: justify;">The PWA score helps you assess your website against multiple aspects of a Progressive Web App. Some of the data points used to calculate this metrics are performance of your app, browser compatibility, responsiveness to multiple screen sizes, offline experience, conformance to accessibility standards, search engine discoverability, ability to use via any input device such as keyboard, touch, stylus, etc.</div><p></p><p style="text-align: justify;"><br /></p><h3 style="text-align: justify;"><b>To access the the tool. Follow these steps:</b></h3><p></p><ol style="text-align: left;"><li style="text-align: justify;">Open Google Chrome and navigate to the webpage which you would like to audit. </li><li style="text-align: justify;">Now Right Click and select "Inspect" to open the developer tools in Chrome.</li><li style="text-align: justify;">At the end, you may find a pre-installed tab titled "Lighthouse". Click to navigate there.</li><li style="text-align: justify;">In Lighthouse window, you may select the categories for which you want to perform audit and then click on "Generate report" button.</li><li style="text-align: justify;">Within a few seconds depending on your internet connection as well as page load time. (usually less than 30 seconds though). You shall get an audit report displayed within the toolbar.</li><li style="text-align: justify;">Now you can go through each and every observation in detail and correct them in order to improve your Website Quality score.</li><li style="text-align: justify;">If you find a lot of observation which may take time to fix. Then you may download a PDF report and keep it for future analysis and fixes.</li></ol><div style="text-align: justify;"><br /></div><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJNcxJkgG1W9dK9Z_70lRwYvHUCgIMHiKSpdxqXuuTqCoUN11WrpnxJHnfswDdDm1dPIIMNo0b85B3bNzgZGpsXI0w8FHA2-jboMo4yHQeiWswx0yL-ykMh__HOSD9rJvNbpgVKkWkzhYx/s672/Google+Lighthouse2.PNG" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="331" data-original-width="672" height="317" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgJNcxJkgG1W9dK9Z_70lRwYvHUCgIMHiKSpdxqXuuTqCoUN11WrpnxJHnfswDdDm1dPIIMNo0b85B3bNzgZGpsXI0w8FHA2-jboMo4yHQeiWswx0yL-ykMh__HOSD9rJvNbpgVKkWkzhYx/w640-h317/Google+Lighthouse2.PNG" width="640" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Lighthouse tool in Google Chrome Inspect Elements</td></tr></tbody></table><div style="text-align: justify;"><br /></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;">I hope you liked reading this blog post. Do not forget to like, share and comment on the post.</div><p></p></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-29051460208219583132021-05-10T08:20:00.001-07:002021-05-10T08:20:13.741-07:00How to disable Javascript from a website using Chrome<p style="text-align: justify;">Often I come across a lot of websites, who obstruct the content by putting an intrusive popup which keeps asking us to subscribe or sign up. Sometimes, It doesn't even allow you to read even a single line and forces you to use its call to action such as registration in the website, providing them your email for their newsletter or marketing communications, sharing the article on multiple social media channels. The list is endless...</p><p style="text-align: justify;">I understand that creating content needs both time and effort from the content creator who should be compensated in return. However it truly doesn't make sense for any quick reader who need some quick info to go all the way to signup to the service, some of which are also paid subscription. Many a times, after signup, we realize the content didn't had the information we were looking for unnecessarily exposing our personal email addresses to potential spammers.</p><p style="text-align: justify;">To overcome this, I came up with a quick solution:</p><p style="text-align: justify;">Whenever you visit a website which blocks the content with a popup and doesn't allow to go back to content, do this:</p><p></p><ol style="text-align: left;"><li style="text-align: justify;"><b>Hope you are using Google Chrome browser.</b></li><li style="text-align: justify;"><b>Right click and click on Inspect (Alternatively you may use Ctrl + Shift + I). This will open the Developer console.</b></li><li style="text-align: justify;"><b>Now Enter (Ctrl + Shift + P). This shall show you the command text box.</b></li><li style="text-align: justify;"><b>Now type "Disable JavaScript" in the command box and hit enter.</b></li></ol><p></p><p></p><div class="separator" style="clear: both; text-align: justify;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOdgAR4wEbfnh58K7RBG2z7Wa85s_1wpA2jwN6wWjm6eDnI36sBREnEUxfGeePRFOJMVcbNTYiuEuur0wkylGsMdfMpx_R7jNtW7KeeLrvA-eA3llgCqmDLSpWi-Lyq6q4iBRAbP_tDmIP/" style="margin-left: 1em; margin-right: 1em;"><img alt="" data-original-height="163" data-original-width="954" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOdgAR4wEbfnh58K7RBG2z7Wa85s_1wpA2jwN6wWjm6eDnI36sBREnEUxfGeePRFOJMVcbNTYiuEuur0wkylGsMdfMpx_R7jNtW7KeeLrvA-eA3llgCqmDLSpWi-Lyq6q4iBRAbP_tDmIP/w640-h109/image.png" width="640" /></a></div><div style="text-align: justify;"><br /></div><div style="text-align: justify;">Now you may refresh and reload the website page again. </div><p></p><p style="text-align: justify;">Now the obtrusive JavaScript based popup will not appear again. Happy reading!</p><p style="text-align: justify;">Share it among your friends if you found this trick useful!</p><p style="text-align: justify;"><br /></p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-12985542952225079162021-04-18T01:23:00.005-07:002021-04-18T01:24:20.149-07:00How to get MySQL Shell in Ubuntu/Linux<p> Often, we install MySQL Server in Ubuntu or Linux machines and then we tend to forget how to login to MySQL shell.</p><p>This may happen if we rarely login to MySQL Server since now a days most of the database table field additions and modifications can be handled by the Web app backend itself. </p><p>If you wanna show MySQL command line in Ubuntu or Linux, use the following command:</p><p><br /></p><p><b><code>mysql -u <username> -p<code></code></code></b></p><p><br /></p><p>Here -u stands for username and -p stands for password </p><p>You are required to replace <username> with your actual username for mysql. If you are trying to login as ROOT user. then you can use the command in the following way:</p><p><br /></p><p><b><code>mysql -u root -p</code></b></p><p><b><br /></b></p><p>Next you will be prompted with the password for root user. Once you enter the password. MySQL shell will appear where you can enter the MySQL query commands as usual.</p>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-70733180010257389432021-04-05T01:04:00.000-07:002021-04-05T01:04:01.487-07:00How to unzip a file in Ubuntu or LinuxTo unzip a file to usual folder in Ubuntu or Linux. Use the following commands:<div><br /></div><div><b><u>Install Unzip (if not yet installed already)</u></b></div><div><br /></div><div>To install unzip into your machine, use the following command:</div><div><br /></div><div>
<code>sudo apt install unzip</code></div><div><code><br /></code></div><div><br /></div><div>After you have installed Unzip, follow these steps to unzip the file:</div><div><br /></div><div><b><u>1. To unzip and extract the files inside the same folder</u></b></div><div><br /></div><div><code>unzip filename.zip</code>
</div><div><br /></div><div><br /></div><div><b><u>
2. To unzip and extract the files inside another folder</u></b></div><div><b><u><br /></u></b></div><div><b><u><br /></u></b>
<code>unzip filename.zip -d /home/pathtofolder/NewFolderName</code> </div><div><br /></div><div><br /></div><div>Bookmark this page if you keep forgetting! Hope it helps. Keep sharing
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-75095700217753904822020-06-16T14:51:00.000-07:002020-06-16T14:52:02.180-07:00URL Redirection scenarios to be tested while installing SSL Certificates<div dir="ltr" style="text-align: left;" trbidi="on">
If you are trying to install SSL certificates for the first time.<br />
<br />
Do ensure to test all possible scenarios of URL direction<br />
<br />
<br />
<ul style="text-align: left;">
<li>Ensure http URLs are redirecting properly</li>
<li>Ensure https URLs are not giving any invalid certificate errors</li>
<li>Ensure naked domains in http are redirecting properly</li>
<li>Ensure naked domains in https are redirecting properly</li>
</ul>
<div>
<br /></div>
<div>
For Example, If you own the domain name as "yourdomain.com", then you must test all below scenarios by typing the below URLs in browser and testing all the page loads or redirection:</div>
<div>
<br /></div>
<br />
<div>
<ul style="text-align: left;">
<li>https://www.yourdomain.com</li>
<li>http://www.yourdomain.com</li>
<li>www.yourdomain.com</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>https://yourdomain.com</li>
<li>http://yourdomain.com</li>
<li>yourdomain.com</li>
</ul>
<div>
<br /></div>
<ul style="text-align: left;">
<li>https://subdomain.yourdomain.com</li>
<li>http://subdomain.yourdomain.com</li>
<li>subdomain.yourdomain.com</li>
</ul>
</div>
<div>
<br /></div>
<br />
<div>
<br /></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-49436725332959148302020-04-28T13:15:00.001-07:002020-04-28T13:15:53.863-07:00How to install MySQL/MariaDb server in GCP Ubuntu Instance<div dir="ltr" style="text-align: left;" trbidi="on">
f you are using Google Cloud Platform and trying to install MySQL server (MariaDB) on Ubuntu 16.04, you may frequently get some issues while trying to install.<br />
<br />
You may get some error like the below one:<br />
<br />
<x-row style="background-color: #222222; caret-color: rgba(0, 0, 0, 0); color: white; display: block; font-family: "courier new", monospace; font-size: 13px; font-variant-ligatures: none; height: var(--hterm-charsize-height); line-height: var(--hterm-charsize-height); visibility: visible; white-space: pre;">Errors were encountered while processing:</x-row><x-row style="background-color: #222222; caret-color: rgba(0, 0, 0, 0); color: white; display: block; font-family: "courier new", monospace; font-size: 13px; font-variant-ligatures: none; height: var(--hterm-charsize-height); line-height: var(--hterm-charsize-height); visibility: visible; white-space: pre;"> mysql-server-5.7</x-row><x-row style="background-color: #222222; caret-color: rgba(0, 0, 0, 0); color: white; display: block; font-family: "courier new", monospace; font-size: 13px; font-variant-ligatures: none; height: var(--hterm-charsize-height); line-height: var(--hterm-charsize-height); visibility: visible; white-space: pre;"> mysql-server</x-row><x-row style="background-color: #222222; caret-color: rgba(0, 0, 0, 0); color: white; display: block; font-family: "courier new", monospace; font-size: 13px; font-variant-ligatures: none; height: var(--hterm-charsize-height); line-height: var(--hterm-charsize-height); visibility: visible; white-space: pre;">E: Sub-process /usr/bin/dpkg returned an error code (1)</x-row><br />
<br />
In this case, follow these steps to clean up the MySQL server installation.<br />
<br />
Type the below command in the same order:<br />
<br />
<ul style="text-align: left;">
<li><span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">sudo mv /etc/mysql/my.cnf /etc/mysql/my.cnf.bak</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">sudo rm -r /etc/mysql/mysql.conf.d/</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">sudo mv /etc/mysql/debian.cnf /etc/mysql/debian.cnf.bak</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new", monospace; font-size: 13px; white-space: pre;">sudo apt purge mysql-server mysql-server-5.7 mysql-server-core-5.7</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new", monospace; font-size: 13px; white-space: pre;">sudo apt install mysql-server</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new", monospace; font-size: 13px; white-space: pre;">sudo ln -s /etc/mysql/mysql.conf.d /etc/mysql/conf.d</span></li>
<li><span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">sudo service mysql start</span></li>
</ul>
<br />
<br />
To check if MySQL is running properly or not, you can type below command to check status:<br />
<br />
<span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">systemctl status mysql.service</span><br />
<br />
or can use this command to know the version of MySQL<br />
<span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;"><br /></span>
<span style="background-color: #222222; color: white; font-family: "courier new" , monospace; font-size: 13px; white-space: pre;">mysqladmin -p -u root version</span><br />
<br />
Hope you found this post useful and it solved your problem!<br />
<br />
I found this solution here: <a href="https://askubuntu.com/questions/760724/16-04-upgrade-broke-mysql-server">[Credits]</a><br />
<br /></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-82075692703685183262020-03-26T07:02:00.000-07:002020-03-26T07:03:15.033-07:00Important Linux Commands - Ready Reckoner<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
<br />
In this blog, let me share some commonly used Linux commands which you may find useful in case you do not frequently interact with Linux servers or operating systems.<br />
<br />
<br />
<ul style="text-align: left;">
<li><b>cd /<folder path></b> - Go inside a particular folder.</li>
</ul>
<ul style="text-align: left;">
<li><b>mkdir <folder name></b> - Create a new folder or directory with the given name.</li>
</ul>
<ul style="text-align: left;">
<li><b>ls</b> - List the contents of the present directory.</li>
</ul>
<ul style="text-align: left;">
<li><b>rmdir <folder name></b> - Delete the directory or folder if it is empty.</li>
</ul>
<ul style="text-align: left;">
<li><b>exit</b> - Leave the existing ssh session</li>
</ul>
<ul style="text-align: left;">
<li><b>sudo su</b> - Switch to Super user.</li>
</ul>
<div>
<br />
I will keep adding the list based on the frequency of usage. Thanks for reading.</div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-34923665906879607402019-10-15T11:28:00.001-07:002019-10-15T11:29:57.170-07:00Unable to install MySQL server on Windows 10 - FIXED<p dir="ltr">Recently I was facing a weird error while trying to install MySQL Community server on a Windows 10 system.</p>
<p dir="ltr">Every time I start the MySQL Community installer and select MySQL server and try to install, It used to successfully download the setup file from internet but at the end it used to fail.</p>
<p dir="ltr">Usually progress percent used to go from 0 to 100% then again used to restart from 0% and used to go till 50% and then it used to show the error message as installation failed.</p>
<p dir="ltr">I googled out a lot and found many places which suggested to install both Microsoft Visual c++ redistributable for both x86 and x64. My system was a 64 bit system, I installed both the visuall c++ distribution but none of them worked even after rebooting system after every install.</p>
<p dir="ltr">What finally worked was this:</p>
<p dir="ltr">1. I wantedly started MySQL installer web and tried installing MySQL server  (version 8.0, earlier had tried 5.7 also).</p>
<p dir="ltr">2. Wantedly waited for the installation to fail.</p>
<p dir="ltr">4. Went to the folder C:\ProgramData\MySQL Installer for Windows\Product Cache. (ProgramData folder might be hidden, enable visibility of hidden file)</p>
<p dir="ltr">5. Selected the .exe file with name mysql-8.0.17-win64.exe and tried installing it again by double clicking that file.</p>
<p dir="ltr">6. But during this time at the time of selection, I selected custom install and excluded the "Server Data Files" while the dialog box was showing which all modules to install.</p>
<p dir="ltr">7. This time it installed well.</p>
<p dir="ltr">8. Once the installation completed. I went back to MySQL installer. Now MySQL server 8.0.17 was showing up. I clicked on reconfigure and went ahead with initial configuration and password setup of the MySQL server.</p>
<p dir="ltr">Hope this helps you save your infinite search to find solution to this known MySQL bug..</p>
<p dir="ltr">I am thankful to Peter (https://bugs.mysql.com/bug.php?id=89066) <u>who</u> posted this solution which I found after two <u>days</u> of rigorous search.</p>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-47535196648014031172019-04-21T14:31:00.003-07:002019-04-21T14:31:41.288-07:00How to remove last commit from Git<div dir="ltr" style="text-align: left;" trbidi="on">
Sometimes while committing codes to Git, we end up doing wrong commits and hence would like to reverse the commit.<br />
<br />
Here are the 3 commands which would be handy:<br />
<br />
These commands are applicable when you are doing reverse commits in non-master branch:<br />
Open Git Bash and type the following command:<br />
<div>
<br /></div>
<div>
<div>
<b>1. git reset HEAD^ </b></div>
<div>
<br /></div>
<div>
This will remove the recent last commit from the active branch.</div>
<div>
<br /></div>
<div>
<b><br /></b></div>
<div>
<b>2. git push origin :branch_name </b></div>
<div>
This command would delete the branch from remote location of the git.</div>
<div>
<br /></div>
<div>
<b><br /></b></div>
<div>
<b>3. git push origin branch_name </b></div>
<div>
<br /></div>
<div>
Now this command will push all the commits from your local to remove by creating the deleted branch again but without the last commit since you deleted it in local git.</div>
<div>
<br /></div>
</div>
<div>
<br /></div>
<div>
If you want to reverse the commit in Master branch, it is little different, Here in non-master branch we deleted the whole branch in remote, but since Master branch is default branch and cannot be deleted, so the trick is little different. If you want to reverse your commit in Master branch, you can </div>
<div>
refer the below reference link from Stackoverflow: </div>
<div>
<br /></div>
<div>
Reference: <a href="https://stackoverflow.com/questions/14836696/delete-last-commit-in-bitbucket/31907323">https://stackoverflow.com/questions/14836696/delete-last-commit-in-bitbucket/31907323</a></div>
<div>
<br /></div>
</div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-4934086990919344832.post-46101834846064952932019-01-15T02:17:00.002-08:002019-01-15T02:17:09.759-08:00Important SQL Query - Ready Reckoner<div dir="ltr" style="text-align: left;" trbidi="on">
<b>1. For Displaying records:</b><br />
<br />
select * from [table_name];<br />
<br />
select * from [table_name] where [field_name]='1';<br />
<br />
<br />
<br />
<b>2. Deleting specific records:</b><br />
<br />
delete from [table_name] where [field_name]>0;<br />
<br />
<br />
<b><br /></b>
<b>3. Insert Records</b><br />
<br />
insert into [table_name] (field1, field2, field3,...) values (value1, value2, value3,...);<br />
<br />
insert into [table_name] values (value1, value2, value3,...);<br />
<br />
<br />
<b><br /></b>
<b>4. Update Records:</b><br />
<br />
update [table_name] set [field1]=[new_value] where [field2]="1";<br />
<br />
<br /></div>
Unknownnoreply@blogger.com0