Do we have a preg_callback equivalent in Perl ?
Lets say I want to match something and replace it with the return value of the function that is called with the matched thing.
Hi All,
We are using ADO.NET dataservices & are building URL based filters.
Example: /Customers?filter=City eq 'London'
We now need to filter on a Full Text 'tags' Field.
WAS HOPING FOR: /Customers?filter=Tag like 'Friendly'
PROBLEM:
ADO.NET does not have a LIKE operator.
ADO.NET does not seem to like FTS
(It is not finding a match - because it is not parsing through the CSV's)
Any ideas how to make this work?
THX
Does gettext have a way to warn me about strings that have not been wrapped in _() or N_()?
Basically is there a way to get a list of all strings that do NOT match the keywords used by xgettext. So, I want:
! xgettext source_code
Hi i have a column (type date).I want to insert custom date and time without using Preparedstatement .i have used
String date = sf.format(Calendar.getInstance().getTime());
String query = "Insert into entryTbl(name, joinedDate, ..etc) values ("abc", to_date(date, 'yyyy/mm/dd HH:mm:ss'))";
statement.executeUpdate(query);
but am getting literal doesnot match error. so even tried with "SYSDATE".Its inserting only date not time.So how to insert the datetime using java into oracle?please any one help..
1st solution located: \Common\Controls\Controls.sln
and its project: \Common\Controls\Common.Controls\Common.Controls.csproj
Description: This is a library that contains this class:
public abstract class OurUserControl : UserControl
{
// Variables and other getters/setters common to our UserControls
}
2nd solution located: \AControl\AControl.sln
and its project: \AControl\AControl\AControl.csproj
Description: Of the many forms/classes, it will contain this class:
using Common.Controls;
namespace AControl
{
public partial class AControl : OurUserControl
{
// The implementation
}
}
A note about adding references (not sure if this is relevant):
When I add references (for projects I create), using the names above:
1. I add Common.Controls.csproj to AControl.sln
2. In AControl.sln I turn off the build of Common.Controls.csproj
3. I add the reference to Common.Controls (by project) to AControl.csproj.
This is the (easiest) way I know how to get Debug versions to match Debug References, and Release versions to match Release References.
Now, here is where the issue lies (the 3rd solution/project that actually utilizes the UserControl):
3rd solution located: \MainProj\MainProj.sln
and its project: \MainProj\MainProj\MainProj.csproj
Description: Here's a sample function in one of the classes:
private void TestMethod<T>()
where T : Common.Controls.OurUserControl, new()
{
T TheObject = new T();
TheObject.OneOfTheSetters = something;
TheObject.AnotherOfTheSetters = something_else;
// Do stuff with the object
}
We might call this function like so:
private void AnotherMethod()
{
TestMethod<AControl.AControl>();
}
This builds, runs, and works. No problem. The odd thing is after I close the project/solution and re-open it, I have red squigglies everywhere. I bring up my error list and I see tons of errors (anything that deals with AControl will be noted as an error).
I'll see errors such as:
The type 'AControl.AControl' cannot be used as type parameter 'T' in the generic type or method 'MainProj.MainClass.TestMethod()'. There is no implicit reference conversion from 'AControl.AControl' to 'Common.Controls.OurUserControl'.
or inside the actual method (the properties located in the abstract class):
'AControl.AControl' does not contain a definition for 'OneOfTheSetters' and no extension method 'OneOfTheSetters' accepting a first argument of type 'AControl.AControl' could be found (are you missing a using directive or an assembly reference?)
Meanwhile, I can still build and run the project (then the red squigglies go away until I re-open the project, or close/re-open the file). It seems to me that I might be setting up the projects incorrectly. Thoughts?
if (preg_match('(\p{Nd}{4}/\p{Nd}{2}/\p{Nd}{2}/\p{L}+)', '2010/02/14/this-is-something'))
{
// do stuff
}
The above code works. However this one doesn't.
if (preg_match('/\p{Nd}{4}/\p{Nd}{2}/\p{Nd}{2}/\p{L}+/u', '2010/02/14/this-is-something'))
{
// do stuff
}
Maybe someone could shed some light as to why the one below doesn't work. This is the error that is being produced:
A PHP Error was encountered
Severity: Warning
Message: preg_match()
[function.preg-match]: Unknown
modifier '\'
Right now my code works as such:
def method_a
self.method_b ==> 'method_b'
end
def method_b
puts self.name_of_calling_method
end
def name_of_calling_method
if /`(.*)'/.match(caller.first)
return $1
else
return nil
end
end
Instead of method_b printing 'method_b', how can I print the name of the calling method - 'method_a'?
I am following railstutorial.org on Chapter 7 and when running tests I get the error
User password encryption has_password? method should be true if the passwords match
Failure/Error: @user = User.create!(@attr)
undefined method password' for #<User:0xa242d18>
# ./spec/models/user_spec.rb:105:inblock (3 levels) in '
line 105 of user_spec.rb:105 is @u @user = User.create!(@attr)ser = User.create!(@attr)
I've created a code to change a password. Now it seem contain an error. When I fill in the form to change password, and click save the error message:
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103
Warning: mysql_real_escape_string() expects parameter 2 to be resource, null given in C:\Program Files\xampp\htdocs\e-Complaint(FYP)\userChangePass.php on line 103
I really don’t know what the error message means. Please guys. Help me fix it.
Here's is the code:
<?php session_start(); ?>
<?php # change password.php
//set the page title and include the html header.
$page_title = 'Change Your Password';
//include('templates/header.inc');
if(isset($_POST['submit'])){//handle the form
require_once('connectioncomplaint.php');//connect to the db.
//include "connectioncomplaint.php";
//create a function for escaping the data.
function escape_data($data){
global $dbc;//need the connection.
if(ini_get('magic_quotes_gpc')){
$data=stripslashes($data);
}
return mysql_real_escape_string($data, $dbc);
}//end function
$message=NULL;//create the empty new variable.
//check for a username
if(empty($_POST['userid'])){
$u=FALSE;
$message .='<p> You forgot enter your userid!</p>';
}else{
$u=escape_data($_POST['userid']);
}
//check for existing password
if(empty($_POST['password'])){
$p=FALSE;
$message .='<p>You forgot to enter your existing password!</p>';
}else{
$p=escape_data($_POST['password']);
}
//check for a password and match againts the comfirmed password.
if(empty($_POST['password1'])) {
$np=FALSE;
$message .='<p> you forgot to enter your new password!</p>';
}else{
if($_POST['password1'] == $_POST['password2']){
$np=escape_data($_POST['password1']);
}else{
$np=FALSE;
$message .='<p> your new password did not match the confirmed new password!</p>';
}
}
if($u && $p && $np){//if everything's ok.
$query="SELECT userid FROM access WHERE (userid='$u' AND password=PASSWORD('$p'))";
$result=@mysql_query($query);
$num=mysql_num_rows($result);
if($num == 1){
$row=mysql_fetch_array($result, MYSQL_NUM);
//make the query
$query="UPDATE access SET password=PASSWORD('$np') WHERE userid=$row[0]";
$result=@mysql_query($query);//run the query.
if(mysql_affected_rows() == 1) {//if it run ok.
//send an email,if desired.
echo '<p><b>your password has been changed.</b></p>';
include('templates/footer.inc');//include the HTML footer.
exit();//quit the script.
}else{//if it did not run OK.
$message= '<p>Your password could not be change due to a system error.We apolpgize for any inconvenience.</p><p>' .mysql_error() .'</p>';
}
}else{
$message= '<p> Your username and password do not match our records.</p>';
}
mysql_close();//close the database connection.
}else{
$message .='<p>Please try again.</p>';
}
}//end oh=f the submit conditional.
//print the error message if there is one.
if(isset($message)){
echo'<font color="red">' , $message, '</font>';
}
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<body>
<script language="JavaScript1.2">mmLoadMenus();</script>
<table width="604" height="599" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="130" colspan="7"><img src="images/banner(E-Complaint)-.jpg" width="759" height="130" /></td>
</tr>
<tr>
<td width="100" height="30" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="100" bgcolor="#ABD519"></td>
<td width="160" bgcolor="#ABD519">
<?php include "header.php"; ?> </td>
</tr>
<tr>
<td colspan="7" bgcolor="#FFFFFF">
<fieldset><legend> Enter your information in the form below:</legend>
<p><b>User ID:</b> <input type="text" name="username" size="10" maxlength="20" value="<?php if(isset($_POST['userid'])) echo $_POST['userid']; ?>" /></p>
<p><b>Current Password:</b> <input type="password" name="password" size="20" maxlength="20" /></p>
<p><b>New Password:</b> <input type="password" name="password1" size="20" maxlength="20" /></p>
<p><b>Confirm New Password:</b> <input type="password" name="password2" size="20" maxlength="20" /></p>
</fieldset>
<div align="center"> <input type="submit" name="submit" value="Change My Password" /></div>
</form><!--End Form-->
</td>
</tr>
</table>
</body>
</html>
When importing feature classes from other sources, how can I make sure the ST_Geometry SRIDs are consistent? I'm having trouble with certain database-level operations because the SRIDs between feature classes do not match, even though the projection and coordinate system are identical.
How would I do to check if a email actially exists?
Cant understand how sites do to send mails with a unique link that the users clicks to validate that he is the owner of email =/
Make a 2 new columns called activationkey and activated and store some random string, send an email with the activationkey, and update the users activated =1 that match that activation link
register.php?a=activate&key=9cdfb439c7876e703e307864c9167a15
Any better ideas?
Hi,
Not able to execute a query ,i need to check if end date is greater than today in the following query
Getting an error invalid query
select * from table1 where user in ('a') and END_DATE >'2010-05-22'
getting an error liter string does not match
We have an xml node "item" with an attribute "style", which is "Header1". This style can change however. We have an attribute set named Header1 which defines how this should look in a PDF, generated through xsl:fo.
This works (the use-attribute-sets is mentioned inline, in the fo:table-cell node):
<xsl:template match="item[@type='label']">
<fo:table-row>
<fo:table-cell xsl:use-attribute-sets="Header1">
<fo:block>
<fo:inline font-size="8pt" >
<xsl:value-of select="." />
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
But this doesn't (using xsl:attribute, because the attribute @style can also be Header2 for example). It doesn't generate an error, the PDF is created, but the attributes aren't applied.
<xsl:template match="item[@type='label']">
<fo:table-row>
<fo:table-cell>
<xsl:attribute name="xsl:use-attribute-sets">
<xsl:value-of select="@style" />
</xsl:attribute>
<fo:block>
<fo:inline font-size="8pt" >
<xsl:value-of select="." />
</fo:inline>
</fo:block>
</fo:table-cell>
</fo:table-row>
</xsl:template>
Does anyone know why? And how we could achieve this, preferably without long xsl:if or xsl:when stuff?
This is Query:
CREATE TABLE #TempTable(datasize varchar(200))
INSERT #TempTable
EXEC sp_spaceused 'Table1'
When executing this query error message shown as below
"Column name or number of supplied values does not match table definition"
How can i solve this problem?
I'm using Licensed componentone product in my ASP.NET application and spcefically i use C1WebReport1 control from the product.while upgrading C1WebReport1 control from version 2.5.20072.239 to 2.6.20093.53207,i get the error message as
"Could not load file or assembly 'C1.Web.C1WebReport.2, Version=2.6.20093.53207, Culture=neutral, PublicKeyToken=594a0605db190bb9' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"
can any one help me to bring complete solution?
Thanks in advance.
Regards
Omprakash
Does anybody know any module in Python that computes the best bipartite matching?
I have tried the following two:
munkres
hungarian
However, in my case, I have to deal with non-complete graph (i.e., there might not be an edge between two nodes), and therefore, there might not be a match if the node has no edge. The above two packages seem not to be able to deal with this.
Any advice?
I'm searching files and returning lines that include the search text, and I'm not really sure the best way to display the information I get. Every time I get a match, I want to show, in some sort of control, the File it came from, and the whole text line. (aka streamreader.ReadLine() result). First I tried just putting it all in a read-only text box, but it doesn't have a scroll bar.
What is the best form control to help me display this data neatly?
Is it somehow possible to use the 'With' keyword on an existing object?
I would like to do the following using LINQ to objects and can't seem to find a way:
From m as Product in Me _
Select m With {.Match = m.Name.IndexOf(query)} _
Where m.Name.IndexOf(query) > 0
US coin values:
.01, .05, .10, .25 (*)
What configuration(s) of US coins can be used to match every value from .01-.99 using the fewest coins possible?
How can you find an answer?
* note: there is actually a .50 coin but it is very rarely seen
I'm writing a shell for a project of mine, which by design parses commands that looks like this:
COMMAND_NAME ARG1="Long Value" ARG2=123 [email protected]
My problem is that Python's command line parsing libraries (getopt and optparse) forces me to use '-' or '--' in front of the arguments. This behavior doesn't match my requirements.
Any ideas how can this be solved? Any existing library for this?
What methods are there to get JPQL to match similar strings?
By similar I mean:
Contains: search string is found within the string of the matches entity
Case-insensitive
Small mispellings: e.g. "arow" matches "arrow"
I suspect the first two will be easy, however, I would appreciate help with the last one
Thank you
I am have completed javascript validation of a form using Regular Expressions and am now working on redundant verification server-side using PHP.
I have copied this regular expression from my jscript code that finds dollar values, and reformed it to a PHP friendly format:
/\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/
Specifically:
if (preg_match("/\$?((\d{1,3}(,\d{3})*)|(\d+))(\.\d{2})?$/", $_POST["cost"])){}
While the expression works great in javascript I get :
Warning: preg_match() [function.preg-match]: Compilation failed: nothing to repeat at offset 1
when I run it in PHP. Anyone have a clue why this error is coming up?
It traverses to bottom dirs for some unknown reason:
Errorsome
/bin/sh: .??*: not found
make[23]: Entering directory `/m/user/files/dir'
make clean
Makefile
all:
make clean
#The wildcard is the bug. I want to make all hidden files in the current makefile.
#It should match .<some char><some char><any char arbitrary times>
make $$(.??*)
#I want to replace below-like-tihngs with a wildcard above
# make .lambda
# make .lambda_t
clean:
-rm .??*
.lambda:
#do something
.lambda_t:
I have seen this type of effect on a visual thesaurus. Is there any open source code for this.
I don't care about the algorithm to match similar objects. I only am wondering about the effects.
I'm trying to integrate vBulliten and Django's user databases. I know vB uses a md5 algorithm to hash it's passwords, with a salt. I have the salt data and the password for each vB user, and would like to know how to import those accounts onto Django.
I've tried the obvious, changing the Django user's password to;
md5$vb's_salt$vb's_password
This just throws back Django's log-in form, with a message saying "username and password does not match"
Any ideas?