Posts

Showing posts from April, 2014

What is the point of using abstract methods?

Say you have a three printers that you would need to write a driver for, Lexmark , Canon , and HP . All three printers will have the print() and getSystemResource() methods. However, only print() will be different for each printer. getSystemResource() remains the same throughout the three printers. You also have another concern, you would like to apply polymorphism. So since getSystemResource() is the same for all three printers, so this can be pushed up to the super class to be implemented, in Java, this can be done via making this abstract in the super class, and in making a method abstract in a super class, the class itself needs to be abstract as well. public abstract class Printer { public void getSystemResource (){ // real implementation of getting system resources } public abstract void print (); } public class Canon extends Printer { public void print (){ // here you will provide the implementation of p

Wordpress widgets not saving?

Sometimes in word press you can face a scenario where you are not able to save widgets items. I face the same problem where i wasnt able to save a "text" widget. After spending few hours on google i found the solution, which helped me to resolve the issue. I am copying down the solution which worked for me Go to Appearence --> Widgets Then at the top right of the screen you should see a tab that says Screen Options. Click on that, then a link will appear in the top left of your screen that says ‘Enable Accessibility Mode’ and click on that and give it a try. Try to save a widget now. This solution worked perfectly for me, there are few other solutions too which are covered on this blog. If there is any question please feel free to ask on twitter. Thanks