Search Results

Search found 10 results on 1 pages for 'nischayn22'.

Page 1/1 | 1 

  • Switching from abstract class to interface

    - by nischayn22
    I have an abstract class which has all abstract methods except one which constructs objects of the subclasses. Now my mentor asked me to move this abstract class to an interface. Having an interface is no problem except with the method used to construct subclass objects. Where should this method go now? Also, I read somewhere that interfaces are more efficient than abstract classes. Is this true? Here's an example of my classes abstract class Animal { //many abstract methods getAnimalobject(some parameter) { return //appropriate subclass } } class Dog extends Animal {} class Elephant extends Animal {}

    Read the article

  • Has the Ubuntu heating problem for Sony Vaio users been solved?

    - by nischayn22
    I use Sony Vaio VPCEA23en with graphics card ATI Radeon HD 5145 and have been using Ubuntu 11.10 and recently upgraded to 12.04 beta, however the problem of overheating (60-70) still persists. I have installed the graphics driver properly. Are there some features of Ubuntu that cause this problem? I would have no problem uninstalling them; Or will using a lighter version of Ubuntu (lubuntu) solve this problem? Right now I am using Win7 and would like to switch to Ubuntu ASAP.

    Read the article

  • Solving programming problems or contributing code?

    - by nischayn22
    What are the best skills to develop for a college graduate?? Should one spend hours/days trying to solve problems on codechef or topcoder or contribute code to open source organizations? My personal experience says solving problems teaches you how to make optimal code and learn new programming techniques (which someone else has researched and made available) to solve problems, whereas contributing to open source teaches you how to organize code (so others can work on it), use coding conventions and make "real" use of what you have learnt so far, blah blah!! Also another thing to note is that many companies are hiring today based on one's problem solving skills (Is this something I should worry about?) P.S. I have done little of online problem solving and little of code contribution (via GSoC), but left confused what I should continue doing (as doing both simultaneously isn't easy).

    Read the article

  • Am I getting Scheme wrong?

    - by nischayn22
    Inspired by the numerous posts about the importance of learning Lisp/Scheme I started to learn Scheme two days back, I am using the book "The little Schemer" and have completed half of it. But I still haven't learned anything new, the book teaches about recursion which I already understand and uses lambda (which I can think of a way to define a function in C). I still haven't got the concept of functional programming (please point to some example of functional compared to normal programming methods in C/C++ so I can get it). Am I learning in the wrong way? or is "The little Schemer" for a newbie in programming and I should look for some other books?

    Read the article

  • Using static in PHP

    - by nischayn22
    I have a few functions in PHP that read data from functions in a class readUsername(int userId){ $reader = getReader(); return $reader->getname(userId); } readUserAddress(){ $reader = getReader(); return $reader->getaddress(userId); } All these make a call to getReader() { require_once("Reader.php"); static $reader = new Reader(); return $reader; } An overview of Reader class Reader{ getname(int id) { //if in-memory cache exists for this id return that //else get from db and cache it } getaddress(int id) { $this->getname(int id); //get address from name here } /*Other stuff*/ } Why is class Reader needed The Reader class does some in-memory caching of user details. So, I need only one object of class Reader and it will cache the user details instead of making multiple db calls. I am using static so that it the object gets created only once. Is this the right approach or should I do something else?

    Read the article

  • How should an undergraduate programmer organize his time learning the maximum possible?

    - by nischayn22
    I started programming lately(pre-final year of a CS degree) and now feel like there's a sea of uncovered treasure for me out there. So, I decided to cover as much as is possible before I look out for a job after graduation. So, I started to read books (The C++ Programming Language, Introduction to Algorithms, Cracking the Coding Interview, Programming Pearls,etc ) participate in StackExchange sites, solving problems (InterviewStreet and ProjectEuler), coding for open source, chatting to fellow programmers/mentors and try to learn more and more. Good,then what's the problem?? The problem is I am trying to do many things, but I am doubtful that I am still utilizing my time properly. I am reading many books and sometimes I just leave a book halfway (jumping from one book to another), sometimes I spend way too much time on chatting and also in getting lost somewhere in the huge internet world, and lastly the wasteful burden of attending classes (I don't think my teachers know good enough or I prefer learning on my own) May be some of you had similar situation. How did you organize your time? Or what do you think is the best way to organize it for an undergraduate? Also what mistakes am I making that you can warn me of

    Read the article

  • Are HTTP requests cached? [closed]

    - by nischayn22
    Many HTTP requests are sent repeatedly by browsers on almost every page load, such as requesting the jQuery .js file etc. Since these are already used on too many sites doesn't modern browsers keep a cache for this? I am thinking of a system where the browser has a cached copy of the .js file used very very frequently. On a new request for the .js file, it sends the server a request for a hash of the .js file (provided the server can reply to that) and compares the returned hash with the cached copy's hash... rest is intuitive.

    Read the article

  • Reading input all together or in steps?

    - by nischayn22
    For many programming quizzes we are given a bunch of input lines and we have to process each input , do some computation and output the result. My question is what is the best way to optimize the runtime of the solution ? Read all input, store it (in array or something) ,compute result for all of them, finally output it all together. or 2. Read one input, compute the result, output the result and so on for each input given.

    Read the article

  • Passing class names or objects?

    - by nischayn22
    I have a switch statement switch ( $id ) { case 'abc': return 'Animal'; case 'xyz': return 'Human'; //many more } I am returning class names,and use them to call some of their static functions using call_user_func(). Instead I can also create a object of that class, return that and then call the static function from that object as $object::method($param) switch ( $id ) { case 'abc': return new Animal; case 'xyz': return new Human; //many more } Which way is efficient? To make this question broader : I have classes that have mostly all static methods right now, putting them into classes is kind of a grouping idea here (for example the DB table structure of Animal is given by class Animal and so for Human class). I need to access many functions from these classes so the switch needs to give me access to the class

    Read the article

  • How to access functions in extended classes efficiently?

    - by nischayn22
    In PHP I have classes as below class Animal { //some vars public function printname(){ echo $this->name; } } class AnimalMySql extends Animal { static public function getTableFields(){ return array(); } } class AnimalPostgreSql extends Animal { static public function getTableFields(){ return array(); } } Now I have an object $lion = new Animal(); and I want to do if($store == mysql) //getTableFields from class AnimalMySql else //getTableFields form class AnimalPostgreSql I am new to OOP and not sure what is the best way to call the method from the specific class P.S. Please leave a note with the answer to explain the efficiency of the approach

    Read the article

1