Click here to Skip to main content
15,888,579 members
Home / Discussions / Java
   

Java

 
AnswerRe: SQL Injection - Is this style of coding correct ? Pin
Tom Marvolo Riddle17-Mar-14 20:01
professionalTom Marvolo Riddle17-Mar-14 20:01 
GeneralRe: SQL Injection - Is this style of coding correct ? Pin
Jewel Joy117-Mar-14 23:49
Jewel Joy117-Mar-14 23:49 
QuestionDisplay the .XML content in charts/bars Pin
Anca Zara17-Mar-14 3:41
Anca Zara17-Mar-14 3:41 
AnswerRe: Display the .XML content in charts/bars Pin
Richard MacCutchan17-Mar-14 4:21
mveRichard MacCutchan17-Mar-14 4:21 
GeneralRe: Display the .XML content in charts/bars Pin
Anca Zara18-Mar-14 3:23
Anca Zara18-Mar-14 3:23 
GeneralRe: Display the .XML content in charts/bars Pin
Richard MacCutchan18-Mar-14 3:33
mveRichard MacCutchan18-Mar-14 3:33 
GeneralRe: Display the .XML content in charts/bars Pin
Anca Zara21-Mar-14 3:04
Anca Zara21-Mar-14 3:04 
QuestionHow to write to file from database ? Pin
f2617-Mar-14 0:31
f2617-Mar-14 0:31 
i am trying to write to file from database where i stored coordinates values. The file i want to save to is SVG file, the code i was confused with how to replace moveTo coordinates and curveTo coordinates ? plus how to repeat C command in each line ? The data are stored in database as String in this form
355.22 632.0771 355.574 631.338 315.228 632.077 
455.22 632.0771 355.574 631.338 335.228 632.077
555.22 632.0771 355.574 631.338 375.228 632.077
655.22 232.0771 355.574 631.338 385.228 632.077
755.22 332.0771 355.574 631.338 365.228 632.077
255.22 432.0771 355.574 631.338 395.228 632.077
155.22 532.0771 355.574 631.338 355.228 632.077

the last 2 values are for move variable i.e: move="355.228 632.077";

and each line is considered as a curve, the curve variable i.e: curve="355.22 632.0771 355.574 631.338 315.228 632.077"; there are 7 curves in my example.
for example :
Java
public class WriteToSVG {

private Formatter f;

public void openFile(){
    try{
        //To Open & create the a File
        f=new Formatter("C:\\demo.svg");
    }
    catch(Exception e){
        System.out.println("Error occured");
    }
}

public void addRecords(){
    try{
        //Add Data to the File
        String str="<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
                "<!-- Generator: Adobe Illustrator 14.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 43363)  -->\n" +
                "\n" +
                "<svg\n" +
                "   xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n" +
                "   xmlns:cc=\"http://creativecommons.org/ns#\"\n" +
                "   xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n" +
                "   xmlns:svg=\"http://www.w3.org/2000/svg\"\n" +
                "   xmlns=\"http://www.w3.org/2000/svg\"\n" +
                "   xmlns:sodipodi=\"http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd\"\n" +
                "   xmlns:inkscape=\"http://www.inkscape.org/namespaces/inkscape\"\n" +
                "   version=\"1.1\"\n" +
                "   id=\"Layer_1\"\n" +
                "   x=\"0px\"\n" +
                "   y=\"0px\"\n" +
                "   width=\"850px\"\n" +
                "   height=\"1219px\"\n" +
                "   viewBox=\"0 0 850 1219\"\n" +
                "   style=\"enable-background:new 0 0 850 1219;\"\n" +
                "   xml:space=\"preserve\"\n" +
                "   inkscape:version=\"0.48.4 r9939\"\n" +
                "   sodipodi:docname=\"001_001_008.svg\"><metadata\n" +
                "   id=\"metadata9\"><rdf:RDF><cc:Work\n" +
                "       rdf:about=\"\"><dc:format>image/svg+xml</dc:format><dc:type\n" +
                "         rdf:resource=\"http://purl.org/dc/dcmitype/StillImage\" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs\n" +
                "   id=\"defs7\" /><sodipodi:namedview\n" +
                "   pagecolor=\"#ffffff\"\n" +
                "   bordercolor=\"#666666\"\n" +
                "   borderopacity=\"1\"\n" +
                "   objecttolerance=\"10\"\n" +
                "   gridtolerance=\"10\"\n" +
                "   guidetolerance=\"10\"\n" +
                "   inkscape:pageopacity=\"0\"\n" +
                "   inkscape:pageshadow=\"2\"\n" +
                "   inkscape:window-width=\"1606\"\n" +
                "   inkscape:window-height=\"1028\"\n" +
                "   id=\"namedview5\"\n" +
                "   showgrid=\"false\"\n" +
                "   inkscape:zoom=\"21.48647\"\n" +
                "   inkscape:cx=\"1014.7893\"\n" +
                "   inkscape:cy=\"780.14409\"\n" +
                "   inkscape:window-x=\"-8\"\n" +
                "   inkscape:window-y=\"-8\"\n" +
                "   inkscape:window-maximized=\"1\"\n" +
                "   inkscape:current-layer=\"Layer_1\" />";
        f.format(str);
        String space=" ";
        String fill="003399";
        String fill_opacity="1";
        String strock="none";
        String move = null;
                    String line="1026.677,438.66868";
        String curve="1022.9594,426.89007 1022.7136,426.30999 1022.5051,425.84922";
        String id="path4044-3";
        String nodeType="cccccccccccccccccc"; 
               f.format("<path%s"+"style="+"\"fill:#%s;fill-opacity:%s;stroke:%s\""+"\nd=\"M%sC%sz\""+"\nid=\"%s\""+"\ninkscape:connector-curvature=\"0\""+"\nsodipodi:nodetypes=\"%s\""+"/>",space,fill,fill_opacity,strock,move,curve,id,nodeType);
        f.format("</svg>");
        System.out.println("Data added to the File successfully");
      }
    catch(Exception e){
        System.out.println("Error occured");
    }
}
public void closeFile(){
    f.close();
}
public static void main(String[
            ] args) {
    WriteToSVG w=new WriteToSVG();
    w.openFile();
    w.addRecords();
    w.closeFile();
}}

