I have a string of the form "ORDER20100322194007", it "20100322194007" Date and time 2010-03-22 19:40:07.000. How to parse a string and get the contained object DateTime?
How to handle the case where the token 'for' is used in two different situations in the language to parse? Such as statement and as a "parameter" as the following example:
echo for print example
for i in {0..10..2}
do
echo "Welcome $i times"
done
Output:
for print example
Welcome 0 times
Welcome 2 times
Welcome 4 times
Welcome 6 times
Welcome 8 times
Welcome 10 times
Thanks.
I'd like my Python script to read some data out of a postgresql dump file. The Python will be running on a system without postgresql, and needs to process the data in a dump file.
It looks fairly straightforward to parse the CREATE TABLE calls to find the column names, then the INSERT INTO rows to build the contents. But I'm sure there would be quite a few gotchas in doing this reliably. Does anyone know of a module which will do this?
My input string is a PM time:
log(start);
// Sunday, January 09, 2011 6:30:00 PM
I'm using Joda Time's pattern syntax as follows to parse the DateTime:
DateTimeFormatter parser1 =
DateTimeFormat.forPattern("EEEE, MMMM dd, yyyy H:mm:ss aa");
DateTime startTime = parser1.parseDateTime(start);
So, why is my output string AM?
log(parser1.print(startTime));
// Sunday, January 09, 2011 6:30:00 AM
I'm looking for some regular expression to help parse my CSV file.
The file has lines of
number,number
number,number
Comment I want to skip
number,number
number,number
Ex:
319,5446
564425,87
Text to skip
27,765564
I read each line into a string and I wanted to use some regular express to make sure the line matches the pattern of (number,number). If not then don't use the line.
Hi! I am looking for method for parsing route path like this:
ActionController::Routing.new("post_path").parse
#=> {:controller => "posts", :action => "index"}
It should be opposite to url_for
Upd
I've found out:
http://stackoverflow.com/questions/2222522/what-is-the-opposite-of-url-for-in-rails-a-function-that-takes-a-path-and-genera
ActionController::Routing::Routes.recognize_path("/posts")
So now I need to convert posts_path into "/posts"
Hi,
say there is an xml file, which not created by me, with a known schema (for example, rss).
how would you parse it with C#? would you do that manually by XDocument etc, or would you use XMLSerializer and create a correspond class? or would you use Visual Studio tools to generate classes using a dtd file (that you'll write).
what do you think the most aesthetic, easy, not error-prone way?
I would like to split a string using multiple chars to split upon. For example, consider spin text format:
This is a {long|ugly|example} string
I would want to parse this string and split it on the "{", "|", and "}" chars
myString.Split('|','{','}')
Now I have tokens to play with, but what I would like is to retain the info about which char was used to split each piece of the array that is returned.
Any existing code that can do something like this?
"8,5,,1,4,7,,,,7,,1,9,3,6,,,8,6,3,9,,2,5,4,,,,,3,2,,,7,4,1,1,,4,,6,9,,5,,,,5,,,1,,6,3,,,6,5,,,,7,4,,1,7,6,,,,8,,5,,,7,1,,3,9,"
I'm doing a programming challenge where i need to parse this sequence into my sudoku script.
Need to get the above sequence into 8,5,0,1,4,7,0,0,0,7,0,1,9,3,6,0,0,8.........
I tried re but without success, help is appreciated, thanks.
Hi I'm trying to run a WordPress plugin and I get the following error:
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /nfs/c03/h05/mnt/52704/domains/creathive.net/html/wp-content/plugins/qr-code-tag/lib/qrct/QrctWp.php on line 13
What would be the problem here? Line 13 is the public bit
EDIT: Here is some code:
class QrctWp
{
public $pluginName = 'QR Code Tag';
what is the best OCR package you've used with java?
I need to parse mainly numbers in a single font and am looking for a well architected, lite weight library to use.
thanks.
Hey guys, I have the following HTML structure that I am trying to pull information from:
// Product 1
<div class="productName">
<span id="product-name-1">Product Name 1</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse 1, ACT</span>
<span class="quantityInStock">25</span>
</div>
// Product 2
<div class="productName">
<span id="product-name-2">Product Name 2</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse 2, ACT</span>
<span class="quantityInStock">25</span>
</div>
…
// Product X
<div class="productName">
<span id="product-name-X">Product Name X</span>
</div>
<div class="productDetail">
<span class="warehouse">Warehouse X, ACT</span>
<span class="quantityInStock">25</span>
</div>
I don't have control of the source html and as you'll see productName and it's accompanying productDetail are not contained within a common element.
Now, I am using the following php code to try and parse the page.
$html = new DOMDocument();
$html->loadHtmlFile('product_test.html');
$xPath = new DOMXPath($html);
$domQuery = '//div[@class="productName"]|//div[@class="productDetail"]';
$entries = $xPath->query($domQuery);
foreach ($entries as $entry) {
echo "Detail: " . $entry->nodeValue) . "<br />\n";
}
Which prints the following:
Detail: Product Name 1
Detail: Warehouse 1, ACT
Detail: 25
Detail: Product Name 2
Detail: Warehouse 2, ACT
Detail: 25
Detail: Product Name X
Detail: Warehouse X, ACT
Detail: 25
Now, this is close to what I want. But I need to do some processing on each Product, Warehouse and Quantity stock and can't figure out how to parse it out into separate product groups. The final output I am after is something like:
Product 1:
Name: Product Name 1
Warehouse: Warehouse 1, ACT
Stock: 25
Product 2:
Name: Product Name 2
Warehouse: Warehouse 2, ACT
Stock: 25
I can't just figure it out, and I can't wrap my head around this DOM stuff as the elements don't quite work the same as a standard array.
If anyone can assist, or point me in the right direction I will be ever appreciative.
Which one would you choose? My important attributes are (not in order)
Support & Future enhancements
Community & general knowledge
base (on the Internet)
Comprehensive (i.e proven to
parse a wide range of *.*ml pages)
Performance
Memory Footprint (runtime, not the code-base)
Hi,
I want to parse google and yandex search results for my little website analyzer utility.
so i should send hundreds requests per minute. What is good practice for this issue?
Is google search api a good way?
Hi everyone,
I'm fighting with socket programming now and I've encountered a problem, which I don't know how to solve in a portable way.
The task is simple : I need to send the array of 16 bytes over the network, receive it in a client application and parse it. I know, there are functions like htonl, htons and so one to use with uint16 and uint32. But what should I do with the chunks of data greater than that?
Thank you.
Hello,
Can anyone tell me how to parse a local xml file stored in the system using SAX ,with an example code.please also tell me where can i find information on that
the model is :
class someModel(db.Model):
name = db.StringProperty()
def name_is_sss(self):
return self.name=='sss'
the view is :
a=someModel()
a.name='sss'
path = os.path.join(os.path.dirname(__file__), os.path.join('templates', 'blog/a.html'))
self.response.out.write(template.render(path, {'a':a}))
and the html is :
{{ a.name_is_sss }}
the page shows :
True
so i want to make it more useful, and like this:
the model:
class someModel(db.Model):
name = db.StringProperty()
def name_is_x(self,x):
return self.name==x
the html is :
{% a.name_is_x 'www'%}
or
{{ a.name_is_x 'www'}}
but the error is :
TemplateSyntaxError: Invalid block tag: 'a.name_is_x'
or
TemplateSyntaxError: Could not parse the remainder: 'www'
so how to make my method running
thanks
Hi, what I want to do is have a PHP script run a program and have it retrieve data somehow from it. For instance the program would parse data from a file and return the data for the PHP script to display.
So far I know to call exec("Program.exe"); but would I have to make it create a file with the data then have the PHP script call fopen and get it that way? Is there a better way to do it? Thanks
How can I do the equivalent of the Ruby snippet below using Java?
require 'net/http'
res = Net::HTTP.get_response(URI.parse("http://somewhere.com/isalive")).body
I want to convert a string like this:
'10/15/2008 10:06:32 PM'
into the equivalent DATETIME value in Sql Server.
In Oracle, I would say this:
TO_DATE('10/15/2008 10:06:32 PM','MM/DD/YYYY HH:MI:SS AM')
This question implies that I must parse the string into one of the standard formats, and then convert using one of those codes. That seems ludicrous for such a mundane operation. Is there an easier way?
I need to determind when a file has been uploaded via an ftp account so i can parse the data and insert into a db.
I could do this 2 different ways, either set up a schedule or watch the directory for any change. Either option would be fine.
I'm new to the apache /php space so any keywords that i can search upon would be handy.
Thanks.
I'd like to programatically determine the "publish location" (the location on the server which contains the installation) of the click-once application I'm running. I know that the appref-ms file contains this information and I could parse this file to find it but the application has no idea as to the location of the appref-ms file and I can't seem to find a way of determining this location.
Does anyone have any ideas how I can easily determine the publish location from within my application?
i am using XML as my backend for the application...
LXML is used to parse the xml.
How can i encrypt this xml file to make sure that the data is protected......
thanks in advance.
Hi All,
In my project i using LibXml to parse data, when i select a row in first controller i will take to next conttroller where i will get data using libxml if i click on the back button while loading the page i am getting exception. if i click afetr loading is completed it is working fine ca any one help me.
the exception is showing here
(void)connection:(NSURLConnection *)connection
didReceiveData:(NSData *)data {
// Process the downloaded chunk of data.
xmlParseChunk(_xmlParserContext, (const char *)[data bytes], [data length], 0);
}
Thank You
greeting all
i want to use a mail server
where the users send emails to it
and then i parse this emails then do some action
please suggest me what mail server to be used
and where to start
some links,tutorials,guide is very appreciated .