Hi, I need to search a particular string in a CSV file ("STPSTR01.134") the line that contains this string. I need to divide the 13th column by the 14th column. Any help would be very much appreciated. I'm using ActivePerl for windows /csv file allAssociationUtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.134;900;FALSE;SCANNER;10;3471;6288;11093;10419;588480;631296;0;254004;316732;0 allAssociationUtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.58;900;FALSE;SCANNER;10;20652;23514;39497;29404;4690132;3929776;0;3471992;2947904;0 allAssociationUtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.60;900;FALSE;SCANNER;10;20593;19351;36274;26039;4350820;3462084;0;3234956;2593056;0 allAssociationUtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.62;900;FALSE;SCANNER;10;24237;21229;40003;28678;5122408;3703840;0;3875508;2746088;0 allAssociationUtilizationData;V16SG;2012/07/27;10:45:00;STPSTR01.26;900;FALSE;SCANNER;10;18538;20644;35833;26421;4075280;3588768;0;2979124;2707892;0

Member Avatar
Member Avatar
+0 forum 2

Hi, I've got a set of folders with each contain many files. I need to extract a specific file extention(.sof) from each of these folders to a new directory(or the same directory in a new folder). Any help is appreciated. Thanks.

Member Avatar
Member Avatar
+0 forum 4

Hi, I have a HTML page in one variable. I need build a mehod that will extract a tag content (dif extract_tag(self, tag_name)). For example, given webpage: <div id="mw-page-base" class="noprint"></div> <div id="mw-head-base" class="noprint"></div> <!-- content --> <div id="content" class="mw-body"> <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice loads here --></div> <!-- /sitenotice --> <!-- firstHeading --> <h1 id="firstHeading" class="firstHeading"><span dir="auto">Earth</span></h1> </div> and tag named: "content" the method should return <a id="top"></a> <div id="mw-js-message" style="display:none;"></div> <!-- sitenotice --> <div id="siteNotice"><!-- centralNotice loads here --></div> <!-- /sitenotice --> <!-- firstHeading --> <h1 id="firstHeading" class="firstHeading"><span dir="auto">Earth</span></h1> I want to do …

Member Avatar
Member Avatar
+0 forum 1

Dear forummembers, Well I am a total noob in visual basic programming, but I want to make a program that opens an ascii file that i choose and reads the file line per line. The ascii file excist as follow 0.0000 Start of measurement time id rx dlc b0 b1 b2 b3 b4 b5 b6 b7 0.3480 C010327x Rx d 8 CF FF FF FF FF FF FF FF 0.3480 18FEF027x Rx d 8 FF FF FF FF FF F0 CC FF 0.3490 18EF4E27x Rx d 8 00 00 00 FF FF FF FF FF 0.3500 18FEF117x Rx d 8 …

Member Avatar
+0 forum 0

