Search Results

Search found 86 results on 4 pages for 'aditya sehgal'.

Page 1/4 | 1 2 3 4  | Next Page >

  • Sorting a Linked List [closed]

    - by Mohit Sehgal
    I want to sort a linked list. Here Node is class representing a node in a Linked List I have written a code to bubble sort a linked list. Program does not finishes execution. Kindly point out the mistakes. class Node { public: int data; public: Node *next; Node() { data=0;next=0; } Node(int d) { data=d; } void setData(int d) { data=d; } void print() { cout<<data<<endl; } bool operator==(Node n) { return this->data==n.data; } bool operator >(Node d) { if((this->data) > (d.data)) return true; return false; } }; class LList { public: int noOfNodes; Node *start;/*Header Node*/ LList() { start=new Node; noOfNodes=0;start=0; } void addAtFront(Node* n) { n->next=(start); start=n; noOfNodes++; } void addAtLast(Node* n) { Node *cur=(start); n->next=NULL; if(start==NULL) { start=n; noOfNodes++; return; } while(cur->next!=NULL) { cur=cur->next; } cur->next=n; noOfNodes++; } void addAtPos(Node *n,int pos) { if(pos==1) { addAtFront(n);return; } Node *cur=(start); Node *prev=NULL; int curPos=0; n->next=NULL; while(cur!=NULL) { curPos++; if(pos==curPos+1) { prev=cur; } if(pos==curPos) { n->next=cur; prev->next=n; break; } cur=cur->next; } noOfNodes++; } void removeFirst() { Node *del=start; start=start->next; delete del; noOfNodes--; return; } void removeLast() { Node *cur=start,*prev=NULL; while(cur->next!=NULL) { prev=cur; cur=cur->next; } prev->next=NULL; Node *del=cur->next; delete del; noOfNodes--; return; } void removeNodeAt(int pos) { if(pos<1) return; if(pos==1) { removeFirst();return;} int curPos=1; Node* cur=start->next; Node* prev=start; Node* del=NULL; while(curPos<pos&&cur!=NULL) { curPos++; if(curPos==pos) { del=cur; prev->next=cur->next; cur->next=NULL; delete del; noOfNodes--; break; } prev=prev->next; cur=cur->next; } } void removeNode(Node *d) { Node *cur=start; if(*d==*cur) { removeFirst();return; } cur=start->next; Node *prev=start,*del=NULL; while(cur!=NULL) { if(*cur==*d) { del=cur; prev->next=cur->next; delete del; noOfNodes--; break; } prev=prev->next; cur=cur->next; } } int getPosition(Node data) { int pos=0; Node *cur=(start); while(cur!=NULL) { pos++; if(*cur==data) { return pos; } cur=cur->next; } return -1;//not found } Node getNode(int pos) { if(pos<1) return -1;// not a valid position else if(pos>noOfNodes) return -1; // not a valid position Node *cur=(start); int curPos=0; while(cur!=NULL) { if(++curPos==pos) return *cur; cur=cur->next; } } void reverseList()//reverse the list { Node* cur=start->next; Node* d=NULL; Node* prev=start; while(cur!=NULL) { d=cur->next; cur->next=start; start=cur; prev->next=d; cur=d; } } void sortBubble() { Node *i=start,*j=start,*prev=NULL,*temp=NULL,*after=NULL; int count=noOfNodes-1;int icount=0; while(i->next!=NULL) { j=start; after=j->next; icount=0; while(++icount!=count) { if((*j)>(*after)) { temp=after->next; after->next=j; prev->next=j->next; j->next=temp; prev=after; after=j->next; } else{ prev=j; j=after; after=after->next; } } i=i->next; count--; } } void traverse() { Node *cur=(start); int c=0; while(cur!=NULL) { // cout<<"start"<<start; c++; cur->print(); cur=cur->next; } noOfNodes=c; } ~LList() { delete start; } }; int main() { int n; cin>>n; int d; LList list; Node *node; Node *temp=new Node(2123); for(int i=0;i<n;i++) { cin>>d; node=new Node(d); list.addAtLast(node); } list.addAtPos(temp,1); cout<<"traverse\n"; list.traverse(); temp=new Node(12); list.removeNode(temp); cout<<"12 removed"; list.traverse(); list.reverseList(); cout<<"\nreversed\n"; list.traverse(); cout<<"bubble sort\n"; list.sortBubble(); list.traverse(); getch(); delete node; return 0; }

    Read the article

  • How do I restore the original color scheme, icons, and theme?

    - by katya sehgal
    I'd like the original colour scheme, icon style of 12.04. I somehow lost the Ambiance theme (possible error or upgrade error). I re-installed 'light-themes' from the terminal and got it back. But the panel on the top that shows the options of sound, battery and wi-fi has changed and I can-not get the original setting back. In the windows, the close, minimize tools have shifted to the right instead of the original left side. I had installed MyUnity and Ubuntu Tweak but deleted them. As such, I want the original setting back. Kindly help me with the commands. I have searched for solutions; there are multiple and I need to be sure if I should follow the same. Kindly bear before marking duplicate. Discoveries: The appearance is gray and boxy as outlined here. Not sure same problem. Similar 'gray and boxy' article here. Desktop forgets theme. I have also tried the unity --reset command. It never completes. I gave it 20 minutes.

    Read the article

  • Restore Default Appearance in Ubuntu 12.04

    - by katya sehgal
    I'd like the original colour scheme, icon style of 12.04. I somehow lost the Ambiance theme (possible error or upgrade error). I re-installed 'light-themes' from the terminal and got it back. But the panel on the top that shows the options of sound, battery and wi-fi has changed and I can-not get the original setting back. In the windows, the close, minimize tools have shifted to the right instead of the original left side. I had installed MyUnity and Ubuntu Tweak but deleted them. As such, I want the original setting back. Kindly help me with the commands. I have searched for solutions; there are multiple and I need to be sure if I should follow the same. Kindly bear before marking duplicate. Discoveries *. [The appearance is gray and boxy as outlined here.] Not sure same problem. *. [Similar 'gray and boxy' article here] *. Desktop forgets theme.] *. I have also tried unity --reset command. It never completes. I gave it 20 minutes.

    Read the article

  • how to show semi-transparent object over playing video

    - by Aditya.Sen
    Hi, I want to have a alpha blended window over a video playing in the background. Considering the fact that a window cannot be made alpha blended over another window unless you take a snap of the background, I had to resort to OpenGL. I have few options for this: (1) To show an object on the WinCE window without showing the OpenGL ES window. Is it possible to do this ?? (2) Make the opengles window transparent and then show the object. Any suggestions will be greatly appreciated. Please can some1 help me by giving some inputs Thanks for any help Aditya

    Read the article

  • Project Idea with Hadoop MapReduce

    - by Aditya Andhalikar
    Hello, I learnt Hadoop a few months back and managed to do a very introductory programming project on it. I want to do a small - medium sized project or series of small programming assignments with Hadoop. I have seen lot of ideas around but I dont see anything that can be finished in about 60-70 hours of work so a pretty small scale project as I want to do that in my spare time along with other studies. Most project ideas I have seen sort of large to go on for 2-3 months. My main objective out of this exercise to develop good expertise in programming with Hadoop environment not to do any research or solve specific problems. I see Hadoop being used lot of with webservices maybe that would be an interesting track for small projects. Thank you in advance. Regards, Aditya

    Read the article

  • Problem resolving many of the Web Pages

    - by Aditya
    I am presently running Ubuntu 12.04 and using Chrome/Firefox along with OpenDNS (have tried Google Public DNS as well as DNS of my ISP). Suddenly, a lot of websites that I visit frequently don't load anymore. Some of them are imgur, yahoo, fed-sudoku, microsoft and addons page of firefox. I am sure there are many more that won't load. I have Windows 7 in Dual-Boot and there are no problems whatsoever in opening these pages on Windows. A little History: 2 weeks back I installed Ubuntu 12.10. I faced this issue right-away on Ubuntu 12.10. I thought something must have went wrong with the installation, so I removed Ubuntu 12.10 and instead installed Lubuntu 12.10 on it. But the same issue persisted on Lubuntu as well. So, I tried opening these webpages in Live Environments (of Ubuntu 12.10, Lubuntu 12.10 and Ubuntu 12.04.1) from USB. The issue was there for Ubuntu 12.10 and Lubuntu 12.10. However, I was able to access these webpages from Ubuntu 12.04.1. So, I installed 12.04.1 on my HardDisk. Everything on 12.04 was fine till yesterday; but suddenly, these sites don't load anymore. All this while, Windows 7 in Dual-Boot works flawlessly. Please help me resolve this issue.

    Read the article

  • When Less is More

    - by aditya.agarkar
    How do you reconcile the fact that while the overall warehouse volume is down you still need more workers in the warehouse to ship all the orders? A WMS customer recently pointed out this seemingly perplexing fact in a customer conference. So what is going on? Didn't we tell you before that for a warehouse the customer is really the "king"? In this case customers are merely responding to a low overall low demand and uncertainty. They do not want to hold down inventory and one of the ways to do that is by decreasing the order size and ordering more frequently. Overall impact to the warehouse? Two words: "More work!!" This is not all. Smaller order sizes also mean challenges from a transportation perspective including a rise in costlier parcel or LTL shipments instead of cheaper TL shipments. Here is a hypothetical scenario where a customer reduces the order size by 10% and increases the order frequency by 10%. As you can see in the following table, the overall volume declines by 1% but the warehouse has to ship roughly 10% more lines. Order Frequency (Line Count)Order Size (Units)Total VolumeChange (%)10010010,000 -110909,900-1% If you want to see how "Less is More" in graphical terms, this is how it appears: Even though the volume is down, there is going to be more work in the warehouse in terms of number of lines shipped. The operators need to pick more discrete orders, pack them into more shipping containers and ship more deliveries. What do you do differently if you are facing this situation?In this case here are some obvious steps to take:Uno: Change your pick methods. If you are used to doing order picks, it needs to go out the door. You need to evaluate batch picking and grouping techniques. Go for cluster picking, go for zone picking, pick and pass...anything that improves your picker productivity. More than anything, cluster picking works like a charm and above all, its simple and very effective. Dos: Are you minimize "touch" points in your pick process? Consider doing one step pick, pack and confirm i.e. pick and pack stuff directly into shipping cartons. Done correctly the container will not require any more "touch" points all the way to the trailer loading. Use cartonization!Tres: Are the being picked from an optimized pick face? Are the items slotted correctly? This needs to be looked into. Consider automated "pull" or "push" replenishment into your pick face and also make sure that high demand items are occupying the golden zones.  Cuatro: Are you tracking labor productivity? If not there needs to be a concerted push for having labor standards in place. Hope you found these ideas useful.

    Read the article

  • Ubuntu Desktop shifted to right

    - by Sunny Kumar Aditya
    I am using Ubuntu 12.04 (precise) Kernel : 3.5.0-18-generic I am encountering a strange problem, my whole desktop has shifted to right. This happened after I restored my system, I was getting a blank screen earlier.(something is better than nothing). For some reason it also shows my display as laptop. Running xrandr xrandr: Failed to get size of gamma for output default Screen 0: minimum 640 x 480, current 1024 x 768, maximum 1024 x 768 default connected 1024x768+0+0 0mm x 0mm 1024x768 0.0* 800x600 0.0 640x480 0.0 Running lspci lspci -nn | grep VGA 00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0102] (rev 09) My Display on window supports maximum of 1366*768. I do not want to reinstall everything please help. It is cycled around as mentioned by Eliah Kagan For correcting my blank screen issue I edited my grub file I edited this line and added nomodeset, without it screen gets all grained up. GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset " When I boot from live CD also I get the same shifted screen Update 2 Tried booting from live CD with 11.04 same issue Update 3 .xsession-errors file : http://pastebin.com/uveSgNa8 Update 4 xrandr -q | grep -w connected xrandr: Failed to get size of gamma for output default default connected 1024x768+0+0 0mm x 0mm

    Read the article

  • Fluid VS Responsive Website Development Questions

    - by Aditya P
    As I understand these form the basis for targeting a wide array of devices based on the browser size, given it would be a time consuming to generate different layouts targeting different/specific devices and their resolutions. Questions: Firstly right to the jargon, is there any actual difference between the two or do they mean the same? Is it safe to classify the current development mainly a html5/css3 based one? What popular frameworks are available to easily implement this? What testing methods used in this regard? What are the most common compatibility issues in terms of different browser types? I understand there are methods like this http://css-tricks.com/resolution-specific-stylesheets/ which does this come under?. Are there any external browser detection methods besides the API calls specific to the browser that are employed in this regard? Points of interest [Prior Research before asking these questions] Why shouldn't "responsive" web design be a consideration? Responsive Web Design Tips, Best Practices and Dynamic Image Scaling Techniques A recent list of tutorials 30 Responsive Web Design and Development Tutorials by Eric Shafer on May 14, 2012 Update Ive been reading that the basic point of designing content for different layouts to facilitate a responsive web design is to present the most relevant information. now obviously between the smallest screen width and the highest we are missing out on design elements. I gather from here http://flashsolver.com/2012/03/24/5-top-commercial-responsive-web-designs/ The top of the line design layouts (widths) are desktop layout (980px) tablet layout (768px) smartphone layout – landscape (480px) smartphone layout – portrait (320px) Also we have a popular responsive website testing site http://resizemybrowser.com/ which lists different screen resolutions. I've also come across this while trying to find out the optimal highest layout size to account for http://stackoverflow.com/questions/10538599/default-web-page-width-1024px-or-980px which brings to light seemingly that 1366x768 is a popular web resolution. Is it safe to assume that just accounting for proper scaling from width 980px onwards to the maximum size would be sufficient to accommodate this? given we aren't presenting any new information for the new size. Does it make sense to have additional information ( which conflicts with purpose of responsive web design) to utilize the top size and beyond?

    Read the article

  • What can I do with the twitter API?

    - by aditya menon
    I've tried googling for this but could not find concrete developer examples. When building mundane daily web applications like Classified websites, Job boards or Intranet targeted Document Management Systems, how can the twitter API help me do more things. May I please have some examples on how developers have used twitter to make their apps better? Other than the obvious use for promotional and search engine optimization purpose (yay there's a new job post on our site), what can I do with it? Also, am I late to the party? I hear a lot of upset on the internet about how twitter is apparently slowly betraying developers (I don't understand the specifics), so should I even look at the system or consider alternatives?

    Read the article

  • MTN WMS Implementation Story

    - by aditya.agarkar
    MTN is Africa's largest cellular phone company serving millions of customers across 21 countries. MTN uses Oracle WMS to manage its distribution activities and its sizzling growth. Just for perspective, since 2004, Africa has been the fastest growing mobile phone market in the world. If you want to know more about MTN and the WMS Project at MTN, a summarized view of MTN WMS project is here. The WMS Project at MTN was presented at Oracle Open World in 2007. The extensive automation at MTN includes interface with Conveyor for item transport, High Speed Sorter for item routing, Put to Light for packing accuracy, ASRS Carousel/Lift for inventory Security and Storage Optimization, Check Weight Scale for shipping accuracy, Automated Carton Erectors for package creation and Automated Carton Labeling. Subsequent to this presentation and their go-live in 2007, the MTN warehouse has scaled new heights. The volume has grown manifolds (as can be expected in a fast growing cellular market). Oracle WMS has been able to scale very well to the increase in volume, just as it was designed to do. Here are a couple of videos that highlight the WMS operations at MTN:  1) Video Interview with Margaretha Theart (Warehouse Manager at MTN) 2) Automation Video at MTN (Hat tip: Syed Imran) Enjoy!

    Read the article

  • Which open source PHP project has the 'perfect' OOP design I can learn from?

    - by aditya menon
    I am a newbie to OOP, and I learn best by example. You could say this question is similar to Which Scala open source projects should I study to learn best coding practices - but in PHP. I have heard-tell that Symfony has the best 'architecture' (I will not pretend I know what that exactly means), as well as Doctrine ORM. Is it worth it to spend many months reading the source code of these projects, trying to deduce the patterns used and learning new tricks? I have seen equal number of web pages dissing and liking Zend's codebase (will provide links if deemed necessary). Do you know of any other project that would make any veteran OOP developer shed tears of joy? Please let me add that practicality and scope of use is not a concern at all here - I just want to do: Pick a project that has a codebase deemed awesome by devs way better and greater than me. Write code that achieves what the project does. Compare results and try to learn what I don't know. Basically, an academic interest codebase. Any recommendations please?

    Read the article

  • Issues with touch buttons in XNA (Release state to be precise)

    - by Aditya
    I am trying to make touch buttons in WP8 with all the states (Pressed, Released, Moved), but the TouchLocationState.Released is not working. Here's my code: Class variables: bool touching = false; int touchID; Button tempButton; Button is a separate class with a method to switch states when touched. The Update method contains the following code: TouchCollection touchCollection = TouchPanel.GetState(); if (!touching && touchCollection.Count > 0) { touching = true; foreach (TouchLocation location in touchCollection) { for (int i = 0; i < menuButtons.Count; i++) { touchID = location.Id; // store the ID of current touch Point touchLocation = new Point((int)location.Position.X, (int)location.Position.Y); // create a point Button button = menuButtons[i]; if (GetMenuEntryHitBounds(button).Contains(touchLocation)) // a method which returns a rectangle. { button.SwitchState(true); // change the button state tempButton = button; // store the pressed button for accessing later } } } } else if (touchCollection.Count == 0) // clears the state of all buttons if no touch is detected { touching = false; for (int i = 0; i < menuButtons.Count; i++) { Button button = menuButtons[i]; button.SwitchState(false); } } menuButtons is a list of buttons on the menu. A separate loop (within the Update method) after the touched variable is true if (touching) { TouchLocation location; TouchLocation prevLocation; if (touchCollection.FindById(touchID, out location)) { if (location.TryGetPreviousLocation(out prevLocation)) { Point point = new Point((int)location.Position.X, (int)location.Position.Y); if (prevLocation.State == TouchLocationState.Pressed && location.State == TouchLocationState.Released) { if (GetMenuEntryHitBounds(tempButton).Contains(point)) // Execute the button action. I removed the excess } } } } The code for switching the button state is working fine but the code where I want to trigger the action is not. location.State == TouchLocationState.Released mostly ends up being false. (Even after I release the touch, it has a value of TouchLocationState.Moved) And what is more irritating is that it sometimes works! I am really confused and stuck for days now. Is this the right way? If yes then where am I going wrong? Or is there some other more effective way to do this? PS: I also posted this question on stack overflow then realized this question is more appropriate in gamedev. Sorry if it counts as being redundant.

    Read the article

  • Sound distortion in Ubuntu 14.04

    - by Aditya Shah
    I recently installed Ubuntu 14.04 on my Dell XPS 15 (L502X). Previously I had Ubuntu 12.04 installed on the laptop along with Windows 8.1 dual boot. The sound worked perfectly fine in Ubuntu 12.04 and is working fine in Windows 8.1. Of late, I have been experiencing sound distortion coming from the subwoofer at moderately high volume levels. At the same level I am unable to reproduce the same effect in Windows 8.1. Also, I did a clean install of Ubuntu 14.04 over 12.04. Can anyone please confirm this and help me with this? Thanks

    Read the article

  • Installer doesn't display partition I want to install to

    - by Aditya
    While performing a Ubuntu 10.10 installation on my laptop, it doesn't show partitions pertaining to the PC. My PC configuration is as follows : HP Pavilion dv6 - 2020AX AMD Turion II Dual Core Mobile Processor M500 4 GB RAM OS Installed : Windows 7 500 GB Hard drive partitioned as follows : C : 227 GB (Free : 142 GB) D : 11.9 GB (Free : 1.98 GB) - Recovery F : 174 GB (Free : 18 GB) G : 50.5 GB (Free : 50.4 GB) So, I want to perform a Dual-boot installation on my PC, so that Ubuntu resides in the free disk space G:. Therefore, I started the Ubuntu 10.10 installation and select the manual partitioning feature in the installation. However, in the 'Allocate Drive Space' section of the installation, following partitions information is displayed: Partition Type Size Used /dev/sda /dev/sda1      1 MB    unknown /dev/sda2    ntfs    208 MB   unknown /dev/sda3   ntfs    244813 MB    168540 MB /dev/sda4    ntfs    255083 MB   3221 MB where /dev/sda - 500 GB So, what exactly is the problem? What is it should I do to install Ubuntu 10.10 in the G: disk space? Why are the partitions not being shown as the way they should be? Any Suggestions. Thank you for the help.

    Read the article

  • What is the need for 'discoverability' in a REST API when the clients are not advanced enough to make use of it anyway?

    - by aditya menon
    The various talks I have watched and tutorials I scanned on REST seem to stress something called 'discoverability'. To my limited understanding, the term seems to mean that a client should be able to go to http://URL - and automatically get a list of things it can do. What I am having trouble understanding - is that 'software clients' are not human beings. They are just programs that do not have the intuitive knowledge to understand what exactly to do with the links provided. Only people can go to a website and make sense of the text and links presented and act on it. So what is the point of discoverability, when the client code that accesses such discoverable URLs cannot actually do anything with it, unless the human developer of the client actually experiments with the resources presented? This looks like the exact same thing as defining the set of available functions in a Documentation manual, just from a different direction and actually involving more work for the developer. Why is this second approach of pre-defining what can be done in a document external to the actual REST resources, considered inferior?

    Read the article

  • What are some easy techniques to scan books for new information?

    - by aditya menon
    I find it irresistible to keep purchasing cheap programming and technical e-books in fields such as Drupal, PHP, etc., and also compulsively download free material made available such as those from Microsoft's developer blog... The main problem with the large library I've developed is that there are many chapters (especially the first few) in these books packed with information I already know, but with helpful tidbits hidden in between. The logical step would be to skip those chapters and read the ones I don't seem to know anything about, but I'm afraid I may lose out on really important information this way. But naturally it is tedious to have to read about variables, functions and objects all over again when you are trying to know more about the Registry pattern, for example. It's hard to research on the net for this, because my question itself seems vague and difficult to formulate into a single search query. I need people-advice - what do you do in this situation?

    Read the article

  • Version Changes: How considerable are the compatibility issues in project?

    - by Aditya P
    For example if we consider ActionScript2.0(based on Objects but programming does not implement much OOP ) vs 3.0(highly OOP) its like a whole new scripting language in the sense of approach, programming style,features you get the idea. In PHP we can see current versions going from 3-5. brief version changes Question :Developers who work on PHP is it easy to migrate from version to version? Question :Are there any extensive compatibility issues, forward or backward? Question :Does your project stick to a particular version till the end ? Question :Does the programming style ,approach change from version to version? Question :If you had to get started on PHP to contribute to a project built earlier versions, would learning the latest version be counterproductive towards this aim? Some related topics i had come across on SE How should I be keeping track of php script version/changes? What is happening to PHP 6? It would be Really helpful in understanding if you could answer this topic directly to the questions put forth.

    Read the article

  • Which free PHP based forum is the easiest to extend or customize? [closed]

    - by aditya menon
    Possible Duplicate: Which Content Management System (CMS) should I use? I am looking to start a new forum, with a traditional forum layout (like webhostingtalk, for example). In this space, I know phpBB and SMF are strong contenders. I do not know for sure the names of other great forum software that might exist... My most important need is that it should be easy to modify the display area, at the least, without having to dig too much into the core. Drupal excels in this area with its templating system, but the forum module doesn't look like the forum interface most people are used to... It would be a great plus if the software has alternative Captchas like question based or invisible Captcha. If it doesn't, I would like to be able to code it in without much trouble (that is, the software exposes a good API)

    Read the article

  • Why is my class worse than the hierarchy of classes in the book (beginner OOP)?

    - by aditya menon
    I am reading this book. The author is trying to model a lesson in a college. The goal is to output the Lesson Type (Lecture or Seminar), and the Charges for the lesson depending on whether it is a hourly or fixed price lesson. So the output should be: lesson charge 20. Charge type: hourly rate. lesson type seminar. lesson charge 30. Charge type: fixed rate. lesson type lecture. When the input is as follows: $lessons[] = new Lesson('hourly rate', 4, 'seminar'); $lessons[] = new Lesson('fixed rate', null, 'lecture'); I wrote this: class Lesson { private $chargeType; private $duration; private $lessonType; public function __construct($chargeType, $duration, $lessonType) { $this->chargeType = $chargeType; $this->duration = $duration; $this->lessonType = $lessonType; } public function getChargeType() { return $this->getChargeType; } public function getLessonType() { return $this->getLessonType; } public function cost() { if($this->chargeType == 'fixed rate') { return "30"; } else { return $this->duration * 5; } } } $lessons[] = new Lesson('hourly rate', 4, 'seminar'); $lessons[] = new Lesson('fixed rate', null, 'lecture'); foreach($lessons as $lesson) { print "lesson charge {$lesson->cost()}."; print " Charge type: {$lesson->getChargeType()}."; print " lesson type {$lesson->getLessonType()}."; print "<br />"; } But according to the book, I am wrong (I am pretty sure I am, too). The author gave a large hierarchy of classes as the solution instead. In a previous chapter, the author stated the following 'four signposts' as the time when I should consider changing my class structure: Code Duplication The Class Who Knew Too Much About His Context The Jack of All Trades - Classes that try to do many things Conditional Statements The only problem I can see is Conditional Statements, and that too in a vague manner - so why refactor this? What problems do you think might arise in the future that I have not foreseen?

    Read the article

  • unable to install ubuntu

    - by Aditya
    I am working on my HP laptop with Windows7. I am not able to install ubuntu (making it dual boot). I have made my usb stick bootable by using UNETBOOTIN. Following are the steps I took to install ubuntu: Bios device options-my_usbstick-default. after this nothing else happens. just a blank screen persists until I have to eventually shut down my system. I assure that the iso file used is good as with the same procedure followed my friend was able to install ubuntu in his DELL system. Please help me out with this one.

    Read the article

  • How to solve linear recurrences involving two functions?

    - by Aditya Bahuguna
    Actually I came across a question in Dynamic Programming where we need to find the number of ways to tile a 2 X N area with tiles of given dimensions.. Here is the problem statement Now after a bit of recurrence solving I came out with these. F(n) = F(n-1) + F(n-2) + 2G(n-1), and G(n) = G(n-1) + F(n-1) I know how to solve LR model where one function is there.For large N as is the case in the above problem we can do the matrix exponentiation and achieve O(k^3log(N)) time where k is the minimum number such that for all km F(n) does not depend on F(n-k). The method of solving linear recurrence with matrix exponentiation as it is given in that blog. Now for the LR involving two functions can anyone suggest an approach feasible enough for large N.

    Read the article

  • Fixing windows MBR without Vista Recovery CD

    - by Aditya Sehgal
    I had Windows Vista + Ubuntu running on my system. I deleted the ubuntu partitions from Windows. However, when I start the system, GRUB throws up an Error 22 (missing partition) and does not let me boot into Windows. The CD ROM on my laptop is fried and therefore I tried installing Ubuntu again using a USB install. However, the version Ubuntu 9.10 justs hangs in the load screen and does nothing. I do not have windows Vista Recovery CD (as it was a recovery partition in my laptop). What are the options I have? How do I fix this?

    Read the article

  • Fixing windows MBR without Vista Recovery CD

    - by Aditya Sehgal
    I had Windows Vista + Ubuntu running on my system. I deleted the ubuntu partitions from Windows. However, when I start the system, GRUB throws up an Error 22 (missing partition) and does not let me boot into Windows. The CD ROM on my laptop is fried and therefore I tried installing Ubuntu again using a USB install. However, the version Ubuntu 9.10 justs hangs in the load screen and does nothing. I do not have windows Vista Recovery CD (as it was a recovery partition in my laptop). What are the options I have? How do I fix this?

    Read the article

  • iptables rule to submit packets matching a specific negative rule

    - by Aditya Sehgal
    I am using netfilter_queue to pick up certain packets from the kernel and do some processing on them. To, the netfilter queue, I need all packets from a particular source except UDP packets with src port 2152 & dst port 2152. I try to add the iptable rule as iptables -A OUTPUT ! s 192.168.0.3 ! -p udp ! --sport 2905 ! --dport 2905 -j NFQUEUE --queue-num 0 iptables throw up an error of Invalid Argument. Querying dmesg, I see the following error print ip_tables: udp match: only valid for protocol 17 I have tried the following variation with the same error thrown. iptables -A OUTPUT ! s 192.168.0.3 ! -p udp --sport 2905 --dport 2905 -j NFQUEUE --queue-num 0 Can you please advise on the correct usage of the iptables command for my case.

    Read the article

1 2 3 4  | Next Page >