Questions tagged [anonymous]

DO NOT USE! Please use a more specific tag such as [anonymous-function] or [anonymous-class].

The term anonymous has come to represent different aspects of development with the rise of the functional programming style and the use of anonymous on-demand applications.

In an effort to disambiguate this tag, it has been split into the following subcategories:

Category Description
Anonymous Classes An anonymous class is a local class without a name. An anonymous class is defined and instantiated in a single succinct expression using the new operator.
Anonymous Functions Anonymous functions use a block of code as a value, defining it as an inline function without a name.
Anonymous Methods An anonymous method is a procedure or function that does not have a name associated with it.
Anonymous Types Anonymous types are data types which dynamically add a set of properties into a single object without having to first explicitly define a type
Anonymous Users Anonymous users are individuals or systems that make use of a product or service, without formally registering account details and are instead associated with some token or identifier.

Former Tag Definition

For new questions, see [anonymous-class] and [anonymous-function].

Typically, a programming language construct like a function or class has a name associated with it -- a symbol that can be used to refer to the construct in some context. An anonymous function or class is one that, in contrast to normal practice, has no name. For example, in Java, you can create an anonymous class using a special syntax that defines a class and constructs an instance of it at the same time:

Runnable r = new Runnable() {
    public void run() {
        System.out.println("Running");
    }
};

The variable r holds a reference to an instance of a class which has no name in Java, but which implements the Runnable interface and can be used anywhere a Runnable instance is needed.

702 questions
6
votes
3 answers

Unnecessary use of unnamed namespaces C++

I keep seeing code like this everywhere in my company: namespace { const MAX_LIMIT = 50; const std::string TOKEN = "Token"; } I am confused as of why you need an anonymous namespace here. On one hand, you want a local translation unit for…
FCR
  • 1,103
  • 10
  • 25
6
votes
1 answer

How to load roles from database for anonymous user in spring security 3?

I'm using Spring Security 3.0.2 and I can't find a way to load roles of anonymous user from database (I've got dynamic roles where roles can be given to everyone). I've tried to use a custom anonymousAuthenticationProvider but this provider is never…
Jerome Cance
  • 8,103
  • 12
  • 53
  • 106
6
votes
3 answers

Sending emails without revealing server's ip address

To reduce attacks, we put our servers behind cloudflare's cloud service. But, our app sends emails (via sendmail and smtp) to users (password reset etc), and those email headers contain the real backend ip addresses. Is there anyway to hide these…
QWJ QWJ
  • 317
  • 1
  • 5
  • 14
6
votes
3 answers

Passing an anonymous variable by reference

Standard C++ types such as int or char have ctors, so you can have expressions like: int a = int(67); // create anonymous variable and assing it to variable a int b(13); // initialize variable b int(77); // create anonymous…
Ivars
  • 2,375
  • 7
  • 22
  • 31
6
votes
2 answers

Declaring functions inside anonymous function

I am looking at code that appears to be declaring a function that would need to be called to run. This function is being declared within an anonymous function. Doesn't this mean that the function will be inaccessible to anything outside of this…
Nate
  • 919
  • 2
  • 9
  • 18
6
votes
5 answers

Identifying anonymous users

If I had a poll on my site, and I didn't want to require a registration to vote, but I only wanted each visit one, how might I do this? Let's say a visitor from IP 123.34.243.57 visits the site and votes. Would it then be safe to disallow anyone…
core
  • 32,451
  • 45
  • 138
  • 193
6
votes
2 answers

How can I identify an anonymous inner class in a NotSerializableException

I have received the following error message when trying to debug an application in NetBeans: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: board.Board$1 In the course of debugging I have had to insert…
forsate
  • 63
  • 6
6
votes
2 answers

Why is an anonymous class created when mixing in a trait?

scala> class A defined class A scala> trait B defined trait B Creating an object of class A gives us: scala> new A res4: A = A@11ea3fc But creating an object of class A with trait B mixed in gives us: scala> new A with B res3: A with B =…
John Threepwood
  • 15,593
  • 27
  • 93
  • 149
6
votes
4 answers

How to check if IP is a public proxy

Recently we have had a lot of issues with a particular user who has been posting a piles of provocative messages on our website using the public proxy IPs. Can someone recommend a way to determine - is a specific IP a public proxy or not? Thanks.
Steve
6
votes
1 answer

javascript onclick, anonymous function

I am a beginning javascript programmer. I am trying to create something similar to Lightbox 2, but much simpler. The only reason why I want to do it from scratch on my own is so that I can learn. However, I've been stuck on the last critical part…
Erik
  • 155
  • 2
  • 2
  • 7
5
votes
3 answers

How to make this javascript work?

I'm trying to make a recursive anonymous function. Here is the function : (function (i) { console.log(i); if (i < 5) this(i + 1) })(0) I know "this" is the window object. Is there a way to call the function ?
Marc Antoine
  • 51
  • 1
  • 2
5
votes
2 answers

Is it possible to reference a specific element of an anonymous array in PHP?

This is probably a simple question, and I'm afraid the answer might be "no", but... Here's a simple piece of code: function func1() { $bt = debug_backtrace(); print "Previous function was " . $bt[1]['function'] . "\n"; } Now... Can this be…
Rick Koshi
  • 945
  • 1
  • 11
  • 21
5
votes
1 answer

Wildfly 26.1.0 final + elytron-oidc-client + wont propagate user to EJB + user become anonymous

I am trying to upgrade from WF24 to WF26.1.0 final and migrate from the jboss:domain:keycloak module to elytron-oidc-client. I have installed WF26.1.0 and configured elytron-oidc-client with secure-deployment to use our Keycloak server for…
5
votes
2 answers

Why can't I use .this in anonymous class?

I recently use this code, and realize that in anonymous class, I can't access the instance by .this, like this: Sprite sprFace = new Sprite() { @Override protected void onManagedUpdate(float pSecondElapsed) { runOnUpdateThread(new…
Luke Vo
  • 17,859
  • 21
  • 105
  • 181
5
votes
2 answers

How to remember an anonymous vote

What is the best way to implement a "memory" or persistence for an anonymous vote? The other day I was browsing some site (unfortunately I forgot the URL), and I could quickly "thumbs up" or "thumbs down" an item. So I voted on several items. I then…
Archil Kublashvili
  • 696
  • 1
  • 8
  • 20