|
Member 13140443 wrote: how to connect the finger print scanner in java
Ask the manufacturer abd/or users forum.
Member 13140443 wrote: how to store the database in sql server 2008 R2
Learn SQL
Both parts are completely unrelated, there is nothing in SQL related to finger print scanners. It Java job to glue things together.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
how the static keyword is used in real time project?
|
|
|
|
|
|
Member 13364717 wrote: how the static keyword is used in real time project?
Exactly the same way as with any other kind of project. Because the usage of static keyword do not depend in the kind of project.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I have created a program by using Java. And there is Login with MySql Database. In this Admin can log into the system by using Username and Password which is in the database. But , I want to use admin's Fingerprint instead of username and password. But, I have no idea how to do this. Then I have searched everywhere to find the useful sources and I didn't find anything useful.
So , Can I know how to do this ??
Is there any kind of Documentation or video tutorial ??
|
|
|
|
|
|
|
No..
BTW , ThnQ Very Much For your links !!
|
|
|
|
|
I am working on dotx file template to generate word documents using docx4j in java. I will be replacing some placeholders in dotx file with text which comes from database columns. But problem is one of my database field contains HTML code(rich text editor value), when I place this text in placeholder in template, generated document display as-is content of html. I want that HTML code to be rendered to be proper text with styles.
Cold you please let me know how can I achieve this?
Sample Code which I have written to replace placeholders:
ByteArrayOutputStream baos = null;
DataRequestVO dataRequest = null;
WordprocessingMLPackage wordMLPackageMain = null;
try {
dataRequest = reportDAO.fetchDocketData(dataRequestNO);
String templateFile = dataRequest.getReportType().getTemplatePath();
String fileName = dataRequest.getDocketNo() + " - " + dataRequest.getDataRequestNo() + "-" + dataRequest.getReportType().getReportName();
URL url = this.getClass().getClassLoader().getResource(templateFile);
String templateFilePath = url.toURI().getPath();
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new File(url.toURI().getPath()));
ContentTypeManager ctm = wordMLPackage.getContentTypeManager();
CTOverride override = ctm.getOverrideContentType().get(new URI("/word/document.xml"));
if (templateFilePath.endsWith("dotm")) {
override.setContentType(
org.docx4j.openpackaging.contenttype.ContentTypes.WORDPROCESSINGML_DOCUMENT_MACROENABLED);
} else {
override.setContentType(org.docx4j.openpackaging.contenttype.ContentTypes.WORDPROCESSINGML_DOCUMENT);
}
DocketReportHelper.prepare(wordMLPackage);
List<Object> texts = DocketReportHelper.getAllElementFromObject(wordMLPackage.getMainDocumentPart(),
Text.class);
DocketReportHelper.replacePlaceholder(texts, dataRequest.getDocketNo(), PLACEHOLDER_DOCKET_NO);
DocketReportHelper.replacePlaceholder(texts, dataRequest.getQuestion(), PLACEHOLDER_QUESTION);
DocketReportHelper.replacePlaceholder(texts, dataRequest.getResponse(), PLACEHOLDER_RESPONSE);
if ("yes".equalsIgnoreCase(dataRequest.getConfidential())) {
wordMLPackageMain = createConfHeaderFooter();
List<Object> listParamMain = wordMLPackage.getMainDocumentPart().getContent();
for (Object param : listParamMain) {
if (param instanceof P) {
wordMLPackageMain.getMainDocumentPart().addObject((P) param);
} else if(param instanceof JAXBElement) {
wordMLPackageMain.getMainDocumentPart().addObject((JAXBElement) param);
}
}
} else {
wordMLPackageMain = wordMLPackage;
}
baos = new ByteArrayOutputStream();
SaveToZipFile saver = new SaveToZipFile(wordMLPackageMain);
saver.save(baos);
replacePlaceholder method:
static void replacePlaceholder(List<Object> texts, String name, String placeholder) {
log.debug("placeholder : " + placeholder);
for (Object text : texts) {
Text textElement = (Text) text;
if (textElement != null && placeholder.equals(textElement.getValue())) {
textElement.setValue(name);
break;
}
}
}
Prepare method:
public static void prepare(WordprocessingMLPackage wmlPackage) throws Exception {
WordprocessingMLPackage.FilterSettings filterSettings = new WordprocessingMLPackage.FilterSettings();
filterSettings.setRemoveProofErrors(true);
filterSettings.setRemoveContentControls(true);
filterSettings.setRemoveRsids(true);
wmlPackage.filter(filterSettings);
log.debug(XmlUtils.marshaltoString(wmlPackage.getMainDocumentPart().getJaxbElement(), true, true));
org.docx4j.wml.Document wmlDocumentEl = wmlPackage.getMainDocumentPart().getJaxbElement();
Body body = wmlDocumentEl.getBody();
SingleTraversalUtilVisitorCallback paragraphVisitor = new SingleTraversalUtilVisitorCallback(
new TraversalUtilParagraphVisitor());
paragraphVisitor.walkJAXBElements(body);
log.debug(XmlUtils.marshaltoString(wmlPackage.getMainDocumentPart().getJaxbElement(), true, true));
}
|
|
|
|
|
Since no one else replied.
1. I would parse the html and handle a LIMITED set of attributes.
2. I would limit the size and refuse to handle anything over a certain limit. I would log an error to indicate it
3. For unknown attributes I would strip them and log a warning.
4. I would document (not code) what was allowed for html in that data slot.
|
|
|
|
|
I want to find a way to convert Microsoft's word to PDF on linux. My idea is to read each word, picture, or table first, and then write their structure into the PDF document. But when I read the format of the document and write it to PDF, only the pictures can be written and the styles are completely different from those in the document. I would like to ask a kind person if you have any experience in this field. Please give me some advice or guidance. Thank you!
|
|
|
|
|
The issue is not too complicated. Firstly you need to understand the structure of Word documents, and how different parts are formatted, and which fonts are used to render the text. You then need to learn how to reformat that information into the structures that a PDF document uses. There are various libraries around to do both parts, and Google will find you the details.
|
|
|
|
|
ok,thank you man,i'll try it
|
|
|
|
|
For me what worked easiest on Linux:
- install OpenOffice or LibreOffice (whatever your Linux distro has as the default)
- then use the PDF converter tool that comes with LibreOffice (or Open...)
It is a simple command line tool that has tons of options. For Word it should provide really decent output as long as you have no real complex stuff in it.
|
|
|
|
|
write a program for a bank employee .
so that when he enters his/her ID the system can tell him to which bank he belongs and what is his designation.Is he a manager , normal employee, sales person, cashier .
manager can perform all the tasks but cashier ca deposit/withdraw cash, sales person can only upload documents etc.
|
|
|
|
|
|
We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.
As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.
The idea of "development" is as the word suggests: "The systematic use of scientific and technical knowledge to meet specific objectives or requirements." BusinessDictionary.com[^]
That's not the same thing as "have a quick google and give up if I can't find exactly the right code".
An interesting link to get you started on a new project: Systems development life cycle - Wikipedia[^]
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
how to connect ble sensor in swing-java using netsbeans
or
how to create window application using bluetooth low-energy in java language not android
|
|
|
|
|
|
i want to know what causes serialization to do ?what is the loss if we dont use serialization in java?
|
|
|
|
|
|
Hey, I am new to the coding world as well as this site. I have been learning Java by myself for a few days now and wanted to make a gambling program just for fun and practice.
I am going to ask two questions, one short, and one long. I'll ask the long one first! How does my code look for a beginner? I know I haven't dipped into using multiple classes yet or anything, so how does this very basic program look?
package com.company;
import java.util.Scanner;
import java.util.Random;
public class StakingGame {
static int cashStack = 500000;
static int amountStaked;
public static void main(String[] args) {
System.out.println("Welcome to my staking game.");
while(cashStack > 0) {
amountStaked();
System.out.println("Rolling...");
whoWon();
}
System.out.println("You have no more money.");
}
public static void amountStaked() {
Scanner scan = new Scanner(System.in);
System.out.println("How much would you like to stake?");
amountStaked = scan.nextInt();
System.out.println("You have chosen to stake, " + amountStaked + "$, goodluck.");
}
public static int roll() {
Random r = new Random();
int min = 0;
int max = 100;
int rolled = r.nextInt(max-min) + min;
return rolled;
}
public static void whoWon() {
int playerRoll = roll();
int computerRoll = roll();
System.out.println("You have rolled a " + playerRoll);
System.out.println("Your oppent has rolled a " + computerRoll);
if(playerRoll > computerRoll) {
stakeWon(0);
} else if (playerRoll < computerRoll) {
stakeLost(0);
} else {
System.out.println("You guys tied.");
}
}
public static int stakeWon(int newAmount) {
newAmount = cashStack + amountStaked;
cashStack = newAmount;
System.out.println("You have won the stake! You now have " + cashStack);
return cashStack;
}
public static int stakeLost(int newAmount) {
newAmount = cashStack - amountStaked;
cashStack = newAmount;
System.out.println("You have lost the stake.. You now have " + cashStack);
return cashStack;
}
}
My second question is, well, more of a question. I want this program to run until I either terminate it or the player runs out of money. So this is how I decided to go about that. I created this loop in my main method,
public static void main(String[] args) {
System.out.println("Welcome to my staking game.");
while(cashStack > 0) {
amountStaked();
System.out.println("Rolling...");
whoWon();
}
System.out.println("You have no more money.");
}
Is that the best way to make the program run until you either lose or I terminate it??
Thankk you in advance!
|
|
|
|
|
1. The code looks OK but I have not run it to see if it works correctly.
2. That is a generally correct way to do what you want.
If you want to find more samples and guidance then The Java Tutorials[^] is a great place for learning.
|
|
|
|
|
CoderKlip wrote: Is that the best way to make the program run until you either lose or I terminate it??
You probably want the user to terminate it by typing something normal like '0' or 'quit'.
|
|
|
|
|
1. As you said you're new here, your code looks good comparable to other noobies, the indentations look perfectly professional.
2. You should use do-while loop in your code that after every round the code asks you to continue or not, terminating will be a little unsatisfying way to end a game.
|
|
|
|