git clone
git push heroku master
git add <filename>
git commit -m "description message"
git config --global user.name "<username>"
git config --global user.email "<email>"
git push origin master
Sunday, July 21, 2013
Popular git commands
Git is a distributed version control and source code management system. Some popular git commands that we use are
Saturday, July 20, 2013
Maven Fortify Plugin
Fortify provides the source code to create a plugin for Maven. The GAV co-ordinates for maven fortify plugin are
1. Copy the folder %FORTIFY_INSTALLATION_DIRECTORY%\HP_FORTIFY\HP_Fortify_SCA_and_Apps_3.90\Samples\advanced\maven-plugin to c:\temp
2. Open a cmd prompt and change directory to c:\temp\maven-plugin
3. Execute the following command. This compiles the maven-plugin and adds maven plugin to local repository
<groupId>com.fortify.ps.maven.plugin</groupId>
<artifactId>sca-maven-plugin</artifactId>
<version>3.90</version>
To install Fortify maven plugin and run Fortify SCA in a Maven build, perform the following1. Copy the folder %FORTIFY_INSTALLATION_DIRECTORY%\HP_FORTIFY\HP_Fortify_SCA_and_Apps_3.90\Samples\advanced\maven-plugin to c:\temp
2. Open a cmd prompt and change directory to c:\temp\maven-plugin
3. Execute the following command. This compiles the maven-plugin and adds maven plugin to local repository
mvn clean package install
4. Change directory to your project folder on which you want to run Fortify
5. Execute the following commandsmvn com.fortify.ps.maven.plugin:sca-maven-plugin:3.90:clean
mvn com.fortify.ps.maven.plugin:sca-maven-plugin:3.90:translate -Dfortify.sca.verbose=true -Dfortify.sca.debug=true
mvn com.fortify.ps.maven.plugin:sca-maven-plugin:3.90:scan -Dfortify.sca.verbose=true -Dfortify.sca.debug=true
6. Search for .fpr in the project directory for Fortify SCA report
Windows - Auto Logon
In order to perform auto-logon in Windows
1. Create a batch file with the following content
On rebooting the machine, you should be able to logon automatically to the user account specified with.
Note:Revealing password in plain text is a bad idea. Use this feature cautiously because you are exposing the plain text password.
1. Create a batch file with the following content
set autologon_username=
set autologon_password=
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v AutoAdminLogon /t REG_SZ /d 1
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v DefaultUserName /t REG_SZ /d %autologon_username%
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /f /v DefaultUserName /t REG_SZ /d %autologon_password%
2. Execute the batch file in an elevated modeOn rebooting the machine, you should be able to logon automatically to the user account specified with
Note:Revealing password in plain text is a bad idea. Use this feature cautiously because you are exposing the plain text password.
Windows - Reboot from cmd
In order to reboot from the cmd prompt in Windows, execute the following command. Make sure you saved all open files before executing this command.
shutdown -r
Tomcat Version
Here is a way to find the version of Tomcat installation. Run the following in your command prompt
java -classpath %CATALINA_HOME%\server\lib\catalina.jar org.apache.catalina.util.ServerInfo
PowerPoint Tip - Dark or White Screen
While presenting using PowerPoint slides, you can make the screen completely dark or completely white by using the following keys
b - to make the screen dark (when the room has lighting) w - to make the screen white (when the room is dark)
Fortify SCA - Location of .fpr file
Fortify Source Code Analyzer creates the scan result file with an extension .fpr in
%LOCALAPPDATA%\Fortify\AWB-<version>\<applicationName>
C# - Constructing File Paths
When you want to construct file paths, use the following
C:\Windows\System32\cmd.exe
String filename = "cmd.exe";
String fullpath = System.IO.Path.Combine (Environment.SystemDirectory, filename);
Console.WriteLine(fullpath);
Output: C:\Windows\System32\cmd.exe
C# - Thread Safe Increment, Decrement
When incrementing or decrementing values such as ++i, --i in a multi-threaded program, use the methods from Thread class.
System.Threading.Interlocked.Increment(i);
System.Threading.Interlocked.Decrement(i);
PowerShell - PSCredential
You can find the usage of PowerShell PSCredential from my other blog post on MSDN http://blogs.msdn.com/b/koteshb/archive/2010/02/13/powershell-creating-a-pscredential-object.aspx
Java - New Line Separator
A string can be constructed to have new line as
String string = "Hello" + "\n" + "World"; Output Hello World Instead of using "\n", a better way to get the new line is from the System class. A new line separator is stored in the System class in a Properties object. The new line separator can be retrieved by the following line System.getProperty("line.separator");
Java - Exception Stack Trace
Stack traces are helpful when a Java application throws exception. When the Java application is running in a console, we see the trace in console window. In order to log the trace to a file, we have to capture the stack trace in such a way, so as to be able to print it with the structure in tact.
The following Java code snippet, converts a stack trace to String format that can be used to save it to a file.
public static String printStackTrace (Throwable throwable)
{
final Writer writer = new StringWriter ();
final PrintWriter printWriter = new PrintWriter (writer);
throwable.printStackTrace (printWriter);
return writer.ToString();
}
Subscribe to:
Posts (Atom)