I am using a json function to parse a link and return a json object. the code is below : public JSONObject getJSONFromUrl(String url) { // Making HTTP request try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); Log.v("url", " " + url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); is = httpEntity.getContent(); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } try { BufferedReader reader = new BufferedReader(new InputStreamReader( is, "iso-8859-1"), 8); StringBuilder sb = new StringBuilder(); String line = null; while ((line …

Member Avatar
+0 forum 0

Hi all, I've browsed the net trying to find a paradigm to describe what I'm looking for but haven't been successful. So I'll try to explain it as succinctly as I can. Right now, for my PhD research, I've set out a few applications that take input files that have paramater/value pairs. When I want to execute a specific case, I generate a new text file with the input parameters I want to pass to the application and execute the application using these parameters. Within the application, I read in the input file, strip and trim all unncessary stuff, like …

Member Avatar
Member Avatar
+0 forum 3

I am developing a program that gets the html source code of a certain webpages in a website. I already developed one program that does so, here's the sample code Dim request As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create(TextBox2.Text) Dim response As System.Net.HttpWebResponse = request.GetResponse() Dim sr As System.IO.StreamReader = New System.IO.StreamReader(response.GetResponseStream()) Dim sourcecode As String = sr.ReadToEnd() TextBox1.Text = sourcecode Recently, I found out that I could do the same using Sockets. This time I want to parse HTML of those web pages SIMULTANEOUSLY. I tried parsing simultaneously on my previous program using multithreading but my bandwidth keeps decreasing as threads increase …

Member Avatar
+0 forum 0

/*This code counts the vowels in strings? It has to use user defined methods: */ import java.lang.String; import java.io.*; import java.util.*; public class vowelConsonant2 { static Scanner scan = new Scanner(System.in); public static void main(String args[]) { String text; int actualI, actualC; System.out.println("Enter the String:"); text = scan.nextLine(); System.out.println("There are " + vowelcounter(actualI,actualC) + " vowels"); } public static int vowelcounter(int countv , int i , char c ) { countv = 0; for (int i = 0; i < text.length(); i++) { text = text.toLowerCase(); char c = text.charAt(i); if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') …

Member Avatar
Member Avatar
+0 forum 6

Here is an amazing article. Peter Norvig does not let small detail, that the language was never implemented in it's time, disturb his debugging the code written without implementation, but single handedly implements it with Python parser. Frustration warning, this is frustratingly amazing stuff: [Prescient but Not Perfect: A Look Back at a 1966 Scientific American Article on Systems Analysis By Peter Norvig | August 23, 2011](http://blogs.scientificamerican.com/at-scientific-american/2011/08/23/systems-analysis-look-back-1966-scientific-american-article/)

Member Avatar
+0 forum 0

I wrote an XML parser that works great to fit my needs, but I can't retrieve the root attribute nodes no matter what I try! So far I have the following code that works great to retrieve the child tag values: import xml.dom.minidom def parse(filename): xmlDoc = xml.dom.minidom.parse(filename) tag = xmlDoc.getElementsByTagName('date_time')[0].childNodes[0].nodeValue return tag Here is the XML data I'm parsing: <?xml version="1.0"?> <order type="buy" subtype="limit" orderID="7659"> <date_time>03:23:2012:11:50.35</date_time> <userID>Miss.Wanda.Sleeplate</userID> <stock_symbol>BROK</stock_symbol> <shares_ammount>50</shares_ammount> <limit>23.87</limit> </order> What I'm trying to get is the value of the attributes of the root **order** tag (**type, subtype, orderID**) Something like: node = tag.attributes['type'].value print node **>>> buy** …

Member Avatar
+0 forum 0

Hi, I want to process a text file. Here are the contents of the text file labels 1 -1 -1 0.2988 0.7012 -1 0.188161 0.811839 -1 0.0824541 0.917546 1 0.579515 0.420485 -1 0.0965063 0.903494 -1 0.174624 0.825376 -1 0.0404312 0.959569 -1 0.0770909 0.922909 -1 0.12001 0.87999 1 0.778388 0.221612 In the above data, there are 11 lines (rows) and 3 values (columns) are on each line and every value is separated by a space. The second are third column are actually the probability scores. Now I want to perform 2 actions. 1. I want to access the second column of …

Member Avatar
Member Avatar
+0 forum 3

Hello, I am currently helping my BI team convert a Cognos Tree Object into a Javascript tree object. The part where I am stuck is using javascript to parse the XML data file that would normally fill up the Cognos tree. Here is an example of the XML data file... Also, the actual XML data file has over 40,000 lines [CODE=xml] <?xml version="1.0" encoding="utf-8" ?> - <dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"> - <!-- <dataset xmlns="http://developer.cognos.com/schemas/xmldata/1/" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:schemaLocation="http://developer.cognos.com/schemas/xmldata/1/ xmldata.xsd" > --> - <metadata> <item name="ROOT_NODE_ID" type="xs:decimal" precision="38" /> <item name="LEVEL1_ID" type="xs:string" length="2002" /> <item name="LEVEL1_NAME" type="xs:string" length="512" /> <item name="LEVEL2_ID" type="xs:string" length="2002" /> …

Member Avatar
Member Avatar
+0 forum 6

My requirement is to parse through a HTML document ( which will be an article) and come up with a few keywords which describe what the document is about. For example, if a professor writes an essay about say, information security; i want to parse this HTML document and come up with keywords say, information security, secure data storage etc. Are there any tools available for such parsing? Are there any algorithms employed to parse and come up with keywords?? VJ.

Member Avatar
Member Avatar
+0 forum 5

I have written this short code [CODE] import os import os.path import string import shutil import difflib Path = 'C:/RESULT/BATCH/SimpleInputParser/' SecPoint = [] FullList = [] newFile = [] for fileName in os.listdir(Path): if fileName.endswith(".inp"): f=open(Path + fileName, 'r') files = f.readlines() f.close() fp_clean = open(Path + "tempClean.inp", "w") fp_newFile = open(Path + "newFile.inp", "w") for i, line in enumerate(files): if line.startswith(("*SECTION POINTS")): SecPoint.append(files[i].strip()) SecPoint.append(files[i+1].strip()) newFile.append(line.strip()) fp_clean.write('\n'.join(SecPoint).strip()+'\n') fp_clean.close() fp_newFile.write('\n'.join(newFile).strip()) fp_newFile.close() f1 = open(Path + "newFile.inp", "r") fileOne = f1.readlines() f1.close() f2 = open(Path + "tempClean.inp", "r") fileTwo = f2.readlines() f2.close() outFile = open(Path + fileName.split(".")[0] + "_v01.inp", "w") diffInstance = …

Member Avatar
Member Avatar
+0 forum 3

Hi guys, I have a project that reads a json data and parse it. The program is working properly except that I cannot get its individual rows and view it in separate panels. Here is my code: [CODE] Imports System.Net.Json Public Class Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim parser As New JsonTextParser Dim o As JsonObject = parser.Parse(TextBox1.Text) 'This will segregate the data from o For Each f As JsonObjectCollection In o.GetValue With lv .Items.Add(f.Item("id").GetValue.ToString) With .Items(.Items.Count - 1).SubItems .Add(f.Item("fname").GetValue.ToString) .Add(f.Item("lname").GetValue.ToString) .Add(f.Item("address").GetValue.ToString) End With End With Next End Sub End Class [/CODE] …

Member Avatar
Member Avatar
+0 forum 3

hi, i would like to parse an input file (input.txt) into output file (output.txt) which i'll into excel. appreciate any advice on how to parse the input.txt into output.txt. thanks johnny

Member Avatar
Member Avatar
+0 forum 8

I have this example php string: [CODE]$string = "@[item_1][door] @[mozart][grass] = yes @[mozart][green] = no @[mozart][human] @[blue][movie]=yes @[item_1][beat] = yes @[item_1][music] = no ";[/CODE] now $string idented just to easy view: [CODE]@[item_1][door] @[mozart][grass] = yes @[mozart][green] = no @[mozart][human] @[blue][movie]=yes @[item_1][beat] = yes @[item_1][music] = no[/CODE] I want to know how can i get this string ( or other string following this style ) and transform in an array that looks like: [CODE]Array ( [item_1] => Array ( [door] => Array ( [mozart] => Array ( [grass] => yes [green] => no [human] => Array ( [blue] => Array ( …

Member Avatar
Member Avatar
+0 forum 5

this is my xml file [ICODE]<myxml> <a> I can load XML like the wind! </a> <b> I can load XML like the storm! </b> </myxml>[/ICODE] i want to trace "I can load XML like the wind!" in flash movie.for this i am using this syntax that is not working .somebody please tell me the right syntax [CODE]trace(this.firstChild.childNodes[0].firstChild.nodeValue); [/CODE]

Member Avatar
Member Avatar
-1 forum 1

Hey, I have an website with dynamic text on it, i want to transfer the text to an textbox, and the text is between this tags: <pre> </pre> How do i do this?

Member Avatar
Member Avatar
+0 forum 11

Hi, i've used the Beautifulsoup module to parse the site and grab the img tag from it, but the problem is , Beautifulsoup while parsing not returning the whole content of the given url. The truncated content contain the image location I want to download: [CODE] from urllib2 import urlopen from BeautifulSoup import BeautifulSoup #reading the webpage source webpage = urlopen('http://www.santabanta.com/photos/aalesha/10066001.htm').read() #putting all the webpage content into variable named soup using beautifulsoup soup = BeautifulSoup(''.join(webpage)) print soup #finding all the img tags imagelocation = soup.findAll('img') #printing the img content for i in imagelocation: print i[/CODE] I want to extract the …

Member Avatar
Member Avatar
+0 forum 4

Hi Guys, Another puzzle for someone to try and crack... I have two divs inside the <body> that basically act as two versions of the same page. I need PHP to call one based on a variable retrieved from a database. As it stands, this is what I have... [CODE] <?php session_start(); require("config.php"); if(!isset($_SESSION['username'])) { header('location:denied.php?msg=LOGIN REQUIRED'); } else { } $curruser = $_SESSION['username']; $con = mysql_connect("***","***","***"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("***", $con); $result = mysql_query("SELECT * FROM users WHERE username='" . $_SESSION['username']) . "'"; while($row = mysql_fetch_array($result)) { $version = $row['version']; $username = …

Member Avatar
Member Avatar
+0 forum 4

Is there any framework or sample java code to evaluate an arithmatic / logical / bitwise expression , which will provide the value for input parameters , to make the condition pass. For example , In the below sample arithmatic condition , if the values a=7 and b=6 are passed , the condition will get passed and we'll get "Condition is passed!!!" printed in console. [ICODE]if( (a>b) && (a<10) && (b>5)) { System.out.println("Condition is passed!!!"); }[/ICODE] Is there any framework which will give me the value of a and b , taking the expression as input.

Member Avatar
Member Avatar
+0 forum 2

I am a complete beginner to PERL. I am using Strawberry PERL. I am coming across text files that I need to format. I basically need to take field data that starts with a certain character and output the field data to a new file which will have all the fields delimited by character of my choosing. Here is a short example. ; Record 1 @FULLTEXT PAGE @T R000358 @C ENDDOC# R000358 @C BEGATTACH R000358 @C ENDATTACH R000358 @C MAILSTORE No @C AUTHOR @C BCC @C CC @C COMMENTS @C ATTACH @C DATECREATED 11/23/2010 @C DATELASTMOD 07/18/2010 @C DATELASTPRNT @C …

Member Avatar
Member Avatar
+0 forum 4

I want to parse command line arguments. Say someone gives me ./progname param2 [-price=50] [-size=10] [-weight=16] [-height=7] Square bracketed items are optional. Either none or exactly two of -price, -size, -weight, and -height can be specified. If none of them are specified, it should be taking default values for price & weight. I have already found how to decode for argv[0], argv[1]. But for argv[2] beyond till these optional items end, i am not able to parse. I require code that can help me or some sort of syntax if complete code not possible. Thanks.

Member Avatar
Member Avatar
+0 forum 2

Hey everyone, I am having difficulty parsing digits in java. By that I mean that I am trying to make a program print out the number of bills the user recieves when he/she recieves change after there payment, (Cash register). Here is the code i've created to do this for me, it runs perfectly but it always ends up giving out the wrong amount of change. double change = payment - totalcost ; double hundredbills = change/100; change = change%100; double fiftybills = change/50; change = change%50; double twentybills = change/20; change = change%20; double tenbills = change/10; change = …

Member Avatar
Member Avatar
+0 forum 1

Hey all, I have a problem to read a XML file using XmlReader. I have this code: [CODE] Dim xCount As Integer = 0 Using xReader As XmlReader = XmlReader.Create("tekno.xml") TreeView1.Nodes.Clear() Do While xReader.Read() With TreeView1 .Nodes.Add(xReader.Item("title")) .Nodes(xCount).Nodes.Add("(link: " & xReader.Item("link") & ")") .Nodes(xCount).Nodes.Add("Date: " & xReader.Item("pubDate")) .Nodes(xCount).Nodes.Add(xReader.Item("description")) xCount = xCount + 1 End With Loop TreeView1.ExpandAll() End Using [/CODE] And the file .XML named ‘tekno.xml’: [CODE] <?xml version="1.0" encoding="iso-8859-1"?> <rss version="2.0"> <channel> <item> <title>Tablet Windows Tak Akan Dukung Flash</title> <link>http://tekno.kompas.com/read/2011/09/20/11432939/Tablet.Windows.Tak.Akan.Dukung.Flash</link> <pubDate>Tue , 20 Sep 2011 11:43:29 +0000</pubDate><description>&lt;img src=&quot;http://stat.k.kidsklik.com/data/photo/2011/09/16/1430299t.jpg&quot; align=&quot;left&quot; hspace=&quot;7&quot; width=&quot;120&quot; height=&quot;90&quot;&gt;Pengguna perangkat tablet yang menggunakan Windows 8 bakal …

Member Avatar
+0 forum 0

Hi, I am new in a python2.7. Please help how efficiently we parse and store the fields in dictionary for later retrieval. my log file example #Version: 1.0 #Fields: date time c-ip s-dns x-proto s-parser cs-resource s-resource sc-response-code sc-response s-candidate-ips x-preferred-location x-location cs-user-agent s-ip c-port #Software: vx-logfeed 1.3 #Start-Date: 2011-04-20 14:05:00 2011-04-20 14:07:30.3 192.0.2.1 us1.isp1loc1s1.abc dns vxdns wp-1234000000000000.id.abc.example.com wp-1234000000000000 NOERROR 198.51.100.201,198.51.100.211 198.51.100.101,198.51.100.102 n.isp1.serv.us.ny n.isp1.serv.us.ma - 198.51.100.101 2323 #End-Date: 2011-04-20 14:10:00 #X-Records: 1 thanks

Member Avatar
Member Avatar
+0 forum 2

Hi, I'm new to python and I am having issues attempting to input data into my code from a text file. The text looks like this: >INFO> CELLID, #729, >INFO> 20100520-035248 LightningTable (scale_1) >INFO> LON,LAT -96.485,34.67,0 datatime, maxref, ref_-10, MaxVIL, TotalVIL, Size(km2), CGDenAVG, CGmaxden, CGCount, FlashCount, FlashDenAVG, MESH 20:03:30:05, 63.5, 59.5, 44.0613, 18091.8, 311.062, 0, 0, 0, 40.5807, 0.0332085, 27.41, 20:03:32:06, 63.5, 60.5, 48.3901, 17427.8, 270.588, 0, 0, 0, 76.9209, 0.0723621, 38.0266, There are several "cells", and I need to pull out the FlashCount column from each cell. Thanks.

Member Avatar
Member Avatar
+0 forum 5

Hi, I'm trying to parse a csv fiel using a code i've found on line: [CODE] private DataTable ParseCSV(string path) { if (!File.Exists(path)) return null; string full = Path.GetFullPath(path); string file = Path.GetFileName(full); string dir = Path.GetDirectoryName(full); //create the "database" connection string string connString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=\"" + dir + "\\\";" + "Extended Properties=\"text;HDR=No;FMT=Delimited(=)\""; //create the database query string query = "SELECT * FROM " + file; //create a DataTable to hold the query results DataTable dTable = new DataTable(); //create an OleDbDataAdapter to execute the query OleDbDataAdapter dAdapter = new OleDbDataAdapter(query, connString); try { //fill the DataTable …

Member Avatar
Member Avatar
+0 forum 7

hi all, i have been working for two months on a project and i have come up with an algorithm that is a mix of R. Mitkov's algorithm on anaphora resolution (robust, knowledge-poor algorithm) and several filters that are applied first to the xml file (a POS tagged text) to eliminate the non-expletive (impersonal/ non anaphoris) "it" e.g. it rains (i am working on a french text) my algorithm is structured as follows: input: XML text with POS tagging step 1: search for pronouns that are tagged as "CL" or "PRO" and tag them as being "expletive" or "non expletive" …

Member Avatar
Member Avatar
+0 forum 14

The End.