Hi
I am using this code for an image for mailto: but when subject line is entered
it is showing a big unable to parse javascript or something in joomla.
mailto:[email protected]?subject=hello
Thanks
Hi ,
I spent lot time figuring out a simple regex to return a group (only 1st group).
So the string can be -
"No purchase required" or "Purchase of $50.00 worth groceries is required."
I am trying to write a regex which can parse "No" or "50" based on the given string.
This is what I have written.
(?:(No) monthly maintenance|Purchase of \$([\d\.]+ worth groceries)
This works fine but I want my output as 1st group/group 1 only.
Hello everyone,
I have some legacy classic ASP code (not ASP.Net, but ASP), and I want to call a WCF service which I developed by using VSTS 2008 + C# + .Net 3.5 and using basic Http Binding.
Any reference samples? I heard the only way is -- we have to manually generate the tricky SOAP message, and parse SOAP response, is that true? :-)
thanks in advance,
George
In .Net when handling numbers with unspecified locale I use:
return double.Parse(myStr, CultureInfo.InvariantCulture.NumberFormat);
Whats the equivalent in Java? java.util.Locale doesnt seem to include such a thing.
Is there a way to integrate StyleCop in a NAnt script such that the build fails if there are too many style violations?
There doesn't seem to be a NAnt task for StyleCop, but we've found StyleCopCmd. However this only seems to generate an XML file as output that we'd have to parse. Is there some easier solution?
I need to parse out the values from some data from select boxes.
Example: <option value="1">Apple</option><option value="2">Chicken</option>
Usage: If option = apple then get value.
Any suggestions?
Hi guys, the question is: suppose I have an input function like sin(2-cos(3*A/B)^2.5)+0.756*(C*D+3-B) specified with a BNF, I will parse input using recursive descent algorithm, and then how can I use or change Dijkstra’s algorithm to handle this given function? After parsing this input function, I need to execute it with variable inputs, where Dijkstra’s algorithm should do the work. Thanks in advance.
EDIT: May be I should ask also: What is the best practice or data structure to represent given function?
I'm attempting to use deftype (from the bleeding-edge clojure 1.2 branch) to create a java class that implements the java Servlet interface. I would expect the code below to compile (even though it's not very useful).
(ns foo [:import [javax.servlet Servlet ServletRequest ServletResponse]])
(deftype servlet []
javax.servlet.Servlet
(service [this
#^javax.servlet.ServletRequest request
#^javax.servlet.ServletResponse response]
nil))
But it doesn't compile. The compiler produces the message:
Mismatched return type: service, expected: void, had: java.lang.Object
[Thrown class java.lang.IllegalArgumentException]
Which doesn't make sense to me, because I'm returning nil. So the fact that the return type of the method is void shouldn't be a problem. For instance, for the java.util.Set interface:
(deftype bar [#^Number n] java.util.Set (clear [this] nil))
compiles without issue.
So what am I doing wrong with the Servlet interface?
To be clear:
I know that the typical case is to subclass one of the servlet abstract classes rather than implement this interface directly, but it should still be possible to do this.
Stack Trace:
The stack trace for the (deftype servlet... is:
Mismatched return type: service, expected: void, had: java.lang.Object
[Thrown class java.lang.IllegalArgumentException]
Restarts:
0: [ABORT] Return to SLIME's top level.
Backtrace:
0: clojure.lang.Compiler$NewInstanceMethod.parse(Compiler.java:6461)
1: clojure.lang.Compiler$NewInstanceExpr.build(Compiler.java:6119)
2: clojure.lang.Compiler$NewInstanceExpr$DeftypeParser.parse(Compiler.java:6003)
3: clojure.lang.Compiler.analyzeSeq(Compiler.java:5289)
4: clojure.lang.Compiler.analyze(Compiler.java:5110)
5: clojure.lang.Compiler.analyze(Compiler.java:5071)
6: clojure.lang.Compiler.eval(Compiler.java:5347)
7: clojure.lang.Compiler.eval(Compiler.java:5334)
8: clojure.lang.Compiler.eval(Compiler.java:5311)
9: clojure.core$eval__4350.invoke(core.clj:2364)
10: swank.commands.basic$eval_region__673.invoke(basic.clj:40)
11: swank.commands.basic$eval_region__673.invoke(basic.clj:31)
12: swank.commands.basic$eval__686$listener_eval__687.invoke(basic.clj:54)
13: clojure.lang.Var.invoke(Var.java:365)
14: foo$eval__2285.invoke(NO_SOURCE_FILE)
15: clojure.lang.Compiler.eval(Compiler.java:5343)
16: clojure.lang.Compiler.eval(Compiler.java:5311)
17: clojure.core$eval__4350.invoke(core.clj:2364)
18: swank.core$eval_in_emacs_package__320.invoke(core.clj:59)
19: swank.core$eval_for_emacs__383.invoke(core.clj:128)
20: clojure.lang.Var.invoke(Var.java:373)
21: clojure.lang.AFn.applyToHelper(AFn.java:169)
22: clojure.lang.Var.applyTo(Var.java:482)
23: clojure.core$apply__3776.invoke(core.clj:535)
24: swank.core$eval_from_control__322.invoke(core.clj:66)
25: swank.core$eval_loop__324.invoke(core.clj:71)
26: swank.core$spawn_repl_thread__434$fn__464$fn__465.invoke(core.clj:183)
27: clojure.lang.AFn.applyToHelper(AFn.java:159)
28: clojure.lang.AFn.applyTo(AFn.java:151)
29: clojure.core$apply__3776.invoke(core.clj:535)
30: swank.core$spawn_repl_thread__434$fn__464.doInvoke(core.clj:180)
31: clojure.lang.RestFn.invoke(RestFn.java:398)
32: clojure.lang.AFn.run(AFn.java:24)
33: java.lang.Thread.run(Thread.java:637)
I am trying to parse some data to no success. Can anyone recommend a good introduction with a lot of examples to Recursive Descent Parsing? I haven't been able to find any.
I have a cell in a spreadsheet that is a date object in Excel but becomes a double (something like 39820.0 for 1/7/2009) when it comes out of C1's xls class. I read this is a Julian date format. Can someone tell me how to parse it back into a DateTime in C#?
Update: It looks like I might not have a Julian date, but instead the number of days since Dec 30, 1899.
I am parsing feeds using feedparser and I am trying to store updated or updated_parsed attributes of feeds in Django db.
But it shows an error as [u'Enter a valid date/time in YYYY-MM-DD HH:MM[:ss[.uuuuuu]] format.']
Please tell me how to convert updated and updated_parsed such that it can be stored in the Django db such that I can (convert and reuse) or just reuse the date stored in db while parsing in this way:
feedparser.parse("url", modified = lastupdate)
Hi,
In my java application, I need to parsexml that contains control character 0x2 inside CDATA. I tried few ways but coudnt get through. I want to avoid any sort of encoding. Is there any way in XML1.1?
Thanks,
Shefali
I am using logback/slf4j to do my logging. I want to parse my log file to analyze some data, so instead of parsing a great big file (mostly consisting of debug statements) I want to have two logger instances which each log to a separate file; one for analytics and one for all purpose logging. Does anyone know if this is possible with Logback, or any other logger for that matter?
Does anybody know of an html cleaner for .NET that can parse html and (for instance) convert it to a more machine friendly format such as xhtml?
I've tried the HTML Agility Pack, but that fails to correctly parse even fairly simple examples.
To give an example of html that should be parsed correctly:
<html><body>
<ul><li>TestElem1
<li>TestElem2
<li>TestElem3 List:
<ul><li>Nested1
<li>Nested2</li>
<li>Nested3
</ul>
<li>TestElem4
</ul>
<p>paragraph 1
<p>paragraph 2
<p>paragraph 3
</body></html>
li tags don't need to be closed (see spec), and neither do P tags. In other words, the above sample should be parsed as:
<html><body>
<ul><li>TestElem1</li>
<li>TestElem2</li>
<li>TestElem3 List:
<ul><li>Nested1</li>
<li>Nested2</li>
<li>Nested3</li>
</ul></li>
<li>TestElem4</li>
</ul>
<p>paragraph 1</p>
<p>paragraph 2</p>
<p>paragraph 3</p>
</body></html>
Since the aim is to use the library on various machines, it's a big disadvantage to need to fall back to native code (such as a wrapper around html tidy) which would require extra deployment hassle and sacrifice platform independance.
Any suggestions?
To recap, I'm looking for:
An html cleaner ala HTML tidy
Must be able to deal with real world html, not just xhtml, at the very least correctly reading valid html 4
Must be able to convert to a more easily processable xml format
Should be a purely managed app.
I'm trying to parse a text file into sentences ending in periods, but names like Mr. Hopkins are throwing false alarms on matching for periods.
What regex indentfy's "." but not "Mr."
For bonus, I'm also using ! to find end of sentences, so my current Regex is /(!/./ and I'd love an answer that incorporates my !'s too.
I have two html select server control on an add data form page.
the user selects a value in the first html select server control and then values are populated into the second html select server control with jquery.
The problem is when a a user clicks the save button and the page posts back, the values are no longer in the drop down list populated by jQuery.
The drop downlist is a html server control, shouldn't it retain the values on post-back?
How can I retain the values and save the selected value to the database?
$(document).ready(function() {
$("#<%=ddlCourseWare.ClientID %>").change(function() {
var courseWareId = this.value;
try {
$.ajax({
type: "POST",
url: "Left_SubCategory.aspx/GetTabData",
data: "{courseWareId:" + courseWareId + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data) {
var result = json_parse(data.d);
$("#<%=ddlTabType.ClientID %>")[0].innerHTML = '';
if (result.length > 0) {
$.each(result, function(key, item) {
$("#<%=ddlTabType.ClientID %>").append($("<option></option>").val(item.id).html(item.TabName));
});
}
else {
$("#<%=ddlTabType.ClientID %>").append($("<option></option>").val('0').html('--Select--'));
}
},
error: function(request, status, error) {
alert(request.responseText);
}
});
}
catch (ex) {
alert(ex);
}
});
});
HTML
<select id="ddlCourseWare" name="ddlCourseWare" runat="server" Width="230px" class="TextBox" Height="18px" >
<select id="ddlTabType" name="ddlTabType" runat="server" Width="230px" class="TextBox" Height="18px" onchange="BindMainCat();">
<option>--Select--</option>
</select>
C#
private void BindCourseWare()
{
ddlCourseWare.DataSource = courseWare.GetCourseWare();
ddlCourseWare.DataTextField = "CourseWareType";
ddlCourseWare.DataValueField = "id";
ddlCourseWare.DataBind();
ddlCourseWare.Items.Insert(0, "----Select Course Ware----");
}
[WebMethod]
public static string GetTabData(int courseWareId)
{
var result = new CourseWare().GetCourseTabByCoursewareId(courseWareId);
JavaScriptSerializer json_tabs = new JavaScriptSerializer();
string jsonArray_tabs = json_tabs.Serialize(result);
return jsonArray_tabs;
}
protected void btnSave_Click(object sender, EventArgs e)
{
int mainCategoryID1 = int.Parse(ddlTabType.Value); // not working
int mainCategoryID2 = int.Parse(Request["ctl00$ContentPlaceHolder1$ddlTabType"]);
// working but always return same value means the upper value (selected index 1)
}
Hi all,
I would like to launch the market from a preference screen but when I try to do this I obain a java.lang.SecurityException: Permission Denial: starting Intent { cmp=com.action.test/.ui.activities.Test } from ProcessRecord{44db1300 3697:com.pippo.pluto/10067} (pid=3697, uid=10067) requires null.
This is my code:
startActivity(new Intent(Intent.ACTION_VIEW,Uri.parse("market://search?q=pname:com.action.test")));
what am I doing wrong?
Thanks in advance
Tobia
So I have a random of strings and I need to parse them, let's take an example:
This string - DeleteMe please and some other text
So I want to find DDeleteMe please and some other text and remove it, because all I need is This string
Best Regards,
Ok, I'm using an ICS parser utility to parse google calendar ICS files. It works great, except google is feeding me the times of the events at UCT.. so I need to subtract 5 hours now, and 6 hours when daylight savings happens.
To get the start time I'm using:
$timestart = date("g:iA",strtotime(substr($event['DTSTART'], 9, -3)));
//$event['DTSTART'] feeds me back the date in ICS format: 20100406T200000Z
So any suggestions how to handle timezone and daylight savings time?
Thanks in advance
When trying to run an Eclipse Dynamic Web Project under a Tomcat setup using WTP, it fails with the attached stacktrace.
Checklist
At the project properties, under "Java EE Module Dependencies" I have checked the "Maven Dependencies"
At the wtp deploy directory, under lib indeed all dependencies are present (esp. struts-taglib-1.3.10.jar)
On the other hand, if I package with maven and copy the war file under the webapps directory everything is working as normal.
Specification
Eclipse JEE Galileo SR2 (with WTP 3.1.1)
Tomcat 6.0.26
Java(TM) SE Runtime Environment (build 1.6.0_17-b04-248-10M3025)
Java HotSpot(TM) 64-Bit Server VM (build 14.3-b01-101, mixed mode)
stacktrace
org.apache.jasper.JasperException: Unable to read TLD "META-INF/tld/struts-html-el.tld" from JAR file "file:/Users/cue/Development/workspace/eclipse/.metadata/.plugins/org.eclipse.wst.server.core/tmp2/wtpwebapps/ticketing/WEB-INF/lib/struts-el-1.3.10.jar": org.apache.jasper.JasperException: Failed to load or instantiate TagExtraInfo class: org.apache.struts.taglib.html.MessagesTei
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:181)
at org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:182)
at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:383)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:446)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1393)
at org.apache.jasper.compiler.Parser.parse(Parser.java:130)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:255)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:185)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Thread.java:637)
Hi,I have a question about converting types each other.I want to change the selected combobox value string to int but I get errors
my code:
int.Parse(age.SelectedItem.ToString());
What can I do for this problem?Thank you
How can I create a view with a particular style programmatically (not in XML)? I tried using this [View (Context context, AttributeSet attrs, int defStyle)][1], but I don't know what to parse in for the second argument. Passing in null results in the View not being displayed
[1]: http://developer.android.com/reference/android/view/View.html#View(android.content.Context, android.util.AttributeSet, int)