Posts

Image
Introduction Python in Eclipse IDE - Pydev Plugin PyDev eclipse plugin is popular to enable Eclipse IDE to work with Python. Though there are other dedicated Linux IDE’s available in the market for python but if you specifically want to tweak your Eclipse IDE to make it perfect for Python development then you are at right place. Checkout below video for a step by step guide for PyDev installation in Eclipse IDE Prerequisite:  We assume that you have already installed below softwares. I have also mentioned the versions used in this tutorial against each of these:  1. Python - 3.8.0 2. Java - openjdk 11.0.11 (it is required for Eclipse to work) 3. Eclipse Installed - 2021-06 (4.20.0) 4. Ubuntu - 18.0.4 Steps :  1. Open Eclipse Market Place 2. Search for Pydev plugin In the search box, type 'PyDev' and click on go. 3. Install PyDev Look for the PyDev plugin from the search results and click on install button to install it. PyDev will ask you to select the packages to in

Linux CAT command

Image
Introduction CAT Command 'cat' command concatenate files to the Standard Output. The name of this command is derived from 'concatenate' function it performes. It is very popular in Linux/Unix Operating Systems to read input stream/file and prints to Standard output stream. Cat comes with really helpful options/switches to get the desired output. Checkout video below for CAT command's basic usage with examples: CAT Options and usage Create a new file Creating a new file using CAT is simple. Let's say we want to create a new file with name foo.txt. Just use below command in terminal. cat > foo.txt Above command uses '>'(greater than) symbol to tell the system that we are going to create new file. Cat will ask for the input content of the files. Write content for the file and press Ctrl+d. foo.txt will be created with the content provided.

How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE

Image
How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE How to Load Servlet on StartUp and Call a Method using Java in NetBeansIDE 1. Open NetBeansIDE. 2. Create a Java Web Project. 3. Create a Servlet (say StartupServlet). 4. Create a Class(say Message) and write method to call say void display() { System.out.print("-------Hello--------"); } 5. In StartupServlet override init() method of GenericServlet and write code calling display() Method in. 6. Change web.xml. Add this line in web.xml <load-on-startup>0</load-on-startup> 7. Run your project. 8. Finish. Thank You :)

How to upload file using Servlet of Java in NetBeansIDE

Image
How to upload file using Servlet of Java in NetBeansIDE How to upload file using Servlet of Java in NetBeansIDE 1. Open NetBeansIDE. 2. Make a new Java web project. 3. Make a form in index.jsp (method='POST', enctype='multipart/form-data'). 4. Make a servlet(FileUploadServlet) in source package folder and add it to deployment    descriptor(web.xml). 5. Copy this process request method code in your servlet. protected void processRequest(HttpServletRequest request,         HttpServletResponse response)         throws ServletException, IOException {     response.setContentType("text/html;charset=UTF-8");     final String path = request.getParameter("destination");     final Part filePart = request.getPart("file");     final String fileName = getFileName(filePart);     OutputStream out = null;     InputStream filecontent = null;     final PrintWriter writer = response.getWriter();  

How to use Url-rewriting using Java in NetBeansIDE

Image
URL Rewriting format - (  url?paramName=paramValue   )   1. In your web project make web page (say index.jsp) having a link as:    <a href="FetchDataServlet">Fetch Data from DB...</a> 2. Make a Servlet (say 'FetchDataServlet') and write code to fetch all the record on web         page.         try {                        Class.forName("com.mysql.jdbc.Driver");             Connection con = DriverManager.getConnection("jdbc:mysql://localhost/testdb", "root", "root");             PreparedStatement ps = con.prepareStatement("select * from test2");             ResultSet rs = ps.executeQuery();             out.print("<table border='1'>");             out.print("<tr><th>Serial No.</th><th>name</th><th>Delete</th></tr>");             while(rs.next()){                 out.println("<tr>");                 out.pr

How to Detect CapsLock key using Java in NetBeansIDE.

Image
How to Detect CapsLock key using Java in NetBeansIDE. Note: packages and classes used: - java.awt.Toolkit; - java.awt.event.KeyEvent; 1. Open NetBeansIDE. 2. Make a new project say DemoCaps. 3. Make a new JFrame Form in it say CapsLockDetect and design it. 4. RC on Form and Goto Properties~Events~KeyPressed~Select formKeyPressed. 5. Write the following code in the method and Fix all imports:    if(Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK))    {        jLabel.setText("ON");    }    else    {        jLabel.setText("OFF");    } 6. Run the Project. 7. Finish. Thank You :)

How to display record in a table on web page using Servlet, using JAVA in NetBeansIDE

Image
  How to display record in a table on web page using Servlet, using JAVA in NetBeansIDE. 1. Open NetBeansIDE 2. In your project, make a new Servlet (say 'GetDataServlet') 3. In servlet write the code in 'processRequest' method      Code Download : http://www.4shared.com/office/-Z7OvgNO/display_record.html 4. Make a hyperlink in index.jsp with href="GetDataServlet" or as in web.xml 5. Add required JAR in Libraries folder. 6. Run your project. 7. Finish Facebook Page : https://www.facebook.com/pages/Raks/335960303097841 Description: