Override Question

this is my code.
import java.io.*;
import java.security.*;
import javax.crypto.*;
import javax.crypto.spec.*;
public class TextEncryptor implements Encryption, Cloneable, Serializable {
     String encryptedFileName;
     String userText;
     boolean successfulEncryptionPerformed = false;
     KeyGenerator kg;
     SecretKey skey;
     SecretKeyFactory skf;
     DESKeySpec dks;
     Cipher c;
     CipherOutputStream cos;
     PrintWriter pw;
     public TextEncryptor(String encryptedFileName, String userText) {
          this.encryptedFileName = encryptedFileName;
          this.userText = userText;
     public void generateSecretKey() {
        try {
          kg = KeyGenerator.getInstance("DES");
          kg.init(new SecureRandom());
          skey = kg.generateKey();
          skf = SecretKeyFactory.getInstance("DES");
        }catch(Exception e) {
          e.printStackTrace();
     public void initialiseCipher() {
        try {
          Class spec = Class.forName("javax.crypto.spec.DESKeySpec");
          dks = (DESKeySpec)skf.getKeySpec(skey, spec);
          c = Cipher.getInstance("DES/CFB8/NoPadding");
          c.init(Cipher.ENCRYPT_MODE, skey);          
        }catch(Exception e) {
          e.printStackTrace();
     public boolean performEncryption() {
        try {
          cos = new CipherOutputStream(new FileOutputStream(encryptedFileName), c);
          pw = new PrintWriter(new OutputStreamWriter(cos));
          pw.println(userText);
          pw.close();
          successfulEncryptionPerformed = true;
        }catch(Exception e) {
          e.printStackTrace();
          return successfulEncryptionPerformed;
     public DESKeySpec getDESKeySpec() {     
          return dks;     
     public Cipher getIV() {
          return c;
     public boolean equals(Object o) {
          if(o == null) {
               return false;
          TextEncryptor te;
          try {
               te = (TextEncryptor) o;
          }catch(ClassCastException cce) {
               return false;
          return (encryptedFileName.equals(te.encryptedFileName)) && (userText.equals(te.userText));
}My question is since the only two variables that can be set (in th constructor) are encryptedFileName and userText, do i need to override the clone() method, as these two variables are immutable(strings), but what about the other variables, these are always set to the same values in the methods listed above.please help,
thanks

My question is since the only two variables that can be set (in th constructor) are encryptedFileName and
userText, do i need to override the clone() method, as these two variables are immutable(strings), but
what about the other variables, these are always set to the same values in the methods listed above.please
help,
thanksWell, if you implement Cloneable, then you really should implement clone(), otherwise it doesn't make much sense. Even if you do implement it just as
public Object clone() {
    return super.clone();
}

Similar Messages

  • FORMCALC (or JS) Default date today with user override questions

    I have a date field where if null, I want today to be inserted. If the user overrides the today date and saves the form, I want the user entered date to stay.
    What I have in FORMCALC is:
    if ($.isNull)
    then
    $.rawValue = num2date(date(), DateFmt(2))
    endif
    The first part works, it populates with today, and I can overrided the date. When I save and then reopen the form, the date is "0".
    Any ideas here?

    I'm having the same problem as described above but I am using JavaScript to reflect the current date:
    var msNow = (new Date()).getTime();
    var d1 = new Date(msNow);
    this.rawValue = util.printd("mm/dd/yyyy", d1);
    The user can override the current date and save the form, BUT when the form is reopened it will run again and insert the current date over the user entered date.
    (I've tried several variations of "if (this.isNull)" to the above code which results in "01/00/0000" when opening the saved form --so it still doesn't retain the date entered by the user.)
    Does anyone know what code I need to add to to keep the user entered date that was saved with the form? Or if there is a better way to make the date calendar default to today, allow user override and save that user entered date on the form?

  • UIComponent override question

    within my custom UIComponent when I want to addchildren, should I always be overriding and using the
    protected function createChildren ?
    I notice I can use addChild anywhere without overriding the protected createChildren function and it still works.
    Should I not be doing this ?
    Thanks

    It depends on what purpose you are trying to addChild().
    If you are doing that initially while creating the component only then it's better to use createChildren() function, but id you are tring to add child for displayng some data, say like list components or so, then try to use updateDisplayList() method.
    cause, as far as I know, createChildren() method gets called when the component it self is added to display list, that is only single time, and updateDisplayList() gets called whenever th component needs to get updated.
    Hope, this should help u

  • Button Override Question Encore CS5

    Hey everyone.
    I have added chapter points to a single timeline and then linked these chapter points to corresponding menu buttons. These chapters will be viewed via the Chapter Selection menu.  After a chapter has been watched, I want the user to be returned to the Chapter Selection menu. So, I set the Override for the menu buttons to return to the menu.
    But, this does not work
    SO ...
    How do you create Chapters in a single timeline and have the user return to the Chapter Selection menu once the chapter has been viewed?
    thanks

    I did not look a second time, but if you did what you said, it should work. But overrides can be tricky.
    However, the current two methods most recommended (for DVD, the first does not work on bluray) is
    1) to create a single chapter, chapter playlist for each chapter, with an end action on each chapter playlist to return to the menu.
    or
    2) make each chapter its own asset (from Premiere), and its own timeline. Then each chapter is a timeline (and the timeline end action is to the menu), and you make a playlist (not a chapter playlist) for the play all.
    Their are no overrides and no end actions on chapters.

  • Inheritance/Overriding question

    Morning :)
    Here is my situation. I have the following situation, within the same package
    Class C, with a protected method doStuff(int x), and a public startStuff() method. This startStuff method calls the doStuff method.
    Class IC, which extends C, which also has a separate protected doStuff(int x) method, and a public startStuff() method
    I am instantiating an object of class IC, and calling the startStuff method, which first calls super.startStuff(), which in turn (in my mind) should call the doStuff method within Class C, but it isn't. In the stack trace, I can see Class C.startStuff being called, but when it gets to the doStuff method, it invokes the one in class IC, which isn't what I want.
    Any way for me to fix this, or am I going about it all wrong?

    I think you are talking about something like this :
    public class SuperClass
         protected void doStuff()
              System.out.println("doStuff in SuperClass");
         public void startStuff()
              System.out.println("startStuff in SuperClass");
              doStuff();
    public class SubClass extends SuperClass
         protected void doStuff()
              System.out.println("doStuff in SubClass");
         public void startStuff()
             super.startStuff();
              System.out.println("startStuff in SubClass");
         public static void main(String args[])
              SubClass aSubClass=new SubClass();
              System.out.println("This is main ");
              aSubClass.startStuff();          
    }What is happening here (why doStuff() in SubClass is getting invoked)is as follows:
    We invoke any method on a target reference(i.e.aSubClass.startStuff()),the invoked method has a reference to the target object so that it may refer to the invoking(or target )object during the execution of the program.That reference is represented by this.
    In method overriding the instance method is chosen according to the runtime class of the object referred to by this.So during the execution of statrStuff() in SuperClass , the doStuff() is invoked on the this reference that is the actual run time type of the target object i.e. SubClass.
    That's why doStuff() in SubClass is getting invoked.
    If you want to invoke SuperClass.doStuff(),declare doStuff() as class method (Static) in both the classes.The class methods are not invoked by the runtime class of the object,because these are not related with any instance od a class.

  • Web sharing & 403 Firbidden, one more time

    I've read, to varying degrees of understandability, various articles and help files on the 10.5 web sharing issue. I've tried & failed. I've come to the article below, which I think states clearly why web sharing does not work out of the box with 10.5.5. I want to follow the ix it offers, but, as with so many other articles, it talks a level or 2 above my expertise.
    My questions include:
    • How do you "Navigate to the Apache2 user configuration directory"? What does that mean?
    • What is "cd /private/etc/apache2/users"? Is it a file? Is it something you type in Terminal?
    • What it "tee"?
    Questions go on along these lines until the end of the article; in short, is there a how-to for Apache / Terminal beginners. The overriding question is, why hasn't Apple addressed the web sharing snag by the 10.5.5 iteration of the OS?
    FYI I am hung up on web sharing directly due to my move from Palm to iTouch as PDA. With the Palm Zire31 I was able to do light word processing, and did hundreds of paragraphs with it; also as a reader, and reads tens of thousands of articles on it. I want to do the same with the iTouch. To that end I've duly downloaded and installed BookZ and eReader, to enable me to move articles back & forth from the iTouch to my new iMac, to be blocked by the dreaded 403 error.
    After reckoning this problem I hope a 3rd party will come out with a real light WP app like that for the Palm: WordSmith.
    Here's the article-
    Configure Apache Web Sharing for user accounts in Mac OS X 10.5 Leopard:
    http://www.gigoblog.com/2007/11/08/configure-apache-web-sharing-for-user-account s-in-mac-os-x-105-leopard/
    Someone please help me.

    Leopard web sharing works just fine out of the box (well, it does for me anyway), although if you updated from Tiger rather than doing a fresh install (not really a good idea for new OS version), you may get the 403 error. Once turned on, it is as simple (?) as dropping files into your user's Sites folder.
    That article is horrible - I don't know what the heck they are doing using a utility such as tee to edit configuration files. For stuff like this, the free text editor TextWrangler works as well as shell utilities (especially for those not comfortable with them), and it can also navigate to and open those normally hidden files.
    As for Apache, it is industrial strength, so there is a lot of stuff you can do with it (don't ask me, I'm just a duffer). The default websites on your computer (as shown in the System Preferences > Sharing > Web Sharing pane) have links to the documentation on your computer, or you can wander around and find other references such as Apache DevCenter.

  • What folder is the music library stored in?  If all music, why 1 folder?

    When I loaded music from CDs into the Library, or downloaded from the itunes store into that same library:
    1.The overriding question is whether this music is always loaded into 1 file folder, specifically which one is it (\my music or is it \my music\itunes or something else), and why would it be in more than that one folder?
    2. for a backup of my library - why can't I just copy that onto my external harddrive (instead of doing as article 1751 suggests which is to back up the library by consolidating the library to one folder)?
    I'm just trying to understand this.
    Thank You for your help!!!!
    Windows XP

    tom111 wrote:
    When I loaded music from CDs into the Library, or downloaded from the itunes store into that same library:
    1.The overriding question is whether this music is always loaded into 1 file folder, specifically which one is it (\my music or is it \my music\itunes or something else), and why would it be in more than that one folder?
    Unless you have changed something, new rips and iStore purchases go into MyMusic\iTunesFolder\iTunesMusicFolder
    2. for a backup of my library - why can't I just copy that onto my external harddrive (instead of doing as article 1751 suggests which is to back up the library by consolidating the library to one folder)?
    If you are sure all your music is in the folder we just talked about, you can skip the Consolidate step. If you have any music in other folders, due to manual activity, ripping with other programs, etc, then Consolidate will put a copy into the iTunesMusicFolder, which prevents it from getting lost when you move the library.
    I'm just trying to understand this.
    No problem. That is the purpose of this Forum. (-:

  • Need to use DSL vs. Airport but can't connect

    I could not find the answer to this, and I'm sure it's probably an easy fix, but I have tried to connect via my DSL router -- instead of my airport and it won't connect. Large downloads (like movies) can take a while, and HD movies are not smooth-playing, so I wanted to use a direct connection to my DSL router instead of my WiFi/Airport. I disconnected the ethernet cable from my router and put it in my laptop (MacBook Pro 10.6.3), no connection. There is a connection called ethernet in my config). I'm not sure how to set it up otherwise (DHCP??) (think I had help last time) but my overriding question is, shouldn't I be able to go back and forth? I plugged in the ethernet cable and rebooted the laptop, thinking it would automatically recognize it, but it didn't. I didn't see anything else that needed to be hooked up. Am I missing a cable? Do I need to use a firewire from my laptop to the router? Do I need to manually set up the DSL each time I want to use it vs. Airport?
    Thank you!!
    Mary

    This is an excerpt from Snow Leopard Help on how the network preference pane works:
    "You can connect to the Internet or a network in several ways (using a modem, AirPort, or Ethernet, for example). If you have multiple active network port configurations, Mac OS X tries the configuration at the top of the list first, and then tries the other port configurations in descending order when you attempt to connect to the Internet."
    I connect with a DSL using PPoE, and I have a port for PPoE and a separate one for Ethernet in my network preference pane. You may find FAQ on your provider's site that will give you the type of connection you have.

  • Pre-amp and mic recommendation

    for a while now I've been recording vocals from my condenser mic directly into the pre-amp on my presonus firebox. im told that in many cases, to get the best out of your mic, it's not necessarily the quality of the mic but the quality of the pre-amp. i spoke to someone earlier who mentioned that the pre-amp on my firebox probably isnt the best for direct mic input. he said i would definately benefit from some sort of pre-amp between my mic and my firebox.
    can anyone recommend a good, affordable pre-amp for the home studio? better yet, can someone confirm what ive been told?
    also considering getting a new mic altogether... im eyeballing the SE electronics z3300a multi-pattern mic. any vouchers or recommendations for good mics in the home studio? I'll be bumping up from an unimpressive m-audio nova condenser mic.
    thanks!

    hey fellas---
    thanks for the replies. to answer some of the overriding questions:
    budget: I'd probobly like to keep in in the range of a few hundred dollars, no more than a grand. if i can get a better sound out of my existing mic by getting a decent pre, that'd be ideal. if i need to upgrade mics, that might take time. still, trying to keep it around $500-$800.
    application: EVERYTHING. anything from male vocals to voiceover work to film ADR to acoustic guitars. everything EXCEPT drums. wont be doing any drum or percussion micing anytime soon. lots of acoustic instruments like guitar and solo violin. might also, if its doable, run electric guitar and bass through the pre-amp if that will help with my electric guitar signal (like i said with the mic, the e-guitar is going straight into the instrument input on the presonus firebox, nothing between to sweeten, warm, or strengthen the signal consistently).
    preference: a clean, dry sound with faithful reproduction. but to be honest, i wouldnt mind a little warm colouring. something with a stronger bass response, but still accurate and faithful mids and highs.
    its been suggested to me that i stick with solid state mics for now, but a tube pre-amp wouldn't hurt. I've got a tube preamp, but im not happy with it so i havent used it in ages (the ART Tube MP Studio V3)
    Thanks!

  • 30EA2 - refuses to unload results into new file

    With ver 3.0.02.83 I'm getting "Not writable" message every time when I try to unload the results into a new file. SqllDeveloper refuses to write to a new file and I have to preallocate it first and then answer yes on override question.
    Does anybody else have the same situation?

    On what OS version?
    K.

  • Question on Quide resolution with SD override set

    I have a question concerning SD override and Quide resolution.
    I gather that the Quide resolution is whatever is set with "SD Override?"  
    I have SD Override set to 480 as that gives the best overall SD experience.   I don't mind the ocassional hiccups as the STB and TV resynch between 480 and 1080 and back.   I was just curious to know if I could keep the guide in 1080 and reserve 480 only for SD channels.  I can't find anything in the menus.
    I have the Cisco STB with 1.9.7 build 19.46 software.
    Thanks!

    Hello!
    Thanks for the reply!
    Yes, you are correct -- the Cisco STB is a HD box.   I have it connected to my 40" RCA HD TV with a HDMI cable.  I watch a mix of SD and HD channels -- and since Verizon and Weather Channel have yet to work out a deal to give local weather on HD, I have to go to the SD Weather channel or SD Weatherscan to see local weather reports.
    My curiosity is that SD PQ looks best when setting "SD Override" in the STB's video settings to 480i or 480p as opposed to "off" or "stretch."   Doing this however, puts the guide in permanent SD mode even though I have the STB guide settings set to display the guide in HD as opposed to SD.  HD channels appear as HD regardless of how I set "SD Override".   The guide doesn't look all that hot in SD mode with my TV.
    So, I have "SD Override" set to "stretch" and improved things a bit on viewing SD on my HD box by reducing the video sharpness settings, that is, moving to soft settings, on both the STB and the TV.  High sharpness settings actually makes the SD PQ worse.
    The other strange thing is that I get text flicker with some SD channels -- like text on Weatherscan, sports scores, etc. -- but I can correct that simply by turning the STB off and then on again while keeping the TV on.  Viola!  The STB and the TV synch up right and the annoying flicker goes away.  It will stay that way so long as I keep watching SD channels.   I stray to a HD channel, go back to SD, and the flicker is there again.  I simply power-cycle the STB and it clears up.   By power cycle I don't mean a reset, simply turn the STB off and back on again while the TV is still on.  That I can't figure out.
    Just curiosities.  I figure Verzon and co. doesn't have the chance to improve things unless we give good feedback.

  • QoS Override Per-SSID Bandwith question

    Hi all,
    on a WLAN there is the possibility to override the QoS Bandwidth settings.
    I try to get some more information about these settings, I want to understand this. As well a customer wants to limit user data.
    My question is: This override Per-SSID, are these settings on a AP basis or on the global controller basis?
    The next question resulting out this will then be what if the AP is set to flex-connect with local VLAN traffic, what then?
    Is there a good documentation on this?
    Thanks.

    This section describes BDRL of the 7.3 release. In releases 7.2 and earlier, there is only the ability to limit the downstream throughput across an SSID and per user on the Global interface. With this new feature in the 7.3 release, rate limits can be defined on both upstream and downstream traffic, as well as on a per WLAN basis. These rate limits are individually configured. The rate limits can be configured on WLAN directly instead of QoS profiles, which will override profile values.
    This new feature adds the ability to define throughput limits for users on their wireless networks with a higher granularity. This ability allows setting a priority service to a particular set of clients. A potential use case for this is in hotspot situations (coffee shops, airports, etc) where a company can offer a free low-throughput service to everyone, and charge users for a high-throughput service.
    Note: The enforcement of the rate limits are done on both the controller and AP.
    Rate limiting is supported for APs in Local and FlexConnect mode (both Central and Local switching).
    When the controller is connected and central switching is used the controller will handle the downstream enforcement of per-client rate limit only.
    The AP will always handle the enforcement of the upstream traffic and per-SSID rate limit for downstream traffic.
    For the locally switched environment, both upstream and downstream rate limits will be enforced on the AP. The enforcement on the AP will take place in the dot11 driver. This is where the current classification exists.
    In both directions, per-client rate limit is applied/checked first and per-SSID rate limit is applied/checked second.
    The WLAN rate limiting will always supercede the Global QoS setting for WLAN and user.
    Rate limiting only works for TCP and UDP traffic. Other types of traffic (IPSec, GRE, ICMP, CAPWAP, etc) cannot be limited.
    Only policing is implemented in the 7.3 releases.
    http://www.cisco.com/c/en/us/support/docs/wireless/5500-series-wireless-controllers/113682-bdr-limit-guide-00.html

  • Question about overriding and overload

    Below is a super class named Animal and subclass named Horse
    public class Animal {
    public void eat() {
    System.out.println("Generic Animal Eating Generically");
    public class Horse extends Animal {
    public void eat() {
    System.out.println("Horse eating hay ");
    public void eat(String s) {
    System.out.println("Horse eating " + s);
    public class Test {
    public static void main ( strin []agrs) {
    Animal ah2 = new Horse();
    ah2.eat("Carrots");
    At the bold line, why can not polymorphism work here.
    Can anyone explain it to me pls.
    Thanks

    800239 wrote:
    Below is a super class named Animal and subclass named Horse
    public class Animal {
    public void eat() {
    System.out.println("Generic Animal Eating Generically");
    public class Horse extends Animal {
    public void eat() {
    System.out.println("Horse eating hay ");
    public void eat(String s) {
    System.out.println("Horse eating " + s);
    public class Test {
    public static void main ( strin []agrs) {
    Animal ah2 = new Horse();
    *ah2.eat("Carrots");*
    }At the bold line, why can not polymorphism work here.
    Can anyone explain it to me pls.
    ThanksThe variable ah2 is declared as a reference of type Animal. That means we can only call methods that exist and are accessible in Animal. The compiler doesn't know or care that at runtime the Animal reference variable points to a Horse object. All that it sees is that ah2 is of type Animal.
    The kind of polymorphism where that does matter is when a child class overrides (not overloads) a non-static, non-final, non-private parent method with the exact same signature.

  • Overriding user defined functions? (LD_PRELOAD question)

    Hi,
    Am new to solaris and am using solaris 9.
    Is there a way on solaris to overload my own written function (a user definted function ) .
    On Hp-Ux using LD_PRELOAD I could dynamically load my shared library and override functions is the same possible here?
    I am having a little problem with overriding functions .
    PS:
    Could you please explain in detail how to use them step by step :)
    Thank you very much
    Kind regards :)

    Hi,
    You can use the LD_PRELOAD as on HP-UX, but if you have a 32bits LD, then better use LD_PRELOAD_32, and if it a 64bits then use LD_PRELOAD_64.
    Otherwise YOU MUST TRUST the new LD, by the way, Solaris ONLY trust the /lib, /usr/lib/secure/{32|64}
    Here you can read more information
    http://developers.sun.com/solaris/articles/linker.html
    Thanks,
    Urko
    http://sparcki.blogspot.com

  • Ask your question.I'm trying to upgrade my OS in my iPhone. In iTunes, I backed everything up, then hit upgrade. All I get is This version of iTunes is the current version. How do I override that and download OS 5.0?

    I'm trying to upgrade my OS in my iPhone. In iTunes, I backed everything up, then hit upgrade. All I get is This version of iTunes is the current version. How do I override that and download OS 5.0?

    You cannot override it.
    What version of itunes do you have?
    You need itunes 10.1 or higher to get ios 4.2.1 which is the latest available for the iphone 3G.

Maybe you are looking for

  • Creating a Materialized View in Oracle 8i

    Hello - What are the steps and privileges required to create a materialized view in Oracle 8i? Thanks

  • How to hide the transaction menu of R/3 in case of transaction iViews

    Hi Friends, I have created a transaction Iview for R/3. As per the requirements i have to hide the R/3 menu where on the left we have execute transaction box to write the transaction code and execute. How can we achieve this Regards...Rohit email [em

  • ISE External RADIUS proxy remove attributes

    Hi all, I setup external RADIUS for authenticating external users on ISE 1.2  - I need to remove all attributes received from the external RADIUS but I cannot find how to do it. I checked the option On Access-Accept, continue to Authorization Policy

  • A question about the Font in JTextPane

    I added a JTextPane in a frame. When input letters in the text pane, the width of them is different. For example, a "H" is wider than "i". How can I make them have same width? package test; import java.awt.Color; import javax.swing.JFrame; import jav

  • Audio suddenly dose not work!! PLEASE HELP

    I just tried to watch a youtube video and there was no audio. I tried some other things which should have sound, no sound.... I tried raising and lowering the audio level (didn't even play the little poppy sounds for each level of audio change) but s