How To Setup Sonar For C# Code Analysis
Jul 20, 2014
I am new to Java. I am from .net background.I am trying to setup Sonar server. In one of our training sessions on Sonar, the instructor did the anaysis of solution using pom.xml file and then calling mvn sonar:sonar. I am trying to replicate the entire setup locally.
1. I installed JRE 7. When I run , java -version, it shows,
java version "1.7.0"
Java(TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
2. I download sonar 3.5 and extracted it to new folder
3. In that folder I installed sonar-runner 2.4
3. setup the path and sonar_runner environment variable
4. downloaded jtds-1.3.1 and placed the jar file in mssql folder of sonar
5. I create database sonar with username and password as sonar
6. changed sonar-runner.properties for sql server connection
7. changed sonar.properties for sql server connection
8. Ran Sonar.bat and found that it created tables in the sql server db. To me the command prompt seems like it is hanging as after creating table graphs, the last line is
"jvm 1 | 2014-07-20 13:03:34.967:INFO::Started SelectChannelConnector@0.0.0.0:
9000 "
Is it supposed to stay like this always or should i closed this command prompt by pressing CTRL+C?
9. Now when i run mvn-sonar:sonar, it says mvn is not recrognizes as internal or external command. A quick search on google showed that I need to install Apache maven something I belive. What is this or how do I solve this issue so that the command mvn sonar:sonar can work?
10. I would like to use c sharp ecosystem plugin. But when I browse to C# Plugin - SonarQube - Codehaus , I am confused as what to select? i.e. version 3.2, 3.1, 3.0
11. So if I do a system restart and everytime I have to use sonar, should i run sonar.bat and then do mvn sonar:sonar after modifying the pom.xml file?
View Replies
ADVERTISEMENT
Dec 5, 2014
Why static bytecode analysis of Async-Await is difficult and what can be done to avoid that?
View Replies
View Related
Feb 24, 2015
I am assigned with a project that will as the user for the amount of days they would like data entered, then loop asking them for these numbers. once it reaches the entered amount of days it will display a menu for which the user can enter the number they want on the list and it will display the data. the menu has 6 items. Total, Average, Determine if its a Drought, Flood or normal rainfall, highest of data entered, lowest of data entered, and 6 is to quit the program.
So far i have total and average working properly. Still looking at how to display drought, flood, and normal.
Main problems, i cannot get highest and lowest to display correct data.
Also when entering 6, or an invalid menu choice, neither "goodbye" or "invalid choice, choose again" gets printed. Rather the loop for entering data continues.
import java.util.Scanner;
public class RainAnalysis {
/*
* Project 1 This program will analyze the rainfall for the number of days a user inputs.
*/
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int numOfDays = 0;
double rainfallAmount = 0.0;
[Code] ....
Here is a sample output to show what happens when i put in 6 after the menu is displayed.
also i noticed that it does not say the correct day when displaying the lowest and highest rainfall. this is because i put count, i did not know what else to put in order to get the correct day.
how many days do you want to monitor rainfall?5
Enter the rainfall for day 1.01
Enter the rainfall for day 2.1
Enter the rainfall for day 36
Enter the rainfall for day 43
Enter the rainfall for day 51
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
4
Day5 has the highest rainfall with 6.0 inches.
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
5
Day5 has the lowest rainfall with 0.1 inches.
Rainfall Data Display Menu:
1 - Display total rainfall.
2 - Display rain average for the period.
3 - Display if drought, flood, or normal conditions.
4 - Display the day and amount of the highest rainfall.
5 - Display the day and amount of the lowest rainfall.
6 - Quit the program.
Enter your choice:
6
Enter the rainfall for day 6
View Replies
View Related
Apr 18, 2015
Right now it displays a number like this "$25.0" and I want it to display it like this "$25.00" and don't know how to do it.
View Replies
View Related
Apr 30, 2014
I am trying to set a picture in the background of my GUI. I had already made the GUI with the all the required buttons and labels. So I was trying to separately make a class which extends JPanel and add a picture to a panel by overriding the paintComponent() method, and then added it to a frame (I did not set the default layout of the frame, so it was the default...), and it worked very fine. Here is the code:
Java Code:
private BufferedImage image;
public ParentPanel() {
try {
image = ImageIO.read(getClass().getResource("/com/dev_nna/scheduler/UI/1405188.png"));
} catch (IOException ex) {
ex.printStackTrace();
[code]....
Then I needed to add this panel with background picture to the background frame of my already made frame with all the buttons on it.The layout of the parent frame of my GUI was BorderLayout(50, 50), panels (with buttons) were added to it n the north and south positions.
Then I tried to add a JPanel with the background image to the parent frame (of my GUI), (I wanted it to elapse the entire frame, and come under all the buttons and controls, which were only present in the north and south positions of the border layout), and then the panels holding the buttons to the north and south postions of this panel, everything disappeared.
If I don't do anything except adding this panel with the background image to the parent frame, it only takes up the place not taken up by the two panels on the frame (Border Layout)
how to add this panel to the parent frame of my GUI such that it elapses the entire parent frame's background, and the panels containing the buttons should sit on it.
IMPORTANT PARTS OF CODE:-
Java Code:
//TOP LEFT PANEL
JPanel topleftpanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 5, 5));
parentPanel_top.add(topleftpanel);
topleftpanel.setOpaque(false);
[code]....
View Replies
View Related
Jun 5, 2014
I create my own TreeCell class to customize the look of the tree items of a TreeView which is displaying java.nio.file.Path information.
To setup the CellFactory of the TreeView I used the following:
pathTV.setCellFactory( (TreeView<Path> tv) -> {
return new MyCustomTreeCell();
} );
This works... Now I tried to do some other things with my custom tree cell class so I created an instance of it
MyCustomTreeCell mctCell = new ...
Later I changed the code to setup the CellFactory
pathTV.setCellFactory( (TreeView<Path> tv) -> {
return mctCell;
} );
This doesn't work ... I did not see anything in my TreeView...
Here is the MyCustomTreeCell class:
public class MyCustomTreeCell extends TreeCell<java.nio.file.Path> {
private final ImageView icon;
public MyCustomTreeCell() {
super();
icon = new ImageView();
[Code] .....
View Replies
View Related
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
View Replies
View Related
Mar 26, 2014
First I was using this way how to get connection and all was fine.
con = DriverManager.getConnection("jdbc:derby:memory:datab;create=true");
But now I have to change it to DataSource and how I find out derby had class ClientDataSource for this but for the hell I can't find out how to setup that virtual DB.
ClientDataSource ds = new ClientDataSource();
con = ds.getConnection();
View Replies
View Related
Jul 12, 2014
Any documentation that deals with assigining an icon to your application? I have tried the:
"stage.getIcons().add(new Image(this.getClass().getResourceAsStream("myicon.png")));"
Code as suggested on the web. It looks like this changes the icon in the window decoration only, which doesn't actually show on my Ubuntu desktop with Unity. What I really want is a custom icon for when I alt-tab through open applications. Currently it shows the default grey question mark. How do I assign an icon to the application.
View Replies
View Related
Feb 16, 2015
I've setup an array that I would like to analyze by adding up the contents of each column, however, the out of bounds exception pops up when I try to execute the program. I know the book usually expresses this operation the other way around, where the row is the argument of the first for statement, but I've set my array up where I need to add each row before moving to the next column.
vowelCounter is a 5x3 array.
// Display the line which had the most number of vowels
public static int maxVowelSentence() {
int max = 0, sum = 0;
int sentence = 1;
for (int row = 0; row < vowelCounter.length; row++) {
max = vowelCounter[row][0];
[Code] ....
View Replies
View Related
Aug 21, 2014
I have completed an assignment for my university in which I had to make a Java NetBeans project. My project is now completed but now I have to make a setup of my NetBeans project and give the university the setup file, only.
My question is, the software I made has a database attached to it, meaning the purpose of the software is to be used with the database. Values must be saved in the database, deleted from the database etc.. I have used MySQL database connections with the JDBC driver
I have used exe4j to make the .exe file and Setup Factory to make the exe file and setup file respectively. Once I make the setup and run the setup, the application works, ON MY COMPUTER. The computer which made the software. But once I take it to a computer in which MySQL was not installed, the setup installed, but the software did not work.
View Replies
View Related
Aug 23, 2010
I was a bit confused of the code generated by the Axis2 Code Gen.
I have created a logIn(String username, String password) method in my service and used Axis2 Code Gen to generate the Stub.
I try to access the logIn method from my Client using the Stub like below:
TestServiceStub stub = new TestServiceStub("http://localhost:8080/axis2/services/TestService");
String test = stub.logIn("user","pass").
but instead of UserName and password as the parameters, the Stub created a Login object as the parameter for the logIn method. like the one below:
stub.logIn(Login login1);
I wanted to try the logIn method by providing a static userName and password but it seems impossible because the Stub changed the parameter for the logIn method.
how to test the logIn method.
View Replies
View Related
Aug 29, 2014
The code here I have works fine if I just want to ask the user to enter four digits: //java application that asks user to input binary numbers(1 or 0) and convert them to decimal numbers import java.util.Scanner; //program uses class scanner public class binarynumber{
//main method that executes the java application
public static void main(String args[]){
//declares variables
int digit;
int base=2;
int degree;
double decimal;
int binary_zero=0;
int binary_one=1;
//create scanner for object input
[code]....
The thing is, I want the java application to input more than four digits for the user and I want it to loop it manytimes f until the user ask it to stop.
View Replies
View Related
Oct 9, 2014
I need to create a Java program that takes an input a color code in HSV and outputs the equivalent RGB code and Vice versa.
Example:
If you test on the color RED in RGB:
Input: (255,0,0)
Output: (0,100%,100%)
If you test on the color RED in HSV:
Input0,100%,100%)
Output: (255,0,0)
View Replies
View Related
Mar 23, 2015
Can i write inner if loop without { and } if it has more lines of code as below
public class TEst111 {
/**
* @param args
*/
public static void main(String[] args) {
int num=11;
// TODO Auto-generated method stub
if (num < 10)
[code]....
I tested to see outer if which does not need { and } even though it has multiple lines in that
View Replies
View Related
Oct 3, 2014
According to what I read, "when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock." (See below for code.)
Why is this? How could making a GUI lead to deadlock?
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
View Replies
View Related
Apr 24, 2014
I have a assignment in which the code has to scrape a web page for a little bit of data including the link to the next page, follow the link, and do this 100 times. It is scraping all the data correctly, including the link, but it isn't following the link to scrape the data on that next page. Instead, it is displaying the first page's data 100 times. I have the code in a while loop where it reads in one character at a time from the page into a string and then uses pattern matching to get the data and the next link from the string. Then it correctly displays the data and should loop back to connect to that next link and read one character at a time into the string and so on.
I have printed the link to the console and it is good. I don't get any errors. I just can't figure out where exactly the problem is. Here is my code:
import java.awt.*;
import java.io.*;
import java.net.*;
import java.util.regex.*;
import javax.swing.* ;
public class SimpleWebSourceGetter{
static void getSourceCode(String url) {
String mystring = "";
[Code] ....
View Replies
View Related
Apr 14, 2015
I have had to create a text analyser. I have created the program but it is all within the main method. The specification states that I have to have at least two methods within my Program.
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.swing.*;
import javax.swing.filechooser.FileNameExtensionFilter;
public class Analyser {
public static void main(String[] args) throws FileNotFoundException,
UnsupportedEncodingException {
[code]....
View Replies
View Related
Mar 4, 2010
i have made a code for my mandelbrot set, however, it doesn't become mandelbrot, but only an oval in the middle
import java.awt.*;
import java.lang.Object.*;
public class MandelbrotCanvas1 extends Canvas{
boolean draw = false;
ComplexNumber[][] cnSet = new ComplexNumber[600][600];
int depth = 255;
double lx = -1.5;
double ly = -1.25;
double ux = 0.5;
double uy = 1.25;
int size = 600;
[code]....
View Replies
View Related
Oct 3, 2014
According to what I read, “when programming in Swing, your GUI creation code should be placed on the Event Dispatch Thread (EDT). This will prevent potential race conditions that could lead to deadlock.” (See below for code.)
Why is this? How could making a GUI lead to deadlock?
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
View Replies
View Related
Apr 16, 2014
how I can use this class:
Java Code:
public class Coordinate{
public int x;
public int y;
publ Coordinate(int x, int y){
this.x = x;
this.y = y;
[code]....
How would I use Coordinate in the second code?
View Replies
View Related
Mar 18, 2015
Code isn't giving me the output that I want and keeps giving me NaN
What I want -
Enter the A value for the line: 2.45
Enter the B value for the line: 4
Enter the C value for the line: -8
Enter the x coordinate of the point: 2.17
Enter the y coordinate of the point: -4
Distance from the point to the line is: 3.9831092774319026
What I am getting
Distance from the point to the line is: NaN
Here is my code-
Tester-
import java.io.*;
import java.util.*;
class tester
{
public static double A;
public static double B;
public static double C;
public static double distance;
public static void main(String args[])
[Code] ....
View Replies
View Related
Nov 30, 2014
how do we get the following numbers (1 2 3 5 8 13 21 34 55 89) out of the following code? I can't get my head around this loop....
HTML Code:
public class Fabnoci{
public static void main(String[] args)
{
int n=10,i,f0=1,f1=1,f2=1;
for(i=1;i<=n;i++)
{
f2=f0+f1;
[code]....
View Replies
View Related
May 15, 2014
write a code using the stacks?i want the output to produce my name.
View Replies
View Related
Feb 12, 2014
How do I get my GUI code into a GUI format? I wrote this put it will not make a GUI image.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Ofelia_Inventory_4;
import java.awt.*;
import java.awt.event.*;
[code]...
View Replies
View Related
Feb 25, 2014
I want to execute my jsp code to compare two dates after every 10 seconds if user enter date and current sys date are equal it will send the mail to the user automatically. Below is my jsp code
this if condition i want to check the date after every 10 seconds and when two dates are equal it will send the mail using below mail code
if(ExpcReDt.compareTo(dateStr)>0) {
out.println("Expected return date is greater than current date");
}
else if(ExpcReDt.compareTo(dateStr)==0)
[code]....
View Replies
View Related