I have this string:
%{Children^10 Health "sanitation management"^5}
And I want to convert it to tokenize this into an array of hashes:
[{:keywords=>"children", :boost=>10}, {:keywords=>"health", :boost=>nil}, {:keywords=>"sanitation management", :boost=>5}]
I'm aware of StringScanner and the Syntax gem (http://syntax.rubyforge.org/) ...
I have a method that alters an "Account" object based on the action delegate passed into it:
public static void AlterAccount(string AccountID, Action<Account> AccountAction) {
Account someAccount = accountRepository.GetAccount(AccountID);
AccountAction.Invoke(someAccount);
someAccount.Save();
}
This works as intended...
AlterAc...
I'm writing an assembler for a custom micro controller I'm working on. I've got the assembler to a point where it will assemble instructions down to binary.
However, I'm now having problems with getting labels to work. Currently, when my assembler encounters a new label, it stores the name of the label and the memory location its referr...
Hello Guys,
I am using libxml/xmlparser.h library in my program to parse the xml file. Is there any function in that library that can remove a node from the xml file?
I want to completely remove the node, i.e. its attributes and properties also.
...
I have the following JavaScript code as a string literal:
var $Page = new function()
{
var _url= 'http://www.some.url.com';
this.Download = function()
{
window.location = _url;
}
}
Is there a way I could get the value of the _url variable from my C# code? An open source library perhaps? I did this using a Regu...
i have line in .csv file as
abc,bcc,
i have to separate it into three tokens as abc bcc and null
first i had try stringTokenizer but it will not return null token so
after that i try string.split(",") but it will not return the last null string
it will return string which has null in between but not at last
so please help me
tha...
When I try to access my ASP.NET password recovery page, I get the following error:
Description: An error occurred during
the parsing of a resource required to
service this request. Please review
the following specific parse error
details and modify your source file
appropriately.
Parser Error Message: Could not load
...
I need to test some existing http:// URL parsing code for compliance to RFC 3986.
I do not want to reinvent the wheel and to bump in to various corner cases.
Is there some existing comprehensive test suite for that?
I do not specify the language I use since I expect the test suite to be generic enough to be adaptable. I would settle ...
Hi there
I;m trying yo implement a javacript function which will not allow to the user to input anything else than float numbers (digits)
This is my approach but I don't know how to improve it in order to allow submition of negatives numbers also (allow '-' key) and work on IE also.
function digits_only(evt, form) {
var evt = evt...
Having a lot of pain with the following Perl file parsing code [last reply on PM @http://www.perlmonks.org/index.pl?node_id=754947] below:
#!/usr/bin/perl -w
use strict;
use warnings;
#use diagnostics;
use Parse::RecDescent;
use Data::Dumper;
# Enable warnings within the Parse::RecDescent module.
$::RD_ERRORS = 1; # Make sure the pa...
I'm currently working on a testing framework for regular expressions, and I need to be able to parse Java regular expressions into ASTs to be able to generate sample strings which match the given regex.
I looked at the implementation of java.util.regex.Pattern but the code looks quite unwieldy (the emphasis was on speed over readability...
Hello, I am parsing out some emails. Mobile Mail, iPhone and I assume iPod touch append a signature as a separate boundary, making it simple to remove. Not all mail clients do, and just use '--' as a signature delimiter.
I need to chop off the '--' from a string, but only the last occurrence of it.
Sample copy
hello, this is some e...
Hi all,
I need a way to find only rendered IMG tags in a HTML snippet. So, I can't just regex the HTML snippet to find all IMG tags because I'd also get IMG tags that are shown as text in the HTML (not rendered).
I'm using Python on AppEngine.
Any ideas?
Thanks,
Ivan
...
I have a URL like this:
http://192.168.0.1:8080/servlet/rece
I want to parse the URL to get the values:
IP: 192.168.0.1
Port: 8080
page: /servlet/rece
How do I do that?
...
C#, .NET 3.5
This just smells of ugly to me, but I can't think of another way.
Given a string with the format of "Joe Smith (jsmith)" (sans quotes), I'd like to parse out just the 'jsmith' string within the parenthesis. I've come up with this:
private static string DecipherUserName( string user )
{
if( !user.Contains( "(" ) )
...
I have an application where I already have a parser for one sort of grammar and I need to add a second different grammar for another purpose.
Is it possible to have more than one?
And if so how do you get another entry point?
Thanks
david allan finch
...
Hi guys,
I have an API call that essentially returns the HTML of a hosted wiki application page. I'm then doing some substr, str_replace and preg_replace kung-fu to format it as per my sites style guides.
I do one set of calls to format my left nav (changing a link to pageX to my wikiParse?page=pageX type of thing). I can safely do thi...
Suppose I wrote a compiler in Python or Ruby that translates a language into a C# AST.
How do I pretty-print this AST from Python or Ruby to get nicely indented C# code?
Thanks, Joel
...
I have a text file that is in a comma separated format, delimited by " on most fields. I am trying to get that into something I can enumerate through (Generic Collection, for example). I don't have control over how the file is output nor the character it uses for the delimiter.
In this case, the fields are separated by a comma and tex...
I have a very large HTML file (several megabytes). I know the data I want is under something like <div class=someName>here</div>
What is a good library to parse through the HTML page so I can loop through elements and grab each someName? I want to do this in either C#, Python or C++.
...