Hi All
I don't usually use regular expressions, hence my question. I need a regex to match the following:
'{any-string}'.
Any assistance appreciated.
BenTheDesigner
How can I translate this SQL into a named_scope? Also, I want the total comments param to be passed through a lambda.
"select users., count() as total_comments from users, comments where (users.id = comments.user_id) and (comments.public_comment = 1) and (comments.aasm_state = 'posted') and (comments.forum_user_id is null) group by users.id having total_comments 25"
I have a Flex repeater that has a complex item template. When a checkbox is clicked, I need to toggle the visibility of a sibling button contained in the same repeater template. Since I can't add binding expressions to event handlers, I can't pass in the repeater item's index.
How can I access sibling components inside a repeater item?
Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.
If letter case was unimportant I would do this:
str.toLowerCase().replaceAll ("a|the|of|some|any", "");
Is there an "ignore case" solution with regular expressions in java?
Is there a way to display "Test" value as bold just like the implementation of newline?
<testElement>Test 
 Test</testElement>
The output of the above line when you display it is:
TEST
TEST
I want to know what/how to make the second line as bold just line by using expressions.
Thank you
in views.py:
@user_passes_test(lambda u: u.is_superuser)
def h_view(request):
return render_to_response('mytest/news.html',context_instance=RequestContext(request))
but i want to show this page when admin login,and my now page is :
<li id="tab_mytest"><a href="{% url mytest_list %}" class="{% block mytest_css_name %}{% endblock %}">{% trans "mytest" %}</a></li>
how to change it,
has this method :user.is_superuser ??
thanks
Is it allowed by the Boost License to just add the source code of the stuff I need to my project (accompanied by the license of course?). I couldn't find any "descriptive" confirmation. I would have seperate Include/boost and Source/boost directories for easy access.
PS: Seeing as boost::filesystem is going into C++0x TR2, and lambda's are already in c++0x TR1, I don't see any reason to be juggling with C functions like realpath, getcwd and the like. They don't work well anyways...
I am trying to move away from TextPad and I just cant get reg expressions like ^ and $ to be replaced.
I have definitely ticked the regular expression box
What am I doing wrong
I am using Python with PLY to parse LISP-like S-Expressions and when parsing a function call there can be zero or more arguments. How can I put this into the yacc code. This is my function so far:
def p_EXPR(p):
'''EXPR : NUMBER
| STRING
| LPAREN funcname [EXPR] RPAREN'''
if len(p) == 2:
p[0] = p[1]
else:
p[0] = ("Call", p[2], p[3:-1])
I need to replace "[EXPR]" with something that allows zero or more EXPR's. How can I do this?
Is it possible to do something like this in C#? Probably with Expressions.
private void RegisterEvent(EventHandler handler, Action<EventArgs> action)
{
handler += action;
m_toUnsubscribe.Add(handler, action);
}
... in Dispose()
{
foreach(var pair in m_toUnsubscribe)
{
pair.handler -= pair.action;
}
}
I often find the following type of incremental definition useful:
(define (foo) (display "bar"))
(foo)
;prints bar
(define foo (let ((bar foo))
(lambda ()
(display "foo")
(bar))))
(foo)
;prints foobar
How do I preform this type of incremental definition with macros?
I could not get let-syntax to provide the same functionality.
Currently I use plt scheme, but would like to see answers in different lisp implementations as well.
I have some experience with C#, and would like to improve my knowledge of its latest improvements. I am in the middle of reading and enjoying "Effective C#" by Bill Wagner right now. However, I would appreciate more examples, especially with lambdaexpressions and such.
Any suggestions are greatly appreciated. High quality resources are preferable, and it does not matter much if they are free or not.
The .NET framework provides a few handy general-use delegates for common tasks, such as Predicate<T> and EventHandler<T>.
Is there a built-in delegate for the equivalent of CompareTo()?
The signature might be something like this:
delegate int Comparison<T>(T x, T y);
This is to implement sorting in such a way that I can provide a lambda expression for the actual sort routine (ListView.ListViewItemSorter, specifically), so any other approaches welcome.
I am looking for a simple tool that generates a catalog of all used action methods, values and bindings. I'm working on a big JSF/RichFaces project and I have lost the overview of the used links to the beans. Therefore I need a tool (would be nice if it is a Eclipse plugin) that generates a simple list of all used EL expressions.
Is there something out there?
i've a table c_const
code | nvalue
--------------
1 | 10000
2 | 20000
and i've another table t_anytable
rec_id | s_id | n_code
---------------------
2 | x | 1
now i want to calculate the x value with computed column, based on
rec_id*(select nvalue from c_const where code=ncode)
but i get error "Subqueries are not allowed in this context. Only scalar expressions are allowed."
how can i calculate the value in this computed column ?
thanks.
I am trying to parse the MySQL data types returned by "DESCRIBE [TABLE]".
It returns strings like:
int(11)
float
varchar(200)
int(11) unsigned
float(6,2)
I've tried to do the job using regular expressions but it's not working.
PHP CODE:
$string = "int(11) numeric";
$regex = '/(\w+)\s*(\w+)/';
var_dump( preg_split($regex, $string) );
Hello.
In ruby there's very common idiom to check if current file is "main" file:
if __FILE__ == $0
# do something here (usually run unit tests)
end
I'd like to do something similar in C after reading gcc documentation I've figured that it should work like this:
#if __FILE__ == __BASE_FILE__
// Do stuff
#endif
the only problem is after I try this:
$ gcc src/bitmap_index.c -std=c99 -lm && ./a.out
src/bitmap_index.c:173:1: error: token ""src/bitmap_index.c"" is not valid in preprocessor expressions
Am I using #if wrong?
I am using Firefox's native JSON.parse() to parse some JSON strings that include regular expressions as values, for example:
var test = JSON.parse('{"regex":"/\\d+/"}');
The '\d' in the above throws an exception with JSON.parse(), but works fine when I use eval (which is what I'm trying to avoid).
What I want is to preserve the '\' in the regex - is there some other JSON-friendly way to escape it?
Hi,
I got used to the xml support and recursive common table expressions of sql server 2005. I am just wondering whether any free dbs like mysql support these requirements nowadays? Thanks.
Christian
i want to delete the following type of expressions from my script.
<a any text here>nothing or space here</a>
i can do it by three functions, but i think there is a way shorter.
could you help me?
thanks in advance
1) Why are member constants available even if there are no instances of a its class?
2) Is the only reason why constant expressions need to be fully evaluated at compile time due to compiler replacing constant variable with literal value?
3) Since string is also an object, I would think the following would produce an error, but it doesn’t. Why?
class A
{
const string b = “it works”;
}
thank you