Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Rish Gupta

+ Follow
since Sep 29, 2011
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Rish Gupta

I am trying to add sheet names to cells in an excel formula that do not have sheet names. For example a formula on curr_sheet :
'other_sheet'!$B$2 + A1
should become :
'other_sheet'!$B$2 + 'curr_sheet'!A1

and :
'Calculation IRDA Circular'!AC4
should remain unchanged

The above code gives me :
'curr_sheet'!'other_sheet'!$B$2 + 'curr_sheet'!A1
I think the solution is in backtracking, I tried but it conflicts with the $ sign in $B$2 and gives me this :
'other_sheet'!$'curr_sheet'!B$2 + 'curr_sheet'!A1
Is there a solution to this?
7 years ago
This should explain the process with an output (please let me know if I can somehow make it more efficient):
8 years ago
I think this should work :
8 years ago
Thanks to whoever is looking..
I have been trying to develop a slide show code, CSS,JavaScript the code is ready.. copying the html code below (please feel free to use it anywhere you like)..
I have been having issues trying to get the z-index right
'cover' div from code below has a box shadow and i'd like the images in 'slide' div to slide under it (notice how images hide the shadow on left and right when moving)
Thanks in advance!

Now another question comes to mind.. say we have a scenario below:

package one
protected class oneA

protected interface oneB
//package one ends

package two
public class twoA extends oneA implements oneB

Can the above scenario be possible?
8 years ago
I was just wondering.. my understanding from everywhere I have read is interface cannot be private or protected (not at the top level) but when we declare an interface without any modifier it is default.
We know default modifier has more restricted access than protected.. public > protected > default > private
Now since an interface can be public and default then why not protected as clearly if they were allowed to be protected they could be implemented by a subclass..?

While typing this question I figured how would an interface know which is it's subclass? that is why Java allows only public i.e. any class can implement it or default i.e. any class within the package can implement.. am I right?
8 years ago
thanks for the reply Bear, that solved my problem..I will definitely do it with the second option you gave..
but since I have been trying to study it for the last one week or so I feel it is possible to do it with js I just cant figure out how...
but in case I wanted to do it through JavaScript is it possible to do something like.. :
var rightP = document.getElementById("rightPanel");
Var images = rightP.getElementsByTag("img"); = "0";

If you could just point me in the right direction.. thanks for your reply!
I am trying to figure out how to change the opacity of all images inside a div (say id="rightPanel") through a JavaScript function.
I am trying to do so onMouseOver which kicks off the method menuOn. I am not very well versed with JS so please correct me if I am wrong but my approach was that I assigned the id "rightPanelImg" to all the images inside rightPanel and this is what my menuOff method looks like:
function menuOn(){
var rightPImg = document.getElementById('rightPanelImg');
rightPImg.setAttribute("style", "opacity:0");
but this only reduces the opacity of the first image inside rightPanel div.
What am I doing wrong?

Thanks in advance!

For starters, that code isn't right, because it doesn't take into account the fact that your "string" is cyclic.

Hi Winston,
I tested the code with about 20 different inputs (S string) and it has given me the right answer each time, could you give me an example that the code might not work for.. Maybe I'm thinking in just one direction. I'm not shifting the string to check if it is cyclic or not, I'm doing something similar to what you asked in question 1 to which I think the answer would be N-1 worst case scenario.

Basically here's what i designed the code to do:
It gets all the factors of string length (let's take 'abcabc' as an example, it'll return 1, 2, 3 and 6)
Now we start with 1, the first factor, so the code compares 'a' to 'b' and since they are different 1 is eliminated.
Next factor is 2, so the code compares 'ab' to 'ca' and since they are different 2 is eliminated.
Next factor is 3, so we compare 'abc' to 'abc', match is found and since we have reached the end of the string we have an answer which is string length divided by 3.. So final answer is 2, which is the right answer .
(If there were 3 more characters say 'abcabcxxx', 'abc' would have been compared again to xxx and answer printed only if it were a match otherwise the code would have moved on to the next factor)

I hope it makes sense, it would be a big help if you gave an example for which the code might not work except empty string, I haven't tested for it.
8 years ago
Is there some software that could compute the time it takes to run?? in terms of N..

in the code above I could cut down further on run time by going for(int i=1; i<=x*/2*; i++) while finding factors in line 7 and changing to i<fact.size() instead of i<fact.size()*-1* in line 14.
8 years ago
K, So I did what you guys suggested (big thanks for all your inputs) and here is what I came up with.. could you confirm if this was at least Oof(N log N) if not OofN..

@Maxim - I din't really get what you suggested.. actually I have never heard of Knuth–Morris–Pratt algo.. I'll try to do some reading online on it and see if I can come up with something better..
thanks a lot for everyone's input
8 years ago
Hi, I am not sure what these are called but here's what I'm trying to do.. please bear with me, i'm not good at explaining.. Say we have a string S='abcabc' now we need to figure out how many similar strings we will get if we go cyclic. for example using the above case:
0th cycle : abcabc //this is the oroginal string
1st cycle : bcabca //here i th character = i+1 (so we are shifting by one) and putting the first character in the end
2nd cycle : cabcab
3rd cycle : abcabc //here we get the same string as the original string so counter is incremented by 1
4th cycle : bcabca
5th cycle : cabcab
6th cycle : abcabc //here we are back to where we started from so counter is again incremented by 1 and program exits returning 2

I hope you get what I'm trying to do and below is the code that I came up with:

The problem is that the above code is time consuming (O of N^2), I am trying to achieve it in O of N..
any ideas would be appreciated. TIA
8 years ago