keyword

Best practices for using @ in C#

Hi, While reading a book on C#, I have come across code that uses the @ to "overload" or use a C# keyword as an identifier. I am guessing this is not a good practice, as it leads to ambiguity. Am I correct in thinking this, or are there times where this should be used ? ...

jQuery $this vs $(this) in plugin development

I was wondering why in so many jquery plugins $(this) is set to be pointing at $this, here is an example, if i have the following two plugins included on a page: (function($) { jQuery.fn.pluginOne = function() { return this.each(function() { $this = $(this); <-- alert($this); }); }; })(jQuery) (funct...

How I can add a keyword to gcc?

My target is to analyze and learn in details of compiler development techniques. Here I want to add a keyword in gcc and see how it works. ...

In VIM: How to highlight "local variables" in a "C" file

I have highlighted all Symbols by using tags file & highlight option. But I could not able to highlight my local variables. I have an idea, that is, VIM already supports autocompletion of keywords for a current file, it does autocompletion of my local variable, so, if I get a list of keywords for my current file then I will highlight t...

C++: Is there a way to forbid subclassing of my class?

Hi all, Say I've got a class called "Base", and a class called "Derived" which is a subclass of Base and accesses protected methods and members of Base. What I want to do now is make it so that no other classes can subclass Derived. In Java I can accomplish that by declaring the Derived class "final". Is there some C++ trick that can...

What effect does the "new" keyword have in C# and why is it only a warning when not employed?

Consider the following code: public abstract class Test1 { public object Data { get; set; } } public abstract class Test2<T> : Test1 { public T Data { get; set; } } This will generate the following warning: 'Test2.Data' hides inherited member 'Test1.Data'. Use the new keyword if hiding was intended. Why is this only a w...

How would you replace the 'new' keyword?

There was an article i found long ago (i cant find it ATM) which states reasons why the new keyword in C++ is bad. I cant remember all of the reasons but the two i remember most is you must match new with delete, new[] with delete[] and you cannot use #define with new as you could with malloc. I am designing a language so i like to ask ...

Implementing a massive search application

We have an email service that hosts close to 10000 domains such that we store the headers of messages in a SQL Server database. I need to implement an application that will search the message body for keywords. The messages are stored as files on a NAS storage system. As a proof of concept, I had implemented a SQL server based searc...

using the 'class' keyword as/in a method argument in c#

I'm not sure where I saw this, and I'm certainly not getting the syntax past the compiler. Is it possible to use the 'class' C# keyword as part of a method parameter signature? foo(string x, class y) { } Anyone else see something like this? thanks, -gene ...

using synchronized in Threads

What could be the understanding of the following? I have gone through this post at SO but still at a loss to assemble it. code1: synchronized(this){ // some code } code2: Object lock = new Object(); synchronized(lock){ // some code } Any tutorial, or some links to explain synchronized like they explain it to a child? ...

Getting the the keyword arguments actually passed to a Python method

I'm dreaming of a Python method with explicit keyword args: def func(a=None, b=None, c=None): for arg, val in magic_arg_dict.items(): # Where do I get the magic? print '%s: %s' % (arg, val) I want to get a dictionary of only those arguments the caller actually passed into the method, just like **kwargs, but I don't want ...

C: Behaviour of the `const` keyword

I've been told that if I'm coding in ANSI-C to declare in the order that the variables will be used, assert that pointers are not null and that indices are within bounds, and to initialize just before usage of the variable. If I declare a const can I initialize it after a block of assertions and code ? In Java final initializations must...

Is there a better way to self reference a type?

I'm finding lately a lot of code smells related to referencing generic classes in C#. My gripes especially apply to those classes which inherit from DependencyObject and contain DependencyProperties. The basic problem is that when declaring a dependency property one generally references the current type which is also known as the owner...

Deduplicating an array of keywords (but not based on EXACT match)

Hi folks! I have a list of a few thousand terms. There is significant overlap in those terms, but in different forms. For example (ruby, a_ruby), (triathlon, triathlete, triathletes), (nonprofit, non_profit, non_profits). Most of these have significant number of character overlap, but not exactly in the same form. For example, (nonprof...

What can human beings make out of the restrict qualifier?

If I got the C99 restrict keyword right, qualifying a pointer with it is a promise made that the data it references won't be modified behind the compiler's back through aliasing. By contrast, the way I understand the const qualifier is as compiler-enforced documentation that a given object won't be modified behind the back of a human be...

Other usage of the this keyword in Java

(For those who read my previous question, this is the same teacher and the same project.) My teacher 'inspected' my code for a web application project and provided some suggestions. One of the suggestions was to use the this keyword even in this situation: private String getUsername() { return username; } So if I follow his advic...

Is '@' used in C++?

Is '@' used in C++? In this yacc file it is listed as a token. And i am sure i cant use @ as part of a variable name. Is @ used in C++? and how might i use it? ...

How do I find the revision that changed a line in my code using TortoiseSvn?

I have one line of code which seems commented. Basically the thing I want to find is the revision that changed this line in the code. So, is it possible to see changes in code related to a specific keyword in TortoiseSvn Log? ...

Add a Keyword Cloud in ASP.NET Page

Hi! I need to add a keyword cloud in my asp net web pages! Can anyone suggest me the best way to do it? I got a few working samples implemented using C# but I want to know if there are other possibilities to do that! Any good suggestion would be really appreciated! Thanks in advance :) ...

Error while using Keyword Query object in asp.net application for search in sharepoint.

I am trying to use Keyword Query object in asp.net application. I wrote this code : Namespace : using System.Data.SqlClient; using Microsoft.SharePoint; using Microsoft.SharePoint.Search; using Microsoft.SharePoint.Search.Query; Page load event: GridView grd = new GridView(); ...