What king can you make if you take,
the head of a lamb,
the middle of a pig,
the hind of a buffalo,
and the tail of a dragon?
Before you start development on magento
I have wasted my lot of time while developing on magento. its only because i was not following some basic things needed before you start development on magento. In my opinion if you follow these 4 tips you should be okay!
[break][/break]1.) DISABLE CACHE : This is the first requirement before you start development on magento. I have seen many people struggling and wondering why their changes are not visible. I also read somewhere that on an average a new developer spends around 2 hours on magento platform wondering why his changes are not visible.
To disable cache
- Go to System > Cache Management
- Click on Select All(on left).
- Select disable from Action dropdown(on right).
- And Click on Submit.
2.) Enable Logging:
You might need this, as often which writing php code if you miss some braces or use a function which does not exist you will get error something like this:-
8 Steps guide on How to create Magento module
This is one of my first article in the series of How to’s in magento. But before you actually start any development on magento you must follow these guidelines.
Step 1: First create a magento module xml file
( app/etc/modules/Pw_Manageproducts.xml)
[break][/break]1 2 3 4 5 6 7 8 9 | <?xml version="1.0"?> <config> <modules> <Pw_Manageproducts> <active>true</active> <codePool>local</codePool> </Pw_Manageproducts> </modules> </config> |
This xml tells magento that module is active and will be available in local codePool.
At this point, you should be able to see your module in Magento Admin Panel. Go to System->Configuration->Advanced->Disable Modules Output. You should be able to see Pw_Manageproducts module listed there.
Confusing one!
a) Q3
b) Q4
c) Q1
d) Q2
a) Q4
b) Q2
c) Q3
d) Q1
Q3. Which is the first question where d) is the correct answer
a) Q1
b) Q2
c) Q4
d) Q3
Q4. Which is the first question where b) is the correct answer
a) Q2
b) Q4
c) Q3
d) Q1
Answers:
d
c
a
b
🙂
River crossing – the harder one
Now the difficulties are : if the dog is left with anyone and the maid isn’t there to control him, he’ll bite. The dad can’t be left with any of the daughters when the mom isn’t there. Likewise, the mom can’t be trusted alone with either of the sons when the dad isn’t there.
Remember! only an adult can operate the boat, and the boat can’t drive itself.See Solution : River crossing - the harder one
Say
West shore is {W} and East shore is {E}
Lets give the nick names to each family member and dog 😉
Mother – {m}, Father – {F}, Daughters – {d1, d2}, Sons – {s1, s2}
House maid – {h}, Dog – {d}
Initially,
W = {m, d1, d2, f, s1, s2, h, d}
E = {…}
let’s move everyone, over…
housemaid and dog go east, and the housemaid comes back:
W = {m, d1, d2, f, s1, s2, h}
E = {d}
housemaid and s1 go east, h and d come back:
W = {m, d1, d2, f, s2, h, d}
E = {s1}
father and s2 go east, father comes back:
W = {m, d1, d2, f, h, d}
E = {s1, s2}
mother and father go east, mother comes back:
W = {m, d1, d2, h, d}
E = {f, s1, s2}
h and d go east, father comes back:
W = {m, d1, d2, f}
E = {s1, s2, h, d}
father and mother go east, mother comes back:
W = {m, d1, d2}
E = {f, s1, s2, h, d}
mother and d1 go east, housemaid and d come back:
W = {d2, h, d}
E = {m, d1, f, s1, s2}
h and d2 go east, h comes back
W = {h, d}
E = {m, d1, d2, f, s1, s2}
h and d go east
W = {}
E = {m, d1, d2, f, s1, s2, h, d}
And we are done.
Defective coins
We have 10 bags of 1 Rupee coins. One bag contains all the defective coins, the weight of each coin in that bag is 1 gram lesser than the weight of a normal 1 Rupee coin. You have a spring balance, which tells the exact weight. After how many minimum no. of weighs you can separate the bag with defective coins.
Other variant of the same problem:
There are 10 machines in a factory. Each produces coins weighing 10 grams each. One day the factory owner cones to know that one of the machine is not functioning properly and produces coins of weight 9 grams. You have to find out the faulted machine. You ONLY have a weighing machine and you can use it only ONCE.
Want to try now ?
solution :
Let P is the no. of the bag which contains the defective coins.
Then S = (W grams)*(1+2+3….+10) – P*(1 gram)
P will come out to be a number between 1 to 10 and thats the required bag.
Hats and IIT students
Prof goes out and comes back after 20 minutes but nobody was able to answer the question. So he gave them 10 more minuets but the result was the same. So he decides to give them final 5 minutes. When he comes everybody was able to answer him correctly.
So what is the answer? and why?
See Solution : Hats and IIT studentsAfter first interval of 20 minutes :
So there can not be 1 red and 8 black hats.
After second interval of 10 minutes :
So there can not be 2 red and 7 black hats.
After third interval of final 5 minutes :
So there are 3 red hats and 6 black hats.
Heavier ball
If you have solved it then try it for N no. of identical balls with one defective ball.
See Solution : Heavier BallThe minimum no. of measures required are 2. Now can you solve it… ? Give it a try…
Here is the solution which tells you that how can you do it in 2 measurements.
Divide 8 balls into groups of 3, 3 and 2.
First weigh :
Weigh the two groups of 3 ball, now there are two possibilities
a) They are balanced (all 6 balls are of equal weight)
b) One side is heavier then the other.
case (a) :
The group of 2 has the defective ball. Weigh them with one on each side of balancing machine. The side which has more weigh has the heavier/defective ball.
case (b) :
We got the three balls of the side which is heavier. Now take any two balls and weigh them, then again there are two cases.
(i) They both are of equal weight.
(ii) One is heavier than the other.
for case (b)(i) :
The third ball is heavier/defective than all other balls
for case (b)(ii) :
The heavier ball is defective.
——————————————–
Solution for N no. of balls.
If there is 1 ball, No measurement is required.
If there are 2-3 balls, we need 1 measurement.[(3^0 +1) to 3^1]
If there are 4-9 balls, we need 2 measurement. [(3^1 +1) to 3^2]
Now if there are N balls
and lets say it lies between (3^(x-1) +1) to 3^x
then x = [logN/log3] = Greatest integer of logN to the base 3.
Then minimum no. of measures is equal to x = [logN/log3]
Defective ball
You have 12 balls all look identical (in shape, color etc.). All of them have same weight except one defective ball. You don’t know that the defective one is heavier or lighter than other balls. You can use a two sided balance system (not the electronic one). It is given that the minimum no. of measures required to separate the defective ball is three. Find the way you separate the defective ball.
See Solution : Defective ballDivide the balls into 3 groups of 4 balls.
weigh 2 groups, one on each side.
There will be two cases
a) The weight on both side is equal i. e. these two groups don’t have the defective ball.
b) One side has less weight than the other side.
You know 8 balls are of equal weight and one of the remaining 4 balls have a defective one. Name these four as B1, B2, B3, B4.
Second weigh :
Take B1, B2 and weight them.
(i) If they are unequal then either B1 is defective or B2. Compare B1 with one of eight balls. If B1 is equal to that then B2 is defective otherwise B1.
Total measurements in this case : 1 (first weigh) + 1 (second weigh) + 1 (B1 with other ball) = 3
(ii) If B1 and B2 are equal then either B3 is defective or B4. Compare B3 with one of eight balls. If B3 is equal to that then B4 is defective otherwise B3.
Total measurements in this case : 1 (first weigh) + 1 (second weigh) + 1 (B3 with other ball) = 3
Mark the balls in the side with less weight as L and with more weight as M. We get 4L and 4M.
Second weigh :
Take 2L and 1M in One side say A and take 2L and 1M in Other side say B of balance system. 2M are reserved for now.(i) If side A is down and next side goes up then it has two possibilities.
1. One of 2L in B has less weight than other 7 balls
2. The 1M in A has more weight(ii) If side B is down then it also has two possibilities.
1. One of 2L in A has less weight than other 7 balls
2. One of 1M in B has more weight than other 7 balls(iii) Both sides are balanced
Third weigh :
In cases (i) or (ii) we will get 3 balls (2L and 1M) after the second weigh.
For case (i) and (ii)of (b) :
Weigh two L balls with each other, if they are equal then the 1M is heavier and if they are not then the ball with less weight is defective.
For case (iii) of (b) :
In this case one of the two reserved balls is defective. We have 2M balls. Weigh them, the one which is heavier is defectives. because we know that issue is with the ball with more weight.
River crossing
Note that if a boat with a cannibal and an anthropologist travels to a shore with one cannibal on it, then no. of cannibals > no. of anthropologists, even if you say the anthropologist immediately takes the boat back.See Solution : River crossing
Let
C = Cannibal
B = the boat
W = the west shore (which they are all on)
and E = the east shore (where they want to go)Step 1 : A and C crosses
W [A, A, C, C] E [A, C, B]Step 2 : A returns
W [A, A, A, C, C, B] E [C]Step 3 : Two C crosses
W [A, A, A] E [C, C, C, B]Step 4 : C returns
W [A, A, A, C, B] E [C, C]Step 5 : Two A crosses
W [A, C] E [A, A, C, C, B]Step 6 : A and C returns
W [A, A, C, C, B] E [A, C]Step 7 : Two A crosses
W [C, C] E [A, A, A, C, B]Step 8 : C returns
W [C, C, C, B] E [A, A, A]Step 9 : Two C crosses
W [C] E [A, A, A, C, C, B]Step 10 : C returns
W [C, C, B] E [A, A, A, C]
Step 11 : Two C crosses
W [Empty]
E [A, A, A, C, C, C, B]