the above example the move,line and curve variables are declared by given some values, but i want to get those values from database, What's the thought behind that ?
java

AnswerRe: How to write to file from database ? Pin
Richard MacCutchan17-Mar-14 4:20
mveRichard MacCutchan17-Mar-14 4:20 
GeneralRe: How to write to file from database ? Pin
f2617-Mar-14 19:26
f2617-Mar-14 19:26 
GeneralRe: How to write to file from database ? Pin
Richard MacCutchan17-Mar-14 22:12
mveRichard MacCutchan17-Mar-14 22:12 
Questionfile path save into database and file save into project folder with file name rename Pin
Ravi900kumar16-Mar-14 10:58
Ravi900kumar16-Mar-14 10:58 
AnswerRe: file path save into database and file save into project folder with file name rename Pin
Richard MacCutchan16-Mar-14 23:26
mveRichard MacCutchan16-Mar-14 23:26 
Questionddslick set Max height Pin
saigowthami14-Mar-14 17:19
saigowthami14-Mar-14 17:19 
AnswerRe: ddslick set Max height Pin
Richard MacCutchan15-Mar-14 0:52
mveRichard MacCutchan15-Mar-14 0:52 
GeneralRe: ddslick set Max height Pin
saigowthami15-Mar-14 0:55
saigowthami15-Mar-14 0:55 
QuestionPlease reply urgent Pin
Member 1065817714-Mar-14 7:33
Member 1065817714-Mar-14 7:33 
AnswerRe: Please reply urgent Pin
Richard MacCutchan14-Mar-14 8:12
mveRichard MacCutchan14-Mar-14 8:12 
AnswerRe: Please reply urgent Pin
jschell14-Mar-14 12:01
jschell14-Mar-14 12:01 
Questionto develop an application Pin
Hari Kiran B M12-Mar-14 3:12
Hari Kiran B M12-Mar-14 3:12 
AnswerRe: to develop an application Pin
Richard MacCutchan12-Mar-14 3:50
mveRichard MacCutchan12-Mar-14 3:50 
GeneralRe: to develop an application Pin
Hari Kiran B M12-Mar-14 5:46
Hari Kiran B M12-Mar-14 5:46 
GeneralRe: to develop an application Pin
Richard MacCutchan12-Mar-14 6:03
mveRichard MacCutchan12-Mar-14 6:03 
GeneralRe: to develop an application Pin
Hari Kiran B M12-Mar-14 6:23
Hari Kiran B M12-Mar-14 6:23 
GeneralRe: to develop an application Pin
Richard MacCutchan12-Mar-14 7:00
mveRichard MacCutchan12-Mar-14 7:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.