Is an index not similar to a dictionary? If you have the key, you can immediately access it?
Apparently indexes are sometimes stored as B-Trees... why is that?
I noticed that in Linux kernel 2.4 setscheduler doesn't force need_resched. Why is that? is it just some convention, or does that happens somewhere else?
Very quick question about programming practices here:
I've always used echo() to output HTML code to the user as soon as it was generated, and used ob_start() at the same time to be able to output headers later in the code. Recently, I was made aware that this is bad programming practice and I should be saving HTML output until the end.
Is there a reason for this? What is it, and why isn't output buffering a good alternative?
Thanks!
public class Test {
public static void main(String[] args){
if (5.0 5) // (5.0<5) for both case it is going to else
System.out.println("5.0 is greater than 5");
else
System.out.println("else part always comes here");
/another sample/
if (5.0 == 5)
System.out.println("equals");
else
System.out.println("not equal");
}
}
can any one explain the first "if statement" why it always come to else part
Why is CompareAndSwap instruction considered expensive?
I read in a book:
"Memory barriers are expensive, about as
expensive as an atomic compareAndSet()
instruction."
Thanks!
I have a script that reports the following error:
Warning: mysql_connect()
[function.mysql-connect]: Access
denied for user 'admin'@'localhost'
(using password: YES) in
C:\wamp\www\bits\includes\connect.inc.php
on line 10
Notice: Undefined variable: l_error in
C:\wamp\www\bits\includes\connect.inc.php
on line 12
Notice: Undefined variable:
l_cannotconnecttodatabase in
C:\wamp\www\bits\includes\connect.inc.php
on line 12
Why would this be?
Why are there only four registers in the most common CPU (x86)? Wouldn't there be a huge increase in speed if more registers were added? When will more registers be added?
This question goes out to those who have used Tapestry as a web framework and then either gave it up or switched to something else, or even ported their application from Tapestry to something else.
The question is why? What led you to make this change?
EDIT: Also, what framework (if any) did you change to?
I believe the expression T() creates an rvalue (by the Standard)
However the following code compiles (at least on gcc4.0)
class T {... };
int main()
{
T() = T();
}
I know technically this is possible because member functions can be invoked on temporaries and the above is just invoking the operator= on the r-value temporary created from T().
But conceptually this is like assigning a new value to an r-value.
Is there a good reason why this is allowed?
$('.box').click(function(){
$(this).find('p').toggle(
function () {
$(this).css({"color" : "red"});
},
function () {
$(this).css({"color" : "black"});
}
);
});
if i execute this script the 'p' color will change if i click on the 'p' not on the .box class why ? And how to i make it so that 'p' color changes when i click on the .box div
I'm only supporting the portrait orientation, but both the right-side-up and upside-down versions. Why do my subviews not resize appropriately? There's a status bar sized black space at the top of the view. If I change tabs and come back, it's corrected.
I read that a few databases can be used in-memory but can't think of reason why someone would want to use this feature. I always use a database to persist data and memory caches for fast access.
hi,
I don't understand why I cannot click the tags on top in IE7 on this website: http://www.sanstitre.ch/drupal/portfolio?tid[0]=38http://www.sanstitre.ch/drupal/portfolio?tid[0]=38
It says javascript error but I debugged with Firefox and I don't get any error...
Could you give me some help ?
I am reading these two articles. However I still do not get --bare option. If the server has no working directory and if a new member of the team clones the project then that person will not get any content.
Any further clarification will help on why --bare is needed.
During a recent interview I was asked why one would want to create mock objects. My answer went something like, "Take a database--if you're writing test code, you may not want that test hooked up live to the production database where actual operations will be performed."
Judging by response, my answer clearly was not what the interviewer was looking for. What's a better answer?
On the Apple guide, there is a step before building the AppStore version:
Open the Xcode project and Duplicate
the “Release” configuration in the
Configurations pane of the project's
Info panel. Rename this new
configuration “Distribution”.
Why this step is needed? Can I skip this step and use the "Release" configuration to build the final version for AppStore?
I know the question has no practical value, but it is interesting why in some languages semicolons and {} blocks are removed although their predecessor have them.
Actually it makes me nervous to write a code in Python as there are no ";" and {}.
Also in new language Google-GO semicolons are also missing although it says that lexer uses a rule to insert semicolons automatically as it scans.
So is there any secret :) reason for this.
Why is Python such a slow language, on average, compared to C/C++? I learned Python as my first programming language, but I've only just started with C and already I can feel and see the difference.
This is my SQL:
SELECT `tbl`.*, 123 AS `test` FROM `tbl` GROUP BY `test`
It works when I run it directly in MySQL. But PDO says:
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'test' in 'field list'
Why so? How to cure this problem? I'm using Zend_Db.