After creating a batch file in visual studio, I get an error when I run it about invalid characters. Does anyone know the default character encoding for txt files?
I've noticed that on some sites, when you request a password reminder or sign in, they'll tell you if the user doesn't exist (I think Meetup does this). Other sites will simply say "the user/password combination is invalid" (Google, I believe, does this).
Is there a security reason for not revealing the existence of a user id?
I have an MVC view with a form built with the Ajax.BeginForm() helper method, and I'm trying to validate user input with the jQuery Validation plugin. I get the plugin to highlight the inputs with invalid input data, but despite the invalid input the form is posted to the server.
How do I stop this, and make sure that the data is only posted when the form validates?
My code
The form:
<fieldset>
<legend>leave a message</legend>
<% using (Ajax.BeginForm("Post", new AjaxOptions
{
UpdateTargetId = "GBPostList",
InsertionMode = InsertionMode.InsertBefore,
OnSuccess = "getGbPostSuccess",
OnFailure = "showFaliure"
}))
{ %>
<div class="column" style="width: 230px;">
<p>
<label for="Post.Header">
Rubrik</label>
<%= Html.TextBox("Post.Header", null, new { @style = "width: 200px;", @class="text required" }) %></p>
<p>
<label for="Post.Post">
Meddelande</label>
<%= Html.TextArea("Post.Post", new { @style = "width: 230px; height: 120px;" }) %></p>
</div>
<p>
<input type="submit" value="OK!" /></p>
</fieldset>
The JavaScript validation:
$(document).ready(function() {
// for highlight
var elements = $("input[type!='submit'], textarea, select");
elements.focus(function() {
$(this).parents('p').addClass('highlight');
});
elements.blur(function() {
$(this).parents('p').removeClass('highlight');
});
// for validation
$("form").validate();
});
EDIT: As I was getting downvotes for publishing follow-up problems and their solutions in answers, here is also the working validate method...
function ajaxValidate() {
return $('form').validate({
rules: {
"Post.Header": { required: true },
"Post.Post": { required: true, minlength: 3 }
},
messages: {
"Post.Header": "Please enter a header",
"Post.Post": {
required: "Please enter a message",
minlength: "Your message must be 3 characters long"
}
}
}).form();
}
I've got a GET method that looks like the following:
GetMethod method = new GetMethod("http://host/path/?key=[\"item\",\"item\"]");
Such a path works just fine when typed directly into a browser, but the above line when run causes an IllegalArgumentException : Invalid URI.
I've looked at using the URIUtils class, but without success. Is there a way to automatically encode this (or to add a query string onto the URL without causing HttpClient to barf?).
Hi
I am am running some selenium tests(ruby) on my web page and as i enter an invalid characters in to a text box i have the JavaScript throw a alert like so
if(isNaN($(this).val()) || Number($(this).val().valueOf() <=0)){
alert("Please Enter A Number");
}
how can i handle this alert when its made and close the pop up?
i tried to use the wait_for_pop_up() and close() but i think that's only for browser pop up's and not JavaScript alerts.
any ideas?
thanks
I have the following columns in TableA
TableA
Column1 varchar
Column2 int
Column3 bit
I am using this statement
IF Column3 = 0
SELECT Column1, Column2 FROM
TableA WHERE
Column2 > 200
ELSE
SELECT Column1, Column2 FROM
TableA WHERE
Column2 < 200
But the statment does not compile. It says Invalid Column Name 'Column3'
Hi all.
i m working sql server 2005.
My query is:
SELECT (
SELECT COUNT(1) FROM Seanslar WHERE MONTH(tarihi) = 4
GROUP BY refKlinik_id
ORDER BY refKlinik_id) as dorduncuay
And the error:
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified.
How can i use order by in a sub query?
I have a Card model that has many Sets and a Set model that has many Cards through a Membership model:
class Card < ActiveRecord::Base
has_many :memberships
has_many :sets, :through => :memberships
end
class Membership < ActiveRecord::Base
belongs_to :card
belongs_to :set
validates_uniqueness_of :card_id, :scope => :set_id
end
class Set < ActiveRecord::Base
has_many :memberships
has_many :cards, :through => :memberships
validates_presence_of :cards
end
I also have some sub-classes of the above using Single Table Inheritance:
class FooCard < Card
end
class BarCard < Card
end
and
class Expansion < Set
end
class GameSet < Set
validates_size_of :cards, :is => 10
end
All of the above is working as I intend. What I'm trying to figure out is how to validate that a Card can only belong to a single Expansion. I want the following to be invalid:
some_cards = FooCard.all( :limit => 25 )
first_expansion = Expansion.new
second_expansion = Expansion.new
first_expansion.cards = some_cards
second_expansion.cards = some_cards
first_expansion.save # Valid
second_expansion.save # **Should be invalid**
However, GameSets should allow this behavior:
other_cards = FooCard.all( :limit => 10 )
first_set = GameSet.new
second_set = GameSet.new
first_set.cards = other_cards # Valid
second_set.cards = other_cards # Also valid
I'm guessing that a validates_uniqueness_of call is needed somewhere, but I'm not sure where to put it. Any suggestions?
UPDATE 1
I modified the Expansion class as sugested:
class Expansion < Set
validate :validates_uniqueness_of_cards
def validates_uniqueness_of_cards
membership = Membership.find(
:first,
:include => :set,
:conditions => [
"card_id IN (?) AND sets.type = ?",
self.cards.map(&:id), "Expansion"
]
)
errors.add_to_base("a Card can only belong to a single Expansion") unless membership.nil?
end
end
This works when creating initial expansions to validate that no current expansions contain the cards. However, this (falsely) invalidates future updates to the expansion with new cards. In other words:
old_exp = Expansion.find(1)
old_exp.card_ids # returns [1,2,3,4,5]
new_exp = Expansion.new
new_exp.card_ids = [6,7,8,9,10]
new_exp.save # returns true
new_exp.card_ids << [11,12] # no other Expansion contains these cards
new_exp.valid? # returns false ... SHOULD be true
when using the jquery ui autocomplete, i would thought there would be an option to force only valid key entry based on the list. Is there anyway to not allow invalid keys so you can only enter valid items in the list?
I am using maven to configure maven-ear-plugin. I am getting following exception when I say jboss version is 5 (See below code, under tag). It works if I replace version to 4.2
<build>
<finalName>tactical</finalName>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<version>5</version>
<defaultJavaBundleDir>lib</defaultJavaBundleDir>
<jboss>
<version>5</version>
<loader-repository>seam.jboss.org:loader=tactical</loader-repository>
</jboss>
<modules>
<ejbModule>
<groupId>${project.groupId}</groupId>
<artifactId>tactical-jar</artifactId>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
Why it works fine for jboss 4.2 but not for 5. What ??
I get the following exception:
[INFO] Failed to initialize JBoss configuration
Embedded error: Invalid JBoss configuration, version[5] is not supported.
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to initialize JBoss configuration
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:583)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:49
9)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:478)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.jav
a:330)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:291)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:142)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:336)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:129)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:287)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to initialize JBoss configuration
at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:159)
at org.apache.maven.plugin.ear.GenerateApplicationXmlMojo.execute(GenerateApplicationXmlMojo.java:96)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:451)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:558)
... 16 more
Caused by: org.apache.maven.plugin.ear.EarPluginException: Invalid JBoss configuration, version[5] is not supported.
at org.apache.maven.plugin.ear.JbossConfiguration.(JbossConfiguration.java:95)
at org.apache.maven.plugin.ear.AbstractEarMojo.initializeJbossConfiguration(AbstractEarMojo.java:296)
at org.apache.maven.plugin.ear.AbstractEarMojo.execute(AbstractEarMojo.java:155)
... 19 more
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 seconds
Any idea.
Thanks
I have a simple Ruby on Rails form which includes an authenticity_token. Unfortunatly, I missed that when you page cache this page then the Authenticity Token becomes invalid. I'm glad I figured it out however.
How do you solve caching in such a case?
Strange exception occurred, when I tried to call the action in my proxy class
exception message: The message could not be processed because the action 'http://testservice//reports/IReportService//Report' is invalid or unrecognized.
Hi all,
I have quite the process that we go through in order to display some e-mail communications in our application. Trying to keep it as general as possible...
-We make a request to a service via XML
-Get the XML reply string, send the string to a method to encode any invalid characters as follows:
public static String convertUTF8(String value) {
char[] chars = value.toCharArray();
StringBuffer retVal = new StringBuffer(chars.length);
for (int i = 0; i < chars.length; i++) {
char c = chars[i];
int chVal = (int)c;
if (chVal > Byte.MAX_VALUE) {
retVal.append("&#x").append(Integer.toHexString(chVal)).append(";");
} else {
retVal.append(c);
}
}
return retVal.toString();
}
We then send that result of a string to another method to remove any other invalid characters:
public static String removeInvalidCharacters(String inString)
{
if (inString == null){
return null;
}
StringBuffer newString = new StringBuffer();
char ch;
char c[] = inString.toCharArray();
for (int i = 0; i < c.length; i++)
{
ch = c[i];
// remove any characters outside the valid UTF-8 range as well as all control characters
// except tabs and new lines
if ((ch < 0x00FD && ch > 0x001F) || ch == '\t' || ch == '\n' || ch == '\r')
{
newString.append(ch);
}
}
return newString.toString();
}
This string is then "unmarshal'ed" via the SaxParser
The object is then sent back to our Display action which generated the response to the calling jsp/javascript to create the page.
The issue is some text can contain characters which can't be processed correctly. The following is eventually rendered on the JSP just fine:
<PrvwCommTxt>This is a new test. Have a*&#xc7;&#xb4;)&#xa1;.&#xf1;&#xc7;&#xa1;.&#xf1;*&#xc7;&#xb4;)...</PrvwCommTxt>
Which shows up as "This is a new test. Have a*Ç´)¡.ñÇ¡." in the browser.
-The following shows up in a tooltip while hovering over the above text:
<CommDetails>This is a new test. Have a*Ç´)¡.ñÇ¡.ñ*Ç´)¡.ñ*´)(¡.ñÇ(¡.ñÇ* Wonderful Day!</CommDetails>
This then shows up incorrectly when rendered in the tooltip javascript with all the HEX values and not being rendered correctly.
Any suggestions on how to make the unknown characters show correctly in javascript?
Hello,
I have successfully come up to the access_token step along with final oauth_token and oauth_token_secret values.
Now I'm trying to access the Post method given by Yammer API with following request :
https://www.yammer.com/api/v1/messages/?
body=MyMessage&
oauth_consumer_key=Myconsumerkey&
oauth_nonce=1825bbc0f0a2875eb94bdb4d51c0638b&
oauth_signature=JzG4DCWxuP%2B7xT7u3tFZ2zCC8%2BI%3D&
oauth_signature_method=HMAC-SHA1&
oauth_timestamp=1257761059&
oauth_token=Myfinaloauthtoken&
oauth_version=1.0
But I'm getting "Invalid OAuth signature" error.
Can somebody help me in this.
Do I need to pay the $30 just to play around in the sandbox for Website Payments Pro? I'm trying to get Active Merchant working in Rails, and it's giving me an error "invalid merchant configuration"... after digging around a bit it says I need to "accept the billing agreement" and/or sign up for the Payments Pro first. So, do I need to pay the $30 just to test in sandbox? Or is there another workaround for this error?
I have a WPF application in which I have a hook at PreviewTextInput, through that I get the currently entered character and I have the string already entered. Given this I need to write the following function :
bool ShouldAccept(char newChar,string existingText)
existingText can be comma seperated valid numbers(including exponential) and it should just return false when invalid characters are pressed.
My code(if else based) currently has a lot of flaws, I wanted to know if there is any smart way to do it.
def merge(l1,l2):
i=0;
while((l1[i]!=none)||(l2[i]!=none)):
SyntaxError: invalid syntax
being a newbie i can't figure out whats wrong with the abouve code.
I'm currently using Windows Authentication with 2 Oracle servers - SP3DSMP1 & SP3DSMP4. I created a database link on SMP1 to connect to SMP4 as:
SQL create public database link LINK_SMP4
2 connect to CURRENT_USER
3 using 'SP3DSMP4';
Database link created.
However when I try to do a query, I get the error:
ERROR at line 1:
ORA-01017: invalid username/password; logon denied
Any ideas what might be wrong here?
thanks
Sunit
I'd like to script p4 a little. Unfortunately, some of the filenames that we're tracking have "@" in the filename.
The filenames are in the form [email protected]. If I try to do something like p4 sync a\@b.xml on a mac (or p4 sync [email protected] on windows) it gives the error:
Invalid changelist/client/label/date '@b.xml'
Is there another way to escape it that perforce will recognize?
Hello.
I have created a folder and published my webservice to this folder. I then created an application (in IIS 7) and pointed it at this folder location. When I try and hit the ASMX file from a browser on the local machine I get the following error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Can someone tell me why?
I am currently playing around with jqueries drag and drop, basically I currently have a div (.drag_check) that holds a checkbox, I have the drag and drop working but I want to alert out the checkbox's ID once the element is dropped, I assume I have to use child but all my attempts have returned 'undefined'. Below is my code,
$('.drag_check').draggable({
containment: 'document',
opacity:0.6,
revert: 'invalid',
helper: 'clone',
zIndex: 100
});
$("ul.searchPage").droppable({
drop:
function(e, ui) {
var param = $(ui.draggable).attr('class')
addlist(param)
alert(param)
}
})
Alright, I have tried a bunch of times the
python setup.py install
command from my command prompt, and this is what I'm getting:
SCREEN
And when trying this:
from SimPy.Simulation import *
on Idle, I get this:
Traceback (most recent call last):
File "C:/Python30/pruebas/prueba1", line 1, in <module>
from SimPy.Simulation import *
File "C:\Python30\SimPy\Simulation.py", line 320
print 'SimPy.Simulation %s' %__version__,
^
SyntaxError: invalid syntax
>>>
I'm using JPA 2.0/Hibernate validation to validate my models. I now have a situation where the combination of two fields has to be validated:
public class MyModel {
public Integer getValue1() {
//...
}
public String getValue2() {
//...
}
}
The model is invalid if both getValue1() and getValue2() are null and valid otherwise.
How can I perform this kind of validation with JPA 2.0/Hibernate? With a simple @NotNull annotation both getters must be non-null to pass validation.
I have a program that needs a lot of memory and want to set the maximum heap space at 6024MB.
Java gives me the error:
Invalid maximum heap size: -Xmx6024m
The specified size exceeds the maximum representable size.
Is there a workaround?
in OO programming, is there some conceptual pattern, ideas, about handling multiple errors?
for example, i have a method that performs some checks and should return an error message for each error found
['name is too short', 'name contains invalid unicode sequences', 'name is too long']
now, should i use an array of exceptions (not thrown exceptions)?
or something like this is better:
class MyExceptionList extends Exception{
public Void addException(Exception e){}
public Array getExceptions(){}
}
any theory behind this argument will be appreciated!
(this isn't a request about a specific programming language, but a pure theoretical one)
thank you in advance