|
If you were testing a count function like the one below, is it considered to be 'right' or 'wrong' to test multiple things for the function in one function vs having a test function for each of the tests?
function testGetKeywordCount() { $tester = $this...
Started by GeoffreyF67 on
, 6 posts
by 6 people.
Answer Snippets (Read the full thread at stackoverflow):
It also makes.
That way it is easier each step along the way, its easier to stick to the one assertion per test approach.
You should have multiple test functions, where each tests its own condition .
|
|
I'm curious as to what the "right" way to convert builtin types is in .NET. Currently i use Convert.To[type]([variable]) without any null checking or anything. What is the best way to do this?
Started by RCIX on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
For the most part*() functions say This object isn't a type B, but there exists a way to convert to type B"
It depends.
Kindness,
Dan
See this link.
If there is a "right" way, like most tasks it is contextual.
|
|
I have an HTML table with large number of rows, and I need to right align one column.
I know the following ways,
<tr><td>..</td><td>..</td><td align='right'>10.00</td><tr>
and
<tr><td>..</...
Started by Palani on
, 8 posts
by 8 people.
Answer Snippets (Read the full thread at stackoverflow):
$(”table td”).addClass(”right-align-class: right; }
Then in your table....
Use jquery to apply class to all tr unobtrusively.
Works wonders ;)
This way compliant.
Step 2: Turn on GZIP compression.
Or, if you must, use inline styles).
|
Ask your Facebook Friends
|
Hello.
Is it any cross-platform way to check that my python script is executed under admin rights? Unfortunately, os.getuid() is UNIX-only and is not available under windows :(.
Started by Eye of Hell on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at serverfault):
That's that....
You should just try to do what you want to do and use exceptions to deal with lack of privileges .
Both Unix and Windows have a long list of different privileges that a particular user may or may not have .
Admin rights" is meaningless.
|
|
I've seen lots of ways to label things in a form such as <label> , <div> , <span> , etc. Is there a right or wrong answer for this? Are there any advantages/disadvantages to any of these? Thank You
Started by bobbyb on
, 5 posts
by 5 people.
Answer Snippets (Read the full thread at stackoverflow):
The best way is this one :
<label for="anInput">.
Www.communitymx.com/content/article.cfm?cid=02310
The proper way to provide a label to a form element is to use="" />
Take a look at what Phil Haack thinks...
|
|
I have a horrible habit, actually something I'm wrestling with right this moment, when I think of a better way to do something - either a refactor, or something that would just be SO MUCH COOLER LOOKING, or such a better UX, I just HAVE to do it. Even...
Started by Sara Chipps on
, 12 posts
by 12 people.
Answer Snippets (Read the full thread at stackoverflow):
On the other hand, if you write crap but get it out super fast, that's also not the "right....
I think when you say you are doing something the "right way" that implies a balance of quality it, it's not the "right way".
|
|
Basically just verify if an object exists and return the object. then based on that perform actions. I'm wondering whats the right way to do it without returning a 404?
try: listing = RealEstateListing.objects.get(slug_url = slug) except: listing = None...
Started by Rasiel on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
If you want a page to return 404 Not Found if an object doesn't exist, you can use django.shortcuts.get_object_or_404 :
listing = get_object_or_404(RealEstateListing, slug_url=slug)
This will return the object with the given ID, or raise Http404 if it... .
|
|
Hi stackers!
What is the right way to create a pointer to pointer object? Like for example,
int **foo; foo = new int[4][4];
Then the compiler gives me an error saying "cannot convert from int (*)[4] to int **.
Thanks.
Started by sasayins on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at stackoverflow):
C++ has no direct language support for dynamically....
Int **foo = new int*[4]; for (int i = 0; i < 4; i++) foo[i] = new int[4];
Clarification:
In many languages the code above is called a jagged array and it's only useful when the "rows" have different sizes .
|
|
Hello, I suppose with the onboard-perl from my linux-distribution I don’t have to care about updates. What is the right way of doing updates when I have build my perl from sourcefiles?
Started by sid_com on
, 3 posts
by 3 people.
Answer Snippets (Read the full thread at superuser):
Do you maintain your Perl via your linux distribution's package manager, or do you build it from source?
If you build from source, simply download the new distribution, build it and install it... .
Your first sentence seems to be contradicted by the second .
|
|
Which of the following ways is the right one in using the characters " and ' inside PHP's sub-arrays?
#1 Way in debugging PHP code $_POST["login['username']"];
#2 My original way in PHP $_POST['login[username]'];
My code is now broken after changing all...
Started by Masi on
, 4 posts
by 4 people.
Answer Snippets (Read the full thread at stackoverflow):
You don't need to quote the array keys in HTML, this is correct:
<input name="login[password]" type="password" cols="92" />
This will create in $_POST a key 'login' whose value is another array having the key 'password', so you can access it like... .
|