RE: More Java Questions Was RE: MAGic and COM

  • From: "Homme, James" <james.homme@xxxxxxxxxxxx>
  • To: "programmingblind@xxxxxxxxxxxxx" <programmingblind@xxxxxxxxxxxxx>
  • Date: Thu, 24 Feb 2011 16:06:45 -0500

Hi Dave,
I think I picked this next thing up without really realizing it. According to 
me, all classes have methods even if you don't code any of your own. The reason 
I say this is that I was looking at the java.lang package. Every class I saw 
said that it (not sure of the right term here) got some of its stuff from the 
one called Object. When I looked up Object, I saw that it has methods. I think 
that in the chapter after the one I'm on right now, we're going to learn how to 
make classes come with the stuff from other classes.

I'm just so technical. <grin>

Jim

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Dave
Sent: Thursday, February 24, 2011 3:15 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: More Java Questions Was RE: MAGic and COM

Hey Jim,

The way I like to think about it is from the bottom up.  Programs
running on your computer have a specific kind of memory layout;
entities within your java application (avoiding lots of detail here),
basicallyhave to be stored in memory in the form of bytes.  For
primitive types like integers, flota's, characters, etc you allocate
some number of bytes to store the value.  For example, for a 32-bit
integer, you need only 4 bytes.

When we talk about  classes, you bring in a whole lot of other
baggage.  Classes can have instance members and they all need to live
in memory somewhere.  They also have "functions" associated with them
in the way of class methods; that needs to be somewhere in memory as
well.  The class "Int" is just another class.

Naturally, one would ask why class "Int"?  Well, for one thing, it
allows us to attach members to integers that know how to operate on
integers.  Off the top of my head, another good reason for boxing is
that you can pass integers into a function as a reference type (if you
really wanted to).

Basically, it lets you treat primitive types as an object -- something
you can call methods on, pass around, etc just llike any other class.

