Cast question
* Local Function Prototypes */
myreturn xx_ioctl(dev_t, int, int, int, cred_t *, int *); <<(1)
/* definition */
myreturn xx_ioctl(dev_t dev, int cmd, int arg, int flag, <<(2)
cred_t cred_p, int rval_p)
[snipped]
(myfunc([snipped], (caddr_t)arg, [snipped]} << (3)
[snipped]
can i change the 3rd argument in the (1) to "long" and change the
"int arg" to "long arg" in (2)?. what is the best way to handle this?.
seems like a library call.
-Raoul
I guess a column alias "mydate" cannot be used in the WHERE clause.
Similar Messages
-
Lightroom color cast question of JPEG image
Lightroom color cast question of JPEG image
Camera Canon MKII Color Matrix Adobe RGB
Photoshop CS Color Setting Adobe RGB (1998)
Lightroom 1.2 as new lightroom user I did not think that I needed to choose a color setting or color profile until I am ready to print my photos. I have not done any preset camera calibration.
Link to my website with example photo http://www.basecampphotos.com/color.jpg
My question is why is Lightroom displaying the images with a yellow color cast ? The image is a print screen from Lightroom on the left and Photoshop on the right The color cast problem can be seen in the white walls of the stairway. Also when viewing the image with Windows Picture and Fax viewer the walls are white as expected.
Any ideas or suggestions as to why Lightroom is displaying the images with the yellow color cast or what I need to do to correct the issue ?
Thanks
JimAlmost definitely a corrupt monitor profile. Time and again this turns out to be the cause of such differences between PS and LR. You need to recalibrate the monitor or if you do not have a hardware calibrator, delete the profile from windows' monitor properties pane to test and then get a hardware calibrator.
P.S since you are using adobeRGB jpegs, Windows picture and Fax viewers cannot give you the correct colors even on a calibrated monitor. Those are not color managed programs (I believe picture viewer finally is in Vista but definitely not in XP which you appear to be using). Also, PS has to be correctly set up to always preserve embedded profiles and to ask when you have profile mismatches, otherwise even PS will give incorrect color. Make sure to set this up in Edit>Color settings.
P.S.2: Make sure you are not applying defaults in Lightroom to your images either on import or elsewhere. Sometimes people by accident define develop defaults that in this case might contain a white balance shift. Go to LR preferences and open the Presets tab. Here click on "Reset all default Develop settings" and make sure that only the auto grayscale checkbox is ticked. For images that it might have already happened to, make sure to hit the reset button. -
Array Cast Question Puzzling me
The question below puzzles me. The answer states that the result is a class cast exception because o1 is an int [] [] not a int []
But I thought the point of line 7 is to say "I know it is a 2D array but I want to cast it to a 1D array - I know I am losing precision here".
Given:
1. class Dims {
2. public static void main(String[] args) {
3. int[][] a = {{1,2,}, {3,4}};
4. int[] b = (int[]) a[1];
5. Object o1 = a;
6. int[][] a2 = (int[][]) o1;
7. int[] b2 = (int[]) o1;
8. System.out.println(b[1]);
9. } }
What is the result?
A. 2
B. 4
C. An exception is thrown at runtime
D. Compilation fails due to an error on line 4.
E. Compilation fails due to an error on line 5.
F. Compilation fails due to an error on line 6.
G. Compilation fails due to an error on line 7.
Answer:
3 C is correct. A ClassCastException is thrown at line 7 because o1 refers to an int[][]
not an int[]. If line 7 was removed, the output would be 4.
˚ A, B, D, E, F, and G are incorrect based on the above. (Objective 1.3)While you could approximate casting a 2D array to a 1D array in C/C++ by just grabbing a pointer to your first array and then overrunning array bounds (relying on how C/C++ allocates 2D arrays and the lack of bounds checking), Java's strong typing and bounds checking makes this impossible.
If you want to do something similar in Java, you will need to create a new 1D array of the proper size and copy the elements stored in your 2D array into this new array. That being said, a database is almost guaranteed to be a better solution. -
sorry to ask a question. LG VX8350 is the phone I have. I am trying to get vcast like it used to be. Where I had two screens and I brought songs from one screen ( the computer) into the other screen (the phone)> I have been up to my ears on this.
when I do okay on v cast Music it says no application.
can I change this
Paul
(Branched this discussion to this new post for better exposure...original post too old)
Message was edited by: Verizon Moderator (M)Hello paulstapp,
You have an excellent question, here! I can definitely help you sync music from your computer to your phone using our VCast services! Based on the "No Application" error message, you're receiving; I would highly recommend uninstalling and reinstalling the V Cast Music Program. For your convenience, I have included a link that will successfully walk you through the music sync process http://bit.ly/RPykHY!
Thank you for being part of our community. Please let us know if you have further questions.
TanishaS_VZW
Follow us on Twitter @VZWSupport -
I'm playing with a 5644 VST and the VST Streaming template. On the FPGA VI I added some code, then added an indicator to the FPGA VI front panel and compiled. Running the FPGA VI in interactive execution mode, the indicator works well. On the host end, though, I can't seem to access the new indicator with a Read/Write control.
Coming out of the Open FPGA VI Reference I can see the indicator on the wire, but in the Dynamic FPGA Interface Cast function it's getting stripped out of the refnum somehow. If I connect a Read/Write control directly to the output of the Open Reference function I can access the indicator just fine.
Any idea what I'm doing wrong?
Thanks.
Solved!
Go to Solution.Have you re-configured your FPGA VI reference interface with the new bitfile? The dynamic interface cast defines the output wire as having all the methods and indicators described by the type wire connected. You can right-click on the type constant and select "Configure FPGA VI Reference...". In the pop-up that follows, choose "Import from bitfile..." and then select the new bitfile that you've built.
You'll need to update the fpga reference type in the "Device Session.ctl" type def as well. This is the type that you'll be able to access throughout the project. -
I am a little weak on my casting skills, so please be patient with me!
I am working on making some of my code generic.
Let's say I have the below code:
public String deleteRow(){
int i = projectsTable.getRowIndex();
ProjectsDTO dto = (ProjectsDTO) projectsTable.getRowData();
ProjectsDTO remove = projects.remove(i);
}I want to make ProjectsDTO in the method generic. Is there anyway to have this method accept a parameter of Object to make things generic?
Something like below.
public String deleteRow(Object dto){
int i = htmlDataTable.getRowIndex();
//I don't know how to make this part generic...
ProjectsDTO dto = (ProjectsDTO) projectsTable.getRowData();
ProjectsDTO remove = projects.remove(i);
Thanks!If the type of projectsTable was appropriately generic, you might not need to do anything at all.
For example:
class ProjectsTable<T> {
T getRowData(int index) {
}Here the getRowData method would return an object of a particular type that the instance was declared as containing. Assuming you didn't want to downcast that any further you could simply call the method as-is:
ProjectsTable<Foo> pt = new ProjectsTable<Foo>();
int index = 42;
Foo foo = pt.getRowData(index); // No cast needed
...Edited by: dcminter on Dec 10, 2007 8:44 PM -
I'm not sure how to search for an answer to this question, so I'll just post it:
I've downloaded via itunes 62 and counting weekly PhotoShop TV podcasts. They are each about an hour long. What I'm wanting to do is to cut out and save just the important parts (tutorials etc.) and save them along with a title describing what it's about in some format, so that I can refer back to them and view at a later time. This way I can pitch what I don't need and reduce the file size, and create an archive for reference purposes. I assumed that this is played back in QuickTime.
I have no idea how to go about this, or what to use, or even if it doable.
Any help would be greatly appreciated.
Thanks
JeffNYou may also wish to cross-post in the Podcasting and Radio in iTunes for Mac Forums where the Podcasting users hang out.
You might as well kill 2 cyber birds w/one stone. -
Integral primitives casting question
Hi. I noticed this thing recently and can't understand it.
I have a byte and set it to -128. Then I cast it to an int, and because the highest bit is set to 1 all the new bits in the 3 higher bytes of an int are all set to 1. This I understand so far. What bugs me is why the int value is still -128. Isn't
1111 1111 1111 1111 1111 1111 1000 0000 a different value? Maybe someone could explain this because such casts are oe of the operations I make in my app and I am afraid it may not always work correctly.> Isn't 1111 1111 1111 1111 1111 1111 1000 0000 a different value?
Nope. That's -128 (that's kind of the whole idea in "filling in all the extra 1s" - to retain the byte's value).
Binary numeral system (Wikipedia)
Two's complement (Wikipedia)
Cat and Mouse Games with Bits
Cup Size -- a story about variables
Hope this helps!
~ -
Easy Casting question...
I have an object of type Fruit stored in a variable as follows:
Fruit myFruit = someFruit;
I KNOW myFruit it is of type Orange (which extends Fruit) because I have used 'instanceof' on the object.
What is the easiest way of getting access to myFruit as an Orange object so I can use its methods?Fruit myFruit = someFruit;
What is the easiest way of getting access to myFruit
as an Orange object so I can use its methods?((Orange)myFruit).someMethod();
or just make an Orange object and set it equal to myFruit and call
methods on that if you dont like having to cast all the time. -
I have the follwing 2 classes
public class Employee {
private String userID;
public Employee() {
public Employee(String id) {
userID = id;
and
public class CMPStaff extends Employee {
private String homePhone;
public CMPStaff() {
public void setHomePhone(String s){
homePhone = s;
In another program I do the following
Employee emp = new Employee();
CMPStaff st = new CMPStaff();
st = (CMPStaff) emp;
The code complies but when I run it java gives the following error.
java.lang.ClassCastException: Employee
at ProcessSessionFiles.main(ProcessSessionFiles.java:23)
Exception in thread "main"
I fails on the st = (CMPStaff) emp statement.
What am I doing wrong??
Shouln't I be able to case from Employee to CMPStaff ???
Any help would be appreciated... Thanks..Your problem is a basic inheiritance/polymorphism problem
//Illegal
Employee emp = new Employee();
CMPStaff st = new CMPStaff();
st = (CMPStaff) emp;
Your emp object is an Employee NOT a CMPStaff
while st IS a CMPStaff AND an Employee. Since emp IS NOT
a CMPStaff object you get the Exception
This would be legal
//Legal
Employee emp = new CMPStaff();
CMPStaff st = new CMPStaff();
st = (CMPStaff) emp;
You might want to read up on polymorphism in the Java tutorial
hope this helps -
Only an unfinished idea (formulated as question in a may be wrong forum):
One of the big strength of generics is, that explicit cast may be avoided in many cases.
From day one Java inserted cast by itself where possible and clear. Using + in print() for all
kind of objects is a cast to (String) and this is handled via a special methods toString()
in Object.
I was always wondering, why a cast to type T is not treated as a "normal" operation , in case
where the cast is not well specified in the language or via generics. Now it inevitably leads to
an exception, without even sending a cast-message to the object.
Would it not be much more OO/Generic, to call something like <T> T cast(Class t) method
located in Object with a default behavior (throwing an cast-exception), which can be overriden
in classes to react individually on those casts, and not only in the special case +(String)object
by calling object.toString() .thread "Request for non-throwing cast!" and your reply no. 7 and 9The 'design flaw' reply (no 8) by dcminter holds, but sometimes you have to work with imperfectly designed APIs, and that just have to use multiple if/then/else if ... constructs. This in turn doesn't mean that you have encourage bad design by providing default behaviour. See also reply 21 by lucretius.
and the track "Possible solution for unchecked casts?"That thread is not about providing new default behaviour, it is about restricting/improving present default behaviour (the unchecked cast)
But you may answer cast is not an operator.Cast is an operator, but it returns it's argument untouched when it doesn't throw a ClassCastException. This rule allows the compiler to optimize and remove type checks if it can prove that the cast's argument will be of the desired type. In combination with parameterized types, that has proven to be difficult ;)
I assume you want the Object.as() method because you find yourself writing the same conversion code on different places. In that case, I would advise to create some kind of Converter object that contains the convert() method:
interface Converter<T,U> {
/** Convert an object from class T to class U. */
U convert(T t);
Class<T> getFromClass();
Class<U> getToClass();
abstract class ConversionManager {
/** get a converter that converts an object to class U. */
public abstract <T,U> Converter<T, U> getConverter(Class<T> from, Class<U> to);
/** register a converter that converts an object from class T to U. */
public abstract <T,U> void registerConverter(Converter<T,U> cnv);
/** Convert an object to class U. */
public <T,U> U as(Class<T> tClass, Class<U> uClass, T t) {
return getConverter(tClass, uClass).convert(t);
}Because this allows for multiple conversion managers, you can use different conversions on different places. -
Newbie question: ""dynamic"" casting
Hello all,
<br>
I have a quite newbie question. I have this class hierarcy:
<br>
A
|_A1
|_A2
|_A3
|_A4
|_A5
|_.....
<br>
in some part of my code I have this:
<br><br>
if (object1 instanceof A){
if (object1 instanceof A1) {A1 object2 = (A1) e;}
if (object1 instanceof A2) {A2 object2 = (A2) e;}
if (object1 instanceof A3) {A3 object2 = (A3) e;}
if (object1 instanceof A4) {A4 object2 = (A4) e;}
if (object1 instanceof A5) {A5 object2 = (A5) e;}
object2.callMethod();
<br><br>
Is there any way to do this type of casting just in one line? I mean, I just want to cast object1 to the class it is instanceof. If it is instance of A1, I want to be casted to A1, if it is A2 to A2, etc...
<br><br>
Thanks you in advance.kamikaze04 wrote:
In fact I know what object1 is on execution time,Which doesn't help your compiler at all, when it's task to link and verify method calls.
because the code posted at the top is working well, i just want to avoid repeating that if's for all the new classes Ax I will create. Big "code smell" here.
In other words if i had from A1 to A200 i dont want to have 200 if's to cast it to the class it is and then execute it's method.You could call the method "doMagic()" and make it abstract in A. Then you can implement it in all Ax classes and would never have to worry about casting in the first place, because A.doMagic() would automagically do the right thing. Polymorphism. -
class SuperClass {
public static void staticMethod() {
System.out.println("static SuperClass method");
public void instanceMethod() {
System.out.println("instance SuperClass method");
class SubClass extends SuperClass {
public static void staticMethod() {
System.out.println("static SubClass method");
public void instanceMethod() {
System.out.println("instance SubClass method");
public class TestSuperSub {
public static void main(String[] args) {
SuperClass superclass = new SuperClass();
SubClass subclass= new SubClass();
superclass.instanceMethod();
subclass.instanceMethod();
((SuperClass)subclass).instanceMethod(); //<--uses the instance method from SubClass
superclass.staticMethod();
subclass.staticMethod();
((SuperClass)subclass).staticMethod(); //<---uses the static method from SuperClass
I don't understand why calling the SubClass instance method when SubClass is cast to SuperClass runs the SubClass method but not with the static method. What is actually happening on the last line?
RONRonNYC2 wrote:
What I'm asking is, why doesn't upcasting retrieve the instance method of the superclass since it retrieves the static method of the superclass? I know that the instance method is overridden and static method cannot be. What I'm asking is, what kind of object is (SuperClass)Subclass? Is it an object which uses only the superclass methods (it doesn't seem so)?Casting it doesn't change the fact that the underlying object is still a Subclass type.
When invoking a static method however, you're telling the compiler to use the version from the SuperClass. The line of code in question is just as if you had coded:
SuperClass.staticMethod();which is one reason why you should ALWAYS (or at least almost always, there are probably corner cases - statements with absolutes just ask for someone to shoot it down with an exception example) invoke static methods via the class name itself rather than through an object instance. -
Noob question: Casting and coverting
I thought I completely had my head around this before, but now I wonder if I do...
I know that for:
class citrus {
void squeeze() {citrus juice}
AND
class orange extends citrus {
void squeeze() {orange juice}
citrus C = new orance();
C.squeeze will give me orange juice, because although the reference in a citrus, the object is actually an orange.
My question is, under what circumstances will I get citrus juice?
For instance, will ((citrus)C).squeeze() give me citrus juice?My question is, under what circumstances will I get
citrus juice?
citrus C = new citrus();
C.squeeze(); // Will give you citrus juiceNow, you got me thirsty. :) -
Question on using CAST, MULTISET and TABLE
Hi,
I am trying to do something that is utterly meaningless, but I am studying the use of CAST with MULTISET and TABLE.
I have created a type: a Nested Table of Number values:
create type numTable as table of number;
Now I perform the following query:
select d.dname
, ( select avg(column_value)
from table
( cast( d.salaries as numTable)
) Department_Avg_Salary
from ( select cast
( multiset
( select e.sal
from emp e
where e.deptno = d1.deptno
) as numTable
) salaries
, d1.dname
from dept d1
) d
I had expected to see each department name and the average salary within that department. Instead, I see the same Department_Avg_Salary value for each row - the average of the first department:
DNAME DEPARTMENT_AVG_SALARY
ACCOUNTING 1875
RESEARCH 1875
SALES 1875
OPERATIONS 1875
However, when I change the query to the following:
select d.dname
, d.salaries
from ( select cast
( multiset
( select e.sal
from emp e
where e.deptno = d1.deptno
) as numTable
) salaries
, d1.dname
from dept d1
) d
I get the following result - note that each department shows the correct list of salaries, not the list of the 1st department's salaries over and over.
DNAME
SALARIES
---------------------------------------------------------ACCOUNTING
NUMTABLE(2450, 1300)
RESEARCH
NUMTABLE(800, 2975, 3000, 5000, 1100, 3000)
SALES
NUMTABLE(1600, 1250, 1250, 2850, 1500, 950)
OPERATIONS
NUMTABLE()
Can someone explain why the
, ( select avg(column_value)
from table
( cast( d.salaries as numTable)
) Department_Avg_Salary
does not give an average per department but instead only the first department's average?
thanks for your help!
regards
Lucas Jellemascott@ORA92> select d.dname,
2 (select avg(column_value)
3 from table (cast (d.salaries as numTable))
4 where d.dname = dname) Department_Avg_Salary
5 from (select cast (multiset (select e.sal
6 from emp e
7 where e.deptno = d1.deptno) as numTable) salaries,
8 d1.dname
9 from dept d1) d
10 /
DNAME DEPARTMENT_AVG_SALARY
ACCOUNTING 2916.66667
RESEARCH 2175
SALES 1566.66667
OPERATIONS
Maybe you are looking for
-
Cancel Billing document User Exit
Hi, The requirement at our client is as follows: In transaction VF02, if the user selects to cancel the billing document "Menu: Billing document->Cancel", then we need an user exit to check that, for a particular pricing condition if an accounting do
-
Can I set a time for music in iTunes to stop
I use an iPad to play my music to an Airplay speaker. I sometimes use the playlist on my iPad and if I want to increase my listening pleasure I would use Remote to play from my entire libray on the iMac. I've looked but can't seem to find any way of
-
All icons on my desktop show up as white sheets. The same document in the Finder shows the appropriate icon. At startup or when you drag something to the desktop, you see the right icon for a brief second before it goes white. Delete a plist somewher
-
Errors occur after installation of Oracle 8i
Because my computer is P4, so at the beginning I couldn't install the oracle 8.1.6 or 8.1.7 from CD-rom. I searched this forum, and according to the information I got, I changed the SYMCJIT.dll to SYMCJIT.old, and installation is done. However, at th
-
Can't my Exchange & Mac finally just be friends?! They still don't talk.
_+*REWARD TO WHOMEVER PROVIDES A WORKING SOLUTION*+_ Okay, maybe not, but now I got your attention: My office is running Exchange 2003 & I desperately want my iMac (internal in the office) to work with our Exchange Server 2003. I know that we have di