To avoid spammers, what's a good strategy for imposing limits on users when sending email from our site? A count limit per day on individual IPs? Sender emails? Domains? In general terms, but recommended figures will also be helpful.
Our users can send emails through our web page. They can register and log in but are also allowed to do this without logging in, but with a captcha and with a field for the senders email. Certainly, there is a header, "The user has sent you the following message.", limiting the use for spammers, so perhaps it's not a big problem.
Any comments on what I'm doing will be greatly appreciated.
Suppose I wish to have a function that fills an array either in pattern
x,y,x,y,x,ywhere x and y are variables defined by some algorithm
and x,y,z,x,y,z where x, y and z are variables defined by the same algorithm.
This should continue for all number of variables. Is this a viable way to implement it.
int recurse_n(int n)
{
while(n > 0)
{
--n;
recurse_n(n);
n = 0;
// Use algorithm here
}
}
I have the following problem. I have a webservice, which accepts a post request with some json data in the request body and which also returns Json data.
Now I want to build a user friendly HTML page to test this service. I have a form to fill in data, when the user clicks the button, the JSON should be build from the form data and POSTed to my webservice, the response should be displayed to the user. How do I achieve that?
I'm really banging my head onto this one. I can't make the Custom Configuration to work with NUnit. It kept on failing to read the configuration file.
I followed carefully this article: http://devlicio.us/blogs/derik_whittaker/archive/2006/11/13/app-config-and-custom-configuration-sections.aspx
placed the references in the Unit test class App.Config, still everything failed.
Is there some sort of a magic setting to do here?
I'm working on a mock exam paper at the moment, however I have no set of correct answers and I'm not sure what the correct answer of this SQL query is.
Given a table:
foo, bar
a , 1
b , 3
a , 2
c , 1
and the query:
SELECT foo, sum(bar)
FROM table
GROUP BY foo
The two ways I can see this going are either:
a 3
a 3
b 3
c 1
or
a 3
b 3
c 1
Thanks.
I'm stuck with my a piece of code I'm creating. My IDE is Eclipse and when I use its debugging feature, to trace what's happening on each line, it outputs perfectly. However, when I click the "run" project, it just outputs a blank screen:
public static void compareInterests(Client[] clientDetails)
{
int interests = 0;
for (int p = 0; p < numberOfClients; p++)
{
for (int q = 0; q < numberOfClients; q++)
{
String a = clientDetails[p].getClientInterests();
String b = clientDetails[q].getClientInterests();
int count = 0;
while (count < a.length())
{
if (a.charAt(count) == b.charAt(count))
interests++;
count++;
}
if ((interests >= 3) && (clientDetails[p].getClientName() != clientDetails[q].getClientName()))
System.out.print (clientDetails[p].getClientName() + " is compatible with " + clientDetails[q].getClientName());
interests = 0;
}
}
}
The code is designed to import an object array which contains information on a client's name and a client's interests. The client's interests are stored in the format "01010", where each 1 means they are interested in that activity, each 0 means they are not.
My code compares each character of every client's string with every other client's string and outputs the results for all client's that don't have the same name and have three or more interests in common.
When I run this code through Java's debugger, it outputs fine - but when I click run project or compile, I just get a blank screen.
Any ideas?
I have the following model
@Entity
class Element {
@Id
int id;
@Version
int version;
@ManyToOne
Type type;
}
@Entity
class Type {
@Id
int id;
@Version
int version;
@OneToMany(mappedBy="type")
Collection<Element> elements;
@Basic(optional=false)
boolean disabled;
}
and would like to allow Type.disabled = true only if Type.elements is empty. Is there a way to do it atomically?
I would like to prevent an insertion of an Element in a transaction while the corresponding Type is being disabled by an other transaction.
CALORIES = \
{ 'Beef' : 200, \
'Chicken' : 140, \
}
class Food():
__slots__ = (
'cal' # Calories
)
def mkFood( name ):
"""Create and return a newly initialized Food item"""
result = Food()
result.cal = calorie in dict(CALORIES[1])
return result
Is that a proper way to the value of the target item in Calories? Like getting 200, 140, such like that.
result.cal = calorie in dict(CALORIES[1])
I need to write a function called multipleOf3 that returns a random number that
is a multiple of 3 between 0 and the function's non-negative integer
parameter n
and here is the result i want [Note: No number returned can be greater than the value of the
parameter n]
Examples:
multipleOf3(0) -- 0
multipleOf3(1) -- 0
multipleOf3(2) -- 0
multipleOf3(3) -- 0 or 3
multipleOf3(20) -- 0 or 3 or 6 or 9 or 12 or 15 or 18
Hi
I need to know if it is possible the current execution node? Ej:
..html
<script id="x"> //
console.log(document.currentNode.id); // << this must return "x"
</script>
..html
thanx
When I connect a Sony Reader to an USB port “USB connected” is shown on the Reader. When the Sony “Reader Library” software is started this message changes to “Do not disconnect”. I want to implement this in a software tool to. There seems to be no file locked. Perhaps it is done via ebookUsb.dll. Does anybody know how this is done from any programming language? I like to see an example.
Is there an opposite of .find()?
Where $('.myclass').except('#myid');
Would grab all elements with .myclass except the element with #myid.
I know I could do $('.myclass[id=myid]') in this example, but seems like it would be helpful in other cases.
Thanks
Hello, I'm developing an application in Symfony and on localhost (XAMPP) I want to simulate the same conditions as on the webserver.
The web server is configured as follows:
/www => mydomain.com
/foo => foo.mydomain.com
/bar => bar.mydomain.com
...
I'm going to put my Symfony application into /www direcotry so there'll be:
/www
/www/apps
/www/apps/frontend
/www/apps/frontend/...
/www/apps/backend
/www/apps/backend/...
/www/cache
/www/config
... and so on...
/www/web
The thing is that the document root is still set to the /www directory but Symfony expects it in the /www/web.
Of course it will work if I call http://mydomain.com/web but I guess you understand this is quiet stupid solution.
So my question is: Is there any way how can I change/bypass the default document root setting using .htaccess or whatever?
I am in the process of submitting an iPhone app to the app store. While making the final touches to the app I was in the process of compiling and running the app on my iPhone when I got the message ...
"There was an internal API error."
The console had this to say ...
25/08/2010 10:10:54 Xcode[3556] Failed willExecute: Error Domain=com.apple.platform.iphoneos Code=0 UserInfo=0x2011adec0 "There was an internal API error." -- {
NSLocalizedDescription = "There was an internal API error.";
NSLocalizedFailureReason = "";
NSLocalizedRecoverySuggestion = "";
}
The problem is specific to this project, others projects don't suffer the same problem. The same problem exhibits when moved to another machine, or another mobile device is swapped in.
I should be most grateful for any hints or ideas on the subject ...
In reference to the statement set.seed(), can I get the seed instead after running some code if I didn't set it explicitly?
I've been re-running some code containing a function that randomises some sample of the input data (the function is part of the kohonen package). After playing with it for some time to see the variety of output (it was an 'unstable' problem), I noticed one result that was pretty interesting. I of course had not used set.seed(), but wondered if I could get the seed after running the code to reproduce the result?
In ?set.seed I see
.Random.seed saves the seed set for the uniform random-number generator
But I don't know how that helps.
What advantages has event-based PHP frameworks? Is this way of programming more effectively compared to imperative programming?
What experiences do you have with there frameworks?
http://phpwork.org/
http://www.pradosoft.com/
I'm revising for an upcoming Haskell exam and I don't understand one of the questions on a past paper. Google turns up nothing useful
fst(x, y) = x
square i = i * i
i) Source reduce, using Haskells lazy evaluation, the expression:
fst(square(3+4), square 8)
ii) Source reduce, using strict evaluation, the same expression
iii) State one advantage of lazy evaluation and one advantage of strict evaluation
Sometimes I do this and I've seen others doing it too:
VB:
Try
DontWannaCatchIt()
Catch
End Try
C#:
try
{
DontWannaCatchIt();
}
catch {}
I know I should catch every important exception
and do something about it, but sometimes it's not important to - or am I doing something wrong?
Is this usage of the try block incorrect, and the requirement of at least one catch or finally block an indication of it?
I've seen a number of posts on SO about how to define custom iterators, but nothing that seems to exactly answers my question, which is...
How do I create an iterator that hides a nested for loop?
For instance, I have a class Foo, inside of the Foo is a Bar, and inside of the Bar is a string. I could write
for (const Foo& foo : foo_set)
for (const Bar& bar : foo.bar_set)
if (bar.my_string != "baz")
cout << bar.my_string << endl;
but instead I want to be able to do something like:
for (const string& good : foo_set)
cout << good << endl;
How do I do something like this?
I have a UITableView that holds just two cells with a textfield in each. As my tableview is just for editing the text in these textfields I always want the keyboard to be shown static in the bottom of the screen. So in viewDidLoad I set the first textfield to become first responder.
Something I have noticed though is that when I push the UITableViewController into the UINavigationController the keyboard show up a little bit slower so you can see it animate into the screen. It would be much better if it was there already there when the uitableview shows up.
I also tried making the textfield first responder before pushing it as recommended but that didn't made the keyboard show at all:
MyTableViewController *myTableViewController = [[MyTableViewController alloc] initWithNibName:@"MyTableViewController" bundle:nil];
[myTableViewController.textField becomeFirstResponder];
[self.navigationController pushViewController:myTableViewController animated:YES];
[myTableViewController release];
How can I accomplish this?
Thanks!
I have a string based code that can be either two or three characters in length and I am looking for some help in creating a function that will increment it.
Each 'digit' of the code has a value of 0 to 9 and A to Z.
some examples:
the first code in the sequence is 000
009 - next code is - 00A
00D - next code is - 00E
AAZ - next code is - AB0
the last code is ZZZ.
Hope this makes some sense.