Questions on Type Convertion
Hi all,
I have a hashmap m. I want to put an object o as the key and an integer as the value. But seems that
m.get(o)
will return an Object, which cannot be converted into primitive type... so what can I do to get the value of integer from the map?
At the same time, can I write something like
if [variable type] is [integer]
put value of variable to another integer
else if [variable type] is [String]
put value of variable to another String
else if [variable type] is [something else]
put value of variable to another variable of same type
.... and so on ?
Thanks in advance!
No, Hashmaps (and in fact all Maps) only take Objects as keys or values. If you need to use a primitive, that's what the primitive wrappers are for:int i = 5;
Object o = new Object();
m.put(o, new Integer(i));
int j = ((Integer) m.get(o)).intValue();so, to answer your question, try something likeint i;
String s;
Object o;
Object val = m.get(key);
if (val instanceof Integer) {
i = ((Integer)val).intValue();
} else if (val instanceof String) {
s = (String) val;
} else {
o = val;
}Robin
Similar Messages
-
Questions & answer type powerbuilder 12.5.2 classic tutorial
Dear All,
Can anybody give me any web link / tutorial / e-book regarding
powerbuilder 12.5.2 classic where the information represented as
questions & answer type.
Thanks
AvishekHi Avishek,
this one seems to be nice:
PowerBuilder: PowerBuilder Interview Questions & Answers Section1 -
Going Abroad - Question About Voltage Converter Stuff
Hello, so I am going abroad for a few months (the Netherlands), and I have a question about voltage converter stuff. All of the voltage converters I can find say powers heat-producing appliances rated 500-1600 and converts foreign voltage of 220-240 volts to U.S. voltage 110-120. However, it says not to use on appliances under 500 watts such as computers. So first, off does anyone know how many watts an ibook g4 14" puts off. Secondly, I read that laptops have a dual adapter and that they can work on the 220-240 volts converter. Does anyone have any ideas about these issues; any help would be greatly appreciated!
Hi Brandon,
Welcome to the Discussions.
Your iBook's power adapter is rated for 100-240v. All you need is an adapter for the plug so it will fit in a European outlet. You can find them at travel stores or online for a few dollars.
John -
I'm trying to print vinyl letters for a gallery I'm a member of and love the Cronos Pro regular font. i've designated this for desktop use and created 24 name files at 200pt. The person working with the vinyl asked if I could 'convert to outline' possibly to make the font a bit larger, I don't really know. When I tried to do this, I found that choice grayed out on the type menu. I am wondering if this means the Typekit fonts 'designated for desktop use' simply do not have the permission to be 'converted to outline'.
Cutting always requires proper paths/ outlines. This has nothing to do with the font or large format printing per se. Beyond that there should be no limitation in using fonts - as long as you can mangle them in AI, it means that somewhere those outlines exist internal to the program so the type can actually be rendered. Whatever prevents this may more likely be inherent in how you treat your text. you would have to provide more specific info on that. Either way, ask in the AI forum for more detailed answers.
Mylenium -
First question is how can I override the default constructor (or add an exception to it). I have an object like this
create or replace type date_object as object
(quarter number,
year number(4),
member procedure set_date(d in date_object),
member procedure set_date(d in date),
member procedure set_date(v_qtr in number, v_year in number),
constructor function date_object(d in date_object) return self as result,
constructor function date_object(d in date) return self as result,
--overriding constructor function date_object(v_qtr number, v_year number) return self as result,
member function to_string return varchar2,
member function get_quarter return number,
member function get_year return number,
member function get_quarter_as_string return varchar2);
/I want to replace date_object(v_qtr number, v_year number) with a new constructor that will call an exception if the quarter number is not 1,2,3,4. Oracle will not let me declare or overide function constructor function date_object(v_qtr number, v_year number) return self as result
Second question is, can I have an ADT as a primary key. This is what I am required to do, but it is not working for me:
create table financial_data
(bank_code number(7) references banks(bank_code),
qdate date_object,
total_assets number,
current_liabilities number,
long_term_liabilities number,
operating_income number,
investment_income number,
expenses number);
constraint fd_pk primary key (bank_code, qdate));It would be much more simple having just a date (year and quarter can be easily extracted from)
Regards
Etbin -
Hi my question abt 2 convert a list into pdf format
hi
experts
i had problem to convert displayed list into pdf format showing an error cannot open the file file format not supported, but i am have downloaded the file in .pdf format
please help me
thank you allHi,
check out this program. this might help:
report zabap_pdf.
tables:
tsp01.
data:
mstr_print_parms like pri_params,
mc_valid(1) type c,
mi_bytecount type i,
mi_length type i,
mi_rqident like tsp01-rqident.
*-- INTERNAL TABLES
data:
mtab_pdf like tline occurs 0 with header line,
mc_filename like rlgrap-filename.
*-- SELECTION SCREEN
parameters:
p_repid like sy-repid, " Report to execute
p_linsz like sy-linsz default 132, " Line size
p_paart like sy-paart default 'X_65_132'. " Paper Format
start-of-selection.
concatenate 'c:\'
p_repid
'.pdf'
into mc_filename.
*-- Setup the Print Parmaters
call function 'GET_PRINT_PARAMETERS'
exporting
authority= space
copies = '1'
cover_page = space
data_set = space
department = space
destination = space
expiration = '1'
immediately = space
in_archive_parameters = space
in_parameters = space
layout = space
mode = space
new_list_id = 'X'
no_dialog= 'X'
user = sy-uname
importing
out_parameters = mstr_print_parms
valid = mc_valid
exceptions
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
others = 4.
*-- Make sure that a printer destination has been set up
*-- If this is not done the PDF function module ABENDS
if mstr_print_parms-pdest = space.
mstr_print_parms-pdest = 'LOCL'.
endif.
*-- Explicitly set line width, and output format so that
*-- the PDF conversion comes out OK
mstr_print_parms-linsz = p_linsz.
mstr_print_parms-paart = p_paart.
submit (p_repid) to sap-spool without spool dynpro
spool parameters mstr_print_parms
via selection-screen
and return.
*-- Find out what the spool number is that was just created
perform get_spool_number using sy-repid
sy-uname
changing mi_rqident.
*-- Convert Spool to PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid= mi_rqident
no_dialog = space
dst_device = mstr_print_parms-pdest
importing
pdf_bytecount = mi_bytecount
tables
pdf = mtab_pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
others = 12.
call function 'DOWNLOAD'
exporting
bin_filesize = mi_bytecount
filename = mc_filename
filetype = 'BIN'
importing
act_filename = mc_filename
tables
data_tab = mtab_pdf.
FORM get_spool_number *
Get the most recent spool created by user/report *
--> F_REPID *
--> F_UNAME *
--> F_RQIDENT *
form get_spool_number using f_repid
f_uname
changing f_rqident.
data:
lc_rq2name like tsp01-rq2name.
concatenate f_repid+0(8)
f_uname+0(3)
into lc_rq2name separated by '_'.
select * from tsp01 where rq2name = lc_rq2name
order by rqcretime descending.
f_rqident = tsp01-rqident.
exit.
endselect.
if sy-subrc ne 0.
clear f_rqident.
endif.
endform." get_spool_number -
Hi,
i want to convert a numeric type field to character type field in ABAP,
and also i want to concatenate some set of different types of field to a character type field at last
if i give just like this
<b>CONCATENATE ' ' it_pa0000-pernr it_pa0105-usrid ' ' it_pa0105-begda into record_tab-string.</b>
it remove space out from the string i need space also in the <b>record_tab-string</b>,
Reg,
HariharanHi,
The CONCATENATE statement combines two or more separate strings into one.
<b>CONCATENATE <c1> ... <cn> INTO <c> [SEPARATED BY <s>].</b>
This statement concatenates the character fields <c1> to <cn> and assigns the result to <c>. The system ignores spaces at the end of the individual source strings.
The addition SEPARATED BY <s> allows you to specify a character field <s> which is placed in its defined length between the individual fields.
try with this sample code..........
CONCATENATE it_pa0000-pernr it_pa0105-usrid it_pa0105-begda INTO record_tab-string SEPARATED BY SPACE.
regards,
Ashok Reddy -
Question about DNG converter in Bridge CS4
Hello,
I just installed Photoshop CS4, When I updated, it downloaded a hefty update (199 megs), so my setup now is:
Win XP pro
Bridge 3.0.0.464
Camera RAW 5.7
Photoshop CS4 11.0.2
My Camera is a Panasonic Lumix FZ150 ( 2011 vintage)
I have downloaded the Adobe DNG converter 6.6.0.261
Every thing seems to be working fine so far, except:
In Bridge when I "get Photos from Camera" the DNG conversion doesn't work. When I use the standalone converter it works fine.
From reading past material on this forum I am assuming this is due to the fact that Bridge is older than my camera, and doesn't recognize the format.
The questions:
1. Does Bridge have its own built in DNG converter that is not upgradeable separately?
2. If 1 is correct, is there a way to point Bridge to the location of the standalone converter so the work flow can be optimized.
3. Since Bridge is not doing the conversion, but only importing the files, does the "Apply metadata" section of that window actually do anything? Should I bother to fill in any of those boxes?
Thanks for any help.I posted a similar question quite a while ago, and what I learned was that Bridge has a DNG converter built in, but it's using ACR to read the file before it can convert. So you need ACR support for your camera.
AFAIK there's no way to point Bridge to a standalone DNG converter.
I suggested an updateable DNG converter plugin for Bridge, don't know why nobody listened...I thought it was an excellent idea
As for the metadata, you just have to try. I don't know if it can write metadata when it can't read the file. -
Profibus data type converting to floating point
Hi,
Is there an efficient way to convert the incoming data to the floating point in the NI cRIO Profibus system?
1) The system is : NI cRIO 9068 Controller with Comsoft profibus slave module. The lavview we are using is 2013.
2) We are using profibus slave example and are able to see a array of unsigned 8 bit data. Please see the Output data shown in the attachement.
3) On the other side of profibus system, thrid party profibus master are converting floating points and tranmit the converted data to NI profibus slave.
Attachments:
Screenshoot.png 7 KBIf it's just a matter of converting data types once you have the data in LabVIEW, you can always manually scale and convert the data using the arithmetic functions and the "To Double Precision Float" or "To Single Precision Float" functions. You just have to know what floating point value the unsigned byte integer corresponds to. Is that what you're asking?
If you're asking for a way to this inherently with the Profibus functions, I'm afraid I can't be of much help...
Ryan K. -
Noob question use dng converter or let LR convert to dng
Sorry for the noob question but I'm transitioning over to LR from aperture and I believe DNG is a good move for me. Now then, is there any advantage to using the converter over letting LR do it?
It really is the same integrated tool, yes. All the same preferences are there.
The only thing I am not aware if Lightroom can do is Extract Embedded Originals. But that's not something I'd ever do to my own RAW files.
Cheers -
Question of data converted.
Hi, I am a newcomer and trying to write a client program to communicte with a old C++ server by socket. The server requires data block of byte array consisting of int, floats etc. For example, there are 4 bytes for an integer. How can I convert data type of java to and from these blocks?
I know that java primitive data types can be casted to byte, but it seems not right. I have written the following codes:
byte b1 =(byte)123456F;
byte b2 =(byte)64;
Both the value of b1 and b2 is 64.
Any help hints are appreciated, especially examples.
Thanks in advanced.I suggest you have a look at the java.nio.ByteBuffer class.
A ByteBuffer has methods to write bytes, ints, floats etc. into it and when your data is written to the buffer there is a method that returns a byte-array with the data you have just written which you could send to your server.
If you are not yet familar with the ByteBuffer class you should read one of the many tutorials on working with ByteBuffers that are on the net.
Search for instance http://www-106.ibm.com/developerworks/java
it has a tutorial that is named something like "Getting started with NIO".
Two more points you might have to consider when you communicate with your server :
1. Sometimes (non-Java)servers you communicate with use little-endian byteorder for ints. You will have to find out if this is the case for the sever you access. If this is the case the ByteBuffer-class has a method to switch the byteorder it uses when writing ints to it.
2. You will need to know if your server is sending or expecting unsigned ints. As this datatype is not available in java you will have to do some conversions of data to be written or read. -
Two questions: file types & navigating itunes store
i was sticking to the mp3 format for my ipod but after getting a nano for my boyfriend and loading it, i realized that i should switch to aac.
what is the quickest way to swap out my 13 gb of mp3 podcasts for acc?
i haven't been using the tunes store for very long find i am finding it very confusing. i click on a help link and end up at apple.com and have to log in there. then when i work my way back to the store, i have to log back.
my goal at this moment is to locate the interface for setting my download type. surely i can change it without having immediate plans for downloading anything.
where is it?
thanks!
HP media center pc m7367c Windows XP Pro 60gb ipod w/video
hpmc (pc) Windows XP Prowhat is the quickest way to swap out my 13 gb of mp3 podcasts for acc?
I'm not sure you can, at least in iTunes, but I really wouldn't bother. The difference between AAC and MP3 isn't sufficient, in my view, for you to worry about converting a large library.
my goal at this moment is to locate the interface for setting my download type.
You're not finding it because there isn't one. You have no choice of format for any content on the iTunes Store. It's all preset by Apple or in the case of podcasts by the podcast creator. -
Questions concerning type casting
can anybody give me a short hint where I
can learn more about type casting in
LabView 5.1. Ecspecially what converting
4.x data means and where to find this in
the online reference ...
Thanks for your support,
Holger HofmannHolger Hofmann wrote:
> can anybody give me a short hint where I
> can learn more about type casting in
> LabView 5.1. Ecspecially what converting
> 4.x data means and where to find this in
> the online reference ...
>
> Thanks for your support,
>
> Holger Hofmann
Holger,
Typecasting and 4.x conversion are 2 different things (well sorta)
The way that LabVIEW stored booleans (in memory etc) was changed after
version 4.x
In ver4.x a bool was 16-bits Bit 15 low = FALSE, bit 15 high = TRUE
Since ver5.0 bool is 8 bits, all 0's = FALSE, non-zero = TRUE.
Typecasting is a more general concept, in that it converts from one data
type
to another. For example I can type cast a Boolean to a U8 (which is what the
convert 4.x does). I wire a bool to the typecast, a constant to
the "type"
and a U8 indocator to the output. On my machine I get 0=FALSE and 256 =
TRUE.
you can use this for any datatypes that you wish.
Check the knowlwdgebase on NIs site (search for 4.x data)
Kevin Kent -
When I use ant converter, I get the following message:
Usage: java [-options] class [args...]
(to execute a class)
or java -jar [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version and exit
-showversion print product version and continue
-? -help print this help message
-X print help on non-standard options
It seems that this message is the usage of java interpreter. What is wrong with my settings? Thanks in advance.I use ant 1.3. I downloaded jakarta-ant-1.3-bin.zip following the link on http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/J2eeTutorialPreface.html#46338.
My environment setting is as follows:
set path=c:\j2sdk1.4.0-beta3\bin\;c:\students\sheng\j2sdkee1.3.1\bin\;c:\j2sdk1.4.0-beta3\jre\lib;c:\students\sheng\ant\bin;%path%;
set J2EE_CLASSPATH=C:\students\sheng\j2sdkee1.3.1\lib\
set JAVA_HOME=c:\j2sdk1.4.0-beta3\
set ANT_HOME=c:\students\sheng\ant\
set J2EE_HOME=c:\students\sheng\j2sdkee1.3.1\
I tried to run "ant converter" to compile the example code in c:\students\sheng\j2eetutorial\examples\src, but I got that error message (same with java command usage) whatever directory I run that "ant converter" command.
Thanks a lot.
Truly yours,
Sheng -
I copied music from CDs into iTunes on my desktop. I downloaded a lot onto a USB stick. I want to play them in my wife's Toyota Avalon but I must use something like an FM converter and that requires all songs be in MP3 format. How can I reformat the CD songs into MP3 format? Not important enough to buy an iPod Nano!!
"but I must use something like an FM converter and that requires all songs be in MP3 format."
No it doesn't.
An FM converter takes audio and sends it over FM to the radio.
A USB stick does not play audio.
You need something to play the audio (like an iPod) and plug the audio out into the FM converter.
Maybe you are looking for
-
Is there a way to see which apps have been swapped? Or maybe something more low-level if it's not possible. Thanks!
-
Number Range Interval Deactivated
Dear Experts, Could anybody suggest on this problem as follows: While configuring Number range interval to GL Account, the interval buttons(create) is deactivated and error message showing as No. Range is locked by sapuser for maintenace Srinivas
-
Hi, I am creating version in cn72. when I am displaying it in cn71,it is giving dump. In cn71 , I am giving project,then choosing DB profile and clicking version data and sales data and then enter.Then in the project version I am giving the version t
-
MICROSOFT DEPLOYMENT TOOLKIT 2013 DO I NEED LICENSE TO INSTALL THIS SOFTWARE IN MY COMPUTER
TO INSTALL MICROSOFT DEPLOYMENT TOOLKIT 2013 DO I NEED ANY MICROSOFT LICENSE, I HAVE WINDOWS 7 & 2008 R2 LICENSES. Many Thanks & Best Regards, K.SURESH
-
How can I make iTunes accept an alias as a movies folder?
I love how iTunes organises my media files. But I need to keep my movie purchases on a different, external HD with USB 3.0. Creating an alias of the folder "Movies" I've copied to the HD and moving the alias back on place into the user's local Librar