I'm using Google prettify for syntax highlighting and I'd like to modify the colors to match my website theme, but I don't understand some of the abbreviations from these:
str = string
atw
kwd = keyword
tag = tag
com = comment
typ = type?
atn
dec = declaration?
lit
pun = punctuation? like colons, braces?
pln
prettyprint
Why I can't construct large tuples in Haskell? Why there's a tuple size limit?
Prelude> (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1)
<interactive>:1:0:
No instance for (Show
(t,
t1,
t2,
...
t23))
arising from a use of `print' at <interactive>:1:0-48
Possible fix:
add an instance declaration for
(Show
(t,
t1,
t2,
...
t23))
In a stmt of a 'do' expression: print it
I came across people passing data objects as:
declaration:
DataObject * data = 0;
calling it as:
SomeMethod( data );
definition of Somethod:
void SomeMethod(SomeObject * & object)
My obvious question is, when and why do you have to do this (& *)?
Is it passing the pointer as reference?
We can import class declaration with #import:
#import "SomeClass.h"
or declare with @class:
@class SomeClass;
What's the difference and when we should use each of them?
I have some classes in my current project which have the wrong package declaration (they are in the wrong folder for their declared package.)
Unfortunately, fixing the problem by moving the class is not an option. Is there a way I can get eclipse to ignore the error?
I don't know how feasible it is and how sensible is this question here.
Is there any changes that we can make in makefile to recommend GCC inline all the function although the functions are not inlined during the declaration or nowhere in the source file.
I have problem that i just cant figure out right now.
I am trying to develop a Windows-8 style app and im stuck implementing this functionality.
I have a MainWindow which contains a ListBox and a Button (lets say addButton).
When i click the button i navigate to a new page, lets say AddCustomerPage with this.Frame.Navigate(typeof (AddCustomerPage));
AddCustomerPage has 1 textBox and 1 button (lets say doneButton. When i click the button i want the string in the textBox to be added to the ListBox on the previous page.
This is my current functionality:
1. MainWindow is created.
Click addButton
AddCustomer page is created. MainWindow is destroyed(problem).
Click doneButton
A MainWindow object is created with a ListBox with 1 item.
Repeat the add process, i always get a MainWindow with a ListBox with 1 item.
Thanks for the help. Here is the code:
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
this.brainPageController = new PageController();
// add items from the List<String> to the listBox
listGoals.ItemsSource = brainPageController.GetListGoals();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
var parameter = e.Parameter as String;
// a simple controller that adds a string to a List<string>
brainPageController.AddGoal(parameter);
}
private void addButton_Click(object sender, RoutedEventArgs e)
{
this.Frame.Navigate(typeof (GoalsInfo));
}
// VARIABLES DECLARATION
private PageController brainPageController;
}
public sealed partial class GoalsInfo : WinGoalsWIP.Common.LayoutAwarePage
{
public GoalsInfo()
{
this.InitializeComponent();
this.brainPageController = new PageController();
}
protected override void LoadState(Object navigationParameter, Dictionary<String, Object> pageState)
{
}
protected override void SaveState(Dictionary<String, Object> pageState)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
brainPageController.AddGoal(nameTextBox.Text);
this.Frame.Navigate(typeof(MainPage), nameTextBox.Text);
}
// VARIABLES DECLARATION
PageController brainPageController;
}
when i try to malloc at kernel mod i get screamed by the compiler :
res=(ListNode*)malloc(sizeof(ListNode));
and the compiler is screaming :
/root/ex3/ex3mod.c:491: error: implicit declaration of function ‘malloc’
what should i do ?
I have this code in base class
protected virtual bool HasAnyStuff<TObject>(TObject obj) where TObject:class
{
return false;
}
In child class I am overriding
protected override bool HasAnyStuff<Customer>(Customer obj)
{
//some stuff
if Customer.sth etc
return false;
}
I am getting this error
'''Type parameter declaration must be an identifier not a type'''
What is it I am doing wrong here?
I'm trying to use the OpenCA library in a C++ application. However, when including the file pki_x509_data_st.h the following code fragment is encountered:
typedef struct pki_x509_callbacks_st {
/* ---------------- Memory Management -------------------- */
void * (*new) (void );
void (*free) (void *x );
void * (*dup) (void *x );
This won't compile because of the "new" pointer declaration.
How can I make it work?
How can I generate types like these using the System.Reflection.Emit libraries:
public class Test<T> {}
public class Test<T1, T2> {}
When I call ModuleBuilder.DefineType(string) with the second type declaration, I get an exception because there is already another type in the module with the same name (I've already defined the type parameter on the first type). Any ideas?
Hi,
What does address operator mean.
say in the method below.
what should be passed in the method as parameter value of integer or the address of an integer variable.
void func1(int&)// method declaration
void func1(int& inNumber)//method definition
{
//some code
}
Hi, I have a use of the CRTP that doesn't compile with g++ 4.2.1, perhaps because the derived class is itself a template? Does anyone know why this doesn't work or, better yet, how to make it work? Sample code and the compiler error are below.
Source: foo.C
#include <iostream>
using namespace std;
template<typename X, typename D> struct foo;
template<typename X> struct bar : foo<X,bar<X> >
{
X evaluate() { return static_cast<X>( 5.3 ); }
};
template<typename X> struct baz : foo<X,baz<X> >
{
X evaluate() { return static_cast<X>( "elk" ); }
};
template<typename X, typename D> struct foo : D
{
X operator() () { return static_cast<D*>(this)->evaluate(); }
};
template<typename X, typename D>
void print_foo( foo<X,D> xyzzx )
{
cout << "Foo is " << xyzzx() << "\n";
}
int main()
{
bar<double> br;
baz<const char*> bz;
print_foo( br );
print_foo( bz );
return 0;
}
Compiler errors
foo.C: In instantiation of ‘foo<double, bar<double> >’:
foo.C:8: instantiated from ‘bar<double>’
foo.C:30: instantiated from here
foo.C:18: error: invalid use of incomplete type ‘struct bar<double>’
foo.C:8: error: declaration of ‘struct bar<double>’
foo.C: In instantiation of ‘foo<const char*, baz<const char*> >’:
foo.C:13: instantiated from ‘baz<const char*>’
foo.C:31: instantiated from here
foo.C:18: error: invalid use of incomplete type ‘struct baz<const char*>’
foo.C:13: error: declaration of ‘struct baz<const char*>’
I have a class definition of the form
class X
{
public:
//class functions
private:
A_type *A;
//other class variables
};
and struct A_type is defined as
struct A_type
{
string s1,s2,s3;
};
Inside the constructor, I allocate appropriate memory for A and try A[0].s1="somestring";
It shows segmentation fault.
Is this kind of declaration invalid, or am I missing something
template <class EventType>
class IEvent;
class IEventable;
typedef boost::function<void (IEventable&, IEvent&)> behaviorRef;
What is the right way for passing template class IEvent into boost function? With this code I get:
error: functional cast expression list treated as compound expression
error: template argument 1 is invalid
error: invalid type in declaration before ‘;’ token
Consider this function declaration:
int IndexOf(const char *, char);
where char * is a string and char the character to find within the string (returns -1 if the char is not found, otherwise its position). Does it make sense to make the char also const? I always try to use const on pointer parameters but when something is called by value, I normally leave the const away.
What are your thoughts?
Hi,
I'm a Java developer starting with .Net development using VS.Net 2008. I would love to get the Eclipse style of navigating methods etc by pressing the Ctrl key, hover over a method then click it to got to that method's declaration. Does such a plugin exist for VS.Net 2008?
thanks
I have this code in base class
protected virtual bool HasAnyStuff<TObject>(TObject obj) where TObject:class
{
return false;
}
In child class I am overriding
protected override bool HasAnyStuff<Customer>(Customer obj)
{
//some stuff
if Customer.sth etc
return false;
}
I am getting this error
'''Type parameter declaration must be an identifier not a type'''
What is it I am doing wrong here?
here's my question:
this works perfectly:
type Asdf = [Integer]
type ListOfAsdf = [Asdf]
Now I want to do the same but with the Integral class restriction:
type Asdf2 a = (Integral a) => [a]
type ListOfAsdf2 = (Integral a) => [Asdf2 a]
I got this error:
Illegal polymorphic or qualified type: Asdf2 a
Perhaps you intended to use -XImpredicativeTypes
In the type synonym declaration for `ListOfAsdf2'
I have tried a lot of things but I am still not able to create a type with a class restriction as described above.
Thanks in advance!!! =)
Dak
I'm just looking at NSString.h and wonder why some method declaration args use
(NSString *)string; while others use (NSString *)aString.
What are the conventions practiced here?
Thanks for any insight.
My Activity has multiple lists so I have defined MyClickListener as below:
My question is how I should instantiate this class:
MyClickListener mMyClickListener = new MyClickListener();
Or maybe it is better to instantiate inside the onCreate(Bundle) and just define above. Whats considered the better way? I don't want too much in onCreate() its already full of stuff. Any thoughts on the declaration and instatiation? Whats the best way?
private class MyClickListener implements OnClickListener
{
@Override
public void onClick(View view) {
}
}