Search Results

Search found 101 results on 5 pages for 'dbf'.

Page 3/5 | < Previous Page | 1 2 3 4 5  | Next Page >

  • Advantage database throws an exception when attempting to delete a record with a like statement used

    - by ChrisR
    The code below shows that a record is deleted when the sql statement is: select * from test where qty between 50 and 59 but the sql statement: select * from test where partno like 'PART/005%' throws the exception: Advantage.Data.Provider.AdsException: Error 5072: Action requires read-write access to the table How can you reliably delete a record with a where clause applied? Note: I'm using Advantage Database v9.10.1.9, VS2008, .Net Framework 3.5 and WinXP 32 bit using System.IO; using Advantage.Data.Provider; using AdvantageClientEngine; using NUnit.Framework; namespace NetworkEidetics.Core.Tests.Dbf { [TestFixture] public class AdvantageDatabaseTests { private const string DefaultConnectionString = @"data source={0};ServerType=local;TableType=ADS_CDX;LockMode=COMPATIBLE;TrimTrailingSpaces=TRUE;ShowDeleted=FALSE"; private const string TestFilesDirectory = "./TestFiles"; [SetUp] public void Setup() { const string createSql = @"CREATE TABLE [{0}] (ITEM_NO char(4), PARTNO char(20), QTY numeric(6,0), QUOTE numeric(12,4)) "; const string insertSql = @"INSERT INTO [{0}] (ITEM_NO, PARTNO, QTY, QUOTE) VALUES('{1}', '{2}', {3}, {4})"; const string filename = "test.dbf"; var connectionString = string.Format(DefaultConnectionString, TestFilesDirectory); using (var connection = new AdsConnection(connectionString)) { connection.Open(); using (var transaction = connection.BeginTransaction()) { using (var command = connection.CreateCommand()) { command.CommandText = string.Format(createSql, filename); command.Transaction = transaction; command.ExecuteNonQuery(); } transaction.Commit(); } using (var transaction = connection.BeginTransaction()) { for (var i = 0; i < 1000; ++i) { using (var command = connection.CreateCommand()) { var itemNo = string.Format("{0}", i); var partNumber = string.Format("PART/{0:d4}", i); var quantity = i; var quote = i * 10; command.CommandText = string.Format(insertSql, filename, itemNo, partNumber, quantity, quote); command.Transaction = transaction; command.ExecuteNonQuery(); } } transaction.Commit(); } connection.Close(); } } [TearDown] public void TearDown() { File.Delete("./TestFiles/test.dbf"); } [Test] public void CanDeleteRecord() { const string sqlStatement = @"select * from test"; Assert.AreEqual(1000, GetRecordCount(sqlStatement)); DeleteRecord(sqlStatement, 3); Assert.AreEqual(999, GetRecordCount(sqlStatement)); } [Test] public void CanDeleteRecordBetween() { const string sqlStatement = @"select * from test where qty between 50 and 59"; Assert.AreEqual(10, GetRecordCount(sqlStatement)); DeleteRecord(sqlStatement, 3); Assert.AreEqual(9, GetRecordCount(sqlStatement)); } [Test] public void CanDeleteRecordWithLike() { const string sqlStatement = @"select * from test where partno like 'PART/005%'"; Assert.AreEqual(10, GetRecordCount(sqlStatement)); DeleteRecord(sqlStatement, 3); Assert.AreEqual(9, GetRecordCount(sqlStatement)); } public int GetRecordCount(string sqlStatement) { var connectionString = string.Format(DefaultConnectionString, TestFilesDirectory); using (var connection = new AdsConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = sqlStatement; var reader = command.ExecuteExtendedReader(); return reader.GetRecordCount(AdsExtendedReader.FilterOption.RespectFilters); } } } public void DeleteRecord(string sqlStatement, int rowIndex) { var connectionString = string.Format(DefaultConnectionString, TestFilesDirectory); using (var connection = new AdsConnection(connectionString)) { connection.Open(); using (var command = connection.CreateCommand()) { command.CommandText = sqlStatement; var reader = command.ExecuteExtendedReader(); reader.GotoBOF(); reader.Read(); if (rowIndex != 0) { ACE.AdsSkip(reader.AdsActiveHandle, rowIndex); } reader.DeleteRecord(); } connection.Close(); } } } }

    Read the article

  • FileNotFoundException when reading .xml file to parse

    - by thechiman
    I'm writing a program in Java where I read in data from an XML file and parse it. The file is imported into a folder named "Resources" in the src directory of my project. I'm using Eclipse. When I run the program, I get the following error: java.io.FileNotFoundException: /Users/thechiman/Dropbox/introcs/PSU SOC Crawler/resources/majors_xml_db.xml (No such file or directory) at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.<init>(FileInputStream.java:106) at java.io.FileInputStream.<init>(FileInputStream.java:66) ... The relevant code is here: private void parseXML() { //Get a factory DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { //Use factory to get a new DocumentBuilder DocumentBuilder db = dbf.newDocumentBuilder(); //Parse the XML file, get DOM representation dom = db.parse("resources/majors_xml_db.xml"); } catch(ParserConfigurationException pce) { pce.printStackTrace(); } catch(SAXException se) { se.printStackTrace(); } catch(IOException ioe) { ioe.printStackTrace(); } } I do not understand why I'm getting the FileNotFoundException when the file is there. Thanks for the help.

    Read the article

  • XML child node attribute value

    - by c0mrade
    I'm trying to read xml file, ex : <entry> <title>FEED TITLE</title> <id>5467sdad98787ad3149878sasda</id> <tempi type="application/xml"> <conento xmlns="http://mydomainname.com/xsd/radiofeed.xsd" madeIn="USA" /> </tempi> </entry> Here is the code I have so far : public void parseXML(String xml) { try { InputStream inputStream = new ByteArrayInputStream(xml.getBytes()); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(inputStream); doc.getDocumentElement().normalize(); System.out.println("Root element " + doc.getDocumentElement().getNodeName()); NodeList nodeLst = doc.getElementsByTagName("entry"); System.out.println("Information of all entries"); for (int s = 0; s < nodeLst.getLength(); s++) { Node fstNode = nodeLst.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { Element fstElmnt = (Element) fstNode; NodeList title = fstElmnt.getElementsByTagName("title").item(0).getChildNodes(); System.out.println("Title : " + ((Node) title.item(0)).getNodeValue()); NodeList id = fstElmnt.getElementsByTagName("id").item(0).getChildNodes(); System.out.println("Id: " + ((Node) update.item(0)).getNodeValue()); NodeList contento= fstElmnt.getElementsByTagName("tempi").item(0).getChildNodes(); System.out.println("Contento : " + ((Node) content.item(0)).getFirstChild().getAttributes()); // with this line above I'm having problems, I get null pointer exception } } } catch (Exception e) { e.printStackTrace(); } } How can I read/get, contento tag attributes? I'm using org.w3c.dom lib.

    Read the article

  • ListView Parsing Persian xml

    - by Namikaze Minato
    I used a tutorial about listview parsing xm from internet and using LasyAdapter shows the items in listview. When I add persian characters in xml (into one of childnodes) the result is some boxes in listview (after showing the text in listview). The format of xml is UTF-8, too. I used typeface too (but didn't work). Besides when I type Pwesian into the application it shows alright but it can't show Persiann content parsed from xml. Thanks in advance. I updated the post with original XMLparser (which was the problem). public String getXmlFromUrl(String url) { String xml = null; try { // defaultHttpClient DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } // return XML return xml; } public Document getDomElement(String xml) { Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } catch (ParserConfigurationException e) { Log.e("Error: ", e.getMessage()); return null; } catch (SAXException e) { Log.e("Error: ", e.getMessage()); return null; } catch (IOException e) { Log.e("Error: ", e.getMessage()); return null; } return doc; }

    Read the article

  • java: how to parse html-like xml

    - by Yang
    I have an html-like xml, basically it is html. I need to get the elements in each . Each element looks like this: <line tid="744476117"> <attr>1414</attr> <attr>31</attr><attr class="thread_title">title1</attr><attr>author1</attr><attr>date1</attr></line> My code is as below, it does recognize that there are 50 in the file, but it gives me NULLPointException when parsing NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("attr"); Any idea why this is happening? The same code has been used for other applications without problems. DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(cleanxml)); Document doc = db.parse(is); doc.getDocumentElement().normalize(); System.out.println("Root element " + doc.getDocumentElement().getNodeName()); NodeList nodeLst = doc.getElementsByTagName("line"); for (int s = 0; s < nodeLst.getLength(); s++) { System.out.println(nodeLst.getLength()); Node fstNode = nodeLst.item(s); if (fstNode.getNodeType() == Node.ELEMENT_NODE) { Element fstElmnt = (Element) fstNode; NodeList fstNmElmntLst = fstElmnt.getElementsByTagName("attr"); Element fstNmElmnt = (Element) fstNmElmntLst.item(0); NodeList fstNm = fstNmElmnt.getChildNodes(); System.out.println("attr : " + ((Node) fstNm.item(0)).getNodeValue()); } }

    Read the article

  • UnknownHostException again!

    - by Nitesh Panchal
    Hello, I posted one question previously and all of them answered that there is some problem with DNS but i changed my DNS to many addressed and now i have the most reliable, google DNS :- 8.8.8.8 Still i get the same UnknownHostException. What can be the problem? This is my code :- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse("http://rss.news.yahoo.com/rss/india"); Infact if i pass address as something very common like :- http://google.com i still get the same error. Please help me :(. I have my submissions tomorrow. Thanks in advance :) EDIT : If i type the same address in my mozilla, it works great. So, i am sure that there is no DNS problem. 2nd EDIT :- I found this link http://www.ehow.com/how_4747553_fix-unknownhostexception-java-applications-ubuntu.html But when i run the command sudo apt-get install lib32nss-mdns i get package not found. Somebody even mentioned :- -Djava.net.preferIPv4Stack=true But where do i write this statement of Djava? I am using Netbeans 6.8 to run my web application

    Read the article

  • How to change hardcoded database paths in a Lotus Approach Database

    - by asoltys
    One of our Lotus Approach files (file extension .apr) has hardcoded paths to additional underlying database files (file extension .dbf). We've moved the Approach database and all the underlying files to a new network drive, so these paths need to be updated. You can see the old paths by opening the File menu and selecting "Approach File Properties", under the "Databases" heading. How can you change these paths?

    Read the article

  • Parser, send an argument/receive xml (receive already done/ send not)

    - by bruno
    public List<Afood> getFoodFromCat(String cat) { String resultado = ""; List<Afood> list = new ArrayList<Afood>(); try { URL xpto = new URL("http://10.0.2.2/webservice/nutrituga/get_food_by_cat.php"); HttpURLConnection conn; conn = (HttpURLConnection) xpto.openConnection(); conn.setDoInput(true); conn.connect(); InputStream is = conn.getInputStream(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(is); NodeList nl = doc.getElementsByTagName("item"); // resultado = String.valueOf(nl.getLength()); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i); Node childNode = n.getFirstChild(); while (childNode != null) { if (childNode.getNodeType() == Node.ELEMENT_NODE) { if (childNode.getNodeName().equalsIgnoreCase( "NAME_FOOD")) { Node valor = childNode.getFirstChild(); // resultado = resultado + valor.getNodeValue(); list.add(new Afood(valor.getNodeValue(), "", (int) Math.round(Math.random()), 1, 1, 1, 1, 1, 1)); } } childNode = childNode.getNextSibling(); } } return list; } catch (ParserConfigurationException e1) { e1.printStackTrace(); } catch (SAXException e1) { e1.printStackTrace(); } catch (IOException e1) { e1.printStackTrace(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } I have this function that receives a xml and copy it to the list. This is well implemented. What i want do to know, is to send a category (that i receive like an argument of the function) and receive only the food from that category. The server is ready to receive the category and to send the food from that category. What do i have to do to send the category and receive the correct xml?

    Read the article

  • MalformedByteSequenceException while trying to pars XML

    - by poeschlorn
    Hey guy, maybe someone can help: I have the following .gpx data from wikipedia: <?xml version="1.0" encoding="UTF-8" standalone="no" ?> <gpx xmlns="http://www.topografix.com/GPX/1/1" creator="byHand" version="1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"> <wpt lat="39.921055008" lon="3.054223107"> <ele>12.863281</ele> <time>2005-05-16T11:49:06Z</time> <name>Cala Sant Vicenç - Mallorca</name> <sym>City</sym> </wpt> </gpx> When I call my parsing method, I get a exception (see below) The call looks like this: Document tmpDoc = getParsedXML(currentGPX); My method to parse looks like this (standart parsing code, nothing exctiting....): public static Document getParsedXML(String fileWithPath){ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; Document doc = null; try { db = dbf.newDocumentBuilder(); doc = db.parse(new File(fileWithPath)); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return doc; } This simple code throws following exception: com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException: Invalid byte 2 of 3-byte UTF-8 sequence. at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.invalidByte(Unknown Source) at com.sun.org.apache.xerces.internal.impl.io.UTF8Reader.read(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.load(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLEntityScanner.skipChar(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source) at javax.xml.parsers.DocumentBuilder.parse(Unknown Source) at Zeugs.getParsedXML(Zeugs.java:38) at Zeugs.main(Zeugs.java:25) I guess the error lies within the format of the first file, but I don't know where exactly. Can you please give me a hint?

    Read the article

  • Java, dBase microsoft driver and deleted flag

    - by blow
    Hi, im connecting to dBase from java with this string: String url="jdbc:odbc:DRIVER={Microsoft dBase Driver (*.dbf)};DBQ="+databasePath+";DefaultDir="+databasePath+";DriverId=533;FIL=dBase IV;MaxBufferSize=2048;PageTimeout=5;"; Work fine, but with a SELECT statement i can retrieve only record that are not "deleted". In dBase database deletet record are only flagged deleted, so i want retrive deleted record too. Is this possibile? Thank.

    Read the article

  • auto submit form from command line

    - by combatwombat
    I have a form page in PHP that reads a DBF, and conditionally converts it into a MySQL - extracting the data from an old, but still production accounting app. The conversion should be able to be actioned without user intervention, ie scripted from the web-host's command line on a cron job. How can I get PHP to submit the form automatically when receiving variables at command line, like for instance a specific post variable? Every auto-submit I've found so far relied upon javascript, which would be useless at PHP command line.

    Read the article

  • How to display the data of DOM parsed attributes in the listView display ?

    - by Praween k
    Hi, I am building a test output for DOM parser with node "Rider" and within that 7 attributes are there.URL://http://ps700.pranasystems.com/tours/8/xml/results/stage1results.xml. I want to display only the "name" and the "team" attributes output in the listview mode of the device.I am not getting clear where to store the output to display. Please help me someone for how to store and display that data to the output of the device in List view. Thanks in advance //-------------------------------// Here is my code------------// public String getSearch(String strURL) { URL url; URLConnection urlConn = null; NamedNodeMap nnm = null; int len; try { url = new URL(strURL); urlConn = url.openConnection(); } catch (IOException ioe) { Log.e("Could not Connect: "+ioe.getMessage(), "."); } DocumentBuilder builder = null ; Document doc = null ; try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); doc = db.parse(urlConn.getInputStream()); Node thisNode, currentNode, node,theAttribute ; NodeList nchild, nodeList; String name; ArrayList<Node> result = new ArrayList<Node>(); nodeList = doc.getElementsByTagName("rider"); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { currentNode = nodeList.item(i); NamedNodeMap attributes = currentNode.getAttributes(); Log.i("TAG", attributes.toString()); for (int a = 0; a < attributes.getLength(); a++) { theAttribute = attributes.item(a); } // s1.setAdapter(new ArrayAdapter<Node>(this, // android.R.layout.simple_list_item_1,result)); }catch(ParserConfigurationException pce ){ Log.e("Could not Parse XML:" +pce.getMessage() ,"."); } catch (SAXException se) {Log.e("Could not Parse XML: "+se.getMessage(), ".");} catch (IOException ioe) {Log.e("Invalid XML: "+ioe.getMessage(), ".");} return strURL; }

    Read the article

  • Parsing XML wont display all items.

    - by Nauman A
    I have this code but the toast wont display any message what is wrong with my code.. I can get the value from link, linknext but title wont bring out any value. ( I am not very bright with writing code so please suggest anything you may feel like. final Button button = (Button) findViewById(R.id.Button01); button.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // Perform action on click try { URL url = new URL( "http://somelink.com=" + Link.setFirst_link); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(new InputSource(url.openStream())); doc.getDocumentElement().normalize(); NodeList nodeList = doc.getElementsByTagName("item"); /** Assign textview array lenght by arraylist size */ for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); Element fstElmnt = (Element) node; NodeList nameList = fstElmnt.getElementsByTagName("link"); Element nameElement = (Element) nameList.item(0); nameList = nameElement.getChildNodes(); String img = (((Node) nameList.item(0)).getNodeValue()); NodeList websiteList = fstElmnt.getElementsByTagName("linknext"); Element websiteElement = (Element) websiteList.item(0); websiteList = websiteElement.getChildNodes(); String nextlink = (((Node) websiteList.item(0)).getNodeValue()); Link.setFirst_link = nextlink; Drawable drawable = LoadImageFromWebOperations(img); imgView.setImageDrawable(drawable); NodeList titleList = fstElmnt.getElementsByTagName("title"); Element titleElement = (Element) titleList.item(0); websiteList = titleElement.getChildNodes(); String title = (((Node) titleList.item(0)).getNodeValue()); Context context = getApplicationContext(); CharSequence text = title; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } catch (Exception e) { System.out.println("XML Pasing Excpetion = " + e); } } }); /** Set the layout view to display */ } Here is the xml file <?xml version="1.0"?> <maintag> <item> <link>http://image.com/357769.jpg?40</link> <linknext>http://www.image.com</linknext> <title>imagename</title> </item> </maintag>

    Read the article

  • JAVA: XML parsers gives null element

    - by Johan
    When I try to parse a XML-file, it gives sometimes a null element by the title. I think it has to do with HTML-tags &#039; How can I solve this problem? I have the follow XML-file: <item> <title>&#039; Nieuwe DVD &#039;</title> <description>tekst, tekst tekst</description> <link>dvd.html</link> <category>nieuws</category> <pubDate>Sat, 1 Jan 2011 9:24:00 +0000</pubDate> </item> And the follow code to parse the xml-file: //DocumentBuilderFactory, DocumentBuilder are used for //xml parsing DocumentBuilderFactory dbf = DocumentBuilderFactory .newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); //using db (Document Builder) parse xml data and assign //it to Element Document document = db.parse(is); Element element = document.getDocumentElement(); //take rss nodes to NodeList element.normalize(); NodeList nodeList = element.getElementsByTagName("item"); if (nodeList.getLength() > 0) { for (int i = 0; i < nodeList.getLength(); i++) { //take each entry (corresponds to <item></item> tags in //xml data Element entry = (Element) nodeList.item(i); entry.normalize(); Element _titleE = (Element) entry.getElementsByTagName( "title").item(0); Element _categoryE = (Element) entry .getElementsByTagName("category").item(0); Element _pubDateE = (Element) entry .getElementsByTagName("pubDate").item(0); Element _linkE = (Element) entry.getElementsByTagName( "link").item(0); String _title = _titleE.getFirstChild().getNodeValue(); String _category = _categoryE.getFirstChild().getNodeValue(); Date _pubDate = new Date(_pubDateE.getFirstChild().getNodeValue()); String _link = _linkE.getFirstChild().getNodeValue(); //create RssItemObject and add it to the ArrayList RssItem rssItem = new RssItem(_title, _category, _pubDate, _link); rssItems.add(rssItem); conn.disconnect(); }

    Read the article

  • UnknownHostException in java (that too only sometimes)

    - by Nitesh Panchal
    Hello, I am trying to read rss feed of Yahoo but i am unable to make it work properly. The code is absolutely correct , i am sure about it. It works sometimes but sometimes i get UnknownHostException. What can be the reason? Is there some problem with my internet or something else? This is my code :- public List<RssFeed> getRssFeed() { try { List<RssFeed> objList = new ArrayList<RssFeed>(); DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse("http://rss.news.yahoo.com/rss/india"); //doc.getDocumentElement().normalize(); Element docElement = doc.getDocumentElement(); NodeList objChannelList = docElement.getChildNodes(); for (int intIndex = 0; intIndex < objChannelList.getLength(); intIndex++) { if (objChannelList.item(intIndex).getNodeType() == Node.ELEMENT_NODE) { Element elemItem = (Element) objChannelList.item(intIndex); NodeList itemList = elemItem.getElementsByTagName("item"); //show only 3 news int count = itemList.getLength() > 3 ? 3 : objChannelList.getLength(); for (int intSubIndex = 0; intSubIndex < count; intSubIndex++) { NodeList itemDetailList = itemList.item(intSubIndex).getChildNodes(); String strTitle = ((Node) itemDetailList.item(RSS_VALUES.TITLE.getValue())).getFirstChild().getNodeValue(); String strdescription = ((Node) itemDetailList.item(RSS_VALUES.DESCRIPTION.getValue())).getFirstChild().getNodeValue(); String strLink = ((Node) itemDetailList.item(RSS_VALUES.LINK.getValue())).getFirstChild().getNodeValue(); //System.out.println(strTitle + "\n" + strdescription + "\n" + strLink + "\n\n\n\n"); objList.add(new RssFeed(strTitle, strdescription, strLink)); } } } return objList; } catch (SAXException ex) { Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex); } catch (ParserConfigurationException ex) { Logger.getLogger(Utils.class.getName()).log(Level.SEVERE, null, ex); } return null; } Thanks in advance :). This problem has been bugging me since 1 month. Don't know why does Java in this case behave as per its mood :(

    Read the article

  • android get duration from maps.google.com directions

    - by urobo
    At the moment I am using this code to inquire google maps for directions from an address to another one, then I simply draw it on a mapview from its GeometryCollection. But yet this isn't enough I need also to extract the total expected duration from the kml. can someone give a little sample code to help me? thanks StringBuilder urlString = new StringBuilder(); urlString.append("http://maps.google.com/maps?f=d&hl=en"); urlString.append("&saddr=");//from urlString.append( Double.toString((double)src.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)src.getLongitudeE6()/1.0E6 )); urlString.append("&daddr=");//to urlString.append( Double.toString((double)dest.getLatitudeE6()/1.0E6 )); urlString.append(","); urlString.append( Double.toString((double)dest.getLongitudeE6()/1.0E6 )); urlString.append("&ie=UTF8&0&om=0&output=kml"); //Log.d("xxx","URL="+urlString.toString()); // get the kml (XML) doc. And parse it to get the coordinates(direction route). Document doc = null; HttpURLConnection urlConnection= null; URL url = null; try { url = new URL(urlString.toString()); urlConnection=(HttpURLConnection)url.openConnection(); urlConnection.setRequestMethod("GET"); urlConnection.setDoOutput(true); urlConnection.setDoInput(true); urlConnection.connect(); dbf = DocumentBuilderFactory.newInstance(); db = dbf.newDocumentBuilder(); doc = db.parse(urlConnection.getInputStream()); if(doc.getElementsByTagName("GeometryCollection").getLength()>0) { //String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getNodeName(); String path = doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getFirstChild().getNodeValue() ; //Log.d("xxx","path="+ path); String[] pairs = path.split(" "); String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude lngLat[1]=latitude lngLat[2]=height // src GeoPoint startGP = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); mMapView01.getOverlays().add(new MyOverLay(startGP,startGP,1)); GeoPoint gp1; GeoPoint gp2 = startGP; for(int i=1;i<pairs.length;i++) // the last one would be crash { lngLat = pairs[i].split(","); gp1 = gp2; // watch out! For GeoPoint, first:latitude, second:longitude gp2 = new GeoPoint((int)(Double.parseDouble(lngLat[1])*1E6),(int)(Double.parseDouble(lngLat[0])*1E6)); mMapView01.getOverlays().add(new MyOverLay(gp1,gp2,2,color)); //Log.d("xxx","pair:" + pairs[i]); } mMapView01.getOverlays().add(new MyOverLay(dest,dest, 3)); // use the default color } }catch (MalformedURLException e){ e.printStackTrace(); }catch (IOException e){ e.printStackTrace(); }catch (SAXException e){ e.printStackTrace(); } catch (ParserConfigurationException e) { e.printStackTrace(); } }

    Read the article

  • Retrieve XML from URL

    - by Pl4za
    I am having some problems retrieving a xml from url with the following code: private static String getAlbumArt(String artistName, String albumName){ try{ XMLParser xml_parser = new XMLParser(); String xml = xml_parser.getXmlFromUrl(getAlbumURL(artistName, albumName)); Document doc = xml_parser.getDomElement(xml); NodeList N = doc.getElementsByTagName("album"); Node node = N.item(0); NodeList N2 = node.getChildNodes(); System.out.println("1------"); for (int i = 0; i < N2.getLength(); i++) { Node detailNode = N2.item(i); if (detailNode.getNodeType() == Node.ELEMENT_NODE) { System.out.println("2------"); if (detailNode.getNodeName().equalsIgnoreCase("image")) { String sizeVal = ((Element) detailNode).getAttribute("size"); String url = detailNode.getTextContent(); if (sizeVal.equalsIgnoreCase("large")) { return url; } } } } } catch (Exception e){ } return null; } The xml function which i call in the above code: public String getXmlFromUrl(String url) { String xml = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return xml; } getAlbumURL: public static String getAlbumURL(String artist, String album){ return URL_METHOD + METHOD_GETALBUM + AMPERSAND + API_KEY + AMPERSAND + PARAM_ARTIST + artist + AMPERSAND + PARAM_ALBUM + album; } XMLparser: public class XMLParser { // constructor public XMLParser() { } //Get XML from URL public String getXmlFromUrl(String url) { String xml = null; try { DefaultHttpClient httpClient = new DefaultHttpClient(); HttpPost httpPost = new HttpPost(url); HttpResponse httpResponse = httpClient.execute(httpPost); HttpEntity httpEntity = httpResponse.getEntity(); xml = EntityUtils.toString(httpEntity); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return xml; } //Get dom element public Document getDomElement(String xml){ Document doc = null; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); doc = db.parse(is); } catch (ParserConfigurationException e) { Log.e("Error: ", e.getMessage()); return null; } catch (SAXException e) { Log.e("Error: ", e.getMessage()); return null; } catch (IOException e) { Log.e("Error: ", e.getMessage()); return null; } return doc; } //Get nod element public final String getElementValue(Node elem ) { Node child; if( elem != null){ if (elem.hasChildNodes()){ for( child = elem.getFirstChild(); child != null; child = child.getNextSibling() ){ if( child.getNodeType() == Node.TEXT_NODE ){ return child.getNodeValue(); } } } } return ""; } //Get element value public String getValue(Element item, String str) { NodeList nlList = item.getElementsByTagName(str).item(0).getChildNodes(); Node nValue = (Node) nlList.item(0); return nValue.getNodeValue(); } } Any ideas ? I seriously don't know what is wrong.. I used this before and it worked.

    Read the article

  • Java saying XML Document Not Well Formed

    - by Pyroclastic
    Hey all. Java's XML parser seems to be thinking that my XML document is not well formed following the root element, but I've validated it with several tools and they all disagree. It's probably an error in my code rather than in the document itself, I'd really appreciate any help you all could offer me. Here is my Java method: private void loadFromXMLFile(File f) throws ParserConfigurationException, IOException, SAXException { File file = f; DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; Document doc = null; db = dbf.newDocumentBuilder(); doc = db.parse(file); doc.getDocumentElement().normalize(); String desc = ""; String due = ""; String comment = ""; NodeList tasksList = doc.getElementsByTagName("task"); for (int i = 0; i < tasksList.getLength(); i++) { NodeList attributes = tasksList.item(i).getChildNodes(); for (int j = 0; i < attributes.getLength(); j++) { Node attribute = attributes.item(i); if (attribute.getNodeName() == "description") { desc = attribute.getTextContent(); } if (attribute.getNodeName() == "due") { due = attribute.getTextContent(); } if (attribute.getNodeName() == "comment") { comment = attribute.getTextContent(); } tasks.add(new Task(desc, due, comment)); } desc = ""; due = ""; comment = ""; } } And here is the XML file I'm trying to load: <?xml version="1.0"?> <tasklist> <task> <description>Task 1</description> <due>Due date 1</due> <comment>Comment 1</comment> <completed>false</completed> </task> <task> <description>Task 2</description> <due>Due date 2</due> <comment>Comment 2</comment> <completed>false</completed> </task> <task> <description>Task 3</description> <due>Due date 3</due> <comment>Comment 3</comment> <completed>true</completed> </task> </tasklist> And here is the error message java is throwing for me: run: [Fatal Error] tasks.xml:28:3: The markup in the document following the root element must be well-formed. May 17, 2010 6:07:02 PM todolist.TodoListGUI SEVERE: null org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:239) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283) at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:208) at todolist.TodoListGUI.loadFromXMLFile(TodoListGUI.java:199) at todolist.TodoListGUI.(TodoListGUI.java:42) at todolist.Main.main(Main.java:25) BUILD SUCCESSFUL (total time: 19 seconds) For reference TodoListGUI.java:199 is doc = db.parse(file); If context is helpful to anyone here, I'm trying to write a simple GUI application to manage a todo list that can read and write to and from XML files defining the tasks. Any advice is appreciated!

    Read the article

  • CodePlex Daily Summary for Thursday, July 18, 2013

    CodePlex Daily Summary for Thursday, July 18, 2013Popular ReleasesCircuit Diagram: Circuit Diagram 2.0 Beta 2: New in this release: Show grid in editor Cut/copy/paste support Bug fixesBetter Network: Better Network v1.0.1: v1.0.1 - Patch Changelog - Fixed app crashed when trying to delete - Hopefully fix other crashes as well :DCommunity TFS Build Extensions: July 2013: The July 2013 release contains VS2010 Activities(target .NET 4.0) VS2012 Activities (target .NET 4.5) VS2013 Activities (target .NET 4.5.1) Community TFS Build Manager VS2012 The Community TFS Build Manager can also be found in the Visual Studio Gallery here where updates will first become available. A version supporting VS2010 is also available in the Gallery here.Open Url Rewriter for DotNetNuke: Open Url Rewriter Core 0.4.2 (Beta): buf fix for removing home page separate version for DNN 7.1 (in advanced mode with custom url)#Zyan Communication Framework: Zyan 2.5: Zyan 2.5 NuGet package Project descriptionZyan is an easy to use distributed application framework for .NET, Mono and Android. With Zyan you can publish any .NET class for remote access over network. [en] What's new in Zyan 2.5: Android platform support via Mono for Android (#1828) Tested with Mono for Android v4.7.9, should work on stable v4.6.x The following restrictions apply to Android version of the library: Only duplex TCP channel is supported MEF integration is not available Re...Install Verify Tool: Install Verify Tool V 1.0: Win Service Web Service Win Service Client Web Service ClientOrchard Project: Orchard 1.7 RC: Planning releasedTerminals: Version 3.1 - Release: Changes since version 3.0:15992 Unified usage of icons in user interface Added context menu in Organize favorites grid Fixed:34219 34210 34223 33981 34209 Install notes:No changes in database (use database from release 3.0) No upgrade of configuration, passwords, credentials or favorites See also upgrade notes for release 3.0WatchersNET.SiteMap: WatchersNE​T.SiteMap 01.03.08: changes Localized Tab Name is now usedGoAgent GUI: GoAgent GUI 1.1.0 ???: ???????,??????????????,?????????????? ???????? ????: 1.1.0? ??? ?????????? ????????? ??:??cn/hk????,?????????????????????。Hosts??????google_hk。Media Companion: Media Companion MC3.573b: XBMC Link - Let MC update your XBMC Library Fixes in place, Enjoy the XBMC Link function Well, Phil's been busy in the background, and come up with a Great new feature for Media Companion. Currently only implemented for movies. Once we're happy that's working with no issues, we'll extend the functionality to include TV shows. All the help for this is build into the application. Go to General Preferences - XBMC Link for details. Help us make it better* Currently only tested on local and ...Wsus Package Publisher: Release v1.2.1307.15: Fix a bug where WPP crash if 'ShowPendingUpdates' is start with wrong credentials. Fix a bug where WPP crash if ArrivalDateAfter and ArrivalDateBefore is equal in the ComputerView. Add a filter in the ComputerView. (Thanks to NorbertFe for this feature request) Add an option, when right-clicking on a computer, you can ask for display the current logon user of the remote computer. Add an option in settings to choose if WPP ping remote computers using IPv4, IPv6 or IPv6 and, if fail, IP...Lab Of Things: vBeta1: Initial release of LoTVidCoder: 1.4.23: New in 1.4.23 Added French translation. Fixed non-x264 video encoders not sticking in video tab. New in 1.4 Updated HandBrake core to 0.9.9 Blu-ray subtitle (PGS) support Additional framerates: 30, 50, 59.94, 60 Additional sample rates: 8, 11.025, 12 and 16 kHz Additional higher bitrates for audio Same as Source Constant Framerate 24-bit FLAC encoding Added Windows Phone 8 and Apple TV 3 presets Introduced process isolation for encodes. Now if HandBrake crashes, VidCoder will ...TBox - tool to make developer's life easier.: TBox 1.021: 1)Add console unit tests runner, to run unit tests in parallel from console. Also this new sub tool can save valid xml nunit report. It can help you in continuous integration. 2)Fix build scripts.LifeInSharepoint Modern UI Update: Version 2: Some minor improvements, including Audience Targeting support for quick launch links. Also removing all NextDocs references.Virtual Photonics: VTS MATLAB Package 1.0.13 Beta: This is the beta release of the MATLAB package with examples of using the VTS libraries within MATLAB. Changes for this release: Added two new examples to vts_solver_demo.m that: 1) generates and plots R(lambda) at a given rho, and chromophore concentrations assuming a power law for scattering, and 2) solves inverse problem for R(lambda) at given rho. This example solves for concentrations of HbO2, Hb and H20 given simulated measurements created using Nurbs scaled Monte Carlo and inverted u...Microsoft Ajax Minifier: Microsoft Ajax Minifier 4.96: Fix for issue #19957: EXE should output the name of the file(s) being minified. Discussion #449181: throw a Sev-2 warning when trailing commas are detected on an Array literal. Perfectly legal to do so, but the behavior ends up working differently on different browsers, so throw a cross-browser warning. Add a few more known global names for improved ES6 compatibility update Nuget package to version 2.5 and automatically add the AjaxMin.targets to your project when you update the package...Outlook 2013 Add-In: Categories and Colors: This new version has a major change in the drawing of the list items: - Using owner drawn code to format the appointments using GDI (some flickering may occur, but it looks a little bit better IMHO, with separate sections). - Added category color support (if more than one category, only one color will be shown). Here, the colors Outlook uses are slightly different than the ones available in System.Drawing, so I did a first approach matching. ;-) - Added appointment status support (to show fr...Columbus Remote Desktop: 2.0 Sapphire: Added configuration settings Added update notifications Added ability to disable GPU acceleration Fixed connection bugsNew ProjectsAdvGenReader: This project is to build a user friendly RSS reader. We are aimed to use WPF for this project.Arroguella: A C# roguelike where anything can happen!CodedUITestExtensions: The project delivers a collection of extensions for CodedUITest.Data UYS System: Production system will be developed.Evolved Walker: A GA project where a physically simulated "Walker" is evolved to travel the longest distance it can.FH Intranet Parser: Parses the grades page of the FH Wiener Neustadt intranet page and reports any new grades.Gauss Numeric Integrator: C# implementation of numerical integration by Gaussian Quadrature.googleprep: Google interview preparations.JMA TFS Archive: TFS Test ProjectJMA TFS NEW: Test projectKill CRM Plugin: Removes a plugin from a Dynamics CRM 2011 database.Kimmo: Collection of source code libraries to help my development projects.Kinect Powerpoint Mapper: Use the Kinect sensor to drive your powerpoint presentation. Change the config file if you'd like to use this keystroke mapper with other applications.Koala.JiraTool: Jira????。Lumi: Lumi is a light based platformer engine based on Neat Game Engine for XNA. Features: Dynamic lighting and shadow system, level builder, console and scripting.MCSD Web Developer: MCSD: Web Applications Certification This is the repository for all the documents, presentations, information, projects and material for the certification.MindReader: It is game using some logic to develop thisNightskyMimic: Ai for Magic: The Gathering PlayerNoBlackWallpaper: Auto set and update bing image as wallpaperPersian FoxPro DBF viewer for .NET: Many legacy systems used FoxPro in Iran. This component allows data stored in DBF files to be read by .NET, including the necessary Farsi codepage conversions.PostEdit: Taringa!/Poringa! Post Editorprakark07172013Git01: *bold* _italics_ +underline+ ! Heading 1 !! Heading 2 * Bullet List ** Bullet List 2 # Number List ## Number List 2 [another wiki page] [url:http://www.example.prakark07172013tfs01: *bold* _italics_ +underline+ ! Heading 1 !! Heading 2 * Bullet List ** Bullet List 2 # Number List ## Number List 2 [another wiki page] [url:http://www.example.prakark07172015Hg01: *bold* _italics_ +underline+ ! Heading 1 !! Heading 2 * Bullet List ** Bullet List 2 # Number List ## Number List 2 [another wiki page] [url:http://www.example.Storyboard application: The Storyboard is an application that allows to model the different elements of a story to better structure it.System.Linq.Dynamic: Extends System.Linq.Dynamic to support Execution of Lambda expressions defined in a string against Entity Framework or any provider that supports IQueryable.Test Automation Data Manager: MVC4 application with SQLServer 2008 back end to manage test automation data.testdd07172013tfs01: dThe Monack Framework: MonackFr is an open source framework. By developing new or combining existing modules you will be able to create tailor made web softwareYAPI (Youtube API): You can do anything and play anymore youtube channel, playlist, video with YAPI

    Read the article

  • Does anyone know of a library in Java that can parse ESRI Shapefiles?

    - by KingNestor
    I'm interested in writing a visualization program for the road data in the 2009 Tiger/Line Shapefiles. I'd like to draw the line data to display all the roads for my county. The ESRI Shapefile or simply a shapefile is a popular geospatial vector data format for geographic information systems software. It is developed and regulated by ESRI as a (mostly) open specification for data interoperability among ESRI and other software products.1 A "shapefile" commonly refers to a collection of files with ".shp", ".shx", ".dbf", and other extensions on a common prefix name (e.g., "lakes.*"). The actual shapefile relates specifically to files with the ".shp" extension, however this file alone is incomplete for distribution, as the other supporting files are required. Does anyone know of existing libraries for parsing and reading in the line data for Shapefiles?

    Read the article

  • Starting a VC++ .exe from MSAccess

    - by Pieter_Jack
    For a complex calculating problem we use an VC++ module (.exe). For the users we have build an ms Access application as userinterface. After input dthe calculating module should start and do its job. The result is again imported in Ms Access. However we work wit dBase files (.dbf) as datafiles. The calculating unit works fine by its own, but when access is running it wo'nt do its job. It will start-up when called from the Access module, but then generates errors or at least does not write correct results to a datatable. We cannot find the reason for this beheavior. Can anyone give us a tip?

    Read the article

  • LINQ to SQL SubmitChangess() progress

    - by Emir
    I'm using LINQ to SQLto import old DBF files into MSSQL. I'm reading all rows and adding them to database using ctx.MyTable.InsertOnSubmit(row) After reading phase is completed I have around 100 000 pending inserts. ctx.SubmitChanges() naturally is taking a long time. Is there any way to track progress of the ctx.submitchanges()? Can ctx.Log somehow be used for this purpose? Update: Is it possible to use ctx.GetChangeSet().Inserts.Count and track insert statements using the Log? Dividing ctx.SubmitChanges() into smaller chunks is not working for me, because I need transaction, all or nothing. Update 2: I've found nice class ActionTextWriter using which I will try to count inserts. http://damieng.com/blog/2008/07/30/linq-to-sql-log-to-debug-window-file-memory-or-multiple-writers

    Read the article

  • Creating an Extremely Large Index in Oracle

    - by Rudiger
    Can someone look at the linked reference and explain to me the precise statements to run? Oracle DBA's Guide: Creating a Large Index Here's what I came up with... CREATE TEMPORARY TABLESPACE ts_tmp TEMPFILE 'E:\temp01.dbf' SIZE 10000M REUSE AUTOEXTEND ON EXTENT MANAGEMENT LOCAL; ALTER USER me TEMPORARY TABLESPACE ts_tmp; CREATE UNIQUE INDEX big_table_idx ON big_table ( record_id ); DROP TABLESPACE ts_tmp; Edit 1 After this index was created, I ran an explain plan for a simple query and get this error: ORA-00959: tablespace 'TS_TMP' does not exist It seems like it's not temporary at all... :(

    Read the article

< Previous Page | 1 2 3 4 5  | Next Page >