Search Results

Search found 5349 results on 214 pages for 'override'.

Page 4/214 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • protected abstract override Foo(); &ndash; er... what?

    - by Muljadi Budiman
    A couple of weeks back, a co-worker was pondering a situation he was facing.  He was looking at the following class hierarchy: abstract class OriginalBase { protected virtual void Test() { } } abstract class SecondaryBase : OriginalBase { } class FirstConcrete : SecondaryBase { } class SecondConcrete : SecondaryBase { } Basically, the first 2 classes are abstract classes, but the OriginalBase class has Test implemented as a virtual method.  What he needed was to force concrete class implementations to provide a proper body for the Test method, but he can’t do mark the method as abstract since it is already implemented in the OriginalBase class. One way to solve this is to hide the original implementation and then force further derived classes to properly implemented another method that will replace it.  The code will look like the following: abstract class OriginalBase { protected virtual void Test() { } } abstract class SecondaryBase : OriginalBase { protected sealed override void Test() { Test2(); } protected abstract void Test2(); } class FirstConcrete : SecondaryBase { // Have to override Test2 here } class SecondConcrete : SecondaryBase { // Have to override Test2 here } With the above code, SecondaryBase class will seal the Test method so it can no longer be overridden.  Then it also made an abstract method Test2 available, which will force the concrete classes to override and provide the proper implementation.  Calling Test will properly call the proper Test2 implementation in each respective concrete classes. I was wondering if there’s a way to tell the compiler to treat the Test method in SecondaryBase as abstract, and apparently you can, by combining the abstract and override keywords.  The code looks like the following: abstract class OriginalBase { protected virtual void Test() { } } abstract class SecondaryBase : OriginalBase { protected abstract override void Test(); } class FirstConcrete : SecondaryBase { // Have to override Test here } class SecondConcrete : SecondaryBase { // Have to override Test here } The method signature makes it look a bit funky, because most people will treat the override keyword to mean you then need to provide the implementation as well, but the effect is exactly as we desired.  The concepts are still valid: you’re overriding the Test method from its original implementation in the OriginalBase class, but you don’t want to implement it, rather you want to classes that derive from SecondaryBase to provide the proper implementation, so you also make it as an abstract method. I don’t think I’ve ever seen this before in the wild, so it was pretty neat to find that the compiler does support this case.

    Read the article

  • Override <customErrors mode="Off"/> message from .NET Framework even when in web.config detailed err

    - by GrZeCh
    Hello, is this possible to override .NET Framework error: Server Error in '/' Application. Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. ... <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration> even if web.config (IIS7.5) is set to <httpErrors errorMode="Detailed"/> ? I'm asking because my default setting for IIS7 is <deployment retail="true" /> so no error is being showed and only adding additional error handling module to website will allow to see errors generated by this application and thats why I want to override this message to inform users about it. Any ideas? Thanks

    Read the article

  • Rails: Overriding ActiveRecord association method

    - by seaneshbaugh
    Is there a way to override one of the methods provided by an ActiveRecord association? Say for example I have the following typical polymorphic has_many :through association: class Story < ActiveRecord::Base has_many :taggings, :as => :taggable has_many :tags, :through => :taggings, :order => :name end class Tag < ActiveRecord::Base has_many :taggings, :dependent => :destroy has_many :stories, :through => :taggings, :source => :taggable, :source_type => "Story" end As you probably know this adds a whole slew of associated methods to the Story model like tags, tags<<, tags=, tags.empty?, etc. How do I go about overriding one of these methods? Specifically the tags<< method. It's pretty easy to override a normal class methods but I can't seem to find any information on how to override association methods. Doing something like def tags<< *new_tags #do stuff end produces a syntax error when it's called so it's obviously not that simple.

    Read the article

  • C# Cast Class to Overridden Class

    - by Nathan Tornquist
    I have a class Application that I need to override with INotifyPropertyChanged events. I have written the logic to override the original class and ended up creating SuperApplication I am pulling the data from a library though, and cannot change the loading logic. I just need a way to get the data from the original class into my superClass. I've tried things like superClass = (SuperApplication)standardClass; but it hasn't worked. How would I go about doing this? If it helps, this is the code I'm using to override the original class: public class SuperCreditApplication : CreditApplication { public SuperCreditApplicant Applicant { get; set; } public SuperCreditApplicant CoApplicant { get; set; } } public class SuperCreditApplicant : CreditApplicant { public SuperProspect Prospect { get; set; } } public class SuperProspect : Prospect, INotifyPropertyChanged { public State DriverLicenseState { get { return DriverLicenseState; } set { DriverLicenseState = value; OnPropertyChanged("DriverLicenseState"); } } public event PropertyChangedEventHandler PropertyChanged; private void OnPropertyChanged(string propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } }

    Read the article

  • ASP.NET MVC2 Implementing Custom RoleManager problem

    - by ile
    To create a custom membership provider I followed these instructions: http://stackoverflow.com/questions/2771094/asp-net-mvc2-custom-membership and these: http://mattwrock.com/post/2009/10/14/Implementing-custom-Membership-Provider-and-Role-Provider-for-Authinticating-ASPNET-MVC-Applications.aspx So far, I've managed to implement custom membership provider and that part works fine. RoleManager still needs some modifications... Project structure: SAMembershipProvider.cs: public class SAMembershipProvider : MembershipProvider { #region - Properties - private int NewPasswordLength { get; set; } private string ConnectionString { get; set; } public bool enablePasswordReset { get; set; } public bool enablePasswordRetrieval { get; set; } public bool requiresQuestionAndAnswer { get; set; } public bool requiresUniqueEmail { get; set; } public int maxInvalidPasswordAttempts { get; set; } public int passwordAttemptWindow { get; set; } public MembershipPasswordFormat passwordFormat { get; set; } public int minRequiredNonAlphanumericCharacters { get; set; } public int minRequiredPasswordLength { get; set; } public string passwordStrengthRegularExpression { get; set; } public override string ApplicationName { get; set; } public override bool EnablePasswordRetrieval { get { return enablePasswordRetrieval; } } public override bool EnablePasswordReset { get { return enablePasswordReset; } } public override bool RequiresQuestionAndAnswer { get { return requiresQuestionAndAnswer; } } public override int MaxInvalidPasswordAttempts { get { return maxInvalidPasswordAttempts; } } public override int PasswordAttemptWindow { get { return passwordAttemptWindow; } } public override bool RequiresUniqueEmail { get { return requiresUniqueEmail; } } public override MembershipPasswordFormat PasswordFormat { get { return passwordFormat; } } public override int MinRequiredPasswordLength { get { return minRequiredPasswordLength; } } public override int MinRequiredNonAlphanumericCharacters { get { return minRequiredNonAlphanumericCharacters; } } public override string PasswordStrengthRegularExpression { get { return passwordStrengthRegularExpression; } } #endregion #region - Methods - public override void Initialize(string name, NameValueCollection config) { throw new NotImplementedException(); } public override bool ChangePassword(string username, string oldPassword, string newPassword) { throw new NotImplementedException(); } public override bool ChangePasswordQuestionAndAnswer(string username, string password, string newPasswordQuestion, string newPasswordAnswer) { throw new NotImplementedException(); } public override MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, object providerUserKey, out MembershipCreateStatus status) { throw new NotImplementedException(); } public override bool DeleteUser(string username, bool deleteAllRelatedData) { throw new NotImplementedException(); } public override MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords) { throw new NotImplementedException(); } public override MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords) { throw new NotImplementedException(); } public override MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords) { throw new NotImplementedException(); } public override int GetNumberOfUsersOnline() { throw new NotImplementedException(); } public override string GetPassword(string username, string answer) { throw new NotImplementedException(); } public override MembershipUser GetUser(object providerUserKey, bool userIsOnline) { throw new NotImplementedException(); } public override MembershipUser GetUser(string username, bool userIsOnline) { throw new NotImplementedException(); } public override string GetUserNameByEmail(string email) { throw new NotImplementedException(); } protected override void OnValidatingPassword(ValidatePasswordEventArgs e) { base.OnValidatingPassword(e); } public override string ResetPassword(string username, string answer) { throw new NotImplementedException(); } public override bool UnlockUser(string userName) { throw new NotImplementedException(); } public override void UpdateUser(MembershipUser user) { throw new NotImplementedException(); } public override bool ValidateUser(string username, string password) { AccountRepository accountRepository = new AccountRepository(); var user = accountRepository.GetUser(username); if (string.IsNullOrEmpty(password.Trim())) return false; if (user == null) return false; //string hash = EncryptPassword(password); var email = user.Email; var pass = user.Password; if (user == null) return false; if (pass == password) { //User = user; return true; } return false; } #endregion protected string EncryptPassword(string password) { //we use codepage 1252 because that is what sql server uses byte[] pwdBytes = Encoding.GetEncoding(1252).GetBytes(password); byte[] hashBytes = System.Security.Cryptography.MD5.Create().ComputeHash(pwdBytes); return Encoding.GetEncoding(1252).GetString(hashBytes); } } SARoleProvider.cs public class SARoleProvider : RoleProvider { AccountRepository accountRepository = new AccountRepository(); public override bool IsUserInRole(string username, string roleName) { return true; } public override string ApplicationName { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } } public override void AddUsersToRoles(string[] usernames, string[] roleNames) { throw new NotImplementedException(); } public override void RemoveUsersFromRoles(string[] usernames, string[] roleNames) { throw new NotImplementedException(); } public override void CreateRole(string roleName) { throw new NotImplementedException(); } public override bool DeleteRole(string roleName, bool throwOnPopulatedRole) { throw new NotImplementedException(); } public override bool RoleExists(string roleName) { throw new NotImplementedException(); } public override string[] GetRolesForUser(string username) { int rolesCount = 0; IQueryable<RoleViewModel> rolesNames; try { // get roles for this user from DB... rolesNames = accountRepository.GetRolesForUser(username); rolesCount = rolesNames.Count(); } catch (Exception ex) { throw ex; } string[] roles = new string[rolesCount]; int counter = 0; foreach (var item in rolesNames) { roles[counter] = item.RoleName.ToString(); counter++; } return roles; } public override string[] GetUsersInRole(string roleName) { throw new NotImplementedException(); } public override string[] FindUsersInRole(string roleName, string usernameToMatch) { throw new NotImplementedException(); } public override string[] GetAllRoles() { throw new NotImplementedException(); } } AccountRepository.cs public class RoleViewModel { public string RoleName { get; set; } } public class AccountRepository { private DB db = new DB(); public User GetUser(string email) { return db.Users.SingleOrDefault(d => d.Email == email); } public IQueryable<RoleViewModel> GetRolesForUser(string email) { var result = ( from role in db.Roles join user in db.Users on role.RoleID equals user.RoleID where user.Email == email select new RoleViewModel { RoleName = role.Name }); return result; } } webconfig <membership defaultProvider="SAMembershipProvider" userIsOnlineTimeWindow="15"> <providers> <clear/> <add name="SAMembershipProvider" type="SA_Contacts.Membership.SAMembershipProvider, SA_Contacts" connectionStringName ="ShinyAntConnectionString" /> </providers> </membership> <roleManager defaultProvider="SARoleProvider" enabled="true" cacheRolesInCookie="true"> <providers> <clear/> <add name="SARoleProvider" type="SA_Contacts.Membership.SARoleProvider" connectionStringName ="ShinyAntConnectionString" /> </providers> </roleManager> AccountController.cs: public class AccountController : Controller { SAMembershipProvider provider = new SAMembershipProvider(); AccountRepository accountRepository = new AccountRepository(); public AccountController() { } public ActionResult LogOn() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult LogOn(string userName, string password, string returnUrl) { if (!ValidateLogOn(userName, password)) { return View(); } var user = accountRepository.GetUser(userName); var userFullName = user.FirstName + " " + user.LastName; FormsAuthentication.SetAuthCookie(userFullName, false); if (!String.IsNullOrEmpty(returnUrl) && returnUrl != "/") { return Redirect(returnUrl); } else { return RedirectToAction("Index", "Home"); } } public ActionResult LogOff() { FormsAuthentication.SignOut(); return RedirectToAction("Index", "Home"); } private bool ValidateLogOn(string userName, string password) { if (String.IsNullOrEmpty(userName)) { ModelState.AddModelError("username", "You must specify a username."); } if (String.IsNullOrEmpty(password)) { ModelState.AddModelError("password", "You must specify a password."); } if (!provider.ValidateUser(userName, password)) { ModelState.AddModelError("_FORM", "The username or password provided is incorrect."); } return ModelState.IsValid; } } In some testing controller I have following: [Authorize] public class ContactsController : Controller { SAMembershipProvider saMembershipProvider = new SAMembershipProvider(); SARoleProvider saRoleProvider = new SARoleProvider(); // // GET: /Contact/ public ActionResult Index() { string[] roleNames = Roles.GetRolesForUser("[email protected]"); // Outputs admin ViewData["r1"] = roleNames[0].ToString(); // Outputs True // I'm not even sure if this method is the same as the one below ViewData["r2"] = Roles.IsUserInRole("[email protected]", roleNames[0].ToString()); // Outputs True ViewData["r3"] = saRoleProvider.IsUserInRole("[email protected]", "admin"); return View(); } If I use attribute [Authorize] then everything works ok, but if I use [Authorize(Roles="admin")] then user is always rejected, like he is not in role. Any idea of what could be wrong here? Thanks in advance, Ile

    Read the article

  • java: List wrapper where get()/set() is allowed but add/remove is not

    - by Jason S
    I need to wrap a List<T> with some class that allows calls to set/get but does not allow add/remove calls, so that the list remains "stuck" at a fixed length. I think I have a thin wrapper class (below) that will work, but I'm not 100% positive. Did I miss anything obvious? import java.util.Collection; import java.util.Iterator; import java.util.List; import java.util.ListIterator; class RestrictedListWrapper<T> implements List<T> { static <T> T fail() throws UnsupportedOperationException { throw new UnsupportedOperationException(); } static private class IteratorWrapper<T> implements ListIterator<T> { final private ListIterator<T> iter; private IteratorWrapper(ListIterator<T> iter) { this.iter = iter; } static public <T> RestrictedListWrapper.IteratorWrapper<T> wrap(ListIterator<T> target) { return new RestrictedListWrapper.IteratorWrapper<T>(target); } @Override public void add(T e) { fail(); } @Override public boolean hasNext() { return this.iter.hasNext(); } @Override public boolean hasPrevious() { return this.iter.hasPrevious(); } @Override public T next() { return this.iter.next(); } @Override public int nextIndex() { return this.iter.nextIndex(); } @Override public T previous() { return this.iter.previous(); } @Override public int previousIndex() { return this.iter.previousIndex(); } @Override public void remove() { fail(); } @Override public void set(T e) { this.iter.set(e); } } final private List<T> list; private RestrictedListWrapper(List<T> list) { this.list = list; } static public <T> RestrictedListWrapper<T> wrap(List<T> target) { return new RestrictedListWrapper<T>(target); } @Override public boolean add(T arg0) { return fail(); } @Override public void add(int index, T element) { fail(); } @Override public boolean addAll(Collection<? extends T> arg0) { return fail(); } @Override public boolean addAll(int arg0, Collection<? extends T> arg1) { return fail(); } /** * clear() allows setting all members of the list to null */ @Override public void clear() { ListIterator<T> it = this.list.listIterator(); while (it.hasNext()) { it.set(null); it.next(); } } @Override public boolean contains(Object o) { return this.list.contains(o); } @Override public boolean containsAll(Collection<?> c) { return this.list.containsAll(c); } @Override public T get(int index) { return this.list.get(index); } @Override public int indexOf(Object o) { return this.list.indexOf(o); } @Override public boolean isEmpty() { return false; } @Override public Iterator<T> iterator() { return listIterator(); } @Override public int lastIndexOf(Object o) { return this.list.lastIndexOf(o); } @Override public ListIterator<T> listIterator() { return IteratorWrapper.wrap(this.list.listIterator()); } @Override public ListIterator<T> listIterator(int index) { return IteratorWrapper.wrap(this.list.listIterator(index)); } @Override public boolean remove(Object o) { return fail(); } @Override public T remove(int index) { fail(); return fail(); } @Override public boolean removeAll(Collection<?> c) { return fail(); } @Override public boolean retainAll(Collection<?> c) { return fail(); } @Override public T set(int index, T element) { return this.list.set(index, element); } @Override public int size() { return this.list.size(); } @Override public List<T> subList(int fromIndex, int toIndex) { return new RestrictedListWrapper<T>(this.list.subList(fromIndex, toIndex)); } @Override public Object[] toArray() { return this.list.toArray(); } @Override public <T> T[] toArray(T[] a) { return this.list.toArray(a); } }

    Read the article

  • Windows 7 Driver Update Override

    - by Elliot
    When I try to update a driver via the device manager, windows 7 tells me that windows has determined the driver software for your device is up to date even though I know that mine is newer (due to the version number), and refuses to install it. Is there some way to override this behavior and force windows to install the newer driver?

    Read the article

  • Override my ISP's "domain not found" page?

    - by Amanda
    If I screw up typing a URL, my ISP shoots me over to their branded search page. So if I type "superuser" in my location bar I end up at http://domainnotfound.optimum.net/cablevassist/dnsassist/main/?domain=superuser I'd like my browser to leave the location the way it was and just say "nothing doing," rather than redirecting me to a search. Can I override that in my own /etc/hosts or at my router?

    Read the article

  • Why Finalize method not allowed to override

    - by somaraj
    I am new to .net ..and i am confused with the destructor mechanism in C# ..please clarify In C# destructors are converted to finalize method by CLR. If we try to override it (not using destructor ) , will get an error Error 2 Do not override object.Finalize. Instead, provide a destructor. But it seems that the Object calss implementation in mscorlib.dll has finalize defined as protected override void Finalize(){} , then why cant we override it , that what virtual function for . Why is the design like that , is it to be consistent with c++ destructor concept. Also when we go to the definition of the object class , there is no mention of the finalize method , then how does the hmscorlib.dll definition shows the finalize funtion . Does it mean that the default destructor is converted to finalize method. public class Object { public Object(); public virtual bool Equals(object obj); public static bool Equals(object objA, object objB); public virtual int GetHashCode(); public Type GetType(); protected object MemberwiseClone(); public static bool ReferenceEquals(object objA, object objB); public virtual string ToString(); }

    Read the article

  • Overriding as_json has no effect?

    - by Ola Tuvesson
    I'm trying to override as_json in one of my models, partly to include data from another model, partly to strip out some unnecessary fields. From what I've read this is the preferred approach in Rails 3. To keep it simple, let's say I've got something like: class Country < ActiveRecord::Base def as_json(options={}) super( :only => [:id,:name] ) end end and in my controller simply def show respond_to do |format| format.json { render :json => @country } end end Yet whatever i try, the output always contains the full data, the fields are not filtered by the ":only" clause. Basically, my override doesn't seem to kick in, though if I change it to, say... class Country < ActiveRecord::Base def as_json(options={}) {foo: "bar"} end end ...I do indeed get the expected JSON output. Have I simply got the syntax wrong?

    Read the article

  • Android: Hiding the keyboard in an overrided "Done" keypress of EditText

    - by Marshall Ward
    Hello, I have used a bit of Android code to override the "Done" button in my EditText field: myEditField.setOnEditorActionListener(new TextView.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_DONE) { mySubroutine(); return true; } return false; } }); Activating the field calls up the keyboard, and pressing "Done" evaluates mySubroutine() successfully. However, the keyboard no longer goes away when I press "Done". How do I restore this default behaviour to the routine?

    Read the article

  • Having a base class function depend on its child class C#

    - by Junk Junk
    I have a Base class with a method that a child class will almost always override. However, instead of replacing the base class' method entirely, I would like for whatever is derived in the child class to be added to what is already in the base class. For Example: class BaseClass public string str() { var string = "Hello my name is" ; } class ChildClass : BaseClass public override string str(){ var string = "Sam"; } The point is that if I want to access the str() method by creating an instance of the ChildClass, the string will print out as "Hello, my name is Sam". I've been looking around and all I have been finding is that this should NOT happen, as the base class shouldn't even know that it is being inherited. So, if the design is false, how would I go about doing this? Keep in mind that there will be multiple child classes inheriting from BaseClass. Thank you

    Read the article

  • How to override a method for a MovieClip Symbol in Flash CS3

    - by php html
    I'm using flash to draw objects, then I export them and use them from flex, and I'm a beginner in flash. I'm trying to do the override a method from the MovieClip I created. The method I'm trying to override is stop() method. I didn't write a single line of code, my movie clip is created using entirely the flash interface. I figured out how to add actions to the movie clip when a frame is reached but I'm stucked now when I'm trying to override a MovieClip method.

    Read the article

  • Why is javac failing on @Override annotation

    - by skiphoppy
    Eclipse is adding @Override annotations when I implement methods of an interface. Eclipse seems to have no problem with this. And our automated build process from Cruise Control seems to have no problem with this. But when I build from the command-line, with ant running javac, I get this error: [javac] C:\path\project\src\com\us\MyClass.java:70: method does not override a method from its superclass [javac] @Override [javac] ^ [javac] 1 error Eclipse is running under Java 1.6. Cruise Control is running Java 1.5. My ant build fails regardless of which version of Java I use.

    Read the article

  • Not able to pass multiple override parameters using nose-testconfig 0.6 plugin in nosetests

    - by Jaikit
    Hi, I am able to override multiple config parameters using nose-testconfig plugin only if i pass the overriding parameters on commandline. e.g. nosetests -c nose.cfg -s --tc=jack.env1:asl --tc=server2.env2:abc But when I define the same thing inside nose.cfg, than only the value for last parameter is modified. e.g. tc = server2.env2:abc tc = jack.env1:asl I checked the plugin code. It looks fine to me. I am pasting the part of plugin code below: parser.add_option( "--tc", action="append", dest="overrides", default = [], help="Option:Value specific overrides.") configure: if options.overrides: self.overrides = [] overrides = tolist(options.overrides) for override in overrides: keys, val = override.split(":") if options.exact: config[keys] = val else: ns = ''.join(['["%s"]' % i for i in keys.split(".") ]) # BUG: Breaks if the config value you're overriding is not # defined in the configuration file already. TBD exec('config%s = "%s"' % (ns, val)) Let me know if any one has any clue.

    Read the article

  • C++: Create abstract class with abstract method and override the method in a subclass

    - by Martijn Courteaux
    Hi, How to create in C++ an abstract class with some abstract methods that I want to override in a subclass? How should the .h file look? Is there a .cpp, if so how should it look? In Java it would look like this: abstract class GameObject { public abstract void update(); public abstract void paint(Graphics g); } class Player extends GameObject { @Override public void update() { // ... } @Override public void paint(Graphics g) { // ... } } // In my game loop: for (int i = 0; i < objects.size(); i++) { objects.get(i).update(); } for (int i = 0; i < objects.size(); i++) { objects.get(i).paint(g); } Translating this code to C++ is enough for me.

    Read the article

  • Guice child injector override binding

    - by Roman
    Hi All I am trying to to override a binding in a child injector that was already configured in a base injector. like that : public class PersistenceModule extends Abstract{ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(ProductPersistenceHelper.class); } } then : Injector injector = Guice.createInjector(new PersistenceModule()); injector.createChildInjector(new AbstractModule(){ @Override protected void configure() { bind(IProductPersistenceHelper.class).to(MockProductPersistenceHelper.class); } }) Guice is complaining that it has already a binding for that. Are there any patterns or best practices for that problem ?

    Read the article

  • Override existing AS3 classes

    - by purga
    For a custom derived class "Vector2" from flash.geom.Point, when trying to override the clone() method (similar to add(), subtract() methods that will return the type itself), it will always complain about incompatible overriding 'cuz the return type has been altered from "Point" to "Vector2". import flash.geom.Point; public class Vector2 extends Point { //Constructor is good public function Vector2(x:Number = 0, y:Number = 0) { super(x,y); } // Error: Incompatible overriding override public function clone():Vector2 //return type has to be "Point" { return new Vector2(this.x , this.y); } } How can we correctly reuse/override the methods provided by the super classes as supposed to create our own one (e.g. : a new clone1() method), or simply we just can't? Thanks.

    Read the article

  • configure spam assassin to delete all spam above a score domain wide and override individual settin

    - by Marlon
    Okay, so this is my scenario and what I want to try and do. I maintain a Red Hat email server running qmail and spamassassin. I have a domain that has well over 100 email account each with individual settings for spam scores and, whether or not to delete email incoming mail deemed spam. What I want to accomplish is to change all those email email accounts to say a more stringent spam score value, AND to enable the deletion of email immediately as it flagged as such, for EACH AND EVERY email box. In short, I want to be able to override a user's individual settings spam settings, with my own. Short of tediously going into each and every email box one by one, is there an way to do this all in one fell swoop? Any advice would be greatly appreciated! :-)

    Read the article

  • nginx: override global ssl directives for specific servers

    - by alkar
    In my configuration I have placed the ssl_* directives inside the http block and have been using a wildcard certificate certified by a custom CA without any problems. However, I now want to use a new certificate for a new subdomain (a server), that has been certified by a recognized CA. Let's say the TLD is blah.org. I want my custom certificate with CN *.blah.org to be used on all domains except for new.blah.org that will use its own certificate/key pair of files with CN new.blah.org. How would one do that? Adding new ssl_* directives inside the server block doesn't seem to override the global settings.

    Read the article

  • Overriding Only Some Default Parameters in ActionScript

    - by TheDarkIn1978
    i have a function which has all optional arguments. is it possible to override a an argument of a function without supplying the first? in the code below, i'd like to keep most of the default arguments for the drawSprite function, and only override the last argument, which is the sprite's color. but how can i call the object? DrawSprite(0x00FF00) clearly will not work. //Main Class package { import DrawSprite; import flash.display.Sprite; public class Start extends Sprite { public function Start():void { var myRect:DrawSprite = new DrawSprite(0x00FF00) addChild(myRect); } } } //Draw Sprite Class package { import flash.display.Sprite; import flash.display.Graphics; public class DrawSprite extends Sprite { private static const DEFAULT_WIDTH:Number = 100; private static const DEFAULT_HEIGHT:Number = 200; private static const DEFAULT_COLOR:Number = 0x000000; public function DrawSprite(spriteWidth:Number = DEFAULT_WIDTH, spriteHeight:Number = DEFAULT_HEIGHT, spriteColor:Number = DEFAULT_COLOR):void { graphics.beginFill(spriteColor, 1.0); graphics.drawRect(0, 0, spriteWidth, spriteHeight); graphics.endFill(); } } }

    Read the article

  • Overriding equals method without breaking symmetry in a class that has a primary key

    - by Kosta
    Hi, the answer to this question is probably "not possible", but let me ask regardless :) Assuming we have a very simple JAVA class that has a primary key, for example: class Person { String ssid; String name; String address; ... } Now, I want to store people in a collection, meaning I will have to override the equals method. Not a completely trivial matter, but on a bare basis I will have something along the lines of: @Override public boolean equals (Object other) { if(other==this) return true; if(!other.getClass().equals(this.getClass()) return false; Person otherPerson = (Person)other; if(this.ssid.equals(otherPerson.getSsid()) return true; } Excuse any obvious blunders, just typing this out of my head. Now, let's say later on in the application I have a ssid I obtained through user input. If I want to compare my ssid to a Person, I would have to call something like: String mySsid = getFromSomewhere(); Person myPerson = getFromSomewhere(); if(myPerson.equals(new Person(mySsid)) doSomething(); This means I have to create a convenience constructor to create a Person based on ssid (if I don't already have one), and it's also quite verbose. It would be much nicer to simply call myPerson.equals(mySsid) but if I added a string comparison to my Person equals class, that would break the symmetry property, since the String hasn't got a clue on how to compare itself to a Person. So finally, the big question, is there any way to enable this sort of "shorthand" comparisons using the overriden equals method, and without breaking the symmetry rule? Thanks for any thoughts on this!

    Read the article

  • Apache override in sub-location

    - by Atmocreations
    This is my Apache vHost-configuration: <VirtualHost subversion.domain.com:80> ServerAdmin [email protected] ServerName servername.domain.com Documentroot /srv/www/htdocs/svn ErrorLog /var/log/apache2/subversion-error_log CustomLog /var/log/apache2/subversion-access_log combined HostnameLookups Off UseCanonicalName Off ServerSignature Off <Location "/"> AuthBasicProvider ldap AuthType Basic AuthzLDAPAuthoritative on AuthName "SVN" AuthLDAPURL "ldap://myldapurl/..." NONE AuthLDAPBindDN "mybinddn" AuthLDAPBindPassword mypwd DAV svn SVNParentPath /svn/ SVNListParentPath on require ldap-group groupname Order allow,deny Allow from all </Location> </VirtualHost> This works perfectly. But I would now like to add a web-frontend for the subversion server. I therefore added the lines <Location "/web"> DAV off Order allow,deny Allow from all </Location> But they don't work, as the <Location "/">...</Location> part is directing the requests to the SVN/DAV module. Therefore, apache tells that it couldn't open the requested SVN-filsystem. Does anybody know how to override this setting? Any hint is appreciated.

    Read the article

  • Conditional CSS file doesn't override regular CSS

    - by dmr
    I am using conditional comments to link to a css file (let's call it "IEonly.css") if the IE version is less than 8. I am trying to override some properties in the regular css file. Strangely enough, IEonly.css will set new css properties correctly, but it won't override the properties in the regular CSS file! (I am trying to make this work for IE7). Help!

    Read the article

  • Objective C override %@ for custom objects

    - by nickcartwright
    Hey there, I'd like to override the default print function in NSLog for custom objects; For example: MyObject *myObject = [[MyObject alloc] init]; NSLog(@"This is my object: %@", myObjcet); Will print out: This is my object: <MyObject: 0x4324234> Is there a function I override in MyObject to print out a prettier description? Cheers! Nick.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >