A periodic computer generated message (simplified):
Hello user123,
- (604)7080900
- 152
- minutes
Regards
Using python, how can I extract "(604)7080900", "152", "minutes" (i.e. any text following a leading "- " pattern) between the two empty lines (empty line is the \n\n after "Hello user123" and the \n\n before "Regards"). Even better if the result string list are stored in an array. Thanks!
final Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("image/jpeg");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "[email protected]" });
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "this is the test");
emailIntent.putExtra(Intent.EXTRA_TEXT, "testing time");
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(url));
How to encode a datetime in a QueryString and read it in the asp:QueryStringParameter
out:
(it's a asp:HyperLink NavigateUrl )
String.Format("~/Reports/Logs/Option_History.aspx?OptionID={0}&time={1}", id, time)
in:
<asp:QueryStringParameter Name="time" QueryStringField="Time" Type="DateTime" ConvertEmptyStringToNull="true" />
The stdio is usually buffered. When I hit a breakpoint and there's a printf before the breakpoint, the printed string may still be in the buffer and I can not see it.
I know I can flush the stdio by adding some flush code in the program.
Without doing this, is there any way to tell GDB to flush the stdio of the program being debugged after GDB stops? This way is more friendly when debugging a program.
Private Sub Command1_Click()
Dim dom As New DOMDocument
Dim http As New XMLHTTP
Dim strRet As String
If Not dom.Load("c:\\CH.xml") Then MsgBox "?????"
http.Open "Post", "http://172.31.132.173/u8eai/import.asp", True '?????ASP
http.send dom.xml '?xml????????
strRet = http.responseText 'strRet:???xml???????
MsgBox strRet
End Sub
The error message, in Chinese:
????
???????????????.
translated by google(To English):
Real-time error
The data needed to complete the operation can not be used also
My program file is encoded in UTF-8 so "abc".length == 3 but "åäö".length == 6. I realize that å, ä, ö, etc. are stored as two bytes in UTF-8, and that a Ruby String is a sequence of bytes (not characters), but it is annoying! Is there a best practice to work around this problem?
My app needs to use a library which is only available for Python and Ruby. From my understanding, Apple allows Ruby to run on iPhone as long as users can't execute arbitrary code (Rhomobile uses Ruby).
How can I bundle Ruby/Python with my app, call a function from my Obj-C code, and get the result (a string) back in C or Obj-C format?
Hi,
as I probably do not describe the problem in the right terms, I was not able to get an answer with google. Please excuse!
In the following code, I would like to replace 'hardcoded' identifier COMMENT with the variable editedField. How to do that?
var editedField:String = event.dataField;
if (model.multipleProcessingData[i][editedInformationProductNO].COMMENT != null{
...
}
I'm trying to make a log-in log-off with Ajax supported.
I made some logic in my controller to sign the user in and then return simple partial containing welcome message and log-Off ActionLink my Action method looks like this :
public ActionResult LogOn(LogOnModel model, string returnUrl)
{
if (ModelState.IsValid)
{
if (MembershipService.ValidateUser(model.UserName, model.Password))
{
FormsService.SignIn(model.UserName, model.RememberMe);
if (Request.IsAjaxRequest())
{
//HERE IS THE PROBLEM :(
return View("LogedInForm");
}
else
{
if (!String.IsNullOrEmpty(returnUrl))
return Redirect(returnUrl);
else
return RedirectToAction("Index", "Home");
}
}
else
{
ModelState.AddModelError("", "The user name or password provided is incorrect.");
if (Request.IsAjaxRequest())
{
return Content("There were an error !");
}
}
}
return View(model);
}
and I'm trying to return this simple partial :
Welcome <b><%= Html.Encode(Model.UserName)%></b>!
<%= Html.ActionLink("Log Off", "LogOff", "Account") %>
and of-course the two partial are strongly-typed to LogOnModel.
But if i returned View("PartialName") i always get OnFailure with status code 500.
While if i returned Content("My Message") everything is going right.
so please tell me why i always get this "StatusCode = 500" ??. where is the big mistake ??.
By the way in my Site MasterPage i rendered partial to show long-on simple form this partial looks like this :
<script type="text/javascript">
function ShowErrorMessage(ajaxContext) {
var response = ajaxContext.get_response();
var statusCode = response.get_statusCode();
alert("Sorry, the request failed with status code " + statusCode);
}
function ShowSuccessMessage() {
alert("Hey everything is OK!");
}
</script>
<div id="logedInDiv">
</div>
<% using (Ajax.BeginForm("LogOn", "Account", new AjaxOptions
{
UpdateTargetId = "logedInDiv",
InsertionMode = InsertionMode.Replace,
OnSuccess = "ShowSuccessMessage",
OnFailure = "ShowErrorMessage"
}))
{ %>
<%= Html.TextBoxFor(m => m.UserName)%>
<%= Html.PasswordFor(m => m.Password)%>
<%= Html.CheckBoxFor(m => m.RememberMe)%>
<input type="submit" value="Log On" />
< <% } %>
How can I write a regex to match strings following these rules?
1 letter followed by 4 letters or numbers, then
5 letters or numbers, then
3 letters or numbers followed by a number and one of the following signs: ! & @ ?
I need to allow input as a 15-character string or as 3 groups of 5 chars separated by one space.
I'm implementing this in JavaScript.
I am experimenting with lex and yacc and have run into a strange issue, but I think it would be best to show you my code before detailing the issue. This is my lexer:
%{
#include <stdlib.h>
#include <string.h>
#include "y.tab.h"
void yyerror(char *);
%}
%%
[a-zA-Z]+ {
yylval.strV = yytext;
return ID;
}
[0-9]+ {
yylval.intV = atoi(yytext);
return INTEGER;
}
[\n] { return *yytext; }
[ \t] ;
. yyerror("invalid character");
%%
int yywrap(void) {
return 1;
}
This is my parser:
%{
#include <stdio.h>
int yydebug=1;
void prompt();
void yyerror(char *);
int yylex(void);
%}
%union {
int intV;
char *strV;
}
%token INTEGER ID
%%
program: program statement EOF { prompt(); }
| program EOF { prompt(); }
| { prompt(); }
;
args: /* empty */
| args ID { printf(":%s ", $<strV>2); }
;
statement: ID args { printf("%s", $<strV>1); }
| INTEGER { printf("%d", $<intV>1); }
;
EOF: '\n'
%%
void yyerror(char *s) {
fprintf(stderr, "%s\n", s);
}
void prompt() {
printf("> ");
}
int main(void) {
yyparse();
return 0;
}
A very simple language, consisting of no more than strings and integer and a basic REPL. Now, you'll note in the parser that args are output with a leading colon, the intention being that, when combined with the first pattern of the rule of the statement the interaction with the REPL would look something like this:
> aaa aa a
:aa :a aaa>
However, the interaction is this:
> aaa aa a
:aa :a aaa aa aa
>
Why does the token ID in the following rule
statement: ID args { printf("%s", $<strV>1); }
| INTEGER { printf("%d", $<intV>1); }
;
have the semantic value of the total input string, newline included? How can my grammar be reworked so that the interaction I intended?
There is function in python called eval that takes string input and evaluates it.
>>> x = 1
>>> print eval('x+1')
2
>>> print eval('12 + 32')
44
>>>
What is Haskell equivalent of eval function?
So there is this nice picture in the hash maps article on Wikipedia:
Everything clear so far, except for the hash function in the middle.
How can a function generate the right index from any string? Are the indexes integers in reality too? If yes, how can the function output 1 for John Smith, 2 for Lisa Smith, etc.?
Suppose I've following Code:
Console.WriteLine("Value1: " + SomeEnum.Value1.ToString() + "\r\nValue2: " +
SomeOtherEnum.Value2.ToString());
Will Compiler Optimize this to:
Console.WriteLine("Value1: " + SomeEnum.Value1 + "\r\nValue2: " +
SomeOtherEnum.Value2);
I've checked it with IL Disassembler and there are calls to
IL_005a: callvirt instance string [mscorlib]System.Object::ToString()
I don't know if JIT optimizes this.
Maybe this is just my unfamiliarity with unicode, so please correct me if I'm mistaken.
Looking at http://json.org/, the spec says that a string can include "any UNICODE character", but this confuses me.
JSON is a communication format
correct? At the core of it,
everything must translate down to
bytes.
In contrast, UNICODE is a
logical format and must be encoded to
be able to transmit it, right?
So what did they mean there?
Hi
I have the following SQL SELECT statement
SELECT bar_id, bar_name, town_name, advert_text
FROM bar, towns, baradverts
WHERE town_id = town_id_fk
AND bar_id = bar_id_fk
My problem is that since not every bar has an advert in table "baradverts", these bars are not coming up in the results. In other words I need a NULL for those bars that do not have an advert string.
This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell.
For instance, if the remote shell prompts for 'what is your name?' then I need to feed it 'first,last'
Using Visual Studio 2010 Professional, I have a ToString() method that looks like this:
public override string ToString()
{
return "something" + "\n" + "something";
}
Because there are several "something"'s and each is long, I'd like to see
something
something
Sadly, I'm seeing
"something\nsomething"
Is there a way to get what I want?
Sorry if this is quite noobish to you, but I'm just starting out to learn Python after learning C++ & Java, and I am wondering how in the world I could just declare variables like id = 0 and name = 'John' without any int's or string's in front! I figured out that perhaps it's because there are no ''s in a number, but how would Python figure that out in something like def increase(first, second) instead of something like int increase(int first, int second) in C++?!
i cant find the method that sets the triggerListener name, i added to the quartz properties file the following:
org.quartz.triggerListener.NAME.class=wavemark.interfaceserver.interfaceengine.action.EngineListener
org.quartz.triggerListener.NAME.propName=myListener
org.quartz.triggerListener.NAME.prop2Name=myListener2
but i still get the Exception:
org.quartz.SchedulerException: TriggerListener 'wavemark.interfaceserver.interfaceengine.action.EngineListener'
props could not be configured.
[See nested exception: java.lang.NoSuchMethodException:
wavemark.interfaceserver.interfaceengine.action.EngineListener.setName(java.lang.String)]
please help!!
Hi guys. I'm having a problem using ActiveSupport's core extensions on a gem I am developing.
I had it working with AS 2.3.8, but as soon as I wanted to port it to 3b4, the extensions stopped working and my test results are filled with lines such as:
undefined method `blank?' for "something":String
I've included it via gem "activesupport" followed by require "active_support"
Is there anything else I need to call to include those extensions?
Thanks
How can I return the key, mean if I want to allow only interger value in the textbox , how can I don't allow user to not enter value other then integer, regarding, keypress event, I know there are other ways such as expression to match the string value, but I want to not assign invalid value to the textbox.
if (( value 0 a&&(value <=9))
then assigned
else
return
thanks in advance
I know I'm probably missing something easy, but I have a foreach loop and I'm trying to modify the values of the first array, and output a new array with the modifications as the new values.
Basically I'm starting with an array:
0 = A:B
1 = B:C
2 = C:D
And I'm using explode() to strip out the :'s and second letters, so I want to be left with an array:
0 = A
1 = B
2 = C
The explode() part of my function works fine, but I only seem to get single string outputs. A, B, and C.
I am looking at History and History JavaDocs in GWT and I notice that there is no way to tell whether the forward or backward button was pressed (either pragmatically or by the user). The "button press" is handled by your registered addValueChangeHandler, but the only thing passed to the handler is a string on your history stack. There is no indication as to whether the "History" is moving "back" (using the back arrow button) or "forward" (using the right arrow button). Is there any way to determine this?