This is more of a general question, so that I a better understand about JSF and managed bean. So when people having multiple managed bean, is it solely because they want to group methods with the same scoped(RequestScoped, ApplicationScoped, SessionScope...) together? Or is there some other reason? What would happen if you inject managed...
I currently this piece of code for creating a UISearchBar (adapted from a previous stackoverflow example):
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectZero];
[searchBar sizeToFit];
//searchBar.delegate = self;
searchBar.placeholder = @"Search messages, listeners or stations";
self.tableView.tableHe...
The global new and delete can be used like normal, but you can also prefix the :: operator to them and it will work the same.
Are there any other keywords that have this same behaviour?
Thanks.
...
I have a Registry where I store my request, validator, database and router objects. So for validation of my forms, I use a method in class MyForm, where the input fields are checked. When user input is incorrect, then Registry::getInstance()->validator->setErrors($errors) is called, so that errors are stored in the Registry and get avail...
Hello, my code is :
class myClass {
$myVariable = 'myCallback';
function myFunction() {
$body = false;
$callback = $this->myVariable;
function test($handle, $line) {
global $body, $callback;
if ($body) {
call_user_func($callback, $line);
}
...
Trying to route:
scope :shortcut do
resources :text_elems
end
Using basic scaffold with form partial
*_form.html.erb*
<%= form_for(@text_elem, :shortcut => @shortcut) do |f| %>
...
Problem is: When I call the edit action, the form html shows as:
<form ... action="/25/text_elems/25">
Note: The new action renders the form acti...
Consider the following code sample:
// line #
{ // 1
// 2
{ // 3
double test = 0; // 4
} // 5
// 6
double test = 0; // 7
} // 8
This gives the error
...
I have a file classes.php in which I declare a set of classes to be used in a series of pages.
Then, in one page, I need to use another class, that is declared in a separate file. Now, this separate class uses some classes located in the classes.php file.
So, in most pages, I have:
[1]
<?php
require('classes.php');
[page code]
?>
whi...
For testing things that query the environment (e.g., os.getenv, sys.version, etc.), it's often more convenient to make the queries lie than to actually fake up the environment. Here's a context manager that does this for one os.getenv call at a time:
from __future__ import with_statement
from contextlib import contextmanager
import os
...
I was reading XML is not S-Expressions. XML scoping is kind of strict, as are S-expressions. And in every programming language I've seen, you can't have the following:
<b>BOLD <i>BOTH </b>ITALIC</i> == BOLD BOTH ITALIC
It's not even expressible with S-Expressions:
(bold "BOLD" (italic "BOTH" ) "ITALIC" ) == :(
Does any programming l...
Hello there
I am facing a weird problem I have defined I a structure in a C header file:
typedef struct iRecActive{
char iRecSID[32];
unsigned char RecStatus;
int curSel;
}iRecAcitve_t;
but when I use the same structure in another file, the compiler doesn't recognize the structure even though I have double checked that...
I am taking a principles of programming languages course right now but I cannot for the life of me figure this out. This is not homework just a general concept question.
In our class we have talked about static chains and displays. I think that I understand why we need these. Otherwise when we have nested methods we cannot figure out...
In C#, would there be any difference in performance when comparing the following THREE alternatives?
ONE
void ONE(int x) {
if (x == 10)
{
int y = 20;
int z = 30;
// do other stuff
} else {
// do other stuff
}
}
TWO
void TWO(int x) {
int y;
int z;
if (x == 10)
{
y = 20;
z = 30;
// do other stuff
} els...
We are trying to build an API to support commit() and rollback() automatically, so that we don't have to bother with it anymore. By researching, we have found that using eval {} is the way to go.
For eval {} to know what to do, I have thought of giving the API an array of functions, which it can execute with a foreach without the API ha...
Hi guys, hoping some one can shed some light on my problem. Basicly I only want to execute a block of code if a certain DOM element exists. If it does I then perform a few bits and bobs and then call a function. However it complains that the function is not defined, suggesting that the function is not in scope. Below is the code :
$(doc...
How do I implement mutually recursive classes in C++? Something like:
/*
* Recursion.h
*
*/
#ifndef RECURSION_H_
#define RECURSION_H_
class Class1
{
Class2* Class2_ptr;
public:
void Class1_method()
{
//...
(*Class2_ptr).Class2_method();
//...
}
};
class Class2
{
Class1* Class1_ptr;
public:
void C...
I find this behavior of the global window object a little weird.
var x = 10;
function SomeClass(){
var y = 15;
console.log("Someclass:y - " + this.y); //prints undefined
}
console.log("window.x: " + window.x); //prints 10
var obj = new SomeClass();
console.log("obj.y: " + obj.y); //prints - undefined
Both variables x and ...
Is there a way to view the variables set in each stack frame in a backtrace? I can come pretty close with a combination of debug_backtrace(true) to get the objects, get_object_vars on each object to get $this vars, the args key in each backtrace frame, and get_defined_vars to get globals, but any temporary variables set within a function...
Here is my master page code behind:
namespace mysite.MasterPages
{
public partial class Main : System.Web.UI.MasterPage
{
public bool isLoggedIn;
protected void Page_Load(object sender, EventArgs e)
{
isLoggedIn = Request.IsAuthenticated; // Is the user currently logged in
}
...
I have an associative array of objects that I want to extend with a number of functions.
myCtrls //Array of objects
I do this with the following loop
$(document).ready(function() {
for (ctrlName in fieldCtrls){
var ctrl = fieldCtrls[ctrlName];
ctrl.Initialize = function(){
//Do some stuff
...