|
|
How to integrate the paypal pro version in Java
|
|
|
|
|
Never, ever, accept code from a insecure website to handle anything to do with real money.
You do not know who is giving you the code, you do not know what it does, you do not know that it places the monies correctly into the appropriate account, without passing the details to any third parties.
Only get such code from PayPal themselves - the scope for fraud otherwise is far too large. And remember, you personally could be liable for any monies lost if your action is seen to be negligent - which getting your code from a public forum would most certainly be!
Talk to them: they are pretty friendly and helpful - remember they don't make any money until you are up and running, so it's in their interest to be both!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have a jframe with a jcomboBox and two buttons, the first button allows to add dynamically jcomboBoxes and the second to generate the RDF file.
the elements of comboBoxes are URIs that I extracted from an ontology.
My goal is to generate an RDF file to describe the URIs of the comboBoxes, for example I add 3 comboBoxes to my jframe by clicking on the button "add comboBox" so the final jframe will have 4 comboBoxes, for each combBoxes, I select a different URI and I click on the "generate RDF" button to generate the RDF file, but the problem is that it only works for the first URI and the other three URIs will be identical.
this is my code to add combBoxes :
add.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent e) {
c4 = new JComboBox ();
req1 ();
panel_2.add (c4);
panel_2.revalidate ();
}
this is my code to generate RDF file :
<pre>btnGenerateRdf.addActionListener (new ActionListener () {
public void actionPerformed (ActionEvent arg0) {
String u = c2.getSelectedItem (). ToString ();
String uu = c4.getSelectedItem (). ToString ();
Model model = ModelFactory.createDefaultModel ();
String u1 = u.substring (u.lastIndexOf ("#") + 1);
String str = u1.replace ('_', '');
String uu1 = uu.substring (uu.lastIndexOf ("#") + 1);
String str1 = uu1.replace ('_', '');
Resource node = model.createResource (u)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str));
Resource node1 = model.createResource (uu)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str1));
Resource node11 = model.createResource (uu)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, str1));
String s = c4.getSelectedItem (). ToString ();
if (add.getActionListeners ()! = null)
{
Resource [] nodes = new Resource [panel_2.getComponentCount () - 2];
for (int i = 0; i <panel_2.getComponentCount () - 2; i ++)
{
String s1 = s.substring (s.lastIndexOf ("#") + 1);
String s2 = s1.replace ('_', '');
nodes [i] = model.createResource (s)
.addProperty (VCARD.N,
model.createResource ()
.addProperty (FOAF.name, s2));
}}
try {
FileOutputStream fout = new FileOutputStream ("C: \\ Users \\ me \\ Desktop \\ file2.xml");
model.write (fout);
} catch (IOException e) {
System.out.println ("Exception caught" + e.getMessage ());
}
}
});
how can i fix this?
|
|
|
|
|
As far as I can see you are using fixed references to access your comboboxes. Create a List(T) for your comboboxes and add each one to the list as you create it. You can then iterate over the list and generate your data for each one as you encounter it in the loop.
|
|
|
|
|
Hi,
I am learning Java and doing some operation related to HashMap. I am trying to add details in hashmap based on city. So suppose below is the list we have :
List<Student> studentList= new LinkedList<>();
studentList.add(new Student(1, "Test1", "US"));
studentList.add(new Student(2, "Test2", "US"));
studentList.add(new Student(3, "Test3", "India"));
studentList.add(new Student(4, "Test4", "Canada"));
studentList.add(new Student(5, "Test5", "Canada"));
studentList.add(new Student(6, "Test6", "India"));
For this I am looking output something like
{US=[Test1, Test2], India=[Test3, Test6], Canada=[Test4, Test5]} mainly creating map based on Cities.
I have implemented the code for this but it's time complexity is very high so looking for some optimize solution. Can someone Please help.
private void getDetailsGroupByCity(List<Student> studentList)
{
Map<String,ArrayList<String>> studentHashMap= new HashMap<>();
List<Student> arrayList= new ArrayList<>(studentList);
List<String> names= new ArrayList<>();
Set<String> setKey= new HashSet<>();
for (Student student : arrayList) {
setKey.add(student.getCity());
}
for (String s : setKey) {
for (Student student : arrayList) {
if (s==student.getCity())
{
names.add(student.getName());
studentHashMap.put(s, (ArrayList<String>) names);
}
}
names= new ArrayList<>();
}
System.out.println(studentHashMap);
}
Thanks for your help in advance Happy Learning for me 
|
|
|
|
|
You could use the SortedSet (Java Platform SE 7 )[^] which allows you to provide your own sort comparator. This means you can easily extract all the entries for each country (maybe keeping a separate List<E> of the countries.
|
|
|
|
|
I get a "javax.net.ssl.SSLHandshakeException: certificate expired" error which supposedly means the distant end has an expired certificate.
The reality is that the distant end doesn't have a certificate at all. Does that show up as an "expired" cert?
Is there a way around it? (I'm not really a java person or, in this case, groovy.)
|
|
|
|
|
I'm looking for a good open source Gantt chart library for Java Swing. I tried JFreeChart but it is not able to draw subtask. I tried with SwiftGantt too. It is able to draw subtask, but it is a little unstable and the look and feel is not professional :(.
Can you recomends others?
Thanks in advance!
|
|
|
|
|
Sorry if this is an offtopic in this group.
I want to buy a laptop for Java development. Of course the question would be simple if I were doing just plain Java development. But I want to try new technologies often used with Java - Kubernetes, Docker etc. That's why I'm asking it here.
These technologies (K8s, Docker) use virtualization. I know that you need to set something in BIOS/UEFI to run Docker. Some years ago I had to buy a new CPU to run 64-bit virtual machines, because my previous CPU was not supporting 64-bit guest virtual machines. The feature in question was called VT-x.
Of course the sure thing would be to buy a Mac, but I want a 500-600 EUR laptop.
So the question is:
1) Do I need to search for some show-stopper CPU features when choosing a computer?
2) Anything that does not work on AMD chips?
3) Is 8GB RAM sufficient for small/medium sized personal projects?
4) Any other pitfalls?
5) Is Windows 10 Home somehow unusable for professional software development?
|
|
|
|
|
8GB would be fine for dev work, but testing may be pushing it. You're very likely going to be limited to running one virtual machine along side your other dev stuff.
Get the fastest processor you can for the money and make sure you get a machine running on an SSD, preferably 1TB.
The only other thing I'm going to tell you is stay away from Windows Home. It will not support virtualization.
|
|
|
|
|
I will answer your questions on by one.
1. If you go for a medium-range Intel i5 or i7 CPU, you are getting a quite versatile CPU which will satisfy all your needs. If your workload includes hardcore video editing and image processing, then you will be better off with the AMD. Otherwise, nothing beats Intel.
2. For CPU chips, in terms of processing, AMD lags behind Intel in every aspect except for video editing. While AMD GPUs are better for graphic creation, you need NVIDIA GPUs to run CUDA.
3. Judging by the workloads that even web browsers are putting on RAMs nowadays, you should go for 16 GB RAM minimum.
4. While the MacBook is the first choice for many, you will enjoy the playfulness of a Windows laptop.
5. Installing frameworks can be tedious on Windows but nothing worth complaining once you get used to it. One huge benefit of a Windows machine is that you can create a Dual boot with Linux or install Linux in a Virtual Machine software. Then you can use both and choose your favorite.
|
|
|
|
|
|
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.ResultSet;
import java.sql.Statement;
import java.sql.DriverManager;
import javax.swing.JOptionPane;
public class Workers extends javax.swing.JFrame {
Connection con;
Statement stmt;
ResultSet rs;
public Workers() {
initComponents();
DoConnect();
}
public void DoConnect(){
try{
String host="jdbc:derby://localhost:1527/Employee";
String uname= "Star";
String uPass ="ST@r6738";
Connection con=DriverManager.getConnection(host, uname, uPass);
Statement stmt=con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
String SQL="SELECT * FROM WORKER";
ResultSet rs=stmt.executeQuery(SQL);
rs.next();
int id_col =rs.getInt(1);
String ID_=Integer.toString(id_col);
String first_name=rs.getString("FIRST_NAME");
String last_name=rs.getString("LAST_NAME");
String job_title=rs.getString(4);
textID.setText(ID_);
textFirstname.setText(first_name);
textLastName.setText(last_name);
textJobTitle.setText(job_title);
}
catch(SQLException err){
System.out.println(err.getMessage());
}
}
@SuppressWarnings("unchecked")
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
textFirstname = new javax.swing.JTextField();
textID = new javax.swing.JTextField();
textLastName = new javax.swing.JTextField();
textJobTitle = new javax.swing.JTextField();
jLabel1 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
btnFirst = new javax.swing.JButton();
btnPrevious = new javax.swing.JButton();
btnNext = new javax.swing.JButton();
btnLast = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
textID.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
textIDActionPerformed(evt);
}
});
jLabel1.setText("JOB Title");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, 52, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 26, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(textFirstname, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(3, 3, 3))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, 302, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textFirstname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(textLastName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(textJobTitle, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel1))
.addGap(41, 41, 41))
);
btnFirst.setText("First");
btnPrevious.setText("Previous");
btnPrevious.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnPreviousActionPerformed(evt);
}
});
btnNext.setText("Next");
btnNext.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnNextActionPerformed(evt);
}
});
btnLast.setText("Last");
btnLast.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLastActionPerformed(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnFirst)
.addGap(18, 18, 18)
.addComponent(btnPrevious)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnNext)
.addGap(18, 18, 18)
.addComponent(btnLast)
.addContainerGap())
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnFirst)
.addComponent(btnPrevious)
.addComponent(btnNext)
.addComponent(btnLast))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(21, 21, 21))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(602, Short.MAX_VALUE))
);
pack();
}
private void textIDActionPerformed(java.awt.event.ActionEvent evt) {
}
private void btnNextActionPerformed(java.awt.event.ActionEvent evt) {
try{
if (rs.next()){
int id_col =rs.getInt("ID");
String id=Integer.toString(id_col);
String first_name=rs.getString("FIRST_NAME");
String last_name=rs.getString("LAST_NAME");
String job_title=rs.getString(4);
textID.setText(id);
textFirstname.setText(first_name);
textLastName.setText(last_name);
textJobTitle.setText(job_title);
}
else{
rs.previous();
JOptionPane.showMessageDialog(Workers.this, "End of file");
}
}
catch(SQLException err){
JOptionPane.showMessageDialog(this, err.getMessage());
err.printStackTrace();
}
}
private void btnPreviousActionPerformed(java.awt.event.ActionEvent evt) {
}
private void btnLastActionPerformed(java.awt.event.ActionEvent evt) {
}
public static void main(String args[]) {
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Workers.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Workers().setVisible(true);
}
});
}
private javax.swing.JButton btnFirst;
private javax.swing.JButton btnLast;
private javax.swing.JButton btnNext;
private javax.swing.JButton btnPrevious;
private javax.swing.JLabel jLabel1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JTextField textFirstname;
private javax.swing.JTextField textID;
private javax.swing.JTextField textJobTitle;
private javax.swing.JTextField textLastName;
}
|
|
|
|
|
You need to use your debugger to step through the code in that method to find out which reference is null. It is not something that anyone here can do for you.
|
|
|
|
|
|
But then he wouldn't be able to push his spam link to his article writing service.
NB: The person you're replying to isn't the OP.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
We have been given a project for my ComSci class and I've done what i think is half, but got feedback today and it was devastating. I dont know what to do. The final hand in is on the 1st of June. Is there anyone willing to maybe help me write the code? The most complex coding knowledge needed is 2D arrays. I would really appreciate it
|
|
|
|
|
Sorry, this site does not provide code to order. For a start it does not help you to hand in work written by someone else. If you cannot understand your assignment then you need to go over your study and course notes a few more times. There is also lots of useful information and sample code at The Java™ Tutorials[^]
|
|
|
|
|
Hi, first time posting so hopefully doing it correctly. I have used a form builder to build my forms but have run into a couple of issues with functionality. In the code/calculation below I need to be able to return the answer 0 if the answer is less than 0. I've searched loads to no avail so any help would be much appreciated. T.I.A.
$('form#Commission #Commission_On').formCalc(" Nett_Earnings -Actual_Takings >0==0",{ currency_format:true, mirror:'sfm_Commission_On_parsed'});
modified 17-May-20 10:15am.
|
|
|
|
|
What language is that, it does not look much like Java? However assuming it is supposed to convert that string into an actual sum it does not look valid. In the expression Nett_Earnings -Actual_Takings >0==0 , what is >0==0 supposed to mean?
|
|
|
|
|
Thanks for answering, I just assumed it was Java as all the scripts are. >0==0 is just one of the ways I was trying to make it work from their info before they told me the form couldn't do the calculation.
|
|
|
|
|
What is this code and where did you get it from? As I said it does not look anything like Java.
|
|
|
|
|
Thanks for answering. The programme is called simfatic form maker.
This was their reply to my query
"Simfatic Forms calculation field can't handle multiple levels of variables. In this case, the user enters a variable that intern is a variable in the next step.
This form has to be hand coded with the help of a developer"
Here is the actual form I am trying to make work https://www.salonlogic.co.uk/forms/Commission/Commission.php[^]
|
|
|
|
|