Hello,
I belong to Asp.Net but just starting to learn JSF. I wanted to know whether all features of MasterPage are available in JSF templating? I mean say suppose i have a menu in template, and based on roles menu changes. If the Admin logs in, he will get to show more options and if general user logs in he will get to see less options. Now i have a managed bean for my "real" page(not template). How do i use this managed bean to toggle my control in template on and Off?
Hi,
list<Dog*> dog;
.............
............
So I added many dog objects to it.
If I call dog.pop_front();
Does memory automatically gets deallocated ?
I have read little bit about architecture and also patterns in order to follow the best practices. So this is the architecture we have and I wanted to know what you think of it and any proposed changes or improvements to it -
Presentation Layer - Contains all the views,controllers and any helper classes that the view requires also it containes the reference to Model Layer and Business Layer.
Business Project - Contains all the business logic and validation and security helper classes that are being used by it. It contains a reference to DataAccess Layer and Model Layer.
Data Access Layer - Contains the actual queries being made on the entity classes(CRUD) operations on the entity classes. It contains reference to Model Layer.
Model Layer - Contains the entity framework model,DTOs,Enums.Does not really have a reference to any of the above layers.
What are your thoughts on the above architecture ? The problem is that I am getting confused by reading about like say the repository pattern, domain driven design and other design patterns. The architecture we have although not that strict still is relatively alright I think and does not really muddle things but I maybe wrong. I would appreciate any help or suggestions here. Thanks !
I am a learning SQL, HTML now.
I would like to learn the following two more... Java, XML.
I want to understand these two from testing and Web Services point of view. Is there a better order to learn the next two Java, XML or XML, Java?
Hi,
I'm trying to upload a file via URLConnection, but i need to read/write it as a binary file without any encoding changes. So i've tried to read byte[] array from FileInputStream, but now i have an issue. The PrintWriter object i use for outputing to the server does not allow me to do writer.write(content) (where content is of type byte[]). How can i fix this? Or is there another way to quickly copy binary data from a FileInputStream to a PrintWriter?
Thank you
I have a templated class
template <typename Data>
class C
{
.....
}
In most situations, I depend on the compiler to let me substitute types for Data.
I call methods foo(), goo() on objects of type Data, so what I substitute needs to provide
that.
I now need to substitute int and string for my Data type. I do not want to specialize
because the class is already too big and would require specializing each method (with only small code change).
My options (please tell me if there are more)
1) I can provide wrapper classes around int and string which implement the methods foo(), goo() etc
2) provide a traits class
traits that calls foo() or goo() on objects of classes that provide foo(),goo()
(these are my present substitutable classes)
and specialize these classes for int and string.
Questions
1) what are the relative merits of 1 vs 2?
2) My traits classes will have static methods. Can a traits class have non-static methods as well? I see most traits classes define constants in the STL.
3) Do I make the traits classes global or should I pass them in as a template parameter
for class C?
I have followed the code example here
toupper c++ example
And implemented it in my own code as follows
void CharString::MakeUpper()
{
char* str[strlen(m_pString)];
int i=0;
str[strlen(m_pString)]=m_pString;
char* c;
while (str[i])
{
c=str[i];
putchar (toupper(c));
i++;
}
}
But this gives me the following compiler error
CharString.cpp: In member function 'void CharString::MakeUpper()':
CharString.cpp:276: error: invalid conversion from 'char*' to 'int'
CharString.cpp:276: error: initializing argument 1of 'int toupper(int)'
CharString.cpp: In member function 'void CharString::MakeLower()':
This is line 276
putchar (toupper(c));
I understand that toupper is looking for int as a parameter and returns an int also, is that the problem? If so how does the example work?
First off I'm new at programming. I'm creating an app with one navigation bar controller. The app is pretty basic except for a quiz section that is comprised of 12 xibs. As the users takes the quiz a new xib is pushed onto the stack. I want to create a button that takes the user back to the home screen if they do not want to complete the quiz. The back button takes them to the previous xib which could be 11 deep. Is it possible to dismiss the modal views and reload the rootView controller?
Here's the code from my delegate
@synthesize window;
@synthesize navigationController;
(void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after application launch
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
(void)dealloc {
[window release];
[navigationController release];
[super dealloc];
}
This is how I'm pushing new xibs onto the stack
(IBAction) showTesting: (id)sender {
Testing *varTesting = [[[Testing alloc] initWithNibName:@"Testing" bundle:nil] autorelease];
[[self navigationController] pushViewController:varTesting animated: YES];
}
Any help would be greatly appreciated. Thanks
do you got the solution for your problem ?
im working on the exact same thing and cant get it to work...
if u could post the solution, it would be much appreciated :o
greetingz
msn: [email protected]
steam : [email protected]
Hi,
i have two queries.
For each tuple of query1 i want to run query2. i dont want to use cursors. i tried several approaches using subqueries.
query1:
select
distinct
category,
Count(category) as CategoryCount
from
mytable
group by
category
query2:
select
top 3
Text,
Title,
Category
from
mytable
where
Category = '1'
Category = '1' is a sample. the value should come from query1
Hello,
I'm new to OOP in PHP, is that to seems correct ?
class whatever {
Function Maths() {
$this->sql->query($requete);
$i = 0;
while($val = mysql_fetch_array($this)) {
$tab[i][average] = $val['average'];
$tab[i][randomData] = $val['sum'];
$i=$i+1;
}
return $tab;
}
I want to access the data contained in the array
$foo = new whatever();
$foo->Maths();
for ($i, $i <= endOfTheArray; i++) {
echo Maths->tab[i][average];
echo Maths->tab[i][randomData];
}
Thank you ;)
Hi
What's the difference between the two code below.
int a[] = {0,0};
int a[2] = {0,0};
It seems I can assign value to a[3] in both cases. I can access a[3] in any case. So what's the difference?
I have a very big table with a lot of rows, every row has stats for every user for certain days. And obviously I don't have any stats for future. So to update the stats I use
UPDATE Stats SET Visits=@val WHERE ... a lot of conditions ... AND Date=@Today
But what if the row doesn't exist? I'd have to use
INSERT INTO Stats (...) VALUES (Visits=@val, ..., Date=@Today)
How can I check if the row exists or not? Is there any way different from doing the COUNT(*)?
If I fill the table with empty cells, it'd take hundreds of thousands of rows taking megabytes and storing no data.
IF both methods are declared as virtual, shouldn't both instances of Method1() that are called be the derived class's Method1()?
I am seeing BASE then DERIVED called each time. I am doing some review for an interview and I want to make sure I have this straight. xD
class BaseClass
{
public:
virtual void Method1() { cout << "Method 1 BASE" << endl; }
};
class DerClass: public BaseClass
{
public:
virtual void Method1() { cout << "Method 1 DERVIED" << endl; }
};
DerClass myClass;
((BaseClass)myClass).Method1();
myClass.Method1();
Method 1 BASE Method 1 DERVIED
I've comeup with the following program to do it, but it does not seem to work and goes into infinite loop. Its working is similar to quicksort.
int main()
{
int arr[] = {1,1,0,1,0,0,0,1,0,1,0,1,0,1,0,1,0,1};
int N = 18;
int *front, *last;
front = arr;
last = arr + N;
while(front <= last)
{
while( (front < last) && (*front == 0) )
front++;
while( (front < last) && (*last == 1) )
last--;
if( front < last)
{
int temp = *front;
*front = *last;
*last = temp;
front ++;
last--;
}
}
for(int i=0;i<N;i++)
printf("%d ",arr[i]);
return 0;
}
Dear all,
I have written up two functions (pseudo code) for calculation the number of nodes and the tree height of a Binary Tree,given the root of the tree.
Most importantly,the Binary Tree is represented as the First chiled/next sibling format.
so
struct TreeNode
{
Object element;
TreeNode *firstChild;
TreeNode *nextSibling;
}
Calculate the # of nodes:
public int countNode(TreeNode root)
{
int count=0;
while(root!=null)
{
root= root.firstChild;
count++;
}
return count;
}
public int countHeight(TreeNode root)
{
int height=0;
while(root!=null)
{
root= root.nextSibling;
height++;
}
return height;
}
This is one of the problem I saw on an algorithm book,and my solution above seems to have some problems,also I didn't quite get the points of using this First Child/right sibling representation of Binary Tree,could you guys give me some idea and feedback,please?
Cheers!
I'm using jWYSIWYG in a form I'm creating that posts to a database and was wondering how you can prevent a malicious user from trying to inject code in the frame?
Doesn't the editor need brackets (which I'd normally strip during the post process) in order to display styles?
Sorry to keep hammering on this, but I'm trying to learn :). Is this any good? And yes, I care about memory leaks. I can't find a decent way of preallocating the char*, because there simply seems to be no cross-platform way.
const string getcwd()
{
char* a_cwd = getcwd(NULL,0);
string s_cwd(a_cwd);
free(a_cwd);
return s_cwd;
}
In Eclipse, the Java Method Override Indicator is the little upwards arrow next to a method in the Type Hierarchy view.
A solid arrow means a method overrides an existing method lower in the hierarchy.
What does the hollow arrow mean?
Do annotations effect either arrow?
(I'm coming from an iPhone dev world. )
In Android do we need to worry what OS version we compile against? In the iPhone world I would usually target a release that's at least 6 months old to limit the number of issues with installing on iPhones with old OSs.
What strategy should I use when choosing what to compile against on the Android?
I am loading an array with floats like this:
NSArray *arr= [NSArray arrayWithObjects:
[NSNumber numberWithFloat:1.9],
[NSNumber numberWithFloat:1.7],
[NSNumber numberWithFloat:1.6],
[NSNumber numberWithFloat:1.9],nil];
Now I know this is the correct way of doing it, however I am confused by the retail counts.
Each Object is created by the [NSNumber numberWithFloat:] method. This gives the object a retain count of 1 dosnt it? - otherwise the object would be reclaimed
The arrayWithObjects: method sends a retain message to each object.
This means each object has a retain cont of 2. When the array is de-allocated each object is released leaving them with a retain count of 1.
What have I missed?