"embed" image data into java code
I have a mind that is it possible embed image file into java code?
That mean an image file information already store in java code, thus no need using the image file in run-time. Then can prevent user change other image file instead.
Do anyone try before, are there technologies required?
I just want to know is it possible or not....thanks.
technologies? The solution you are asking for is all about storing your data in static variables such as byte[][] used to build your image instance. I guess you should have a look at the different constructors of BufferedImage.
Similar Messages
-
Can I use Bridge to export image data into a .txt file?
I have a folder of images and I would like to export the File Name, Resolution, Dimensions and Color Mode for each file into one text file. Can I use Bridge to export image data into a .txt file?
Hello
You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
if f ends with "/" then set f to f's text 1 thru -2
do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
use strict;
use open IN => ':crlf';
chdir $ARGV[0] or die qq($!);
local $/ = qq(\\0);
my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
local $/ = qq(\\n);
# CSV spec
# - record separator is CRLF
# - field separator is comma
# - every field is quoted
# - text encoding is UTF-8
local $\\ = qq(\\015\\012); # CRLF
local $, = qq(,); # COMMA
# print column header row
my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
# print data row per each file
while (@ff) {
my $f = shift @ff; # file path
if ( ! open(IN, '<', $f) ) {
warn qq(Failed to open $f: $!);
next;
$f =~ s%^.*/%%og; # file name
@dd = ('', $f, '', '', '', '');
while (<IN>) {
chomp;
$dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
last unless grep { /^$/ } @dd;
close IN;
print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
EOF
Hope this may help,
H -
How to transform this pascal code into java code!
I want to transform this pascal code into java code . Please tel me how to do it because I really don't know how to do it!
Thanks!
{CALCULATE HOHN-LONDON FACTORS}
var kk:tab4;
PROCEDURE INTENS(var kk:tab4);
begin
for n:=0 to nr+2 do
begin
kk^[1,n]:=sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1)) +lup*(yg-2);
kk^[2,n]:= sqrt(lup*lup*yg*(yg-4)+4*sqr(n+1))-lup*(yg-2);
kk^[3,n]:=0.5*(kk^[1,n]*kk^[1,n]+4*(sqr(n+1)-lup*lup));
kk^[4,n]:= 0.5*(kk^[2,n]*kk^[2,n]+4*(sqr(n+1)-lup*lup));
kk^[5,n]:= sqrt(ldown*ldown*yd*(yd-4)+4*sqr(n+1)) +ldown*(yd-2);
end;
end;
BEGIN
new (kk);
intens(kk);
writeln(f2,' ','N ','V','branch ','H-L');
for n:=1 to np do
begin
fp1[n,v]:=(n-ldown)*(n+ldown+1)*sqr(kk^[2,n-1]*kk^[6,n]+4*(n+ldown)*(n-ldown+1));
fp1[n,v]:=fp1[n,v]/(4*(n+0.5)*kk^[4,n-1]*kk^[8,n]) ;
writeln(f2,' ',n,' ',v,' fp1 ',fp1[n,v]:10:2);
end;
for n:=1 to nq do
begin
fq1[n,v]:=sqr(kk^[2,n]*kk^[6,n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)) ;
fq1[n,v]:=fq1[n,v]/(2*(n+0.5)*kk^[4,n]*kk^[8,n]*(n+1.5));
fq1[n,v]:=fq1[n,v]*(n+1);
writeln(f2,' ',n,' ',v,' fq1 ',fq1[n,v]:10:2);
end;
for n:=1 to nr do
begin
fr1[n,v]:=sqr(kk^[2,n+1]*kk^[6,n]+4*(n-ldown+2)*(n+ldown+1));
fr1[n,v]:=fr1[n,v]/(4*kk^[4,n+1]*kk^[8,n]*(n+1.5));
fr1[n,v]:=fr1[n,v]*(n-ldown+1)*(n+ldown+2) ;
writeln(f2,' ',n,' ',v,' fr1 ',fr1[n,v]:10:2);
end;Basically it looks like this:
public class KK{
private your_type[][] kk = new your_type[length][length];
private void intens(your_type[] kk){
for(int n= 0; n<nr+2; n++){
kk[1][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2)) +lup*(yg-2);
kk[2][n] = Math.sqrt(lup*lup*yg*(yg-4)+4*Math.pow((n+1), 2))-lup*(yg-2);
kk[3][n] = 0.5*(kk[1][n]*kk[1][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[4][n] = 0.5*(kk[2][n]*kk[2][n]+4*(Math.pow((n+1), 2)-lup*lup));
kk[5][n] = Math.sqrt(ldown*ldown*yd*(yd-4)+4*Math.pow((n+1), 2)) +ldown*(yd-2);
public static void main(String args[]){
KK k = new KK();
k.intens(kk);
System.out.println(f2 + ' ' + 'N ' + 'V' + 'branch ' + 'H-L');
for(int n=1; n < np; n++){
fp1[n][v] = (n-ldown)*(n+ldown+1)*Math.pow((kk[2][n-1]*kk[6][n]+4*(n+ldown)*(n-ldown+1)), 2);
fp1[n][v] = fp1[n][v]/(4*(n+0.5)*kk[4][n-1]*kk[8][n]) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fp1 ' + fp1[n][v]:10:2);
for(int n=1; n< nq;n++){
fq1[n][v] = Math.pow((kk[2][n]*kk[6][n]*(ldown+0.5)+4*(n-ldown+1)*(n+ldown+1)*(ldown-0.5)), 2);
fq1[n][v] = fq1[n][v]/(2*(n+0.5)*kk[4][n]*kk[8][n]*(n+1.5));
fq1[n][v] = fq1[n][v]*(n+1);
System.out.println(f2 + ' ' + n + ' ' + v + ' fq1 ' + fq1[n][v]:10:2);
for(int n=1; n < nr; n++){
fr1[n][v] = Math.pow((kk[2][n+1]*kk[6][n]+4*(n-ldown+2)*(n+ldown+1)), 2);
fr1[n][v] = fr1[n][v]/(4*kk[4][n+1]*kk[8][n]*(n+1.5));
fr1[n][v] = fr1[n][v]*(n-ldown+1)*(n+ldown+2) ;
System.out.println(f2 + ' ' + n + ' ' + v + ' fr1 ' + fr1[n][v]:10:2); //fr1[n][v]:10:2 --> Here you must use the BigDecimal class
}I'm not very sure because my pascal knowledge is extremely "dated".
What about the converter I told you about? -
Pythagors into java-code (i got the idea, i think, but need it simplified)
Goodday all :),
I have been trying to turn the forumula | a^2 + b^2 = c^2 | into java code.
To clear it up a little more;
1. Define unknown variable
2. Define values of other two variables
3. Program calculates
x1. unkown variable is 'a'
x2. b = 20 , c = 40
x3. a = [(40^2) - (20^2)] ^0.5 (sorry couldnt figure out superscript)
What i was thinking as a concept;
1. Java asks for uknown value -> user defines as 'a' , 'b' or 'c'.
2. Java If else statement
2.1 if 'd' -> java asks again
2.2 else 'e' --> java asks again etc (if else statemenst from d - z)
import java.io.*;
public class example {
public static void main(String[] args) {
System.out.println("define uknown value");
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
boolean running = true;
while(running) {
String line = reader.readLine();
if (line.startsWith("d")) {
System.out.println("wrong input, define unknown value");
running = true;
} else if (line.startsWith("e")) {
System.out.println("wrong input, define unknown value");
running = true;
} else if (line.startsWith("f")) {
System.out.println("wrong input, define unknown value");
running = true;
} else if (line.startsWith("g")) {
System.out.println("wrong input, define unknown value");
running = true;and furter i was thinking;
If a, b or c is pressed it will ask for the values of the other two
and it will be such a code as above, repeating itself;
String line = reader.readLine();
if (line.startsWith("a")) {
System.out.println("please define b");
running = true;
if (line.startsWith("1")) {
int x = 1;
System.out.println("b=1");
running = true;
} else if (line.startsWith("2")) {
int x = 2;
System.out.println("b=2");
running = true;
} else if (line.startsWith("3")) {
int x = 3;
System.out.println("b=3");
running = true;and so on till, lets say 1000?
Now my question is;
Is this the right way to make this program?
I would have like a .java file of severel megebytes if i wanted the values to get up to 10000 or something >.<Aargh! No. This code snippet might be of help.
try {
int x = Integer.parseInt("42");
System.out.println("X = " + x);
} catch( NumberFormatException e ) {
System.err.println("Not a number: " + e);
e.printStackTrace();
}You would probably also find it useful to read about "regular expressions" if you always expect the formula to have exactly the same form. -
How to export image data into XDP
Hi, All
I'm working on a healthcare project that needs to export the doctor's signature image into XDP file from the database to fill in the Insurance company claim form. My question is how to export image data into a field node in the XDP file, we know the name of the image field which defined in the PDF form, Is it something like:
the signature image data ?
Should the image data in this node be base64 encoded or text encoded or something else?
Can the image be any kind? e.g. BMP, PNG, JPEG, ..., etc?
Thanks
WilliamHi Andre,
Document will be of ASCII characters right?? but image data will be in binary format. as per database concept it is stored as binary large object. But in datawarehousing the back end is also going to be some database such as Oracle or other DBs.
which can take blob's. so it would be possible to store the binary data.
If any one has faced this situation can reply.to this ques.
can post the step to load image(jpg/bmp or any image format) data in to info cube??
hi andre if u have done loading image data as you say.pls reply me if you have the steps with you.
thanks Andre -
How to load image data into cube?? Is it possible??
How to load image data into cube?? Is it possible??
Any sugession??Hi Andre,
Document will be of ASCII characters right?? but image data will be in binary format. as per database concept it is stored as binary large object. But in datawarehousing the back end is also going to be some database such as Oracle or other DBs.
which can take blob's. so it would be possible to store the binary data.
If any one has faced this situation can reply.to this ques.
can post the step to load image(jpg/bmp or any image format) data in to info cube??
hi andre if u have done loading image data as you say.pls reply me if you have the steps with you.
thanks Andre -
How to parse xml data into java component
hi
everybody.
i am new with XML, and i am trying to parse xml data into a java application.
can anybody guide me how to do it.
the following is my file.
//MyLogin.java
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
class MyLogin extends JFrame implements ActionListener
JFrame loginframe;
JLabel labelname;
JLabel labelpassword;
JTextField textname;
JPasswordField textpassword;
JButton okbutton;
String name = "";
FileOutputStream out;
PrintStream p;
Date date;
GregorianCalendar gcal;
GridBagLayout gl;
GridBagConstraints gbc;
public MyLogin()
loginframe = new JFrame("Login");
gl = new GridBagLayout();
gbc = new GridBagConstraints();
labelname = new JLabel("User");
labelpassword = new JLabel("Password");
textname = new JTextField("",9);
textpassword = new JPasswordField(5);
okbutton = new JButton("OK");
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 5;
gl.setConstraints(labelname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 5;
gl.setConstraints(textname,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 10;
gl.setConstraints(labelpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 2;
gbc.gridy = 10;
gl.setConstraints(textpassword,gbc);
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.gridx = 1;
gbc.gridy = 15;
gl.setConstraints(okbutton,gbc);
Container contentpane = getContentPane();
loginframe.setContentPane(contentpane);
contentpane.setLayout(gl);
contentpane.add(labelname);
contentpane.add(labelpassword);
contentpane.add(textname);
contentpane.add(textpassword);
contentpane.add(okbutton);
okbutton.addActionListener(this);
loginframe.setSize(300,300);
loginframe.setVisible(true);
public static void main(String a[])
new MyLogin();
public void reset()
textname.setText("");
textpassword.setText("");
public void run()
try
String text = textname.getText();
String blank="";
if(text.equals(blank))
System.out.println("First Enter a UserName");
else
if(text != blank)
date = new Date();
gcal = new GregorianCalendar();
gcal.setTime(date);
out = new FileOutputStream("log.txt",true);
p = new PrintStream( out );
name = textname.getText();
String entry = "UserName:- " + name + " Logged in:- " + gcal.get(Calendar.HOUR) + ":" + gcal.get(Calendar.MINUTE) + " Date:- " + gcal.get(Calendar.DATE) + "/" + gcal.get(Calendar.MONTH) + "/" + gcal.get(Calendar.YEAR);
p.println(entry);
System.out.println("Record Saved");
reset();
p.close();
catch (IOException e)
System.err.println("Error writing to file");
public void actionPerformed(ActionEvent ae)
String str = ae.getActionCommand();
if(str.equals("OK"))
run();
//loginframe.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}hi, thanks for ur reply.
i visited that url, i was able to know much about xml.
so now my requirement is DOM.
but i dont know how to code in my existing file.
means i want to know what to link all my textfield to xml file.
can u please help me out. i am confused.
waiting for ur reply -
Accept RDF data using java code
Hello,
I am trying to write a java code that helps in accepting the RDF(resource description framework) data and finally output the file in csv format. Can I get some help regarding this?
RegardsGeneral solution.
1. Determine the exact format of the RDF. This has nothing to do with code.
2. Determine the exact format of the csv. This has nothing to do with code.
3. Write, find or buy a RDF parser.
4. Write, find or buy a csv output routine (most likely write)
5. Wrap 3 (RDF parser) in convienence class(es) to match what you have found in 1.
6. Wrap 4 (csv output) in a convienence class(es) to match what you have found in 2.
7. Write glue code that combines 5 and 6 into an application. -
Fill a pdf form with data using Java code
Hi,
Modern formats of Acrobat ".pdf" files allows to define form fields.
I have a datasource, let's say in a database.
I want to fill my ".pdf" with my database-stored data automatically, and want to write Java code for that.
1. What is the best way to achieve this ?
2. Is it necessary to install Acrobat Distiller server and if so what web services should I invoke ? Where is the doc ?
3. Are there efficient Java libraries to do so ?
Thank you for helping... As ever, this is kind of an emergency case
Have a good day.
PhilTake a look at the FDF Toolkit for Java:
http://www.adobe.com/devnet/acrobat/fdftoolkit.html
That will allow you to, through Java, construct an FDF that contains all your form data. You then add a reference to your "template" PDF file in the FDF as well and send the FDF to the client. Acrobat will open the FDF, see the reference to the PDF, open the PDF and then merge any data contained in the FDF with the PDF. -
Load image data into array collection without ever displaying it
Hi all,
I am starting with a String that is a path to a local file. I
need to add that image (png) to an array collection without ever
displaying it on screen. What would be the most direct process to
get it into the type BitmapData.
No matter what i try, i cant seem to get the image to
actually load into memory so it is available without displaying it
on the screen. Thanks in advance,Hi Jed,
In AIR, you can simply use FileStream's readBytes() call to
read the contents of the image file into a bytearray. Now when you
want to display the image, simply use Loader.loadBytes().
Once the loadBytes() call completes, you will be able to get
bitmap data. Till then it would be in JPG/PNG/GIF format. -
How to pass table data into below code for alv
hi
i want to pass table data into alvgrid
i dont know how to pass table data.
here instead of passing ABC into internal table
i want to pass table data .
please help me
ialv-test1 = 'ABC'.
form get_data.
ialv-test1 = 'ABC'.
ialv-test2 = 'DEF'.
append ialv.
ialv-test1 = 'GHI'.
ialv-test2 = 'JKL'.
append ialv.
ialv-test1 = '123'.
ialv-test2 = '456'.
append ialv.
endform
thanks in advanced.Have a look at below links. It gives you sample code of alv grid.
http://sap.niraj.tripod.com/id64.html
http://www.sap-img.com/abap/sample-programs-on-alv-grid.htm
Have a look at below links for SAP Help.
http://help.sap.com/saphelp_nw04/helpdata/en/8d/e994374c9cd355e10000009b38f8cf/content.htm
http://help.sap.com/saphelp_erp2004/helpdata/en/12/904f42d5f811d2b469006094192fe3/content.htm
Best Regards,
Vibha
*Please mark all the helpful answers -
How to download (export) user master data from java code
Hi,
I've an requirment. I need to export the user master through java code from a dual stack system
The requirment is like an autmated of what we do in indentity management export.
Thanks in advance
Regards,
mcsekar_21Solved it..
Wrote a bean using UME factory, to download, upload and modify. -
Converting String into Java code
Hi everyone,
I will describe the scenario I have. I have a GUI application. I want the user to write some Java code in a text box and plug that code during runtime. Is there a way in Java so that a string could be used as a Java code?
You help is really appreciated.
Thanks
RGcatch the string input
output string (code) to file
call javac on the file you made
that's it, you have a class, and you can run it/load it -
Converting CPP code into JAVA Code
i have made a cpp file that is running fine... is ther a tool which can convert that cpp file into java file easily?
No
-
XML data storage - How to handle symbol ' inside xml data from java code
Hi
I'm trying to store XML data in Oracle XML DB 10gR2 both through SQL and JAVA .
I have a simple test table called xmltable with a primary key and a XMLType column
My sql is:
insert into xmltable values ('020', sys.XMLType.CreateXML(
'<?xml version="1.0"?>
<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001">
<DescriptionMetadata id="2005">
<LastUpdate>2006-10-19T12:48:22.null+01:00</LastUpdate>
<Creator/>
<CreationTime>2006-10-19T12:48:22.null+01:00</CreationTime>
<Instrument>
<Tool>
<Name>LAS MPEG-7 Services v1.0</Name>
</Tool>
</Instrument>
</DescriptionMetadata>
<Description xsi:type="urn:ContentEntityType" xmlns:urn="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<MultimediaContent xsi:type="urn:ImageType">
<Image id="2005">
<MediaInformation>
<MediaProfile>
<MediaFormat>
<Content/>
<Medium href="urn:mpeg:MPEG7MediumCS:2.1.1"/>
<FileFormat href="urn:mpeg:IPTCMimeTypeCS:image/jpeg"/>
<FileSize>2782043</FileSize>
<VisualCoding>
<Format colorDomain="color" href="urn:mpeg:MPEG7VisualCodingFormatCS:1"/>
<Frame height="11604" width="8676"/>
</VisualCoding>
</MediaFormat>
</MediaProfile>
</MediaInformation>
<MediaLocator>
<MediaUri>oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.MEDIA_IMAGE/IMAGE[IMG_ID=2005]</MediaUri>
</MediaLocator>
<TextAnnotation>
<FreeTextAnnotation>B?miy?n and Shikari areas</FreeTextAnnotation>
</TextAnnotation>
<Semantic>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='65']"/>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='148']"/>
</Semantic>
</Image>
</MultimediaContent>
</Description>
</Mpeg7>
Unfortunately I'm facing problem with the symbol ' at the tags:
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='65']"/>
<SemanticBaseRef href="oracle:bosch.informatik.rwth-aachen.de:1521/SMILEY/AMSDB.OBJECT_XML/MPEG7_SB#/mpeg7:Mpeg7/mpeg7:DescriptionMetadata[@id='148']"/>
If I tried with double ' (not '' ) it works with SQL through SQLPLUS but not with java. Indeed I have to store the data through my application
In java I get java.sql.SQLException: ORA-19102
Many thanks in advance,
EvanelaThanks for your answer. I downloaded the JDBC AddressBook application and I found it very usefull. I was able to populate a datalist from a datasource and show it in my application. My problem still remains in the sense that I am unable to show the KPI data in a "custom node" meaning I woul like not only to extract directly the database record to a datalist object but also put the information of a single record in a textbok and a gauge and keep control of paging. I think this is done with the parser in the other examples but I can not figure out how to do it with MySQL and the new Desktop screen designer. Should I use a clip object? or is that managed already by the desktop screen designer? or where can I find an example with the functionality I need?.
Maybe you are looking for
-
Binding 2 Models in the Same component controller
I'm using 2 Import Adaptive RFC Models. I want to bind both the models in the component controller of the same web dynpro component. But when I try to do model binding for the second model, it does not allow me to do so. If I try to bind the same mod
-
Done with Verizon - BTW, TY Smith6612!
Well, I gave Verizon another two weeks while I called up Comcast to get another line setup and as to be expected, next to nothing was done on Verizon's end to fix the issue. I noticed that my speed went down on speedtest.net which is likely why I hav
-
How to delete one page in a section
I want to only add one page, but when i add one it adds three to a section, and then i try to delete the third blank one and it deletes everything but the original first page. How can i delete only one page from a section?
-
SPRO Customisation - archive Link
Hi All Thanks in advance . I am adding two functionality in my Dialog programming, 1. Attach document 2. View Document . For these two functionality in sap (4.5B) No Class library is available . For attaching i am using following function module To g
-
I just had a scare. I've put weeks into CD project with about 10 songs almost finished and I get a blue screen kernel panic. About three months I had to erase and install and lost everything but only a few rough songs were in Logic. (It was L7 so I w