ToString and StreamTokenizer - general use questions

Hello everyone.
I am currently taking a class in Java at a NYC school, and got into an argument with the teacher regarding the proper use of the toString method and the SteamTokenizer class. He claims the following:
1. toString() methods are primarily for debugging - i.e., I defined this method in a class I created in order to better represent the class' state visually - and he marked that as wrong - since I was not using the method 'properly'.
2. I was using the StreamTokenizer class in order to read in user input from the terminal - and only perform something if values entered were numbers. He claims that my use of the class is inappropriate - since it "doesn't do what I think it does" - whatever that means.
I just wanted to see what people's feelings were on the proper use of the toString method and the StreamTokenizer class (in regards to reading user input). Thanks!

also on your last remark,
if the example you use the toString-method insteadof
the getAccountNumber-method: how is a developer to
know what the toString-method will give; that'swhat
I mean with vague. 'getAccountNumber' does notleave
much roam for imagination.Yes, but if you give the developer an API for your
program (if he can't see the code himself), the API
will (should!) tell him what toString will return.Maybe you work in a project where developers actually have time to do this. I agree that they should and that the API should always be up-to-date but I've never encountered a project where this is actually done.
Actually, I don't really understand your problem with this statement. Don't you agree that a method getAccountNumber should be created and that this should not only be returned by the toString-method. If you want your toString to return this value you can allways do this, for debugging purposes.
Another important argument; in these cases you do not excpect the toString to return important information that is called from other methods. What if another developer needs to debug and changes the debug-information? I know that where I work it's the first developer who would get blamed for this.

Similar Messages

  • Workflow and General Use Questions

    Hello,
    I'll apologize right off the bat for these novice question because I'm sure the information is probably somewhere in the forum, I just haven't been able to find it. I just purchased Aperture after completing the demo as my library is getting too large to manage using standard file folders. I'm now trying to figure out the best practices for workflow and general use before I invest some serious time into importing and keywording all my pictures.
    1) Store files in the there current location, or in the Aperture Library? It seems to me that once they are moved to the Aperture library, you can only access them from within Aperture. I'm thinking I would be better off leaving them in their current location. For one, if I want to quickly grab a picture as an attachment to an email or something it seems easier to grab it from the standard folders. Second (and more important) I do not have room to keep all my pictures on my Macbook, thus most of them are stored on the Time Capsule.
    So... Keeping photos in their current location appears to be the best choice for me even though it adds an additional step every time I bring in new photos from my camera. Does this sound right?
    2) Is there a way to mark the photos that I have uploaded to my website (Smugmug)? Ideally, I would like to badge photos that have already been uploaded so I can quickly recognize them and ensure I'm not duplicating. I've considered using the rating, or keywords to indicate that a photo has been uploaded but both methods have disadvantages.
    3) Any suggestions for general workflow and organization resources (tutorials, books, websites, etc.)? I've looked at the videos on Apple's site but they obviously didn't get that detailed.
    Thanks for the help, sorry for the length.

    I recommend to Manage by Reference with Master image files stored on external hard drives (note that Aperture defaults to a Managed-Library configuration rather than a Referenced-Masters Library). Especially important for iMacs and laptops with a single internal drive. The workflow as described below in an earlier post of mine uses a Referenced-Masters Library.
    I feel pretty strongly that card-to-Aperture or camera-to-Aperture handling of original images puts originals at unnecessary risk. I suggest this workflow, first using the Finder (not Aperture) to copy images from CF card to computer hard drive:
    • Remove the memory card from the camera and insert it into a memory card reader. Faster readers and faster cards are preferable.
    • Finder-copy images from memory card to a labeled folder on the intended permanent Masters location hard drive.
    • Eject memory card.
    • Burn backup hard drive or DVD copies of the original images (optional strongly recommended recommended backup step).
    • Eject backup hard drive(s) or DVDs.
    • From within Aperture, import images from the hard drive folder into Aperture selecting "Store files in their current location." This is called "referenced images." During import is the best time to also add keywords, but that is another discussion.
    • Review pix for completeness (e.g. a 500-pic shoot has 500 valid images showing in Aperture).
    • Reformat memory card in camera, and archive originals off site on hard drives and/or on DVDs.
    Note that the "eject" steps above are important in order to avoid mistakenly working on removable media/backups.
    Also note with a Referenced-Masters Library that use of the "Vault" backup routine backs up the Library only, not the Masters. Masters should be separately backed up, IMO a good thing from a workflow and data security standpoint.
    Max out RAM in your MB and keep the internal drive less than 70% full.
    Good luck!
    -Allen Wicks

  • Best Font for Subtitles? and other General Subtitling questions?

    I've never had to use subtitles, until my current project, so I am looking for some general advice and suggestions.
    I will be using PPCS3 (on XPpro) as the subtitles (as in the kind that translate a foreign language) will be permanent.
    So here are my questions:
    1. What is the best font and or what is the most standard font for subtitles? (Font size and other characteristics may be worth mentioning here too.)
    2. Is it possible to have an outline around the text as opposed to shadow?
    3. What are some general rules of thumb for subtitles that apply to broadcast and cinematic productions?
    Thank you.

    See also:
    FAQ:Why are my titles blurry/wrong?
    Cheers
    Eddie
    PremiereProPedia   (
    RSS feed)
    - Over 300 frequently answered questions
    - Over 250 free tutorials
    - Maintained by editors like
    you
    Forum FAQ

  • Aspire R11 (R3-131T): Locating the SSD and other general upgrading questions

    So, I managed to find the RAM with no problem, but I can't find the SSD. I'm starting to think it is just integrated into the motherboard, but at the same time, I'm told I can upgrade it.

    Questions:
    1) how do I upgrade the size of the SSD?
    2) there is this small area next to the motherboard. The void is filled with a metal brace. Can a SSD be placed there? And if so, how would I connect it to the motherboard?
    3) can the CPU or GPU be overclocked? I understand that there is no fans, so it would have to be minor overclocking.
    4) is there a way to increase cooling, whether that be via fan or heat sink?
    5) aside from the SSD and RAM, is there anything else that can be upgraded?

  • Question on iSetup and the files used

    All
    I have a customer on 115.10.2 and they are using iSetup to transfer data from their Hyperion DRM instance into their Oracle E-Business Instance.
    The customer is moving the key flexfields data from the Hyperion DRM Instance to the Oracle E-Business Instance and has a question on the format of the file that contains the data.
    The customer's file has all the fields that they want to upload into the Oracle E-Business Suite and this loads the data without any errors. However, the customer has concerns over the file and the fact that its structure is not a supported one.
    Therefore the question that the customer has is:
    The ldt file that the customer is using, does this have to be of a particular format/structure to be supported with iSetup when it calls the API's to load the data ?
    The customer was concerned that if the file that they were using was not of a specific format then they would not be supported when uploading the data, as it may be classed as customisation.
    Any help on this matter would be appreciated
    Rgds
    Tim

    updating forum for benefit of other users:
    -----mail snip-------
    Generally at the beginning of a data file (LDT), a dbdrv hint comment will specify the configuration file (*.lct file) to be used for uploading this data file. You should use a compatible LCT file (some times version is also important).
    When data is downloaded using the loader, it writes out the entity definition for each unique entity type that was downloaded in the DEFINE block. Though not used while UPLOAD, it is a ready reference to validate the structure of the LDT.
    During Upload, loader parses the config file (lct file) to get entity definitions for the data records
    Hope this helps.
    Thanks,
    Roopesh R
    -----mail snip-------

  • Can I use coherence as follows? (General architecture question)

    I'm working on creating a "web service" that will typically
    - Receive a request and log it.
    - Process
    - Reply to "client" and log it.
    The idea is to put the logs into the grid and finally to SOR?
    Of course the logs need to be parsed, searchable etc...
    Does the above make sense?
    And some general questions...
    If coherence is configured as partitioned do you really need a SOR, can it replace the SOR?
    Can I have coherence running on seperate machines and the web service on other servers?

    It makes perfect sense.
    You can use a CacheStore to asynchronously ("write behind") to write your log entries to the system of record. You can implement a LogEntry class which would wrap the log messages, and expose getters for the attributes you wished to query by. You can configure an evication policy to determine how long LogEntry's should remain in Coherence.
    So long as you have sufficient memory for the amount of data you wish to store (and backups, if necessary), yes Coherence can replace your SOR.
    Yes, Coherence can run on different servers. Your web service layer can be configured as a "storage disabled" cluster member, or connect to the cache servers using Extend.

  • NI 6008 - Questions on the C APIs and how to use them

    Hi
    I am trying to use the NI 6008 to drive a Digital Programmable Attenuator and had a few questions. I am newbie with this device, so most of my questions are relating to figuring out the basics with this device.
    1) I am hoping to be able to write a simple C program to have the NI USB 6008 drive this Digital Programmable Attenuator. Is this possible? I could find the NI-DAQmx C Reference Help file, but I cant seem to find how to build and load a program onto the NI USB 6008?
    2) I would like to be able to turn ON a particular attenuation setting on the Digital Prog. Atten. at a specific instant and after a few milliseconds turn it OFF. And repeat this endlessly. I was looking for a Timer API to let me control the Digital Prog. Atten. at set timer interrupts but I am not sure if there is a way to do this. I see the APIs: DAQmxCfgImplicitTiming and DAQmxCfgSampClkTiming. But I am not 100% sure if these are the right APIs to use for this purpose. Also which APIs can I use to set the Digital lines in the DAQ to highs and lows?
    Like I said earlier, I am a newbie with this device and I am not really sure if I am going in the right direction. Any help would be greatly appreciated.
    Thanks
    Anand

    You do not load a program onto the device. Your program runs on your pc and you build your program that calls the DAQmx functions.
    There is no clock for for the digital I/O. As the spec says, it is strictly software timed which means you explicitly write a true or false, one state at a time. This is subject to jitter from Windows and I would not expect rates above 100 Hz.

  • HT4623 in settings and then general i do not have the option of software update...? How do I know if I am on IOS6 I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyo

    in settings and then general i do not have the option of software update...? How do I know if I am on IOS6 I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyone help

    stell80 wrote:
    in settings and then general i do not have the option of software update...?
    That is only present if you have already updated to iOS 5 or later.  If you're on iOS 4 you can only update while connected to your computer's iTunes.
    stell80 wrote:
    How do I know if I am on IOS6
    Settings/ General/ About
    stell80 wrote:
    I also seem to be having trouble trying to use icloud i think this is because my apple id is not in the form of an email address...? can anyone help
    You can't access iCloud from your iPhone unless you're on iOS 5 or later.  Otherwise, refer to this article:
    http://support.apple.com/kb/HT4436

  • Validation Script for Dates and General Event Questions

    I have just started using Javascript, and am now using some objects and methods etc. that I did not even know about. It's progressing rather well, now I need to know some Livecycle Designer Basics that I can't seem to answer from my searches.
    Here's what I am trying to do in English:
    I want users to choose a date that they will miss at our Farmers Market. I have the date field on the form - works well.
    I want to validate the entry for:
    The date must be today or in the future
    AND
    The date must be before the closing date
    AND
    The date must be a Saturday
    Here's some script I've written and placed in the Validation Event (I have actually written more for testing out that the results are coming out properly):
    ----- form1.#subform[0].Missdate::validate - (JavaScript, client) ----------------------------------
    var entereddate = this.rawValue;// The date vendor will not attend as entered on the form
    var dentry = new Date(entereddate.slice(0,4),[entereddate.slice(5,7)-1],entereddate.slice(8,10),0,0,0); // month starts at 0!
    var closingdate = "October 04,2008" // closing date of the market
    var today = Date();// today
    (dentry.getDay() = 6);// and attempt to validate that the day = Saturday - nothing happens!
    But now -
    How do I actually validate this - my last statement seems to be ignored. How to I force a 'false' being returned? In Formcalc I simply put a camparison statement here and if it resulted in 'False' validation failed and if it resulted in 'True' it passed - What's the JS equivalent? Or are the variables giving me troubles?
    Maybe I'm putting this in the wrong Event? If so which one should I place it in.
    I want to force the user to enter the correct data - how do I code this - and put in a custom message refering to this. I may even get fancy and ask the user if the next Saturday is what they meant if they enter the incorrect one (this will be a real challenge!)
    I think I'm lacking some basic knowledge here that other posts have assumed. Please refer me to any help pages as well - although I've done extensive searching on this and have not really found a good explanation of Validation - only specific pages that are not basic or general enough for my understanding. Thank!

    In the validation script you have to allow the field's length to be 0, or
    it will not be possible to clear it...

  • Quick Question: When to use ( ) and when to use [ ] and why the ( *)

    Hi all,
    A quick question that i'm sure is very simple but is slightly confusing me. I've just started trying to learn Objective-C and am a little confused by ( ) and [ ].
    I get that you use the [ ] brackets when you want something specific from an object, i.e.
    [ textField textColor ]
    and that you use ( ) brackets for things like:
    if ( x == y) {
    But I get confused when I see things like:
    NSLog(@"some text here");
    Why does that get ( ) brackets and why is it not [ ].
    Also another point of confusion, creating methods... Why are some methods done like:
    - (void)awakeFromNib
    And others done like (with the additional "*" added):
    - (NSString *)stringvalue
    As I said, I'm sure this is very simple and obvious, but it is confusing me slightly.
    Thanks in advance!

    Adam:
    As you already know, square brackets are used to send a message to an object, so if a object like myObject implements the method -doSomething, you can call it with:
    \[myObject doSomething\];
    The other use square for brackets have is to index C-style arrays, such as:
    aValue = anArray\[10\]; // Get the 10-element of an array
    However, because C-style arrays are rarely used in Cocoa applications (use NSArray instead) you will not see this situation often.
    Parenthesis in expressions are used to group and prioritize, such as:
    x = 10 * (3 + 5); // x = 80
    If () statements use it to delimit the test expression. Same with while (). for () uses it to enclose the limits and increment statements, etc.
    The other important use of parenthesis is in calling a C function:
    result = foo(3);
    means that you are calling the function named foo with the argument 3, and storing the the return value in the variable 'result'. This is different from a message because a C function is not a method of an object. They exist independently of any objects. NSLog() is a function defined within Cocoa but it is not a method. So, you call it with the traditional C function call syntax. Cocoa defines other functions like NSStringFromRect(), which takes an NSRect as argument and returns a pointer to an NSString.
    And that leads me to your last question. Some methods return simple types, like int, float, or void (i.e. returns no value). These methods will have prototypes like:
    \- \(void\)returnNothing;
    \- (int)returnInteger;
    Other methods return pointers to types, like:
    \- (int \*)returnPointerToInteger;
    \- (void \*)returnPointerToAnything; // In obj-C one typically uses id instead of void*
    Returning whole objects from methods has problems and it is better to just return a pointer (the address in memory) instead:
    \- (NSString *)makeAString;
    The method above returns a pointer to an NSString rather than the entire object.
    Good luck with your learning,
    Juan-Pablo
    Message was edited by: Juan Pablo Claude

  • I have asked this question before, and had a useful reply, but I have the same problem. I cannot unlock the screen from landscape

    How do I unlock the screen on my mini Ipad which is stuck on landscape? I have a green tick in 'lock rotation which I cannot remove. it asys 'use slide switch to ......., but where is the slide switch?

    What version of iOS do you have on your iPad (Settings > General > About > Version) ? Depending upon the version that you have you may have a Settings > General > Use Side Switch To setting on your iPad :
    In the above image the switch on the side of the iPad above the volume control will rotation lock - so putting that side switch 'on' on the side of your iPad will give you an image of 'rotation lock' in the middle of your iPad's screen for a second or so :
    and you should get a lock symbol at the top of the screen next to the battery indicator, and putting the switch 'off' will give an unlocked image in the middle of the screen :
    and the lock symbol will disappear from the top of the screen.
    If you have the 'mute' option ticked on the above image then you will get a bell icon with/without a line through indicating whether you've muted/unmuted notifications.
    As there is only one side switch and 2 things that it could control, the function that the switch isn't controlling (i.e. the unticked option in my first image on this reply) will be controlled (if your iPad is on iOS 5 or 6) via the left-hand end of the iPad's taskbar (double-click the home button to open the taskbar and the slide that taksbar to the right), or (if your iPad is on iOS 7) via Control Centre (swipe up from the bottom of the screen to open it)

  • Since the IOS 5 update my iPad seems to run a lot slower connecting to websites and general use? Can anyone help?

    Since the IOS 5 update my iPad seems to run a lot slower connecting to websites and general use? Can anyone help?

    Digging a little deeper on here, and I've Cleared the Safari cache, and rebooted , so i'll see if it is any better!!!!!

  • Is it better to export an iMovie project as QT and use Toast to burn a DVD for general use or to export to iDVD and burn VD from there?  Why?

    Is it better to export an iMovie project as QT and use Toast to burn a DVD for general use -  or to export iMovie project to iDVD and burn DVD from there?  Why?

    Toast probably maintains better quality if you are just doing simple conversion direct from your camera straight into Toast and then to DVD. There's a lot less transcoding steps and loss of quality in that direct to DVD disk creation in Toast. However, having said that,...There's good arguments probably for both.
    What I've seen promoted most often (as most people don't have Toast or aren't motivated to buy it) is to Share to Media Browser (choose the Large size option) and then from inside iDVD click the Media Button and the Movies button to find the project under the iMovie star icon in the Media Browser window. Drag that project into your iDVD project and burn the disk.

  • Using illustrator for iOS graphics and frame animations (beginner question)

    Hey there,
    Just want to get some opinions and advice.
    We are developing a sidescolling 2D game and I am creating 2D graphics in illustrator, ...so far so good, at this point in time I have a few characters designed.
    Now for the character poses, positions and frame by frame animations.... hmmmm.
    I have been searching for examples of ways to create character movements and positions in illustrator but as of yet have not found any good examples or explainations.
    Would anyone care to share (or point me to some examples) of workflows you use to create different poses and character postions using illustrator...
    (eg. should I be importing my artwork into flash to use the bone tool? Or should I create each variation in illustrator by copying my character and manipulating)

    Though the people I have talked to are using solely illustrator to do just that!?
    Maybe the people you've talked to just haven't taken opportunity to familiarize themselves with Bones. The artwork for cartooney walking animations can be done fairly easily in a drawing program, using Blends, Transform Again etc. So in many cases it's just not a big deal either way.
    What is the advantage of using just illustrator to create animations, I'm guessing that its because the drawing tools available are superior to flash?
    To me, it's not so much about "superior" drawing tools in a drawing program; it's more about a more complete set of drawing tools and commands. Flash has a Bezier drawing tool that works fine, so you can draw paths with control. But creating Blends on paths is just more convenient to do right on the page, without involving a timeline, keyframes, etc. Brushes and Transform Effect make it easy to repeat a series of objects. Flash's continual on-the-fly autotracing and auto merging of overlapping unselected and ungrouped objects can be cumbersome while drawing.
    See this example. Then click the Construction Notes link below it to view a 2-page PDF that shows how the majority of the artworks was accomplished with just two very simple ArtBrushes used in combination with pathBlends. That kind of stuff is often just easier/quicker to do in a drawing program, release to layers, and then copy/paste or otherwise import to Flash.
    Using Blends in AI for things like this experiment can save alot of tedium and time, as compared to working only with Flash's drawing tools. (Notes here.)
    Some things just can't be done with only Flash's drawing tools. Envelope distortions, for example, can be blended to create frame-by-frame shape tweens that would be difficult to do with just Flash's native tools, as in this experiment. (The animation is embedded on Page 11 of the PDF; you may have to click "Trust this host one time only" in Reader and then click the middle of the page to get it to play, depending on your OS version.)
    But as a general rule whenever using a drawing program in conjunction with Flash, avoid using more than ordinary flat fills and stokes in the drawing program before importing the paths to Flash. If you want to involve grads, shadows, transparency, etc., you'll generally be better off adding those things in Flash. Such effects are not the same constructs in different programs, and will most likley become rasterized in Flash (as is the case in the last example, above).
    So again, it depends on specifically what you are trying to do.
    JET

  • I am passing on my ipod touch 4th generation to my husband. I restored it so he could put in his own data but it keeps asking for my passward and it is using my segurity questions. How can he change that?

    I am passing on my ipod touch 4th generation to my husband. I restored it so he could put in his own data but it keeps asking for my passward and it is using my segurity questions. How can he change that?

    Whose account id shows in Settings > Store (Settings > iTunes & App Stores if it's on iOS 6) ? If it's yours then tap on it and log out of it, and your husband can then log in with his account

Maybe you are looking for