On 2/24/11, Andreas Stefik <stefika@xxxxxxxxx> wrote:
> Jim,
>
> Another way to think about it is that the reason Java did this is
> because having primitives in the language potentially makes it faster,
> as you can store primitive values directly in a certain place in
> hardware called a "register." Essentially, the more data you can put
> in the registers the faster things go.
>
> And the automatic conversion Java does between primitives and objects
> has a standard name, which is "auto-boxing." I don't really know why
> that exact name was chosen, but it has sort of stuck in the
> literature.
>
> Stefik
>
> On Thu, Feb 24, 2011 at 9:28 AM, Homme, James <james.homme@xxxxxxxxxxxx>
> wrote:
>> Hi Kerneels,
>> Thanks for this. I'll re-read it a few times and see what happens. It
>> sparked one question. It sounds like a binding is something that
>> understands one language and how to say the same thing in another. But is
>> it usually a dll or just some code that gets called somehow when the
>> computer sees something going on? I'm sure that this question is badly
>> phrased, but I don't know the jargon.
>>
>> Jim
>>
>> -----Original Message-----
>> From: programmingblind-bounce@xxxxxxxxxxxxx
>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Kerneels Roos
>> Sent: Thursday, February 24, 2011 10:05 AM
>> To: programmingblind@xxxxxxxxxxxxx
>> Subject: Re: More Java Questions Was RE: MAGic and COM
>>
>> Hi Jim,
>>
>> I'll try and clear up your confusion.
>>
>> The thing is, Java isn't a *purely* object oriented language such as
>> Smalltalk for example, and hence you have so called primitive types such
>> as int (all lower case) which isnt' a class but the type of a variable
>> that can store an integer value.
>>
>> You can't call methods on an int variable because it's just a value. Now
>> there are some operations that best is classified as belonging to, and
>> acting on variables of type int, and hence these methods are placed in a
>> class called Int (capital I).  So, the class called Int (capital I) has
>> a member variable of type int (all lower case) and dealing with this int
>> is it's main obsession, hence they speak about the class Int (capital I)
>> being a wrapper class for the type int (all lowercase).
>>
>> Consider the following code:
>>
>> int i = 123;     // perfect, i is a primitive type int variable
>> Int objInt = 123;  // won't work, objInt is an object not a primitive type
>> Int objInt = new Int(123);  // ah, this works
>>
>> Primitive types don't have all the overheads of classes, or rather,
>> variables of primitive types doesn't have all the overheads associated
>> with objects of classes.
>>
>> Int.value is indeed of primitive type int and is inside class Int.
>>
>> I'm no expert on inter language operability, but basically it is
>> possible to interact with code written in another language from within
>> one language in many ways. They often speak of Python bindings to the wx
>> toolkit, or Java bindings to the XYZ language, meaning with those
>> bindings you can call methods created and compiled with the XYZ
>> language. JNI also has something to do with it, and COM is also a
>> technology on Windows for interoperability.
>>
>> And now my ignorance is probably starting to show way too much :-)
>>
>> C# brings in some extra confusion, with structs that can have
>> methods.... But don't worry about that, you are learning Java.
>> BTW, what's the point of structures with methods?
>>
>> Hope that was useful.
>>
>> Kerneels
>>
>> On 2/24/2011 4:26 PM, Homme, James wrote:
>>> Hi,
>>> I have so many holes in my programming knowledge. This idea of wrapping
>>> things also came up in my Java book yesterday, and they didn't satisfy my
>>> curiosity. I may not be re-phrasing it exactly the way they did, but it
>>> went something like this.
>>>
>>> The Int class is a wrapper for the int primitive type.
>>>
>>> I immediately went to the Java documentation and looked up the Int class.
>>> When I did that, it left me with more questions than answers.
>>>
>>> Here are my uneducated impressions to this point. Are they anywhere in
>>> the universe?
>>>
>>> The int primitive type is somewhere inside the Int class. That's why it's
>>> called a wrapper. Are they trying to say that the thing called int.value
>>> actually is a primitive type? Int.value is inside the Int class.
>>>
>>> When you use the term wrap in the context of this original message, how
>>> are you able to get one programming language to understand that it can
>>> use a piece of code and do something in another language? Can you put
>>> this in terms a 10 year old can understand?<grin>
>>>
>>> Why is a primitive type not a class? What does it need to make it a
>>> class? Is there some advantage to it being a primitive type as opposed to
>>> being a class? I can conceive of having a class with only data and no
>>> methods. Is that something that happens very often? I would think that a
>>> class like that should have setters and getters for the pieces of data
>>> that it wants to let other classes use.
>>>
>>> Thanks for your indulgence.
>>>
>>> Jim
>>>
>>> -----Original Message-----
>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Andreas
>>> Stefik
>>> Sent: Thursday, February 24, 2011 8:46 AM
>>> To: programmingblind@xxxxxxxxxxxxx
>>> Subject: Re: MAGic and COM
>>>
>>> Haden,
>>>
>>> Yes, that's what we've been building, is a C-wrapper to screen readers
>>> that you can connect to through Java. We haven't publicly released yet
>>> our JAR wrapper libraries, but the current build is used in the
>>> Sodbeans 2.0 trunk build. For example, to connect using our libraries,
>>> on windows, mac, or linux, using either JAWS, NVDA, Voice Over
>>> (Carbon), ORCA with Speech Dispatcher, Apple Say, or Microsoft SAPI,
>>> requires the following Java code:
>>>
>>> TextToSpeech speech = TextToSpeechFactory.getDefaultTextToSpeech();
>>> speech.speak("Hello, World!");
>>>
>>> You can also request, from Java, a particular speech engine. For
>>> example, you can request that you connect to JAWS, etc.
>>>
>>> We're planning on releasing that publicly in July or so, although the
>>> trunk build is actually pretty stable. For now, we're working to add
>>> pitch shifting of the TTS, better priority support for complicated
>>> streams of auditory cues (as we have on the Sodbeans project), and
>>> we're doing lots and lots of testing.
>>>
>>> Stefik
>>>
>>> On Wed, Feb 23, 2011 at 8:23 PM, Haden Pike<haden.pike@xxxxxxxxx>  wrote:
>>>> That's what I was referring too. It's under the MIT license. Correct me
>>>> if
>>>> I'm wrong, but if this library was written in C, could you write a
>>>> wrapper
>>>> to call it in java?
>>>> Haden
>>>>
>>>> On 2/23/2011 4:54 PM, Andreas Stefik wrote:
>>>>> Interesting, our libraries work very similar to accessible_output (it
>>>>> appears), and for that matter, SayTools, as well, although we all seem
>>>>> to support slightly different systems (our tools allow call-downs from
>>>>> Java and our language, Hop).
>>>>>
>>>>> I assume this is what you are referring to:
>>>>> http://pypi.python.org/pypi/accessible_output/0.5.5
>>>>>
>>>>> What License are you under?
>>>>>
>>>>> And yaa, I will have to look into screen magnifiers as well.
>>>>>
>>>>> Stefik
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Feb 23, 2011 at 3:40 PM, Haden Pike<haden.pike@xxxxxxxxx>
>>>>>  wrote:
>>>>>> That could work. We really need to rewrite at least the core of
>>>>>> accessible_output in C or C++, so we can write bindings for other
>>>>>> languages...
>>>>>>
>>>>>> I don't know much about magnification myself. That's something I'd
>>>>>> have
>>>>>> to
>>>>>> research prior to writing this.
>>>>>> Haden
>>>>>>
>>>>>> On 2/23/2011 3:58 PM, Nathaniel Schmidt wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> This might not be very useful, but if there is such an API for magic,
>>>>>>> would
>>>>>>> it make things easier to include it in a package like
>>>>>>> accessible_output?
>>>>>>>   I
>>>>>>> suppose then it would be limited to python, but it would be simple to
>>>>>>> use
>>>>>>> the magnification package, magnifier.magnify()? Of course I am
>>>>>>> writing
>>>>>>> this
>>>>>>> knowing not much at all about magnification, just throwing the
>>>>>>> suggestion
>>>>>>> out there.
>>>>>>>
>>>>>>> Nathaniel
>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>>>>>>> [mailto:programmingblind-
>>>>>>>> bounce@xxxxxxxxxxxxx] On Behalf Of Haden Pike
>>>>>>>> Sent: Thursday, 24 February 2011 7:09 AM
>>>>>>>> To: programmingblind@xxxxxxxxxxxxx
>>>>>>>> Subject: Re: MAGic and COM
>>>>>>>>
>>>>>>>> Maybe someone could write a cross-platform wrapper for the different
>>>>>>>> magnifiers.  Magtools, anyone?
>>>>>>>>
>>>>>>>> I'd do it myself, but it would have to wait until July at the
>>>>>>>> earliest...
>>>>>>>> Haden
>>>>>>>>
>>>>>>>> On 2/23/2011 1:59 PM, Andreas Stefik wrote:
>>>>>>>>> James,
>>>>>>>>>
>>>>>>>>> For example, really quick, what we would REALLY like to do is have
>>>>>>>>> a
>>>>>>>>> cross-platform bolding, highlighting, and magnification
>>>>>>>> infrastructure
>>>>>>>>> built into Sodbeans, so that users can magnify certain parts of the
>>>>>>>>> tool and that the magnification flexibly adjusts to whatever the
>>>>>>>>> user
>>>>>>>>> is doing (e.g., it follows you as you type, it focses when you hit
>>>>>>>>> a
>>>>>>>>> menu). So far as we can tell, so far, however, it seems like we'll
>>>>>>>>> need some kind of complicated wrapper API in C on each system, like
>>>>>>>>> how we connect to screen readers right now (which works, but is
>>>>>>>>> complicated).
>>>>>>>>>
>>>>>>>>> Anyway, maybe that puts our actual goal into context. Who knows,
>>>>>>>> maybe
>>>>>>>>> such an API already exists ...
>>>>>>>>>
>>>>>>>>> Stefik
>>>>>>>>>
>>>>>>>>> On Wed, Feb 23, 2011 at 12:48 PM, Andreas Stefik<stefika@xxxxxxxxx>
>>>>>>>> wrote:
>>>>>>>>>> I'm not sure. We definitely know about, and have looked at
>>>>>>>>>> SayTools.
>>>>>>>> I
>>>>>>>>>> forget, but I think it connects to JAWS, but not MAGic. I'll have
>>>>>>>>>> to
>>>>>>>>>> ask download and look again to make sure.
>>>>>>>>>>
>>>>>>>>>> If anything, what we really want to do is make magnification
>>>>>>>>>> easier/better in Sodbeans, as we're finding that Sodbeans is
>>>>>>>>>> working
>>>>>>>>>> great for the kids that are non-sighted, but there are a number of
>>>>>>>>>> ways that we think we need to improve for the visually impaired
>>>>>>>>>> community.
>>>>>>>>>>
>>>>>>>>>> Another possible route we could take is to bypass MAGic altogether
>>>>>>>> and
>>>>>>>>>> roll our own magnification system, although I've heard that this
>>>>>>>>>> is
>>>>>>>>>> difficult. Hmm ...
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Stefik
>>>>>>>>>>
>>>>>>>>>> On Wed, Feb 23, 2011 at 11:21 AM, Homme,
>>>>>>>> James<james.homme@xxxxxxxxxxxx>       wrote:
>>>>>>>>>>> Hi Stefik,
>>>>>>>>>>> I wish that wasn't the case. Do you think that maybe SayTools or
>>>>>>>> the other thing whose name I forget that Jamal created would help
>>>>>>>> you
>>>>>>>> at all?
>>>>>>>>>>> Thanks.
>>>>>>>>>>>
>>>>>>>>>>> Jim
>>>>>>>>>>>
>>>>>>>>>>> -----Original Message-----
>>>>>>>>>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>>>>>>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Andreas
>>>>>>>> Stefik
>>>>>>>>>>> Sent: Wednesday, February 23, 2011 11:08 AM
>>>>>>>>>>> To: programmingblind@xxxxxxxxxxxxx
>>>>>>>>>>> Subject: Re: MAGic and COM
>>>>>>>>>>>
>>>>>>>>>>> Kind of sort of, and I appreciate it. This is basically what we
>>>>>>>>>>> do
>>>>>>>> now
>>>>>>>>>>> to connect to JAWS, but because there is basically no
>>>>>>>> documentation, I
>>>>>>>>>>> was hoping folks knew of a library out there that we could just
>>>>>>>>>>> "connect" to, instead of figuring it all out again for this
>>>>>>>> particular
>>>>>>>>>>> set of DLLs.
>>>>>>>>>>>
>>>>>>>>>>> Sounds like we'll just have to slog through it, though.
>>>>>>>>>>>
>>>>>>>>>>> Stefik
>>>>>>>>>>>
>>>>>>>>>>> On Wed, Feb 23, 2011 at 5:51 AM, Homme,
>>>>>>>> James<james.homme@xxxxxxxxxxxx>       wrote:
>>>>>>>>>>>> Hi Stefik,
>>>>>>>>>>>> This is just a guess. I'm thinking that Magic has a dll like
>>>>>>>>>>>> JAWS
>>>>>>>> does. It may even use a copy of that dll to talk. Are you also
>>>>>>>> talking
>>>>>>>> about enlargement? I'm also thinking that you can get a demo of
>>>>>>>> Magic
>>>>>>>> to find out what's in it. I know that it uses the same scripting
>>>>>>>> language JAWS does. That language can do some stuff like get at
>>>>>>>> other
>>>>>>>> applications like IE, Word, Excel, and so on.
>>>>>>>>>>>> Does any of this rambling help?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks.
>>>>>>>>>>>>
>>>>>>>>>>>> Jim
>>>>>>>>>>>>
>>>>>>>>>>>> Jim Homme,
>>>>>>>>>>>> Usability Services,
>>>>>>>>>>>> Phone: 412-544-1810. Skype: jim.homme
>>>>>>>>>>>> Internal recipients,  Read my accessibility blog. Discuss
>>>>>>>> accessibility here. Accessibility Wiki: Breaking news and
>>>>>>>> accessibility
>>>>>>>> advice
>>>>>>>>>>>> -----Original Message-----
>>>>>>>>>>>> From: programmingblind-bounce@xxxxxxxxxxxxx
>>>>>>>> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Andreas
>>>>>>>> Stefik
>>>>>>>>>>>> Sent: Tuesday, February 22, 2011 4:56 PM
>>>>>>>>>>>> To: programmingblind@xxxxxxxxxxxxx
>>>>>>>>>>>> Subject: MAGic and COM
>>>>>>>>>>>>
>>>>>>>>>>>> Hey folks,
>>>>>>>>>>>>
>>>>>>>>>>>> Anyone have any experience connecting to Freedom scientific's
>>>>>>>> MAGic,
>>>>>>>>>>>> either through Java or COM? Any existing libraries out there to
>>>>>>>> make
>>>>>>>>>>>> this easy?
>>>>>>>>>>>>
>>>>>>>>>>>> Stefik
>>>>>>>>>>>> __________
>>>>>>>>>>>> View the list's information and change your settings at
>>>>>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> This e-mail and any attachments to it are confidential and are
>>>>>>>> intended solely for use of the individual or entity to whom they are
>>>>>>>> addressed.  If you have received this e-mail in error, please notify
>>>>>>>> the sender immediately and then delete it.  If you are not the
>>>>>>>> intended
>>>>>>>> recipient, you must not keep, use, disclose, copy or distribute this
>>>>>>>> e-
>>>>>>>> mail without the author's prior permission.  The views expressed in
>>>>>>>> this e-mail message do not necessarily represent the views of
>>>>>>>> Highmark
>>>>>>>> Inc., its subsidiaries, or affiliates.
>>>>>>>>>>>> __________
>>>>>>>>>>>> View the list's information and change your settings at
>>>>>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>> __________
>>>>>>>>>>> View the list's information and change your settings at
>>>>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>>>>>
>>>>>>>>>>> __________
>>>>>>>>>>> View the list's information and change your settings at
>>>>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>> __________
>>>>>>>>> View the list's information and change your settings at
>>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>>>
>>>>>>>> __________
>>>>>>>> View the list's information and change your settings at
>>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>> __________
>>>>>>> View the list's information and change your settings at
>>>>>>> //www.freelists.org/list/programmingblind
>>>>>>>
>>>>>> __________
>>>>>> View the list's information and change your settings at
>>>>>> //www.freelists.org/list/programmingblind
>>>>>>
>>>>>>
>>>>> __________
>>>>> View the list's information and change your settings at
>>>>> //www.freelists.org/list/programmingblind
>>>>>
>>>> __________
>>>> View the list's information and change your settings at
>>>> //www.freelists.org/list/programmingblind
>>>>
>>>>
>>> __________
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/programmingblind
>>>
>>> __________
>>> View the list's information and change your settings at
>>> //www.freelists.org/list/programmingblind
>>>
>>
>> --
>> Kerneels Roos
>> Cell: +27 (0)82 309 1998
>> Skype: cornelis.roos
>>
>> "There are only two kinds of programming languages in the world; those
>> everyone complains about, and those nobody uses."
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>>
>>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

Other related posts: