Posts

Showing posts from August, 2018

C++ Convert String into Base 64

Image
In this Post i will show you how you can encode normal Strings into Base 64. #include <iostream> #include <string> #include<windows.h> using namespace std; static const std :: string base64_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/" ; const char Base64EncodingTable[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" ; char * Base64EncodeTriplet (byte * vInput, const int & vLength = 3 ) { char * ret = new char [ 5 ]; ret[ 4 ] = '\0' ; long tValue = 0 ; if (vLength >= 1 ) tValue += vInput[ 0 ] << 16 ; if (vLength >= 2 ) tValue += vInput[ 1 ] << 8 ; if (vLength >= 3 ) tValue += vInput[ 2 ]; long tMask; for ( int i = 0 ; i < 4 ; i ++ ) { int bitshift = (( 3 - i) * 6 ); tMask = 63 ; tMa

Open a Folder or File by typing single word. [Windows]

Image
Using System variables it is more easy to open a directory or a file by typing a single word in my computer address bar and also in " Run " or " Search " box. Sometimes you need a file or a folder again and again and it is difficult to switches between folders or files then this method might help you. For this method we need to setup or create a system variable for this... Right Click on my computer  Select Properties  Click on Advance system setting Click on "Environment variables..." button Click on "New" button to add a variable In variable name field type any single word that you want to use for open a file or folder, and in value field type complete directory of folder that you want to open directly. For file right click on file and select properties and then copy the file link and paste in value field. Now open My Computer and in address bar type your word within %Word% and hit enter your require folder will

Error: Could not found or load main Class

Image
In Java 8.0 or latter version when you write a program and compile it using command line it compile fine but display an error "Error: Could not found or load main class" when you try to execute this program. When you get the message "Could not find or load main class ...", that means that the first step has failed. The Java command was not able to find the class. And indeed, the "..." in the message will be the fully qualified class name that Java is looking for. if you have specified the class name correctly, the next thing to check is that you have specified the class and  classpath correctly as environment variables. In this post i will explain to you how to set CLASS and CLASSPATH environment variables. To open environment variables dialogue follow these steps. Right Click on my computer Click Advance system setting (system properties dialogue box will open) From system properties dialogue box click on "Advance" tab.    Click on "

Java Servlet not affected after changes made. [Solved]

Image
While you create a servlet/Java program and execute it using tomcat server, its works fine and display output, but when you change your code compile it and refresh your web-page it does not display any changes that you have made. There are three methods to fix this problem. Restart Tomcat server Deploy your application from tomcat application manager Configure Server.xml file  First two methods are time consuming and difficult because we makes change in our code again and again and if we use first two methods we must restart tomcat or deploy our application each time we made change in our servlet code. Third method is easy and we need to configure server.xml file only once time.   In this post i will explain to you how you can configure server.xml file with <context> tag. Server.xml file is located in C:\tomcat\conf directory. Open server.xml in notepad or notepad++ or any other text editor. At the end of this file add this tag <Context path="