ABCDchinchwad18-Mar-2010-11.sql.zip
ABCDsolapur18-Mar-2010-10.sql.zip
How do I find the string between "ABCD" and the date "18-Mar-2010"
Expected resuts:
chinchwad
solapur
So, I basically would like to test to see if a string contains a range of alphanumeric characters. It's to be used as a client-side validation and I don't want to prevent users from entering whatever they want. Best to give examples of what should/should not pass validation:
So to be specific, the expression I'm looking for is to test to make sure string contains anywhere from 3 to 10 alphanumeric characters. I'd like to plug into an ASP.NET client side validator.
NOTE: quotes not part of input (but could be!)
" f o o " should pass since there are 3 chars
"f_0_0" should pass
" fo " should not
"F......o......o......b.....a......r" should pass
thx
When I run this code:
- (NSString *)description{
return [NSString stringWithFormat:@"(FROG idle:%i animating:%i rect:%@ position:%@ tongue:%@)",
self.idleTime,
self.animating,
NSStringFromCGRect(self.rect),
NSStringFromCGPoint(self.position),
tongue
];
}
I get the following output:
(FROG idle:0 animating:0 rect:(null) position:{{1,2}{3,4}} tongue:{5,6})
This is wrong because it seems to be skipping the rect format string and placing everything displaced by one. So idle and animating are what I expect, then rect is skipped, but the result from NSStringFromCGRect(self.rect) is placed into position, then the result for position is pushed to tongue, then tongue is not displayed at all.
I'm at a loss.
Response to : http://stackoverflow.com/questions/1454913/regular-expression-to-find-a-string-included-between-two-characters-while-exclud
Hi,I'm looking for a regex pattern that applies to my string including brackets:
[1,2,3,4,5] [abc,ef,g] [0,2,4b,y7]
could be anything including word,digit,non-word together or separated.
I wish to get the group between brackets by \[(.*?)\]
but what is the regex pattern that will give me the group between brackets and sub-group strings separated by commas so that the result may be following ??
Group1 : [1,2,3,4,5]
Group1: 1
Group2: 2
Group3: 3
Group4: 4
Group5: 5
Group2 : [abc,ef,g]
Group1: abc
Group2: ef
Group3: g
etc ..
Thank you for your help
Hi Experts,
I had a Ribbon like custom control. I created an application using this control. These applications work fine until I change the system number format. They crashes if I change the system number format like below:
Current Format = English (United State)
Decimal symbol = ','
Digit group symbol = '.'
When I run applications, they throw an exception "Input string not in Correct format". .
Some other applications specify the Exception's message = "Input string '0,2,0,2' was not a correct format", so I think in Wpf ES's xaml files, we may declare some properties i.e Padding, Margin like "0,2,0,2" = that will cause errors with the system number format above.
I have note that this error only occurs in Windows Vista, it does not occurs on Windows XP. I do not know why?
I have also look at this link, But it not helps for Vista.
http://support.microsoft.com/kb/968227/en-us
Hi,
I need to tokenize some strings which will be splitted of according to operators like = and !=. I was successful using regex until the string has != operator. In my case, string was seperated into two parts, which is expected but ! mark is in the left side even it is part of given operator. Therefore, I believe that regex is not suitable for it and I want to benefit from lex. Since I do not have enough knowledge and experience with lex, I am not sure whether it fits my work or not. Basically, I am trying to do replace the right hand side of the operators with actual values from other data. Do you people think that can it be helpful for my case?
Thanks.
I want to break a string according to the following rules:
all consecutive alpha-numeric chars, plus the dot (.) must be treated as one part
all other consecutive chars must be treated as one part
consecutive combinations of 1 and 2 must be treated as different parts
no whitespace must be returned
For example this string:
Method(hierarchy.of.properties) = ?
Should return this array:
Array
(
[0] => Method
[1] => (
[2] => hierarchy.of.properties
[3] => )
[4] => =
[5] => ?
)
I was unsuccessful with preg_split(), as AFAIK it cannot treat the pattern as an element to be returned.
Any idea for a simple way to do this?
I created a jquery collection that stores xml as follows:
var rh_request = $('')
.attr('user_id', user_id)
.attr('company_id', company_id)
.attr('action', 'x');
I want to post it to my server via an ajax request as follows:
$.ajax({
type: "POST",
url: mywebsiteURL,
processData: false,
dataType: "xml",
data: rh_request.html(),
success: mycallbackfunction
});
My problem is that the "data" parameter of the ajax call needs a string version of the xml and it seems neither Jquery's .html() or .text() function yields this. I have older code that used straight javascript to form the outgoing xml and calling the DOM .xml() function yielded a string that worked. How is this done with a jquery collection???
This is probably a beginner question, but how do you set a recordset to a string variable?
Here is my code:
Function getOffice (strname, uname)
strEmail = uname
WScript.Echo "email: " & strEmail
Dim objRoot : Set objRoot = GetObject("LDAP://RootDSE")
Dim objDomain : Set objDomain = GetObject("LDAP://" & objRoot.Get("defaultNamingContext"))
Dim cn : Set cn = CreateObject("ADODB.Connection")
Dim cmd : Set cmd = CreateObject("ADODB.Command")
cn.Provider = "ADsDSOObject"
cn.Open "Active Directory Provider"
Set cmd.ActiveConnection = cn
cmd.CommandText = "SELECT physicalDeliveryOfficeName FROM '" & objDomain.ADsPath & "' WHERE mail='" & strEmail & "'"
cmd.Properties("Page Size") = 1
cmd.Properties("Timeout") = 300
cmd.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Dim objRS : Set objRS = cmd.Execute
WScript.Echo objRS.Fields(0)
Set cmd = Nothing
Set cn = Nothing
Set objDomain = Nothing
Set objRoot = Nothing
Dim arStore
Set getOffice = objRS.Fields(0)
Set objRS = Nothing
End function
When I try to run the function, it throws an error "vbscript runtime error: Type mismatch"
I presume this means it can't set the string variable with a recordset value.
How do I fix this problem?
I've been fiddling with this for over twenty minutes and my Google-foo is failing me.
Let's say I have an XML Document created in Java (org.w3c.dom.Document):
DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
Document document = docBuilder.newDocument();
Element rootElement = document.createElement("RootElement");
Element childElement = document.createElement("ChildElement");
childElement.appendChild(document.createTextNode("Child Text"));
rootElement.appendChild(childElement);
document.appendChild(rootElement);
String documentConvertedToString = "?" // <---- How?
How do I convert the document object into a text string?
Hello,
I have a database (sql 2008 mdf file), a class library project with an edmx file, created with the wizard. So the connection string is also made by the wizard.
This project is on a teamfoundation server.
I can use all the wizard made objects when coding.
But when i run the program and I try to make an entityContainerName, the program crashes and gives this error:
The specified named connection is
either not found in the configuration,
not intended to be used with the
EntityClient provider, or not valid.
on this line:
public TestEntities() : base("name=TestEntities", "TestEntities")
How can I solve this problem or what am I doing wrong?
I have a file with a bunch of number in columns. These numbers are separated by variable number of spaces. I want to skip the first line and get all the other lines and separte each number on the line. Finally, I want to write each number on Excel. I've been able to get the lines and write them on Excel but I can't separate each number (I'm getting the whole line as one string).
Does any body know how to split a string that has a variable number of spaces?
Here is my code.
Sub Test()
r = 0
With New Scripting.FileSystemObject
With .OpenTextFile("C:\Users\User\Desktop\File.tab", ForReading)
If Not .AtEndOfStream Then .SkipLine
Do Until .AtEndOfStream
ActiveCell.Offset(r, 0) = Split(.ReadLine, vbCrLf)
r = r + 1
Loop
End With
End With
End Sub
hi,
I have the following values:
int a=1;
int b=0;
int c=2;
int d=2;
int e=1;
How do i concatenate these values so that i end up with a String that is 10221;
please note that multiplying a by 10000, b by 1000.....and e by 1 will not working since b=0 and therefore i will lose it when i add the values up.
Thnks you in advance.
Hi StackOverflow,
I have a Java application that makes heavy use of a large file, to read, process and give through to SolrEmbeddedServer (http://lucene.apache.org/solr/).
One of the functions does basic HTML escaping:
private String htmlEscape(String input)
{
return input.replace("&", "&").replace(">", ">").replace("<", "<")
.replace("'", "'").replaceAll("\"", """);
}
While profiling the application, the program spends roughly 58% of the time in this function, a total of 47% in replace, and 11% in replaceAll.
Now, is the Java replace that slow, or am I on the right path and should I consider the program efficient enough to have its bottleneck in Java and not in my code? (Or am I replacing wrong?)
Thanks in advance!
I'm using the function time() in order to get a timestamp in C++, but, after doing so, I need to convert it to a string. I can't use ctime, as I need the timestamp itself (in its 10 character format). Trouble is, I have no idea what form a time_t variable takes, so I don't know what I'm converting it from. cout handles it, so it must be a string of some description, but I have no idea what.
If anyone could help me with this it'd be much appreciated, I'm completely stumped.
Alternately, can you provide the output of ctime to a MySQL datetime field and have it interpreted correctly? I'd still appreciate an answer to the first part of my question for understanding's sake, but this would solve my problem.
<ListBox x:Name="MainList" HorizontalAlignment="Left" Height="468" Margin="10,10,0,0" VerticalAlignment="Top" Width="100" ItemsSource="{Binding Items,Mode=TwoWay}" DisplayMemberPath="Name"/>
[Serializable()]
public class MYcontainer : INotifyPropertyChanged,ISerializable
{
private List<MYClass> _items = new List<MYClass>();
public List<MYClass> Items
{
get{ return _items;}
set { this._items =value;
OnPropertyChanged("Items");
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName = null)
{
var eventHandler = this.PropertyChanged;
if (eventHandler != null)
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
when i add an item to "Items" the UI doesnt update, the binding is working fine, since if i closed the window and opened it again, the new items appear correctly
what am i doing wrong? i know if i used observablecollection it will work fine, but shouldn't it work with List<? , i already have in another window a string[] property and it update fine
Hello, I need help sorting and counting instances of the words in a string.
Lets say I have a collection on words:
happy beautiful happy lines pear gin happy lines rock happy lines pear
How could I use php to count each instance of every word in the string and output it in a loop:
There are $count instances of $word
So that the above loop would output:
There are 4 instances of happy.
There are 3 instances of lines.
There are 2 instances of gin....
Thank you for your genius.
I've read through a few threads detailing how to tokenize strings, but I'm apparently too thick to adapt their suggestions and solutions into my program. What I'm attempting to do is tokenize each line from a large (5k+) line file into two strings. Here's a sample of the lines:
0 -0.11639404
9.0702948e-05 0.00012207031
0.0001814059 0.051849365
0.00027210884 0.062103271
0.00036281179 0.034423828
0.00045351474 0.035125732
The difference I'm finding between my lines and the other sample input from other threads is that I have a variable amount of whitespace between the parts that I want to tokenize. Anyways, here's my attempt at tokenizing:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;
int main(int argc, char *argv[])
{
ifstream input;
ofstream output;
string temp2;
string temp3;
input.open(argv[1]);
output.open(argv[2]);
if (input.is_open())
{
while (!input.eof())
{
getline(input, temp2, ' ');
while (!isspace(temp2[0])) getline(input, temp2, ' ');
getline (input, temp3, '\n');
}
input.close();
cout << temp2 << endl;
cout << temp3 << endl;
return 0;
}
I've clipped it some, since the troublesome bits are here. The issue that I'm having is that temp2 never seems to catch a value. Ideally, it should get populated with the first column of numbers, but it doesn't. Instead, it is blank, and temp3 is populated with the entire line. Unfortunately, in my course we haven't learned about vectors, so I'm not quite sure how to implement them in the other solutions for this I've seen, and I'd like to not just copy-paste code for assignments to get things work without actually understanding it. So, what's the extremely obvious/already been answered/simple solution I'm missing? I'd like to stick to standard libraries that g++ uses if at all possible.
I've added a combo box in the gui editor in MSVC 2010 pro in my MFC project. I have a list of strings I am grabbing from an external source and want to add them to my combo box. I've searched for a while, and every post seems to suggest I need to use the CComboBox class, however, I have no idea how to get the class variable from the resource ID of the combobox element in the gui editor.
In summary, how do I add a string to my combo box, either using a macro (like CB_ADDSTRING(RESOURCE_ID, "my string");) or using CComboBOx (something like CComboBox::GetObject(RESOURCE_ID)->AddString("blah");).
I do not do much win32 api/mfc programming, and just started fiddling around with it.
Have an image field and want to insert into this from a hex string:
insert into imageTable(imageField)
values(convert(image, 0x3C3F78...))
however when I run select the value is return with an extra 0 as 0x03C3F78...
This extra 0 is causing a problem in another application, I dont want it.
How to stop the extra 0 being added?
The schema is:
CREATE TABLE [dbo].[templates](
[templateId] [int] IDENTITY(1,1) NOT NULL,
[templateName] [nvarchar](50) NOT NULL,
[templateBody] [image] NOT NULL,
[templateType] [int] NULL)
and the query is:
insert into templates(templateName, templateBody, templateType)
values('I love stackoverflow', convert(image, 0x3C3F786D6C2076657273696F6E3D.......), 2)
the actual hex string is quite large to post here.
I am running Exchange 2013 on Windows Server 2012 R2.
When I add my exchange account to Outlook, it seems to work perfectly (sending/receiving email, syncing everything), but when I open the account settings it has the following set as the Server:
[email protected]
I would have expects this to be: mail.domain.com since this is the DNS A record pointing to the IP of my server. Where is it getting this server name?
I have a simple test code for testing SimpleDateFormat. This code works well on Eclipse and Android 1.5 emulator, but it failed at Android 2.0 emulator. Does anyone know why? Thanks.
public class TemplateActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView tv = new TextView(this);
tv.setText(R.string.hello);
setContentView(tv);
SimpleDateFormat format =
new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz");
String dateStr = "Mon, 17 May 2010 01:45:41 GMT";
try {
Date parsed = format.parse(dateStr);
Log.v("Test", parsed.toString());
} catch (ParseException pe) {
Log.v("Test", "ERROR: Cannot parse \"" + dateStr + "\"");
}
}
}
Log message:
V/Test( 400): ERROR: Cannot parse "Mon, 17 May 2010 01:45:41 GMT"
I'm working on a string pattern match algorithm. I use NSRegularExpression for finding the matches. For ex: I've to find all words starting with '#' in a string..
Currently I use the following regex function:
static NSRegularExpression *_searchTagRegularExpression;
static inline NSRegularExpression * SearchTagRegularExpression()
{
if (!_searchTagRegularExpression)
{
_searchTagRegularExpression = [[NSRegularExpression alloc]
initWithPattern:@"(?<!\\w)#([\\w\\._-]+)?
options:NSRegularExpressionCaseInsensitive error:nil];
}
return _searchTagRegularExpression;
}
and I use it as below:
NSRegularExpression *regexp = SearchTagRegularExpression();
[regexp enumerateMatchesInString:searchString
options:0 range:stringRange
usingBlock:^(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop)
{
// comes here for every match with range
}];
This works properly. But i just want to know if this is the best way. suggest if there's any better alternative...