basics

Java double initialization

In what way are these statements different? double dummy = 0; double dummy = 0.0; double dummy = 0.0d; double dummy = 0.0D; ...

Reading a Wordpress function description

I want to be able to understand the standard function description that is provided for Wordpress functions. In particular, could someone explain the following example from here: Usage <?php wp_list_categories( $args ); ?> Default Usage <?php $args = array( 'show_option_all' => , 'orderby' => 'name', 'order...

What's the difference between "LIKE" and "=" in SQL ?

Is there any difference between: SELECT * FROM users WHERE username="davyjones" and SELECT * FROM users WHERE username LIKE "davyjones" (I think I've bungled up the syntax... pardon me for that, I'm mostly a desktop app development guy) ...

How do you tell the C# compiler that a symbol is a type and not a variable when they share the same name?

Hi, When you have a local variable named the same as a type, is there any way to tell the compiler that the symbol you have given is a type or a variable? For instance consider (and ignore all type return errors): public class sometype { public static sometype DoSomething() {} } public string sometype { get { return sometype.DoSometh...

Is there any difference between class imports and package imports in Java?

This is probably a dumb question but thought to ask it. In java we can either import single classes as well as the whole set of classes (a package). As an example import java.util.* includes import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import java.util.HashSet; import java.util.Hashtable; import ...

Objective-C: what is private what is not?

Why are people using @interface ViewController : UIViewController { @private UIButton* button_; } @private declarations in public headers? Declaring a variable inside an implementation yields the same result, doesn't it? It feels strange to me, I thought a public header should only contain really public members. What to do with ...

Very basic SPARQL beginner problem (or RDF modelling problem)

Hi to you all (and thanks for this great website since there doesn't seem to exist a forum on beginner-SPARQL-questions), i hope someone can help me on this probably totally easy-to-solve problem: I want to run a SPARQL query against the following RDF (noted in N3, the RDF/XMl sits here). This is the desription of a journal article and...

When should one use interfaces?

I know that an interface does not have a body just a method definition. But when should I use interfaces? If I provide someone a set of interfaces with no body, why would they feel a need to write the function body? Would they be better off writing their own abstract class with abstract methods in it. Edited: I guess the use of Interfa...

run unit tests and coverage in certain python structure

Hi, I have some funny noob problem. I try to run unit tests from commandline: H:\PRO\pyEstimator>python src\test\python\test_power_estimator.py Traceback (most recent call last): File "src\test\python\test_power_estimator.py", line 2, in <module> import src.main.python.power_estimator as power ImportError: No module named src.ma...

get the control with a certain name provided as a string in c#

Hi there, i have the name of a control in a string and I want to manipulate the control, how do i turn the string into the current form instance of that control in c#? e.g. string controlName = "Button1"; What goes here? button1.text = "Changed"; Thanks ...

How to bind table row to Edit-button in jsf?

It's trivial but unfortunately I don't understand some processes 'behind the scenes' in JSF. So, I'm also interested in links to related articles. The problem: I have a list of User-objects. And I represent this list as a dataTable. <h:dataTable var="user" value="#{userService.allUsers}"> <h:column> <f:facet name="header"> ...

Do pointers in java actually exist?

I thought I'm pretty experienced in java, but it seems that's not really the case, I just noticed something yesterday, something I used before but never really realised what it did. I googled but didn't find the answer to my question. If I declare an int array, and use Array's static sort function to sort my array, I just need to type ...

Modify detab to accept list of tab stops

This is my version of detab, from this K&R exercise: Modify detab to accept a list of tab stops as arguments. Use the default tab setting if there are no arguments. #include <stdio.h> #include <stdlib.h> #define TAB_STOP 8 /* replaces tabs from input with the proper amount of blank spots */ int Detab() { int c, x; int co...

Relationship between string module and str

What is the difference or relationship between str and string? import string print str print string ...

_functools module

How does this import work, what file does it use? import _functools in python 2.5 : import _functools print _functools.__file__ Traceback (most recent call last): File "D:\zjm_code\mysite\zjmbooks\a.py", line 5, in <module> print _functools.__file__ AttributeError: 'module' object has no attribute '__file__' and how can i g...

order by and group by mysql

tell some big, diff between order by and group by, like sort columns data=>order by group it by similar data used for aggregation , order by could be used inside the grouped items , please Tell 5 diff ...

What is a null-terminated string?

How does is differ from a usual string? ...

Basics rules on UPDATE statement for relational MySql table: for vs while

Hello, I'm doing my first steps with mysql and php, so I have doubts on foundamental rules for a right code optimization. I have a case where my UPDATE statement need to be executed on a certain number of rows, because it should be executed on a relational table, so is a for cicle correct? <? // connection already created $data[] = arr...

How does << differ from +?

I see a lot of this sort of this going on in Ruby: myString = "Hello " << "there!" How is this different from doing myString = "Hello " + "there!" ...

Literal initialization for const references

How does the following code work in C++? Is it logical? const int &ref = 9; const int &another_ref = ref + 6; Why does C++ allow literal initialization for const references when the same is not permitted for non-const references? E.g.: const int days_of_week = 7; int &dof = days_of_week; //error: non const reference to a const objec...