Search Results

Search found 2030 results on 82 pages for 'params'.

Page 15/82 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • HttpClient POST fails to submit the form

    - by Jayomat
    Hi, I'm writing an app to check for the bus timetable's. Therefor I need to post some data to a html page, submit it, and parse the resulting page with htmlparser. Though it may be asked a lot, can some one help me identify if 1) this page does support post/get (I think it does) 2) which fields I need to use? 3) How to make the actual request? this is my code so far: String url = "http://busspur02.aseag.de/bs.exe?Cmd=RV&Karten=true&DatumT=30&DatumM=4&DatumJ=2010&ZeitH=&ZeitM=&Suchen=%28S%29uchen&GT0=&HT0=&GT1=&HT1="; String charset = "CP1252"; System.out.println("startFrom: "+start_from); System.out.println("goTo: "+destination); //String tag.v List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add(new BasicNameValuePair("HTO", start_from)); params.add(new BasicNameValuePair("HT1", destination)); params.add(new BasicNameValuePair("GTO", "Aachen")); params.add(new BasicNameValuePair("GT1", "Aachen")); params.add(new BasicNameValuePair("DatumT", day)); params.add(new BasicNameValuePair("DatumM", month)); params.add(new BasicNameValuePair("DatumJ", year)); params.add(new BasicNameValuePair("ZeitH", hour)); params.add(new BasicNameValuePair("ZeitM", min)); UrlEncodedFormEntity query = new UrlEncodedFormEntity(params, charset); HttpPost post = new HttpPost(url); post.setEntity(query); InputStream response = new DefaultHttpClient().execute(post).getEntity().getContent(); // Now do your thing with the facebook response. String source = readText(response,"CP1252"); Log.d(TAG_AVV,response.toString()); System.out.println("STREAM "+source); One person also gave me a hint to use firebug to read what's going on at the page, but I don't really understand what to look for, or more precisely, how to use the provided information. I also find it confusing, for example, that when I enter the data by hand, the url says, for example, "....HTO=Kaiserplatz&...", but in Firebug, the same Kaiserplatz is connected to a different field, in this case: \<\td class="Start3" Kaiserplatz <\/td (I inserted \ to make it visible) The last line in my code prints the html page, but without having send a request.. it's printed as if there was no input at all... My app is almost done, I hope someone can help me out to finish it! thanks in advance EDIT: this is what the s.o.p returns: (At some point there actually is some input, but only the destination ???) 04-30 03:15:43.524: INFO/System.out(3303): STREAM <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 04-30 03:15:43.524: INFO/System.out(3303): <html> 04-30 03:15:43.524: INFO/System.out(3303): <head> 04-30 03:15:43.545: INFO/System.out(3303): <title>Busspur online</title> 04-30 03:15:43.554: INFO/System.out(3303): <base href="http://busspur02.aseag.de"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="description" content="Busspur im Internet"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="author" content="Dr. Manfred Enning"> 04-30 03:15:43.554: INFO/System.out(3303): <meta name="AUTH_TYPE" content="Basic"> 04-30 03:15:43.574: INFO/System.out(3303): <meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252"> 04-30 03:15:43.574: INFO/System.out(3303): <meta HTTP-EQUIV="Content-Language" CONTENT="de"> 04-30 03:15:43.574: INFO/System.out(3303): <link rel=stylesheet type="text/css" href="busspur.css"> 04-30 03:15:43.574: INFO/System.out(3303): </head> 04-30 03:15:43.574: INFO/System.out(3303): 04-30 03:15:43.574: INFO/System.out(3303): <body> 04-30 03:15:43.574: INFO/System.out(3303): <table border="0" cellspacing="0" cellpadding="0" width="100%"> 04-30 03:15:43.574: INFO/System.out(3303): <tr> 04-30 03:15:43.584: INFO/System.out(3303): <td align="left" width="25%"><small>Version: 6.8.1.9s2<br>Datenstand: 13.04.2010 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.584: INFO/System.out(3303): <br>12.04.2010 - 12.06.2010 04-30 03:15:43.584: INFO/System.out(3303): <br>1663 04-30 03:15:43.584: INFO/System.out(3303): 3D3B9</small> 04-30 03:15:43.584: INFO/System.out(3303): </td> 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.584: INFO/System.out(3303): <td align="center" width="50%"> 04-30 03:15:43.584: INFO/System.out(3303): <a href="/bs.exe/SL?Sprache=Nederlands&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/nederlands.gif" alt="Nederlands" border="0" Width="32" Height="22"></a><a href="/bs.exe/SL?Sprache=English&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/english.gif" alt="English" border="0" Width="32" Height="22"></a><a href="/bs.exe/SL?Sprache=Francais&amp;SID=3D3B9"><img src="http://www.busspur.de/logos/francais.gif" alt="Francais" border="0" Width="32" Height="22"></a> 04-30 03:15:43.584: INFO/System.out(3303): </td> 04-30 03:15:43.584: INFO/System.out(3303): 04-30 03:15:43.594: INFO/System.out(3303): <td align="right" width="25%"> 04-30 03:15:43.594: INFO/System.out(3303): <a href="http://www.avv.de/"><img src="/logos/avvlogo.gif" border="0" alt="AVV"></a> 04-30 03:15:43.594: INFO/System.out(3303): </td> 04-30 03:15:43.594: INFO/System.out(3303): </tr> 04-30 03:15:43.594: INFO/System.out(3303): </table> 04-30 03:15:43.594: INFO/System.out(3303): 04-30 03:15:43.594: INFO/System.out(3303): <!-- Kopfbereich (automatisch erzeugt) --> 04-30 03:15:43.594: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.594: INFO/System.out(3303): 04-30 03:15:43.604: INFO/System.out(3303): <H2>Busspur-Online <i>Verbindungsabfrage</i></H2> 04-30 03:15:43.604: INFO/System.out(3303): </div> 04-30 03:15:43.604: INFO/System.out(3303): <!-- Ende Kopfbereich --> 04-30 03:15:43.604: INFO/System.out(3303): 04-30 03:15:43.604: INFO/System.out(3303): <!-- Ausgabebereich (automatisch erzeugt) --> 04-30 03:15:43.604: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.614: INFO/System.out(3303): <p></p> 04-30 03:15:43.614: INFO/System.out(3303): <p></p> 04-30 03:15:43.614: INFO/System.out(3303): 04-30 03:15:43.614: INFO/System.out(3303): 04-30 03:15:43.624: INFO/System.out(3303): </div> 04-30 03:15:43.624: INFO/System.out(3303): <!-- Ende Ausgabebereich --> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): <!-- Fussnotenbereich (automatisch erzeugt) --> 04-30 03:15:43.634: INFO/System.out(3303): <div align="left"> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): </div> 04-30 03:15:43.634: INFO/System.out(3303): <!-- Ende Fussnotenbereich --> 04-30 03:15:43.634: INFO/System.out(3303): 04-30 03:15:43.634: INFO/System.out(3303): <!-- Nachschlageliste (automatisch erzeugt) --> 04-30 03:15:43.634: INFO/System.out(3303): <div align="center"> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): </div> 04-30 03:15:43.644: INFO/System.out(3303): <!-- Ende Nachschlageliste --> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <!-- Eingabeformular --> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <!-- Eingabeformular --> 04-30 03:15:43.644: INFO/System.out(3303): <form name="Maske" action="/bs.exe" method="get"> 04-30 03:15:43.644: INFO/System.out(3303): 04-30 03:15:43.644: INFO/System.out(3303): <input type="hidden" name="SID" value="3D3B9"> 04-30 03:15:43.644: INFO/System.out(3303): <input type="hidden" name="ScreenX" value=""> 04-30 03:15:43.654: INFO/System.out(3303): <input type="hidden" name="ScreenY" value=""> 04-30 03:15:43.654: INFO/System.out(3303): <input type="hidden" class="hiddenForm" name="CMD" value="CR" /> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): <input TYPE="Submit" name="Suchen" value="S" tabindex="20" style="visibility:hidden"> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.654: INFO/System.out(3303): <table align="center" border="0" cellspacing="0" cellpadding="2"> 04-30 03:15:43.654: INFO/System.out(3303): <tr> 04-30 03:15:43.654: INFO/System.out(3303): <td class="Haupt"> 04-30 03:15:43.654: INFO/System.out(3303): 04-30 03:15:43.674: INFO/System.out(3303): <table border="0" cellspacing="0" cellpadding="2"> 04-30 03:15:43.674: INFO/System.out(3303): <!-- 1.Zeile Startauswahl --> 04-30 03:15:43.674: INFO/System.out(3303): <tr> 04-30 03:15:43.674: INFO/System.out(3303): <td rowspan="2" class="Start1"> 04-30 03:15:43.674: INFO/System.out(3303): Start 04-30 03:15:43.685: INFO/System.out(3303): </td> 04-30 03:15:43.685: INFO/System.out(3303): 04-30 03:15:43.685: INFO/System.out(3303): <td class="Start2" height="25"> 04-30 03:15:43.685: INFO/System.out(3303): Stadt/Gemeinde 04-30 03:15:43.685: INFO/System.out(3303): </td> 04-30 03:15:43.685: INFO/System.out(3303): 04-30 03:15:43.685: INFO/System.out(3303): <td class="Start3"> 04-30 03:15:43.685: INFO/System.out(3303): <input type="text" name="GT0" value="" tabindex="1" /> 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): </td> 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): 04-30 03:15:43.704: INFO/System.out(3303): <td rowspan="2" class="Start4"> 04-30 03:15:43.714: INFO/System.out(3303): <input type="submit" name="Map0" value="Karte" tabindex="100" /> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): </td> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): </tr> 04-30 03:15:43.724: INFO/System.out(3303): 04-30 03:15:43.724: INFO/System.out(3303): <tr> 04-30 03:15:43.734: INFO/System.out(3303): <td class="Start2" height="25"> 04-30 03:15:43.734: INFO/System.out(3303): <select name="T0" id="efaT0"> 04-30 03:15:43.734: INFO/System.out(3303): <option value="A" >Adresse 04-30 03:15:43.734: INFO/System.out(3303): <option value="H" selected="selected">Haltestelle 04-30 03:15:43.734: INFO/System.out(3303): <option value="Z" >Bes. Ziel 04-30 03:15:43.734: INFO/System.out(3303): </select> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.734: INFO/System.out(3303): </td> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.734: INFO/System.out(3303): <td class="Start3"> 04-30 03:15:43.734: INFO/System.out(3303): <input type="text" name="HT0" value="" tabindex="2" /> 04-30 03:15:43.734: INFO/System.out(3303): 04-30 03:15:43.745: INFO/System.out(3303): </td> 04-30 03:15:43.754: INFO/System.out(3303): 04-30 03:15:43.774: INFO/System.out(3303): </tr> 04-30 03:15:43.784: INFO/System.out(3303): 04-30 03:15:43.784: INFO/System.out(3303): <!-- 2.Zeile Ziel oder ViaAuswahl --> 04-30 03:15:43.784: INFO/System.out(3303): 04-30 03:15:43.805: INFO/System.out(3303): <tr> 04-30 03:15:43.834: INFO/System.out(3303): <td rowspan="2" class="Ziel1"> 04-30 03:15:43.834: INFO/System.out(3303): Ziel 04-30 03:15:43.834: INFO/System.out(3303): </td> 04-30 03:15:43.844: INFO/System.out(3303): 04-30 03:15:43.844: INFO/System.out(3303): <td class="Ziel2" height="25"> 04-30 03:15:43.844: INFO/System.out(3303): Stadt/Gemeinde 04-30 03:15:43.844: INFO/System.out(3303): </td> 04-30 03:15:43.854: INFO/System.out(3303): 04-30 03:15:43.854: INFO/System.out(3303): <td class="Ziel3"> 04-30 03:15:43.854: INFO/System.out(3303): Aachen 04-30 03:15:43.864: INFO/System.out(3303): </td> 04-30 03:15:43.874: INFO/System.out(3303): 04-30 03:15:43.874: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): <td rowspan="2" class="Ziel4"> 04-30 03:15:43.884: INFO/System.out(3303): <input type="submit" name="Map1" value="Karte" tabindex="101" /> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): </td> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): </tr> 04-30 03:15:43.884: INFO/System.out(3303): 04-30 03:15:43.884: INFO/System.out(3303): <tr> 04-30 03:15:43.884: INFO/System.out(3303): <td class="Ziel2" height="25"> 04-30 03:15:43.894: INFO/System.out(3303): <small></small> 04-30 03:15:43.894: INFO/System.out(3303): </td> 04-30 03:15:43.894: INFO/System.out(3303): <td class="Ziel3"> 04-30 03:15:43.894: INFO/System.out(3303): Karlsgraben 04-30 03:15:43.904: INFO/System.out(3303): </td> 04-30 03:15:43.904: INFO/System.out(3303): </tr> 04-30 03:15:43.904: INFO/System.out(3303): 04-30 03:15:43.914: INFO/System.out(3303): 04-30 03:15:43.924: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): 04-30 03:15:43.934: INFO/System.out(3303): <!-- 3.Zeile Datum/Zeit/Intervall --> 04-30 03:15:43.934: INFO/System.out(3303): <tr> 04-30 03:15:43.944: INFO/System.out(3303): <td rowspan="3" class="Zeit1"> 04-30 03:15:43.944: INFO/System.out(3303): Zeit 04-30 03:15:43.944: INFO/System.out(3303): </td> 04-30 03:15:43.944: INFO/System.out(3303): <td class="Datum2"> 04-30 03:15:43.944: INFO/System.out(3303): Datum 04-30 03:15:43.944: INFO/System.out(3303): </td> 04-30 03:15:43.944: INFO/System.out(3303): 04-30 03:15:43.944: INFO/System.out(3303): <!-- Für Abfragen ohne Karte alternativ Zeile ohne colspan hinzufügen --> 04-30 03:15:43.954: INFO/System.out(3303): 04-30 03:15:43.964: INFO/System.out(3303): <td class="Datum3" height="25" colspan="2"> 04-30 03:15:43.984: INFO/System.out(3303): <select name="DatumT" tabindex="10" id="efaDatumT"> 04-30 03:15:43.984: INFO/System.out(3303): <option >1</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >2</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >3</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >4</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >5</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >6</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >7</option> 04-30 03:15:43.984: INFO/System.out(3303): <option >8</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >9</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >10</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >11</option> 04-30 03:15:43.994: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.005: INFO/System.out(3303): <option >13</option> 04-30 03:15:44.024: INFO/System.out(3303): <option >14</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >15</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >16</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >17</option> 04-30 03:15:44.034: INFO/System.out(3303): <option >18</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >19</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >20</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >21</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >22</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >23</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >24</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >25</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >26</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >27</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >28</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >29</option> 04-30 03:15:44.044: INFO/System.out(3303): <option selected="selected">30</option> 04-30 03:15:44.044: INFO/System.out(3303): <option >31</option> 04-30 03:15:44.055: INFO/System.out(3303): </select> 04-30 03:15:44.055: INFO/System.out(3303): . 04-30 03:15:44.055: INFO/System.out(3303): <select name="DatumM" tabindex="11" id="efaDatumM"> 04-30 03:15:44.055: INFO/System.out(3303): <option >1</option> 04-30 03:15:44.055: INFO/System.out(3303): <option >2</option> 04-30 03:15:44.055: INFO/System.out(3303): <option >3</option> 04-30 03:15:44.064: INFO/System.out(3303): <option selected="selected">4</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >5</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >6</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >7</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >8</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >9</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >10</option> 04-30 03:15:44.064: INFO/System.out(3303): <option >11</option> 04-30 03:15:44.085: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.085: INFO/System.out(3303): </select> 04-30 03:15:44.085: INFO/System.out(3303): . 04-30 03:15:44.085: INFO/System.out(3303): <select name="DatumJ" tabindex="12" id="efaDatumJ"> 04-30 03:15:44.095: INFO/System.out(3303): <option >2009</option> 04-30 03:15:44.095: INFO/System.out(3303): <option selected="selected">2010</option> 04-30 03:15:44.095: INFO/System.out(3303): <option >2011</option> 04-30 03:15:44.095: INFO/System.out(3303): </select> 04-30 03:15:44.095: INFO/System.out(3303): 04-30 03:15:44.095: INFO/System.out(3303): </td> 04-30 03:15:44.095: INFO/System.out(3303): 04-30 03:15:44.105: INFO/System.out(3303): </tr> 04-30 03:15:44.115: INFO/System.out(3303): 04-30 03:15:44.115: INFO/System.out(3303): <tr> 04-30 03:15:44.115: INFO/System.out(3303): <td class="Uhrzeit2"> 04-30 03:15:44.115: INFO/System.out(3303): <input type="radio" name="AbfAnk" value="Abf" checked />Abfahrten ab<br /> 04-30 03:15:44.115: INFO/System.out(3303): <input type="radio" name="AbfAnk" value="Ank" />Ankünfte bis 04-30 03:15:44.115: INFO/System.out(3303): 04-30 03:15:44.115: INFO/System.out(3303): </td> 04-30 03:15:44.125: INFO/System.out(3303): <td class="Uhrzeit3" height="25"> 04-30 03:15:44.125: INFO/System.out(3303): <select name="ZeitH" tabindex="14" id="efaZeitH"> 04-30 03:15:44.125: INFO/System.out(3303): <option >0</option> 04-30 03:15:44.125: INFO/System.out(3303): <option >1</option> 04-30 03:15:44.125: INFO/System.out(3303): <option >2</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >3</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >4</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >5</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >6</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >7</option> 04-30 03:15:44.135: INFO/System.out(3303): <option >8</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >9</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >10</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >11</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >12</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >13</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >14</option> 04-30 03:15:44.145: INFO/System.out(3303): <option selected="selected">15</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >16</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >17</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >18</option> 04-30 03:15:44.145: INFO/System.out(3303): <option >19</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >20</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >21</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >22</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >23</option> 04-30 03:15:44.155: INFO/System.out(3303): </select> 04-30 03:15:44.155: INFO/System.out(3303): : 04-30 03:15:44.155: INFO/System.out(3303): <select name="ZeitM" tabindex="15" id="efaZeitM"> 04-30 03:15:44.155: INFO/System.out(3303): <option >00</option> 04-30 03:15:44.155: INFO/System.out(3303): <option selected="selected">15</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >30</option> 04-30 03:15:44.155: INFO/System.out(3303): <option >45</option> 04-30 03:15:44.155: INFO/System.out(3303): </select> 04-30 03:15:44.155: INFO/System.out(3303): 04-30 03:15:44.155: INFO/System.out(3303): </td> 04-30 03:15:44.155: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): <td class="Uhrzeit2">&nbsp;</td> 04-30 03:15:44.165: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): </tr> 04-30 03:15:44.165: INFO/System.out(3303): 04-30 03:15:44.165: INFO/System.out(3303): <tr> 04-30 03:15:44.165: INFO/System.out(3303): <td class="Intervall2"> 04-30 03:15:44.165: INFO/System.out(3303): Intervall 04-30 03:15:44.165: INFO/System.out(3303): </td> 04-30 03:15:44.184: INFO/System.out(3303): 04-30 03:15:44.184: INFO/System.out(3303): <td class="Intervall3" height="25"> 04-30 03:15:44.184: INFO/System.out(3303): <select name="Intervall" tabindex="13" id="efaIntervall"> 04-30 03:15:44.184: INFO/System.out(3303): <option value="60" >1 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="120" >2 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="240" >4 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="480" >8 h</option> 04-30 03:15:44.184: INFO/System.out(3303): <option value="1800" >ganzer Tag</option> 04-30 03:15:44.194: INFO/System.out(3303): </select> 04-30 03:15:44.194: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </td> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): <td class="Intervall3">&nbsp; 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </tr> 04-30 03:15:44.204: INFO/System.out(3303): </table> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): </td> 04-30 03:15:44.204: INFO/System.out(3303): 04-30 03:15:44.204: INFO/System.out(3303): <td class="Schalter" valign="top"> 04-30 03:15:44.204: INFO/System.out(3303): <table class="Schalter"> 04-30 03:15:44.204: INFO/System.out(3303): <!-- Buttons --> 04-30 03:15:44.204: INFO/System.out(3303): <tr> 04-30 03:15:44.204: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Submit" accesskey="s" class="SuchenBtn" name="Suchen" tabindex="20" VALUE="(S)uchen"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Submit" accesskey="o" name="Optionen" tabindex="22" VALUE="(O)ptionen"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Button" accesskey="z" tabindex="24" VALUE="(Z)urück" onClick="history.back()"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.226: INFO/System.out(3303): </tr> 04-30 03:15:44.226: INFO/System.out(3303): <tr> 04-30 03:15:44.226: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.226: INFO/System.out(3303): <input TYPE="Button" accesskey="h" tabindex="25" VALUE="(H)ilfe" onClick="self.location.href='/bs.exe/FF?N=hilfe&amp;SID=3D3B9'"> 04-30 03:15:44.226: INFO/System.out(3303): </td> 04-30 03:15:44.235: INFO/System.out(3303): </tr> 04-30 03:15:44.235: INFO/System.out(3303): <tr> 04-30 03:15:44.235: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.235: INFO/System.out(3303): <input TYPE="Submit" accesskey="n" tabindex="26" name="Loeschen" VALUE="(N)eue Suche"> 04-30 03:15:44.235: INFO/System.out(3303): </td> 04-30 03:15:44.235: INFO/System.out(3303): </tr> 04-30 03:15:44.235: INFO/System.out(3303): 04-30 03:15:44.235: INFO/System.out(3303): <tr> 04-30 03:15:44.235: INFO/System.out(3303): 04-30 03:15:44.244: INFO/System.out(3303): <td class="Schalter" align="center"> 04-30 03:15:44.244: INFO/System.out(3303): <input TYPE="Button" accesskey="a" tabindex="27" VALUE="H(a)ltestelle" onClick="self.location.href='/bs.exe/RHFF?Karten=true?N=Result&amp;SID=3D3B9'"> 04-30 03:15:44.244: INFO/System.out(3303): </td> 04-30 03:15:44.244: INFO/System.out(3303): 04-30 03:15:44.244: INFO/System.out(3303): </tr> 04-30 03:15:44.244: INFO/System.out(3303): </table> 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): </td> 04-30 03:15:44.254: INFO/System.out(3303): </tr> 04-30 03:15:44.254: INFO/System.out(3303): </table> 04-30 03:15:44.254: INFO/System.out(3303): </form> 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): 04-30 03:15:44.254: INFO/System.out(3303): <!-- Meldungsbereich (automatisch erzeugt) --> 04-30 03:15:44.254: INFO/System.out(3303): <div align="center" id="meldungen"> 04-30 03:15:44.265: INFO/System.out(3303): <table class="Bedienhinweise"><tr><td rowspan="2"><img SRC="http://www.busspur.de/logos/hinweis.png" ALIGN="top" alt="Symbol" WIDTH="32" HEIGHT="20">&nbsp;</td><td rowspan="2">Start</td><td>Geben Sie den Namen der Stadt/Gemeinde ein</td></tr><tr><td>Geben Sie den Namen der Haltestelle ein</td></tr></table> 04-30 03:15:44.265: INFO/System.out(3303): </div> 04-30 03:15:44.265:

    Read the article

  • Using will_paginate with AJAX live search with jQuery in Rails

    - by Mark Richman
    I am using will_paginate to successfully page through records. I am also using AJAX live search via jQuery to update my results div. No problem so far. The issue I have is when trying to paginate through those live search results. I simply get "Page is loading..." with no div update. Am I missing something fundamental? # index.html.erb <form id="searchform" accept-charset="utf-8" method="get" action="/search"> Search: <input id="search" name="search" type="text" autocomplete="off" title="Search location, company, description..." /> <%= image_tag("spinner.gif", :id => "spinner", :style =>"display: none;" ) %> </form> # JobsController#search def search if params[:search].nil? @jobs = Job.paginate :page => params[:page], :order => "created_at desc" elsif params[:search] and request.xhr? @jobs = Job.search params[:search], params[:page] end render :partial => "jobs", :layout => false, :locals => { :jobs => @jobs } end # Job#search def self.search(search, page) logger.debug "Job.paginate #{search}, #{page}" paginate :per_page => @@per_page, :page => page, :conditions => ["description LIKE ? or title LIKE ? or company LIKE ?", "%#{search}%", "%#{search}%", "%#{search}%"], :order => 'created_at DESC' end # search.js $(document).ready(function(){ $("#search").keyup(function() { $("#spinner").show(); // show the spinner var form = $(this).parents("form"); // grab the form wrapping the search bar. var url = form.attr("action"); // grab the URL from the form's action value. var formData = form.serialize(); // grab the data in the form $.get(url, formData, function(html) { // perform an AJAX get, the trailing function is what happens on successful get. $("#spinner").hide(); // hide the spinner $("#jobs").html(html); // replace the "results" div with the result of action taken }); }); });

    Read the article

  • Sortable_element with RJS does not working

    - by jaycode
    I have a list of images where user can arrange their orders. When user uploaded an image, I want the list to still be sortable. I am using a similar upload that was described here: http://kpumuk.info/ruby-on-rails/in-place-file-upload-with-ruby-on-rails/ Please help. Here are the code for upload in view file: <% form_for [:admin, @new_image], :html => { :target => 'upload_frame', :multipart => true } do |f| %> <%= hidden_field_tag :update, 'product_images'%> <%= f.hidden_field :image_owner_id %> <%= f.hidden_field :image_owner_type %> <%= f.file_field :image_file %><br /> or get image from this URL: <%= f.text_field :image_file_url %> <%= f.hidden_field :image_file_temp %><br /> <%= f.submit "Upload Image" %> <% end %> And in controller view: def create @image = Image.new(params[:image]) logger.debug "params are #{params.inspect}" if @image.save logger.debug "initiating javascript now" responds_to_parent do render :update do |page| logger.debug "javascript test #{sortable_element("product_images", :url => sort_admin_images_path, :handle => "handle", :constraint => false)}" page << "show_notification('Image Uploaded');" page.replace_html params[:update], :partial => '/admin/shared/editor/images', :locals => {:object => @image.image_owner, :updated_image => @image} page << sortable_element("product_images", :url => sort_admin_images_path, :handle => "handle", :constraint => false) end end #render :partial => '/admin/shared/editor/images', :locals => {:object => @image.image_owner, :updated_image => @image} else responds_to_parent do render :update do |page| page << "show_notification('Image Upload Error');" end end end end Or, to rephrase the question: Running this: page.replace_html params[:update], :partial => '/admin/shared/editor/images', :locals => {:object => @image.image_owner, :updated_image => @image} page << sortable_element("product_images", :url => sort_admin_images_path, :handle => "handle", :constraint => false) Will NOT adding sortable list feature. Please help, Thank you

    Read the article

  • Approaches to create a nested tree structure of NSDictionaries?

    - by d11wtq
    I'm parsing some input which produces a tree structure containing NSDictionary instances on the branches and NSString instance at the nodes. After parsing, the whole structure should be immutable. I feel like I'm jumping through hoops to create the structure and then make sure it's immutable when it's returned from my method. We can probably all relate to the input I'm parsing, since it's a query string from a URL. In a string like this: a=foo&b=bar&a=zip We expect a structure like this: NSDictionary { "a" => NSDictionary { 0 => "foo", 1 => "zip" }, "b" => "bar" } I'm keeping it just two-dimensional in this example for brevity, though in the real-world we sometimes see var[key1][key2]=value&var[key1][key3]=value2 type structures. The code hasn't evolved that far just yet. Currently I do this: - (NSDictionary *)parseQuery:(NSString *)queryString { NSMutableDictionary *params = [NSMutableDictionary dictionary]; NSArray *pairs = [queryString componentsSeparatedByString:@"&"]; for (NSString *pair in pairs) { NSRange eqRange = [pair rangeOfString:@"="]; NSString *key; id value; // If the parameter is a key without a specified value if (eqRange.location == NSNotFound) { key = [pair stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; value = @""; } else { // Else determine both key and value key = [[pair substringToIndex:eqRange.location] stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; if ([pair length] > eqRange.location + 1) { value = [[pair substringFromIndex:eqRange.location + 1] stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; } else { value = @""; } } // Parameter already exists, it must be a dictionary if (nil != [params objectForKey:key]) { id existingValue = [params objectForKey:key]; if (![existingValue isKindOfClass:[NSDictionary class]]) { value = [NSDictionary dictionaryWithObjectsAndKeys:existingValue, [NSNumber numberWithInt:0], value, [NSNumber numberWithInt:1], nil]; } else { // FIXME: There must be a more elegant way to build a nested dictionary where the end result is immutable? NSMutableDictionary *newValue = [NSMutableDictionary dictionaryWithDictionary:existingValue]; [newValue setObject:value forKey:[NSNumber numberWithInt:[newValue count]]]; value = [NSDictionary dictionaryWithDictionary:newValue]; } } [params setObject:value forKey:key]; } return [NSDictionary dictionaryWithDictionary:params]; } If you look at the bit where I've added FIXME it feels awfully clumsy, pulling out the existing dictionary, creating an immutable version of it, adding the new value, then creating an immutable dictionary from that to set back in place. Expensive and unnecessary? I'm not sure if there are any Cocoa-specific design patterns I can follow here?

    Read the article

  • SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters

    - by Gremo
    Weird error and this is driving me crazy all the day. To me it seems a bug because there are no positional parameters in my query. Here is the method: public function getAll(User $user, DateTime $start = null, DateTime $end = null) { $params = array('user_id' => $user->getId()); $rsm = new \Doctrine\ORM\Query\ResultSetMapping(); // Result set mapping $rsm->addScalarResult('subtype', 'subtype'); $rsm->addScalarResult('count', 'count'); $sms_sql = "SELECT CONCAT('sms_', IF(is_auto = 0, 'user' , 'auto')) AS subtype, " . "SUM(messages_count * (customers_count + recipients_count)) AS count " . "FROM outgoing_message AS m INNER JOIN small_text_message AS s ON " . "m.id = s.id WHERE status <> 'pending' AND user_id = :user_id"; $news_sql = "SELECT CONCAT('news_', IF(is_auto = 0, 'user' , 'auto')) AS subtype, " . "SUM(customers_count + recipients_count) AS count " . "FROM outgoing_message AS m JOIN newsletter AS n ON m.id = n.id " . "WHERE status <> 'pending' AND user_id = :user_id"; if($start) : $sms_sql .= " AND sent_at >= :start"; $news_sql .= " AND sent_at >= :start"; $params['start'] = $start->format('Y-m-d'); endif; $sms_sql .= ' GROUP BY type, is_auto'; $news_sql .= ' GROUP BY type, is_auto'; return $this->_em->createNativeQuery("$sms_sql UNION ALL $news_sql", $rsm) >setParameters($params)->getResult(); } And this throws the exception: SQLSTATE[HY093]: Invalid parameter number: mixed named and positional parameters Array $arams is OK and so generated SQL: var_dump($params); array (size=2) 'user_id' => int 1 'start' => string '2012-01-01' (length=10) Strangest thing is that it works with "$sms_sql" only! Any help would make my day, thanks. Update Found another strange thing. If i change only the name (to start_date instead of start): if($start) : $sms_sql .= " AND sent_at >= :start_date"; $news_sql .= " AND sent_at >= :start_date"; $params['start_date'] = $start->format('Y-m-d'); endif; What happens is that Doctrine/PDO says: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'sent1rt_date' in 'where clause' ... as string 1rt was added in the middle of the column name! Crazy...

    Read the article

  • Write binary stream to browser using PHP

    - by Dave Jarvis
    Background Trying to stream a PDF report written using iReport through PHP to the browser. The general problem is: how do you write binary data to the browser using PHP? Working Code The following code does the job, but (for many reasons) it is not as efficient as it should be (the code writes a file then sends the file contents the browser). // Load the MySQL database driver. // java( 'java.lang.Class' )->forName( 'com.mysql.jdbc.Driver' ); // Attempt a database connection. // $conn = java( 'java.sql.DriverManager' )->getConnection( "jdbc:mysql://localhost:3306/climate?user=$user&password=$password" ); // Extract parameters. // $params = new java('java.util.HashMap'); $params->put('DistrictCode', '101'); $params->put('StationCode', '0066'); $params->put('CategoryCode', '010'); // Use the fill manager to produce the report. // $fm = java('net.sf.jasperreports.engine.JasperFillManager'); $pm = $fm->fillReport($report, $params, $conn); header('Cache-Control: no-cache private'); header('Content-Description: File Transfer'); header('Content-Disposition: attachment, filename=climate-report.pdf'); header('Content-Type: application/pdf'); header('Content-Transfer-Encoding: binary'); header('Content-Length: ' . strlen( $result ) ); $path = realpath( "." ) . "/output.pdf"; $em = java('net.sf.jasperreports.engine.JasperExportManager'); $result = $em->exportReportToPdfFile($pm,$path); readfile( $path ); $conn->close(); Non-working Code To remove the slight redundancy (i.e., write directly to the browser), the following code looks like it should work, but it does not: $em = java('net.sf.jasperreports.engine.JasperExportManager'); $result = $em->exportReportToPdf($pm); header('Content-Length: ' . strlen( $result ) ); echo $result; Content is sent to the browser, but the file is corrupt (it begins with the PDF header) and cannot be read by any PDF reader. Question How can I take out the middle step of writing to the file and write directly to the browser so that the PDF is not corrupted? Thank you!

    Read the article

  • Facebook PHP SDK - can't pass parameters to getLoginUrl()

    - by Elliott
    I'm using the Facebook PHP SDK for simple login with extended permissions. I'm using the example code from the SDK docs, but I found that I need to manually clear out the FB session data otherwise if($user) comes back as true even though the user is logged out. I have the app going to logout.php upon logout; this page clears out the session vars and redirects to the app home page. Once I clear out the FB session data, log in/log out works fine. However, it stops working if I pass $params to the getLoginUrl function. Once I pass any params (I've tried several), the login breaks, either by not bringing up the second extended permissions screen or by refreshing the app page w/out login success. index page and logout page code follow. index.php <?php require 'services/facebook-php-sdk/src/facebook.php'; $facebook = new Facebook(array( 'appId' => '[APP_ID]', 'secret' => '[SECRET]', )); // Get User ID $user = $facebook->getUser(); if($user) { try { // Proceed knowing you have a logged in user who's authenticated. $user_profile = $facebook->api('/me'); $params = array('next' => 'http://'.$_SERVER["SERVER_NAME"].'/logout.php'); $logout_url = $facebook->getLogoutUrl($params); } catch (FacebookApiException $e) { error_log($e); $user = null; } } else { $login_url = $facebook->getLoginUrl($params = array('redirect_uri' => 'http://'.$_SERVER["SERVER_NAME"].'/', 'scope' => 'read_stream')); } ?> <!DOCTYPE html> <html lang="en"> <head> </head> <body> <?php if($user) { ?> <p><a href="<?php echo($logout_url); ?>">Log out</a></p> <?php } else { ?> <p><a href="<?php echo($login_url); ?>">Log in</a></p> <?php } ?> </body> </html> logout.php <?php session_start(); $fb_app_id = '[APP_ID]'; unset($_SESSION['fb_'.$fb_app_id.'_code']); unset($_SESSION['fb_'.$fb_app_id.'_access_token']); unset($_SESSION['fb_'.$fb_app_id.'_user_id']); unset($_SESSION['fb_'.$fb_app_id.'_state']); header('Location: http://'.$_SERVER["SERVER_NAME"].'/'); ?>

    Read the article

  • How to count the length (number of lines) of a csv file in Rails?

    - by Mathias
    Hello, I have a form (Rails) which allows me to load a .csv file using the file_field. In the view: <% form_for(:upcsv, :html => {:multipart => true}) do |f| %> <table> <tr> <td><%= f.label("File:") %></td> <td><%= f.file_field(:filename) %></td> </tr> </table> <%= f.submit("Submit") %> <% end %> Clicking Submit redirects me to another page (create.html.erb). The file was loaded fine, and I was able to read the contents just fine in this second page. I am trying to show the number of lines in the .csv file in this second page. My controller (semi-pseudocode): class UpcsvController < ApplicationController def index end def create file = params[:upcsv][:filename] ... #params[:upcsv][:file_length] = file.length # Show number of lines in the file #params[:upcsv][:file_length] = file.size ... end end Both file.length and file.size returns '91' when my file only contains 7 lines. From the Rails documentation that I read, once the Submit button is clicked, Rails creates a temp file of the uploaded file, and the params[:upcsv][:filename] contains the contents of the temp/uploaded file and not the path to the file. And I don't know how to extract the number of lines in my original file. What is the correct way to get the number of lines in the file? My create.html.erb: <table> <tr> <td>File length:</td> <td><%= params[:upcsv][:file_length] %></td> </tr> </table> I'm really new at Rails (just started last week), so please bear with my stupid questions. Thank you!

    Read the article

  • Ruby on Rails: create records for multiple models with one form and one submit

    - by notblakeshelton
    I have a 3 models: quote, customer, and item. Each quote has one customer and one item. I would like to create a new quote, a new customer, and a new item in their respective tables when I press the submit button. I have looked at other questions and railscasts and either they don't work for my situation or I don't know how to implement them. I also want my index page to be the page where I can create everything. quote.rb class Quote < ActiveRecord::Base attr_accessible :quote_number has_one :customer has_one :item end customer.rb class Customer < ActiveRecord::Base #unsure of what to put here #a customer can have multiple quotes, so would i use: has_many :quotes #<----? end item.rb class Item < ActiveRecord::Base #also unsure about this #each item can also be in multiple quotes quotes_controller.rb class QuotesController < ApplicationController def index @quote = Quote.new @customer = Customer.new @item = item.new end def create @quote = Quote.new(params[:quote]) @quote.save @customer = Customer.new(params[:customer]) @customer.save @item = Item.new(params[:item]) @item.save end end items_controller.rb class ItemsController < ApplicationController def index end def new @item = Item.new end def create @item = Item.new(params[:item]) @item.save end end customers_controller.rb class CustomersController < ApplicationController def index end def new @customer = Customer.new end def create @customer = Customer.new(params[:customer]) @customer.save end end quotes/index.html.erb <%= form_for @quote do |f| %> <%= f.fields_for @customer do |builder| %> <%= label_tag :firstname %> <%= builder.text_field :firstname %> <%= label_tag :lastname %> <%= builder.text_field :lastname %> <% end %> <%= f.fields_for @item do |builder| %> <%= label_tag :name %> <%= builder.text_field :name %> <%= label_tag :description %> <%= builder.text_field :description %> <% end %> <%= label_tag :quote_number %> <%= f.text_field :quote_number %> <%= f.submit %> <% end %> When I try submitting that I get an error: Can't mass-assign protected attributes: item, customer So to try and fix it I updated the attr_accessible in quote.rb to include :item, :customer but then I get this error: Item(#) expected, got ActiveSupport::HashWithIndifferentAccess(#) Any help would be greatly appreciated.

    Read the article

  • How to troubleshoot a PHP script that causes a Segmenation Fault?

    - by johnlai2004
    I posted this on stackoverflow.com as well because I'm not sure if this is a programming problem or a server problem. I'm using ubuntu 9.10, apache2, mysql5 and php5. I've noticed an unusual problem with some of my php programs. Sometimes when visiting a page like profile.edit.php, the browser throws a dialogue box asking to download profile.edit.php page. When I download it, there's nothing in the file. profile.edit.php is supposed to be a web form that edits user information. I've noticed this on some of my other php pages as well. I look in my apache error logs, and I see a segmentation fault message: [Mon Mar 08 15:40:10 2010] [notice] child pid 480 exit signal Segmentation fault (11) And also, the issue may or may not appear depending on which server I deploy my application too. Additonal Details This doesn't happen all the time though. It only happens sometimes. For example, profile.edit.php will load properly. But as soon as I hit the save button (form action="profile.edit.php?save=true"), then the page asks me to download profile.edit.php. Could it be that sometimes my php scripts consume too much resources? Sample code Upon save action, my profile.edit.php includes a data_access_object.php file. I traced the code in data_access_object.php to this line here if($params[$this->primaryKey]) { $q = "UPDATE $this->tableName SET ".implode(', ', $fields)." WHERE ".$this->primaryKey." = ?$this->primaryKey"; $this->bind($this->primaryKey, $params[$this->primaryKey], $this->tblFields[$this->primaryKey]['mysqlitype']); } else { $q = "INSERT $this->tableName SET ".implode(', ', $fields); } // Code executes perfectly up to this point // echo 'print this'; exit; // if i uncomment this line, profile.edit.php will actually show 'print this'. If I leave it commented, the browser will ask me to download profile.edit.php if(!$this->execute($q)){ $this->errorSave = -3; return false;} // When I jumped into the function execute(), every line executed as expected, right up to the return statement. And if it helps, here's the function execute($sql) in data_access_object.php function execute($sql) { // find all list types and explode them // eg. turn ?listId into ?listId0,?listId1,?listId2 $arrListParam = array_bubble_up('arrayName', $this->arrBind); foreach($arrListParam as $listName) if($listName) { $explodeParam = array(); $arrList = $this->arrBind[$listName]['value']; foreach($arrList as $key=>$val) { $newParamName = $listName.$key; $this->bind($newParamName,$val,$this->arrBind[$listName]['type']); $explodeParam[] = '?'.$newParamName; } $sql = str_replace("?$listName", implode(',',$explodeParam), $sql); } // replace all ?varName with ? for syntax compliance $sqlParsed = preg_replace('/\?[\w\d_\.]+/', '?', $sql); $this->stmt->prepare($sqlParsed); // grab all the parameters from the sql to create bind conditions preg_match_all('/\?[\w\d_\.]+/', $sql, $matches); $matches = $matches[0]; // store bind conditions $types = ''; $params = array(); foreach($matches as $paramName) { $types .= $this->arrBind[str_replace('?', '', $paramName)]['type']; $params[] = $this->arrBind[str_replace('?', '', $paramName)]['value']; } $input = array('types'=>$types) + $params; // bind it if(!empty($types)) call_user_func_array(array($this->stmt, 'bind_param'), $input); $stat = $this->stmt->execute(); if($GLOBALS['DEBUG_SQL']) echo '<p style="font-weight:bold;">SQL error after execution:</p> ' . $this->stmt->error.'<p>&nbsp;</p>'; $this->arrBind = array(); return $stat; }

    Read the article

  • python unhashable type - posting xml data

    - by eterry28
    First, I'm not a python programmer. I'm an old C dog that's learned new Java and PHP tricks, but python looks like a pretty cool language. I'm getting an error that I can't quite follow. The error follows the code below. import httplib, urllib url = "pdb-services-beta.nipr.com" xml = '<?xml version="1.0"?><!DOCTYPE SCB_Request SYSTEM "http://www.nipr.com/html/SCB_XML_Request.dtd"><SCB_Request Request_Type="Create_Report"><SCB_Login_Data CustomerID="someuser" Passwd="somepass" /><SCB_Create_Report_Request Title=""><Producer_List><NIPR_Num_List_XML><NIPR_Num NIPR_Num="8980608" /><NIPR_Num NIPR_Num="7597855" /><NIPR_Num NIPR_Num="10166016" /></NIPR_Num_List_XML></Producer_List></SCB_Create_Report_Request></SCB_Request>' params = {} params['xmldata'] = xml headers = {} headers['Content-type'] = 'text/xml' headers['Accept'] = '*/*' headers['Content-Length'] = "%d" % len(xml) connection = httplib.HTTPSConnection(url) connection.set_debuglevel(1) connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) response = connection.getresponse() print response.status, response.reason data = response.read() print data connection.close Here's the error: Traceback (most recent call last): File "C:\Python27\tutorial.py", line 14, in connection.request("POST", "/pdb-xml-reports/scb_xmlclient.cgi", params, headers) File "C:\Python27\lib\httplib.py", line 958, in request self._send_request(method, url, body, headers) File "C:\Python27\lib\httplib.py", line 992, in _send_request self.endheaders(body) File "C:\Python27\lib\httplib.py", line 954, in endheaders self._send_output(message_body) File "C:\Python27\lib\httplib.py", line 818, in _send_output self.send(message_body) File "C:\Python27\lib\httplib.py", line 790, in send self.sock.sendall(data) File "C:\Python27\lib\ssl.py", line 229, in sendall v = self.send(data[count:]) TypeError: unhashable type My log file says that the xmldata parameter is empty. Any ideas?

    Read the article

  • {PHP} Fatal error: Using $this when not in object context (Joomla)

    - by Asher
    Hi all, i don't really know php and have hit a brick wall. The problem is that my site is showing the following error... Fatal error: Using $this when not in object context in /hermes/web07/b2350/pow.thefoodie/htdocs/index.php on line 11 This is the begining of my index.php file... // no direct access define( 'YOURBASEPATH', dirname(FILE) ); ? language; ?" lang="language; ?" main_body ul li { behavior: url(baseurl; ?/templates/template ?/css/iepngfix.htc) } baseurl; ?/templates/template ?/js/pngfix.js" baseurl; ?/templates/template ?/css/template_css.css" rel="stylesheet" type="text/css" media="all" / baseurl; ?/templates/template ?/js/fx_styles.js" baseurl; ?/templates/template ?/js/accordion.js" // *************************** // // Template Parameters // // *************************** $h1 = $this-params-get("logo"); $linked_h1 = ($this-params-get("logoLinked", 1) == 0)?"false":"true"; $h1_title = $this-params-get("logoTitle"); $h2_motto = $this-params-get("logoMotto"); // Please do NOT change this unless you know what you doing. $template_path = $this-baseurl.'/templates/'.$this-template; // template path $default_font = "default"; // **************************** ? Any help would be great as i am completely lost.

    Read the article

  • How can I create a HTTP POST request with Qt 4.6.1?

    - by Tobias Langner
    How can I create a HTTP POST request with some URL encoded parameters using Qt 4.6.1? I figured out that I can create a QNetworkRequest, set all the parameters there and send it via QNetworkAccessManagers post method. But how can I add some URL-encoded parameters to the request? In the end I want to access the Eve API using Qt/C++. A Python example can be found here: http://www.eveonline.com/api/doc/example-python.asp I managed it using something like (still to be refactored and formed into something useful): QNetworkReply *requestApi(QNetworkAccessManager &nwam) { QNetworkRequest request(QUrl("http://api.eve-online.com/account/Characters.xml.aspx")); request.setHeader(QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded"); QByteArray data; QUrl params; params.addQueryItem("userid","user"); params.addQueryItem("apiKey","key"); data.append(params.toString()); data.remove(0,1); QNetworkReply *reply = nwam.post(request,data); return reply; }

    Read the article

  • PHP session_write_close() causes empty response

    - by Xeoncross
    When using session_write_close() in a shutdown function at the end of my script - PHP just dies. There is no error logged, response headers (firebug), or data (even whitespace!) returned. I have full PHP error reporting on with STRICT enabled and PHP 5.2.1. My guess is that since session_write_close() is being called after shutdown - some fatal error is being encountered that crashes PHP before it has a chance to send the output or log anything. This only happens on the logout page where I first: ... //If there is no session to delete (not started) if ( ! session_id()) { return; } // Get the session name $name = session_name(); // Delete the session cookie (if exists) if ( ! empty($_COOKIE[$name])) { //Get the current cookie config $params = session_get_cookie_params(); // Delete the cookie from globals unset($_COOKIE[$name], $_SESSION); //Delete the cookie on the user_agent setcookie($name, '', time()-43200, $params['path'], $params['domain'], $params['secure']); } // Destroy the session session_destroy(); ... then 2) do some more stuff 3) issue a redirect and 4) finally, after the whole page is done the register_shutdown_function(); I placed earlier runs and calls session_write_close() which saves the session to the database. The end. Since this blank response only occurs on logout I'm guessing that I'm not restarting the session properly which is causing session_write_close() to die fatally at the end of the script.

    Read the article

  • Strange error coming from ActiveRecord (probably)

    - by artemave
    My development environment: Ubuntu 9 Ruby 1.9.1/1.8.7 (rvm) Rails 2.3.5 Mysql 5.0 Apache Passenger Below is the part of the program flow to represent the issue. Request comes: #action def create begin @report = Report.new(params[:report]) ... rescue LocationNotFound => e ... end end Report constructor: class Report attr_accessor :locations def initialize(params = {}) @locations = params[:locations] ? fetch_locations(params[:locations]) : [] end ... end fetch_locations: def fetch_locations(loc_names) Rails.logger.debug "LOC_NAMES: " + loc_names.inspect ls = Location.find(:all, :conditions => [ # line 57 "locations.name in (#{loc_names.map{'?'}.join(',')})", *loc_names ], :include => [:sample_summaries, :samples]) # loc_names will never be empty ... end Location model: class Location < ActiveRecord::Base has_many :sample_summaries has_many :samples, :through => :sample_summaries ... end Now, the first time (after passenger restart) this runs fine and does the job. Most of the consequent times I get the error: Mar-11 11:01:00 #15098 DEBUG: LOC_NAMES: ["Moscow, RF", "London, UK"] Mar-11 11:01:00 #15098 DEBUG: Location Load (0.0ms) SELECT * FROM `locations` WHERE (locations.name in ('Moscow, RF','London, UK')) Mar-11 11:01:00 #15098 DEBUG: SampleSummary Load (0.0ms) SELECT `sample_summaries`.* FROM `sample_summaries` WHERE (`sample_summaries`.location_id IN (1,3)) Mar-11 11:01:00 #15098 DEBUG: SampleSummary Columns (0.0ms) SHOW FIELDS FROM `sample_summaries` Mar-11 11:01:00 #15098 FATAL: NoMethodError (You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.include?): app/models/report.rb:57:in `fetch_locations' app/models/report.rb:9:in `initialize' app/controllers/report_controller.rb:11:in `new' app/controllers/report_controller.rb:11:in `create' Looks quite random to me. Any ideas? P.S. I also tried to wrap the query in uncached block, but that didn't change anything. EDIT Here is what SampleSummary model looks like: class SampleSummary < ActiveRecord::Base has_many :samples belongs_to :location ... #validations default_scope :include => :samples, :order => 'rss_ts desc' ... end

    Read the article

  • Nested forms and automatic creation of parent, children

    - by Karen
    Guys, I was wondering if it was possible to create new parent, children in a has many relationship, using rails nested forms. Rails documentation clearly says that this works in a one to one relationship. Not sure if its the same in has many relationship. For example: If params = { :employee => { :name => "Tester", :account_attributes => {:login => 'tester'} } } works as one to one relationship. So Employee.new(params) works fine. New employee, account are created. Supposing I had params = { :employee => { :name => "Tester", :account_attributes => { "0" => {:login => 'tester'}, "1" => {:login => 'tester2'} } } } Employee.new(params) doesnt work. It fails on child validations saying parent cant be blank. Any help is appreciated. Thanks Karen

    Read the article

  • TypeError: coercing to Unicode: need string or buffer, User found

    - by Clemens
    hi, i have to crawl last.fm for users (university exercise). I'm new to python and get following error: Traceback (most recent call last): File "crawler.py", line 23, in <module> for f in user_.get_friends(limit='200'): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 2717, in get_friends for node in _collect_nodes(limit, self, "user.getFriends", False): File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 3409, in _collect_nodes doc = sender._request(method_name, cacheable, params) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 969, in _request return _Request(self.network, method_name, params).execute(cacheable) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 721, in __init__ self.sign_it() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 727, in sign_it self.params['api_sig'] = self._get_signature() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/pylast.py", line 740, in _get_signature string += self.params[name] TypeError: coercing to Unicode: need string or buffer, User found i use the pylast lib for crawling. what i want to do: i want to get a users friends and the friends of the users friends. the error occurs, when i have a for loop in another for loop. here's the code: network = pylast.get_lastfm_network(api_key = API_KEY, api_secret = API_SECRET, username = username, password_hash = password_hash) user = network.get_user("vidarnelson") friends = user.get_friends(limit='200') i = 1 for friend in friends: user_ = network.get_user(friend) print '#%d %s' % (i, friend) i = i + 1 for f in user_.get_friends(limit='200'): print f any advice? thanks in advance. regards!

    Read the article

  • Adding Table Columns to a Group by clause - Ruby on Rails - Postgresql

    - by bgadoci
    I am trying to use Heroku and apparently Postgresql is a lot more strict than SQL for aggregate functions. When I am pushing to Heroku I am getting an error stating the below. On another question I asked I received some guidance that said I should just add the columns to my group by clause and I am not sure how to do that. See the full error below and the PostsControll#index. SELECT posts.*, count(*) as vote_total FROM "posts" INNER JOIN "votes" ON votes.post_id = posts.id GROUP BY votes.post_id ORDER BY created_at DESC LIMIT 5 OFFSET 0): PostsController def index @tag_counts = Tag.count(:group => :tag_name, :order => 'count_all DESC', :limit => 20) conditions, joins = {}, :votes @ugtag_counts = Ugtag.count(:group => :ugctag_name, :order => 'count_all DESC', :limit => 20) conditions, joins = {}, :votes @vote_counts = Vote.count(:group => :post_title, :order => 'count_all DESC', :limit => 20) conditions, joins = {}, :votes unless(params[:tag_name] || "").empty? conditions = ["tags.tag_name = ? ", params[:tag_name]] joins = [:tags, :votes] end @posts=Post.paginate( :select => "posts.*, count(*) as vote_total", :joins => joins, :conditions=> conditions, :group => "votes.post_id", :order => "created_at DESC", :page => params[:page], :per_page => 5) @popular_posts=Post.paginate( :select => "posts.*, count(*) as vote_total", :joins => joins, :conditions=> conditions, :group => "votes.post_id", :order => "vote_total DESC", :page => params[:page], :per_page => 3) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @posts } format.json { render :json => @posts } format.atom end end

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Probably an easy one - PHP/CodeIgniter 'Undefined Variable'

    - by Jack W-H
    Morning y'all This is probably an easy one but I barely got any sleep last night and am struggling to comprehend anything. I've got a CodeIgniter library I've made called Points.php. Here's the contents of Points: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class Points { function __construct() { $this->ci =& get_instance(); $this->ci->load->database(); } function getpoints($params) { echo $userid; } } /* End of file Points.php */ /* Location: ./application/libraries/Points.php */ ?> As you can see, I'm building it up slowly and it's being kept simple. In one of my views, I want it to display the number of 'points' (which for the time being is simply the third segment of the URI). I call it like this: <p>Points: <?php $params['user_id']=$this->uri->segment(3,1); echo $this->points->getpoints($params); ?></p> The warning I get back in the view is this: A PHP Error was encountered Severity: Notice Message: Undefined variable: userid Filename: libraries/Points.php Yes I know it's such a simple problem but I've tried lots of things. Some variations include echoing in Points.php $params['userid']; etc. But I don't see what I'm doing wrong? This is my first CodeIgniter class and I've fallen at the first step, haha...

    Read the article

  • How to search inbox using zend mail

    - by Bob Cavezza
    The following is a function from zend_mail_protocol_imap. i read that to search emails, I would want to override it using zend_mail_storage_imap (which is what I'm using now to grab email from gmail). I copy and pasted the following function into zend_mail_storage_imap, but I'm having issues with the params. I can't find documentation on what to use for the array $params. I initially thought it was the search term before reading it more thoroughly. I'm out of ideas. Here's the function... /** * do a search request * * This method is currently marked as internal as the API might change and is not * safe if you don't take precautions. * * @internal * @return array message ids */ public function search(array $params) { $response = $this->requestAndResponse('SEARCH', $params); if (!$response) { return $response; } foreach ($response as $ids) { if ($ids[0] == 'SEARCH') { array_shift($ids); return $ids; } } return array(); } Initially I thought this would do the trick... $storage = new Zend_Mail_Storage_Imap($imap); $searchresults = $storage->search('search term'); But nope, I need to send the info in an array. Any ideas?

    Read the article

  • Why do you have to explicitly specify scope with friendly_id?

    - by nfm
    I'm using the friendly_id gem. I also have my routes nested: # config/routes.rb map.resources :users do |user| user.resources :events end So I have URLs like /users/nfm/events/birthday-2009. In my models, I want the event title to be scoped to the username, so that both nfm and mrmagoo can have events birthday-2009 without them being slugged. # app/models/event.rb def Event < ActiveRecord::Base has_friendly_id :title, :use_slug => true, :scope => :user belongs_to :user ... end I'm also using has_friendly_id :username in my User model. However, in my controller, I'm only pulling out events pertinent to the user who is logged in (current_user): def EventsController < ApplicationController def show @event = current_user.events.find(params[:id]) end ... end This doesn't work; I get the error ActiveRecord::RecordNotFound; expected scope but got none. # This works @event = current_user.events.find(params[:id], :scope => 'nfm') # This doesn't work, even though User has_friendly_id, so current_user.to_param _should_ return "nfm" @event = current_user.events.find(params[:id], :scope => current_user) # But this does work! @event = current_user.events.find(params[:id], :scope => current_user.to_param) SO, why do I need to explicitly specify :scope if I'm restricting it to current_user.events anyway? And why does current_user.to_param need to be called explicitly? Can I override this?

    Read the article

  • Merging Passed Parameters

    - by Josh Crowder
    I have a two data arrays sent in from a form, one called transloaded and the other video which is the actual form for the model. I need to get [:video_encoded][:url] and save that to [:video][:flash_url] This is the passed arguments or transloaded, when I try and access [:transload][:results][:video_encode] I get nil. print params[:transload] { "assembly_id":"d59b4293b3d79d2ccd1948c02421c6a6", "status":"success", "uploads":{ "video":{ "name":"bbc_one.mp4", "mime":"video/mp4", "ext":"mp4", "size":601104, "meta":{ "width":720, "height":404, "video_fps":25, "video_bitrate":null, "video_format":"avc1", "video_codec":"ffh264", "audio_bitrate":"128k", "audio_codec":"faad", "duration":3.07, "device_vendor":null, "device_name":null, "device_software":null, "latitude":null, "longitude":null }, "url":"http://tmp.transloadit.com/" } }, "results":{ "video_encode":{ "name":"bbc_one.flv", "mime":"video/x-flv", "steps":["encode","export"], "ext":"flv", "size":388317, "meta":{ "width":480, "height":320, "video_fps":25, "video_bitrate":"512k", "video_format":"FLV1", "video_codec":"ffflv", "audio_bitrate":"64k", "audio_codec":"mp3", "duration":3.11, "device_vendor":null, "device_name":null, "device_software":null, "latitude":null, "longitude":null }, "url":"http://s3.transloadit.com/b7deac9c96af6c745e914e25d0350baa/7a/2b09e822265ac2328789b40dcc02ae/bbc_one.flv" }, "video_encode_iphone":{ "name":"bbc_one.qt", "mime":"video/quicktime", "steps":["encode_iphone","export"], "ext":"qt", "size":218236, "meta":{ "width":480, "height":320, "video_fps":25, "video_bitrate":null, "video_format":"avc1", "video_codec":"ffh264", "audio_bitrate":"128k", "audio_codec":"faad", "duration":3.04, "device_vendor":null, "device_name":null, "device_software":null, "latitude":null, "longitude":null }, "url":"http://s3.transloadit.com/31/58bcc80d5345e52a42c9773125e8f0/bbc_one.qt" } } } Here is what I am trying to use video_links = { :flash_url => params[:transload][:results][:video_encode][:url], :mp4_url => params[:transload][:results][:video_encode_iphone][:url] } params[:video].merge(video_links)

    Read the article

  • Spring Stripes framework problem

    - by ali
    I am new to stripes and am attempting to integrate spring into stripes In the following code : public class ContactFormActionBeanTest { private static MockServletContext mockServletContext; private static MockHttpSession mockSession; @BeforeClass public static void setup() throws Exception { mockServletContext = new MockServletContext("webmail"); Map<String,String> params = new HashMap<String,String>(); params.put("ActionResolver.Packages", "stripesbook.action"); params.put("Extension.Packages", "stripesbook.ext," + "net.sourceforge.stripes.integration.spring"); mockServletContext.addFilter(StripesFilter.class, "StripesFilter", params); mockServletContext.setServlet(DispatcherServlet.class, "DispatcherServlet", null); mockSession = new MockHttpSession(mockServletContext); mockServletContext.addInitParameter("contextConfigLocation", "/WEB-INF/applicationContext-test.xml"); ContextLoaderListener springContextLoader = new ContextLoaderListener(); springContextLoader.contextInitialized( new ServletContextEvent(mockServletContext)); // Load mock user MockRoundtrip trip = new MockRoundtrip(mockServletContext, MockDataLoaderActionBean.class, mockSession); trip.execute(); // Login mock user trip = new MockRoundtrip(mockServletContext, LoginActionBean.class, mockSession); trip.setParameter("username", "freddy"); trip.setParameter("password", "nadia"); trip.execute("login"); } I get null in springContextLoader ContextLoaderListener springContextLoader = new ContextLoaderListener(); and test fails. Am I missing something? I am using eclipse with maven. Also when I try to deploy it for tomcat 6.0 I get following warnings: WARN net.sourceforge.stripes.util.ResolverUtil - Could not examine class 'stripesbook/ext/ContactFormatter.class' due to a java.lang.UnsupportedClassVersionError with message: Bad version number in .class file (unable to load class stripesbook.ext.ContactFormatter) I have checked to be sure that I am compiling with Java 5(set JDK compiler to 1.5) instead of 1.6 (Java 6); but didn't work out for me and still have problems running spring-stripes integrated project.

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >