Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Omar Sharaki

Greenhorn
+ Follow
since Aug 12, 2015
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Omar Sharaki

I feel that you're still trying to get me to lean toward TDD. Am I right? Also, do you have any comments on my Review suggestion in the previous post?
2 years ago
Thanks for the insights guys. It's not the first time I've heard the benefits of TDD being mentioned. However, given lack of time, in depth specification and most of all experience I think TDD isn't really an option for us.

After speaking with our chief programmer, I decided that unit tests will be carried out for a class's components whenever a developer pushes his version on to the server. The test results will then be returned to the developer who upon failure of the tests will make the proper adjustments and give the new version in to be re-tested. Does that sound sensible? Furthermore, I'm wondering how often I should get the developers to make reviews of their code. An idea would be once right before each release. This includes releases which happen after adjustment of the code in case of a failed test.    
2 years ago
Hi all,

I'm the test manager on my university project where we're developing a small software product in Java. I'm currently in the middle of writing up a test document where I'm detailing our test strategy and so on.
My big question right now, however, is WHEN. When are test supposed to be run? We're not doing TDD. This means tests need to be written as soon as there has been some code written. If we take Unit Tests as an example, how often should the tests be carried out? Is a Unit Test for a component(say a method) to be carried out as soon as the component is implemented? Or should I wait for a whole class to be implemented before running test cases for it's components? I'd also be curious to know how this applies to integration tests. However, for simplicity's sake let's focus on Unit Tests for now.
Looking forward to hearing your answers!
2 years ago
Why does the following:


give me an error saying "This method must return a result of type int"?
I am returning. And it's not like I'm returning in an if-statement where it's possible that the condition might never be fulfilled, this is a loop which means that sooner or later the return-statement will be carried out. Ideas?
3 years ago
In this article, the author states that:

Tracing the type hierarchy down the branch of simple types, we see that the first simple type is anySimpleType, which is also type that you could actually use. W3C XML Schemas has 44 built-in simple types, each of which derives from anySimpleType, and all but three of which derive by restriction. Not a single one derives by extension. To extend a simple type would mean to add element children or an attribute. This contradicts the definition of simple type in W3C Schemas and is thus prohibited.


However, I see over and over again people doing just that. For example line 5 of this code snippet taken from here:



So is the author of the article mistaken?
Could you explain more clearly please what you mean by Internet Explorer 8 compatible mode and how I might switch to that?
But even when I use Internet Explorer I still don't see omarkiwi as one would expect, rather I see just omar. Which means that part of the external DTD(namely the line where I defined my general entity &kw;) is not being taken into consideration.
I have an external DTD where I've declared the following general entity:



In my XML file I try to use this new entity after, of course, declaring the external DTD like so:



However when I open this file in internet explorer I get my XML file displayed with omar where I'd expected to see omarkiwi. When I open it in chrome it says that kw was never declared, even though my validator didn't bring up any errors. Also, when I pass the DTD as an internal DTD in the XML file, instead of as an external one, and display it, I get omarkiwi as it's supposed to be. What do you guys think?
I'm trying to apply the exponential binary search, but I'm facing problems regarding the power index. As you know, before I do the normal binary search, I need to keep comparing my key with the elements in my array until I find an element array[2^i] where key<array[2^i]. Then I call binary search with the boundaries 2^(i-1)...2^i. Now, my array contains 676 elements. Which means that starting from i=10, I'm out of the bounds of my array. So if key>array[2^1] and key>array[2^2]....till key>array[2^9], i will be incremented once more to become 10(i.e. 2^10=1024) and the comparison will be done again. But this time, since the array only has 676 elements, I will be out of bounds and I'll get an error. So say the element I'm looking for lies near the end of my array. Then, the first part of the algorithm would probably reach an i greater or equal 10 to find an element greater than my key. This will give me an ArrayOutOfBounds error. So what can one do to avoid this considering that one uses finite arrays? It seems like this is an obvious question to ask regarding the way this algorithm functions, but there doesn't seem to be that much information on it online. Thanks in advance.
3 years ago
It appears to be working. I believe the problem solved itself after restarting eclipse. Cheers and sorry for the false alarm.
3 years ago
It gives me this error:
" StackElement cannot be cast to java.lang.Character"
StackElement is my node class. But why does it say this? Shouldn't I be converting an object to char since I called the getO() method?
3 years ago
So I have a stack that contains elements of type object. In these elements I'm saving characters.



As I said I'm saving chars in these elements. Now I would like to use these stack elements as characters. These are methods in my code, first one returns the data in the element and the second returns the element:



This is how I'm trying to cast, but it isn't working:
3 years ago
Well for the String arrays it says that they're not equal but for the Strings it says that they are equal. Do you know why this is?
4 years ago


How come this prints "is there" but this:



prints "not there"? Thanks in advance!
4 years ago