public IEnumerable<ModuleData> ListModules()
{
foreach (XElement m in Source.Descendants("Module"))
{
yield return new ModuleData(m.Element("ModuleID").Value);
}
}
Initially the above code is great since there is no need to evaluate the entire collection if it is not needed.
However, once all the Modules have been ...
Hi all,
I'm having problems returning XML in my ZF Application.
Below is the code I have:
<?php
class ProjectsController extends Gid_Controller_Action
{
public function xmlAction ()
{
$content = "<?xml version='1.0'><foo>bar</foo>";
header('Content-Type: text/xml');
echo $content;
}
}
?>
I've also tried the following:
<?php...
Hi,
I have created a paypal Unsubscribe button in Java , when user click on it and after login to paypal account and unsubscribes , the paypal posts on the notifyurl successfully and i am able to update my database.But i want to return to my site after unsubscription. But not able to do so.
Is there any way so that i can return t...
I want to have a single custom section header, with the rest being the default header.
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
return ???;
}
What do I return to just give the default header view?
...
Ok, I'm unsure if my return line will end the for() loop or just the if() question?
Example:
for(;;) {
wait(1);
if(something) {
tokens = strTok(something, " ")
if(tokens.size < 2)
return;
}
}
I'm guessing that it'll just return from the if(something) question but I just want to be sure...
...
Hi there,
I have 2 questions related to the same problem:
1) How to return a reference to a vector which belongs to a class. I have this class:
class sys{
protected:
vector<int> s;
public:
sys();
vector<int>& getS() {return s;} //(1)
};
(1) should return the reference of the vector s. However in the main:
main(){
...
I have two names from a user.
I want to compare them and display them in alphabetical order.
I tried the compareTo method, but that only returns an int.
EDIT: Answer found! Thanks again guys!
...
import java.util.Scanner;
public class GregorianYear
{
private int year;
public GregorianYear(int a)
{
year = a;
}
public void SetYear()
{
System.out.println( "The year is: " );
Scanner kbd = new Scanner( System.in );
year = kbd.nextInt();
}
public int getYear()
{
...
Hi Friends,
I need to get only 1 record from sql result. we use "SELECT TOP 1" in standard sql, but how can we do that in CodeIgniter? Is there any func for that? I researched so much on net, but could not find :/
appreciate! thanks,
...
Hi,
In general, let's say you have a method like the below.
def intersect_two_lists(self, list1, list2):
if not list1:
self.trap_error("union_two_lists: list1 must not be empty.")
return False
if not list2:
self.trap_error("union_two_lists: list2 must not be empty.")
return False
#http://byt...
Hi,
I'm making a basic ajax function in jquery which echoes the number of rows found in a MySQL Query.
function checkEventIDClass(id) {
var params = 'method=checkEventIDClash&table=test&id=' + id;
$.ajax({
type: "POST",
url: "ajax.php",
data: params,
...
Hi,
I need to store a char array inside a class and then return it. I have to admit that I'm a bit confused about pointers and have tried everything I can think of but can't get it to work. Here's what I have:
#include <iostream>
using namespace std;
class Test {
public:
void setName(char *name);
char getName();
private:
c...
The following returns whatever integer I feed it as a parameter.
def space(spacer_count)
spacer_count.times do
image_tag("24gray/spacer.png", :class => "spacer")
end
end
How do I make it return the desired number of images? E.g., I want space(6) to return six copies of spacer.png, not the number "6".
Thanks!
...
Is there anyway to directly access the data returned in an array without a temporary variable?
Currently, my code is as follows:
function getData($id) {
// mysql query
return mysql_fetch_array($result);
}
$data = getData($id);
echo $data['name'];
Is there a direct way to get the returned data without the temporary variable?
...
Hi,
I have a class tree like this:
master class abstract class Cell
AvCell extends Cell
FCell extends Cell
i have an abstract method getValue() in Cell
Is it posibble to make the method getValue() to return int for AvCell and String for FCell?
Can i use generics for int String?
Thanks!
...
An n-ary tree is memorised in the following way:
(node (list-subtree-1) (list-subtree-2) ...)
As an example, the tree
A
/ \
B C
/ \
D E
is represented as follows:
(A (B) (C (D) (E)))
Return the number of levels of a tree
The problem is that I am only allowed to use the following functions: null, car, cdr, equal, atom, ...
hi very short question
can php return a boolean like this:
return $aantal == 0;
like in java you can
public boolean test(int i)
{
return i==0;
}
or do you Have to use a if contruction?
because if i do this.
$foutLoos = checkFoutloos($aantal);
function checkFoutloos($aantal)
{
return $aantal == 0;
}
echo "foutLoos = $foutLoo...
In my application, I have the need to allow blocks to be defined and called within the scope of a class, using instance_exec (via Rails 2.3.2). However, some of these blocks need to return early in some situations, which is causing me a problem.
My application was built using ruby 1.8.6, but I need to get it running on 1.8.7 as well. It...
I've started developing a new web service in VS2005. There is only one method:
[WebMethod]
[XmlInclude(typeof(Person))]
public PersonAction GetAction()
{
PersonAction action = new PersonAction();
return action;
}
where PersonAction class contains a field with a reference to a Person class
[Serializable]
public ...
Hey,
I have a problem returning a variable in my function, the below script works fine:
function sessionStatus(){
$(document).ready(function(){
$.getJSON(scriptRoot+"sessionStatus.php",function(status){
alert(status);
});
});
}
sessionStatus();
Bet when I try the following I get a message box with the message...