Search Results

Search found 3143 results on 126 pages for 'br hudgens'.

Page 23/126 | < Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >

  • C# Error reading two dates from a binary file

    - by Jamie
    Hi all, When reading two dates from a binary file I'm seeing the error below: "The output char buffer is too small to contain the decoded characters, encoding 'Unicode (UTF-8)' fallback 'System.Text.DecoderReplacementFallback'. Parameter name: chars" My code is below: static DateTime[] ReadDates() { System.IO.FileStream appData = new System.IO.FileStream( appDataFile, System.IO.FileMode.Open, System.IO.FileAccess.Read); List<DateTime> result = new List<DateTime>(); using (System.IO.BinaryReader br = new System.IO.BinaryReader(appData)) { while (br.PeekChar() > 0) { result.Add(new DateTime(br.ReadInt64())); } br.Close(); } return result.ToArray(); } static void WriteDates(IEnumerable<DateTime> dates) { System.IO.FileStream appData = new System.IO.FileStream( appDataFile, System.IO.FileMode.Create, System.IO.FileAccess.Write); List<DateTime> result = new List<DateTime>(); using (System.IO.BinaryWriter bw = new System.IO.BinaryWriter(appData)) { foreach (DateTime date in dates) bw.Write(date.Ticks); bw.Close(); } } What could be the cause? Thanks

    Read the article

  • How to parse text fragments located outside tags (inbetween tags) by simplehtmldom?

    - by moogeek
    Hello! I'm using simplehtmldom to parse html and I'm stuck in parsing plaintext located outside of any tag (but between two different tags): <div class="text_small"> <b>?dress:</b> 7 Hange Road<br> <b>Phone:</b> 415641587484<br> <b>Contact:</b> Alex<br> <b>Meeting Time:</b> 12:00-13:00<br> </div> Is it possible to get these values of Adress, Phone, Contact, Meeting Time? I wonder if there is a opportunity to pass CSS Selectors into nextSibling/previousSibling functions... foreach($html->find('div.text_small') as $div_descr) { foreach($div_descr->find('b') as $b) { if ($b->innertext=="?dress:") {//someaction } if ($b->innertext=="Phone:") { //someaction } if ($b->innertext=="Contact:") { //someaction } if ($b->innertext=="Meeting Time:") { //someaction } } } What I should use instead "someaction" ? upd. Yes, I don't have an access for editing the target page. Otherwise, would it be worth to? :)

    Read the article

  • Problem locating file in a classpath

    - by Gandalf StormCrow
    I'm trying to read in file content, ex : public void myMethod(){ FileInputStream fstream = new FileInputStream(fileLocation); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; while ((strLine = br.readLine()) != null) { .... .... ..... end while end method And I have at the begining of the class body private String fileLocation; and at the end of a class I have a getter and setter for it. Now I'm trying inject this file location from spring inside bean from this class and I specify the init-method of this class. But I get error cannot find the specified file as if its not on a classpath but it is inside war file? I'm building the project with maven and I put file in src/main/resources This is the error I get when trying to read file : Error: src\main\resources\ids.txt (The system cannot find the path specified) That is when I tried this : FileInputStream fstream = new FileInputStream("src\\main\\resources\\ids.txt"); how to reference the properly from the classpath? EDIT When I edit my code according to @BalusC solution , here is how it looks but I still get null error : ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream input = classLoader.getResourceAsStream("src/main/resources/ids.txt"); // Get the object of DataInputStream BufferedReader br = new BufferedReader(new InputStreamReader(input)); String strLine; while ((strLine = br.readLine()) != null) { .... .... ..... end while end method

    Read the article

  • Asp.net PopupControlExtender inside UpdatePabel

    - by user296422
    Hi, So i use PopupControlExtender (to edit some of the fields) inside ListViewControl which itself is embeded inside an UpdatePanel. The problem is as follows whenever you cause partail postback the popup panels are created client side outside the updatepanel. And you get more clientside controls with the same clientside ID. When you postback with popup panel the server side control eg. Texbox has Text = clientsidecontrol1.text, clientsidecontrol2.text, clientsidecontrol.text3 Is there a way to prevent this. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Secure_Test" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> </cc1:ToolkitScriptManager> <div> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Label ID="InputLabel" runat="server" Text="Whatever you put in the textbox"></asp:Label> <br /> <asp:Label runat="server"> <%= DateTime.Now.ToString() %></asp:Label> <br /> <asp:Button ID="Button1" runat="server" Text="Refresh" /> <br /> <asp:LinkButton ID="PopupLB" runat="server">Popup</asp:LinkButton> <br /> <cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" PopupControlID="Panel1" TargetControlID="PopupLB" CommitProperty="Value"> </cc1:PopupControlExtender> <asp:Panel ID="Panel1" runat="server"> <asp:UpdatePanel ID="UpdatePanel2" runat="server"> <ContentTemplate> <asp:TextBox ID="InputTB" runat="server"></asp:TextBox> <asp:Button ID="SubmitBTN" runat="server" Text="Submit" onclick="SubmitBTN_Click" UseSubmitBehavior="false" /> </ContentTemplate> </asp:UpdatePanel> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> </div> </form> </body> </html> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using AjaxControlToolkit; public partial class Secure_Test : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void SubmitBTN_Click(object sender, EventArgs e) { PopupControlExtender pce = AjaxControlToolkit.PopupControlExtender.GetProxyForCurrentPopup(Page); pce.Commit("Popup"); InputLabel.Text = InputTB.Text; } } To make it easier to test i post the code of an example page i used for testing. To make myself clear here is an example: i click Popup. Type "asdf" in the textbox and click Submit. InputPanel dispalys "asdf" i click Popup again. Type "qwerty" in the textbox and click Submit. InputPanel now displays "qwerty,asdf" When you check it the firebug you get this: <form id="form1" action="Test.aspx" method="post" name="form1"> <div> <input type="hidden" value=";;AjaxControlToolkit, Version=3.0.30930.21526, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e:pl-PL:c83bc095-c5d9-40da-b175-dc46338fcc3a:865923e8:91bd373d:596d588c:411fea1c:e7c87f07:bbfda34c:30a78ec5:42b7c466;" id="ToolkitScriptManager1_HiddenField" name="ToolkitScriptManager1_HiddenField"> </div> <script type="text/javascript"> //&lt;![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]&gt; </script> <script type="text/javascript" src="/WebResource.axd?d=B2RAZw_YugtketKJqWIbXA2&amp;t=634051184591131846"></script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66f0flKVDmPL2woIPesut_FUpsFZUN2A5sDN7IOqPUOZO41&amp;t=1a45d080"></script> <script type="text/javascript"> //&lt;![CDATA[ if (typeof(Sys) === 'undefined') throw new Error('Ladowanie struktury strony klienta ASP.NET Ajax nie powiodlo sie.'); //]]&gt; </script> <script type="text/javascript" src="/ScriptResource.axd?d=zifZiisoqXYJSwLXuAZ4DmtrWVvn9x0W1r7qfDo40UU7q9QYoa5ChdBZD6dDL66fyxEJaYB3uJEQ0r_TmOPczeBZ1gpFH5a6x4ug130lptsKAcGA3S1vt08sHQo5sFtH0&amp;t=1a45d080"></script> <script type="text/javascript" src="/Secure/Test.aspx?_TSM_HiddenField_=ToolkitScriptManager1_HiddenField&amp;_TSM_CombinedScripts_=%3b%3bAjaxControlToolkit%2c+Version%3d3.0.30930.21526%2c+Culture%3dneutral%2c+PublicKeyToken%3d28f01b0e84b6d53e%3apl-PL%3ac83bc095-c5d9-40da-b175-dc46338fcc3a%3a865923e8%3a91bd373d%3a596d588c%3a411fea1c%3ae7c87f07%3abbfda34c%3a30a78ec5%3a42b7c466"></script> <div> </div> <script type="text/javascript"> //&lt;![CDATA[ Sys.WebForms.PageRequestManager._initialize('ToolkitScriptManager1', document.getElementById('form1')); Sys.WebForms.PageRequestManager.getInstance()._updateControls(['tUpdatePanel1','tUpdatePanel2'], [], [], 90); //]]&gt; </script> <div> <div id="UpdatePanel1"> <span id="InputLabel">qwerty,asdf</span> <br> <span>2010-06-15 18:26:50</span> <br> <input type="submit" id="Button1" value="Refresh" name="Button1"> <br> <a href="javascript:__doPostBack('PopupLB','')" id="PopupLB">Popup</a> <br> </div> </div> <script type="text/javascript"> //&lt;![CDATA[ (function() {var fn = function() {$get('ToolkitScriptManager1_HiddenField').value = '';Sys.Application.remove_init(fn);};Sys.Application.add_init(fn);})();Sys.Application.initialize(); Sys.Application.add_init(function() { $create(AjaxControlToolkit.PopupControlBehavior, {"CommitProperty":"Value","PopupControlID":"Panel1","dynamicServicePath":"/Secure/Test.aspx","id":"PopupControlExtender1"}, null, null, $get("PopupLB")); }); //]]&gt; </script> <div id="Panel1" style="position: absolute; left: 8px; top: 73px; z-index: 1000; display: none; visibility: hidden;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><span style="display: none ! important;"><input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value=""></span><span style="display: none ! important;"><input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value=""></span><span style="display: none ! important;"><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMTkwNzc2NzAzD2QWAgIDD2QWAgIDD2QWAmYPZBYCAgEPDxYCHgRUZXh0BQtxd2VydHksYXNkZmRkZApLPc2nZUC+UkZsCrByuofHMah5"></span><span style="display: none ! important;"><input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBQLi2qWdAwKM54rGBgKIkJujDQKbjp+pDQKc7v+tArliNtJzeG8HrfsGBBXIViJAUGMz"></span><div id="Panel1" style="visibility: hidden; position: absolute; left: 8px; top: 73px; z-index: 1000; display: none;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div><div id="Panel1" style="display: none; visibility: hidden; position: absolute;"> <div id="UpdatePanel2"> <input type="text" id="InputTB" value="qwerty,asdf" name="InputTB"> <input type="button" id="SubmitBTN" onclick="javascript:__doPostBack('SubmitBTN','')" value="Submit" name="SubmitBTN"> </div> </div></form> InputTB and Panel1 where generated 3 time.

    Read the article

  • Inserting an image into sqlserver gives an "operand type clash"

    - by Termedi
    I'm trying to save an image in a sql server 2000 database. The data type of the column is image. Here is the code: Image Upload: <?php include('config.php'); if(is_uploaded_file($_FILES['userfile']['tmp_name'])) { $fileName = $_FILES['userfile']['name']; $tmpName = $_FILES['userfile']['tmp_name']; $fileSize = $_FILES['userfile']['size']; $fileType = $_FILES['userfile']['type']; $size = filesize($tmpName); set_magic_quotes_runtime(0);//to desactive the default escape spacials caracters made by PHP in the externes files $img_binaire = base64_encode(fread(fopen(str_replace("'","''",$tmpName), "r"), $size)); $query = "INSERT INTO test_image (image_name, image_content, image_size) ". "VALUES ('{$fileName}','{$img_binaire}', '{$size}')"; odbc_exec($conn, $query) or die('Error, query failed'); echo "<br>File $fileName uploaded<br>"; echo "<br>File Size: $fileSize <br>"; } ?> Image Show: <?php include('config.php'); $sql = "select * from test_image where id =2"; $rsl = odbc_exec($conn, $sql); $image_info = odbc_fetch_array($rsl); //$count = sizeof($image_info['image_content']); //header('Accept-Ranges: bytes'); //header('Content-Length: '.$image_info['image_size']); //header("Content-length: 17397"); header('Content-Type: image/jpeg'); echo base64_decode($image_info['image_content']); //echo bindec($image_info['image_content']); ?> It gives the following error: Error: Warning: odbc_exec() [function.odbc-exec]: SQL error: [Microsoft][ODBC SQL Server Driver][SQL Server]Operand type clash: text is incompatible with image, SQL state 22005 in SQLExecDirect in C:\xampp\htdocs\test\upload.php on line 25 Error, query failed What do I need to do differently?

    Read the article

  • How do I set default search conditions with Searchlogic?

    - by Danger Angell
    I've got a search form on this page: http://staging-checkpointtracker.aptanacloud.com/events If you select a State from the dropdown you get zero results because you didn't select one or more Event Division (checkboxes). What I want is to default the checkboxes to "checked" when the page first loads...to display Events in all Divisions...but I want changes made by the user to be reflected when they filter. Here's the index method in my Events controller: def index @search = Event.search(params[:search]) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @events } end end Here's my search form: <% form_for @search do |f| %> <div> <%= f.label :state_is, "State" %> <%= f.select :state_is, ['AK','AL','AR','AZ','CA','CO','CT','DC','DE','FL','GA','HI','IA','ID','IL','IN','KS','KY','LA','MA','MD','ME','MI','MN','MO','MS','MT','NC','ND','NE','NH','NJ','NM','NV','NY','OH','OK','OR','PA','RI','SC','SD','TN','TX','UT','VA','VT','WA','WI','WV','WY'], :include_blank => true %> </div> <div> <%= f.check_box :division_like_any, {:name => "search[:division_like_any][]"}, "Sprint", :checked => true %> Sprint (2+ hours)<br/> <%= f.check_box :division_like_any, {:name => "search[:division_like_any][]"}, "Sport" %> Sport (12+ hours)<br/> <%= f.check_box :division_like_any, {:name => "search[:division_like_any][]"}, "Adventure" %> Adventure (18+ hours)<br/> <%= f.check_box :division_like_any, {:name => "search[:division_like_any][]"}, "Expedition" %> Expedition (48+ hours)<br/> </div> <%= f.submit "Find Events" %> <%= link_to 'Clear', '/events' %> <% end %>

    Read the article

  • does php mysql_fetch_array works with html input box?

    - by dexter
    this is my entire PHP code: <?php if(empty($_POST['selid'])) {echo "no value selected"; } else { $con = mysql_connect("localhost","root",""); if(mysql_select_db("cdcol", $con)) { $sql= "SELECT * FROM products where Id = '$_POST[selid]'"; if($result=mysql_query($sql)) { echo "<form name=\"updaterow\" method=\"post\" action=\"dbtest.php\">"; while($row = mysql_fetch_array($result)) { echo "Id :<input type=\"text\" name=\"ppId\" value=".$row['Id']." READONLY></input></br>"; echo "Name :<input type=\"text\" name=\"pName\" value=".$row['Name']."></input></br>"; echo "Description :<input type=\"text\" name=\"pDesc\" value=".$row['Description']."></input></br>"; echo "Unit Price :<input type=\"text\" name=\"pUP\" value=".$row['UnitPrice']."></input></br>"; echo "<input type=\"hidden\" name=\"mode\" value=\"Update\"/>"; } echo "<input type=\"submit\" value=\"Update\">"; echo "</form>"; } else {echo "Query ERROR";} } } ?> PROBLEM here is, ....if the value i am getting from database using mysql_fetch_array($result) is like:(say Description is:) "my product" then; in input box it shows only "my" the word(or digit) after "SPACE"(ie blank space) doesn't get displayed? can input box like above can display the data with two or more words(separated by blank spaces)?

    Read the article

  • PHP Parse Error Help Needed

    - by adcmarti
    I am receiving this PHP parse error on the last line of this php file. What am I missing? Here is the last 15 lines or so. <div id="footer"> <br /> <p><b>Member Total:</b><?php echo $database->getNumMembers(); ?> <br>There are <?php echo $database->num_active_users; ?> registered members and <?php $database->num_active_guests; ?> guests viewing the site.<br><br> <?php include("include/view_active.php"); ?> </p> </div><!-- #footer --> <? } ?> </div><!-- #main --> <?php include("_footer.html"); ?> Any help would be appreciated. Thank you!

    Read the article

  • CSS: "float:left" doesn't work as expected

    - by Patrick
    hi, I want to display 2 columns of images using "float:left", and I dunno why the 3rd image is on the right. See screenshot:http://dl.dropbox.com/u/72686/imagesFloat.png See HTML: <div class="field-item odd"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%202.png" title=""><br> <span>description1</span> </div> <div class="field-item even"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%203.png" title=""><br> <span>description2</span> </div> <div class="field-item odd"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%204.png" title=""><br> <span>description3</span> </div> <div class="field-item even"> <img alt="" class="filefield-imagecache-galleryImage" src="http://localhost/bernardi/sites/default/files/Picture%205.png" title=""><br> <span></span> </div> see CSS: .field-field-image .odd { padding-right:20px; } .field-field-image .even { padding-left:20px; } .field-field-image .field-item { float:left; } thanks

    Read the article

  • Drupal db_query_range sql query

    - by hfidgen
    Hiya, I'm trying to get this working and the query executes but nothing comes back.. I've tried everything I can think of, can you spot what I'm doing wrong? Thanks in advance! $nido = $node->nid; $result = db_query_range(' SELECT i.nid, i.iid, a.fid, p.filename, p.filepath FROM {drup_image_attach} i LEFT JOIN {drup_image} a ON i.iid = a.nid LEFT JOIN {drup_files} p ON a.fid = p.fid WHERE i.nid = %d AND p.filename = "recipe_thumb"', $nido, 0, 10); echo "Filepath = " . $result ->filepath. "<br>"; echo "Filepath = " . $result ->filename . "<br>"; echo "IID = " . $result ->iid. "<br>"; echo "NID = " . $result ->nid . "<br>"; } EDIT - sorted out a couple of bits, but the output is still empty!

    Read the article

  • Urgent: Sort HashSet() function data in sequence

    - by vincent low
    i am new to java, the function i like to perform is something like: i will load a series of data from a file, into my hashSet() function. the problem is, i able to enter all the data in sequence, but i cant retrieve it out in sequence base on the account name in the file. any 1 can help to give a comment? below is my code: public Set retrieveHistory(){ Set dataGroup = new HashSet(); try{ File file = new File("C:\\Documents and Settings\\vincent\\My Documents\\NetBeansProjects\\vincenttesting\\src\\vincenttesting\\vincenthistory.txt"); BufferedReader br = new BufferedReader(new FileReader(file)); String data = br.readLine(); while(data != null){ System.out.println("This is all the record:"+data); Customer cust = new Customer(); //break the data based on the , String array[] = data.split(","); cust.setCustomerName(array[0]); cust.setpassword(array[1]); cust.setlocation(array[2]); cust.setday(array[3]); cust.setmonth(array[4]); cust.setyear(array[5]); cust.setAmount(Double.parseDouble(array[6])); cust.settransaction(Double.parseDouble(array[7])); dataGroup.add(cust); //then proced to read next customer. data = br.readLine(); } br.close(); }catch(Exception e){ System.out.println("error" +e); } return dataGroup; } public static void main(String[] args) { FileReadDataModel fr = new FileReadDataModel(); Set customerGroup = fr.retrieveHistory(); System.out.println(e); for(Object obj : customerGroup){ Customer cust = (Customer)obj; System.out.println("Cust name :" +cust.getCustomerName()); System.out.println("Cust amount :" +cust.getAmount()); }

    Read the article

  • Java resource closing

    - by Bob
    Hi, I'm writing an app that connect to a website and read one line from it. I do it like this: try{ URLConnection connection = new URL("www.example.com").openConnection(); BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream())); String response = rd.readLine(); rd.close(); }catch (Exception e) { //exception handling } Is it good? I mean, I close the BufferedReader in the last line, but I do not close the InputStreamReader. Should I create a standalone InputStreamReader from the connection.getInputStream, and a BufferedReader from the standalone InputStreamReader, than close all the two readers? I think it will be better to place the closing methods in the finally block like this: InputStreamReader isr = null; BufferedReader br = null; try{ URLConnection connection = new URL("www.example.com").openConnection(); isr = new InputStreamReader(connection.getInputStream()); br = new BufferedReader(isr); String response = br.readLine(); }catch (Exception e) { //exception handling }finally{ br.close(); isr.close(); } But it is ugly, because the closing methods can throw exception, so I have to handle or throw it. Which solution is better? Or what would be the best solution?

    Read the article

  • jquery appendTo form

    - by user313271
    jquery $(function(){ $('#4').click(function() { $('<input name="if4" type="text" value="other price>"').appendTo('form'); }); }); html <form> < input name="name" type="text" value="Enter your name" /><br /> < input name="contacts" type="text" value="Contact info" /><br /> < select name="services"> < option value="1">1</option> < option value="2">2</option> < option value="3">3</option> < option id="4" value="Other">4</option> < /select><br /> < textarea name="description">Description</textarea><br /> < /form> What i want to do: When i press on option value nr 4, there appears is new input field, this thing works fine. But how can I to change order where input field gonna appear, because now it appears after textfield, how can i put it after ? Thank you

    Read the article

  • Updating extra attributes in a has_many, :through relationship using Rails

    - by Robbie
    I've managed to set up a many-to-many relationship between the following models Characters Skills PlayerSkills PlayerSkills, right now, has an attribute that Skills don't normally have: a level. The models look something like this (edited for conciseness): class PlayerSkill < ActiveRecord::Base belongs_to :character belongs_to :skill end class Skill < ActiveRecord::Base has_many :player_skills has_many :characters, :through => :player_skills attr_accessible :name, :description end class Character < ActiveRecord::Base belongs_to :user has_many :player_skills has_many :skills, :through => :player_skills end So nothing too fancy in the models... The controller is also very basic at this point... it's pretty much a stock update action. The form I'm looking to modify is characters#edit. Right now it renders a series of checkboxes which add/remove skills from the characters. This is great, but the whole point of using has_many :through was to track a "level" as well. Here is what I have so far: - form_for @character do |f| = f.error_messages %p = f.label :name %br = f.text_field :name %p = f.label :race %br = f.text_field :race %p = f.label :char_class %br = f.text_field :char_class %p - @skills.each do |skill| = check_box_tag "character[skill_ids][]", skill.id, @character.skills.include?(skill) =h skill.name %br %p = f.submit After it renders "skill.name", I need it to print a text_field that updates player_skill. The problem, of course, is that player_skill may or may not exist! (Depending on if the box was already ticked when you loaded the form!) From everything I've read, has_many :through is great because it allows you to treat the relationship itself as an entity... but I'm completely at a loss as to how to handle the entity in this form. As always, thanks in advance for any and all help you can give me!

    Read the article

  • AJAX CascadingDropDown ViewState Problem

    - by Steven
    Question: How do I maintain both the contents (from queries) and selected value of both dropdowns after postback? Source Code: Download my source code from this link (link now works). Just add a reference to your AjaxControlToolkit User Action: Select a value from each dropdown. Click Submit. After Postback: StatesDrop: (Selected value), CitiesDrop "Select a City" Before and after: I believe that when the first dropdown gets its selected value, the second dropdown refreshes and therefore loses its selected value. C# answers also welcome. Default.aspx Active States<br /><asp:DropDownList ID="StatesDrop" runat="server" /><br /> Active Cities<br /><asp:DropDownList ID="CitiesDrop" runat="server" /><br /> <ajax:CascadingDropDown ID="StatesCasc" TargetControlID="StatesDrop" ServicePath="WebService1.asmx" ServiceMethod="GetActiveStates" Category="States" runat="server" PromptText="Select a State" PromptValue="?" /> <ajax:CascadingDropDown ID="CitiesCasc" TargetControlID="CitiesDrop" ServicePath="WebService1.asmx" ServiceMethod="GetActiveCities" Category="Cities" runat="server" ParentControlID="StatesDrop" PromptText="Select a City" PromptValue="?" /> WebService1.asmx.vb Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Web.Script.Services Imports AjaxControlToolkit <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding _ (ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class WebService1: Inherits System.Web.Services.WebService <WebMethod()> _ Public Function GetActiveStates (ByVal knownCategoryValues As String, _ ByVal category As String) As CascadingDropDownNameValue() Dim values As New List(Of CascadingDropDownNameValue)() 'Fill values array' Return values.ToArray() End Function <WebMethod()> _ Public Function GetActiveCities (ByVal knownCategoryValues As String, _ ByVal category As String) As CascadingDropDownNameValue() Dim values As New List(Of CascadingDropDownNameValue)() Dim kv As StringDictionary = _ CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues) Dim SelState As String = "" If kv.ContainsKey("State") Then SelState = kv("State") 'Fill values array' Return values.ToArray() End Function End Class Default.aspx.vb Imports System.Web.Services Imports System.Web.Script.Services Imports AjaxControlToolkit Partial Public Class _Default Inherits System.Web.UI.Page Protected Sub Submit_Click(ByVal sender As Object, _ ByVal e As EventArgs) Handles SubmitBtn.Click ResultsGrid.DataBind() End Sub End Class

    Read the article

  • javascript: what does this syntax means?

    - by user1067138
    it is like this: (function () { //codes here })(); here is an example: (function () { var D = TED.EditorCore, E = TED.extend, A = TED.EditorInstanceManager, B = TED.augmentObject; window.TED["SimpleEditor"] = C; function C(F) { C.superclass.call(this, F) } C.defaultConfig = { height: "100px", width: "400px", //blablabla... flashNumLimit: 10, didaDelay: 300, imageWidthLimit: 570 }; E(C, D, { getContentLength: function () { return Math.ceil(this.filteHTML(this.editArea.innerHTML, ["img", "br"]).replace(/<img[^>]*>/gi, "mm").replace(/<br[^>]*>/gi, "m").replace(/&nbsp;/gi, "m").replace(/[^\x00-\xff]/g, "mm").length / 2) }, filteEditHTML: function () { return html = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<\\/?(?:br[^>]*)>", "gi"), "[$1]").replace(new RegExp('<span([^>]*class="?at"?[^>]*)>', "gi"), "[span$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.emptyClassName + "|" + this.config.smileyClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:br|img|span)[^\\]]*)\\]", "gi"), "<$1>") }, filteSubmitHTML: function () { this.reLayout(); var G = this.editArea.innerHTML.replace(/_moz_dirty=""/gi, "").replace(/\[/g, "[[-").replace(/\]/g, "-]]").replace(new RegExp("<(/?(?:" + this.submitValidHTML.join("|") + ")[^>]*)>", "gi"), "[$1]").replace(new RegExp('<img([^>]*class="?(?:' + this.config.imageClassName + "|" + this.config.smileyClassName + "|" + this.config.flashClassName + "|" + this.config.musicClassName + ')"?[^>]*)>', "gi"), "[img$1]").replace(/<[^>]*>/g, "").replace(/\[\[\-/g, "[").replace(/\-\]\]/g, "]").replace(new RegExp("\\[(/?(?:" + this.submitValidHTML.join("|") + "|img)[^\\]]*)\\]", "gi"), "<$1>"); var F = document.createElement("div"); F.innerHTML = G; this.parseURL(F); return F.innerHTML } }); B(C, A) })(); what exactly does (funtion (){})(); do?

    Read the article

  • JQuery printfunction: no content, no view

    - by Joris
    I got a JQuery printfunction: function doPrintPage() { myWindow = window.open('', '', 'titlebar=yes,menubar=yes,status=yes,scrollbars=yes,width=800,height=600'); myWindow.document.open(); myWindow.document.write(document.getElementById("studentnummer").value); myWindow.document.write(document.getElementById("Voornaam").value + " " + document.getElementById("Tussenvoegsel").value + " " + document.getElementById("Achternaam").value); myWindow.document.write("</br>"); myWindow.document.write("Result"); myWindow.document.write(document.getElementById('tab1').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Tree"); myWindow.document.write(document.getElementById('tab2').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Open"); myWindow.document.write(document.getElementById('tab3').innerHTML); myWindow.document.write("</br>"); myWindow.document.write("Free"); myWindow.document.write(document.getElementById('tab4').innerHTML); myWindow.document.close(); myWindow.focus(); } There are 3 gridviews (elements in "tab#"), and on the page that is generated by this script, eacht gridview gets a header (Results, Tree, Open, Free). It is possible that there is no gridview for "Tree". It would be nice if the "tree" header wouldn't be shown either. EDIT: I tried this: if ($('tab4')[0]) {myWindow.document.write("Free"); myWindow.document.write(document.getElementById('tab4').innerHTML); but it seems not to work either... Anyone knows the solution?

    Read the article

  • Yahoo BOSS Question

    - by Fincha
    Hello everyone, I wonna to echo totalresults but somethink is wrong. // Get search results from Yahoo BOSS as an XML* $API = 'http://boss.yahooapis.com/ysearch/web/v1/'; $request = $API . $query .'?format=xml&appid='. APP_ID.'&start='.$start."0"; $ch = curl_init($request); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HEADER, 0); $xml = simplexml_load_string(curl_exec($ch)); echo $xml->resultset_web->totalhits; // Display search results - Title, Date and URL. foreach ($xml->resultset_web->result as $result) { $ausgabe .= '<a href="'.$result->clickurl.'">'.$result->title.'</a><br />'; $ausgabe .= $result->abstract."<br>"; $ausgabe .= '<a href="'.$result->clickurl.'">'.$result->url."</a> - ".round(($result->size/1024), 2)." Kb<br><br>"; } Can someone help me

    Read the article

  • Jquery get each div's sub child divs and grab info into an array

    - by McNabbToSkins
    I have a some html that looks like this <div id="main"> <div id="sub_main_1" class="sub_main"> <input type="text" class="sub_name_first" /><br /> <input type="text" class="sub_name_second" /><br /> </div> <div id="sub_main_2" class="sub_main"> <input type="text" class="sub_name_first" /><br /> <input type="text" class="sub_name_second" /><br /> </div> </div> I would like to pull out each sub_main divs information into an array in javascript. So far I have this as my jquery code $('#main').find('.sub_main').each( function() { alert('hi'); }); The alert is just a test that it should show "hi" twice. But this is not working. I am also not clear on how I can store the two inputs in a javascript array. Any help would be great! Thanks,

    Read the article

  • Table HTML problem..

    - by Azzyh
    hello i am trying to setup tables so the result outcomes like this: code: <table width="60%" cellpadding="0" cellspacing="1" id="theBoxer"> <tr style="background: #686868 ;"> <td align="center" valign="top" width="240" height="25" style="border:1px #FFF solid;">About me</td> </tr> <tr> <td align="left" valign="top" width="250" height="112" style=""> Points:<br> Lalala: <br> Lalala: <br> </td> <td align="left" valign="top" width="250" height="112" style=""> Lalala: <br> Lalala: </tr> </table> cant get it to work like how i wanted. the problem i get with my code is that "About me" only covers for the first td and not the other

    Read the article

  • Send email in wordpress

    - by jul
    hi, I'm trying to send an email using PHP mail() in a wordpress site. I created an empty page http://www.exam-vision.com/request-flip-up-instructions which template includes the php code shown below. When I post the data, isset($_REQUEST['email']) is false, while I can in firebug that the data have been posted correctly. What can be wrong? thanks <?php if (isset($_REQUEST['email'])) //if "email" is filled out, send email { //send email $email = $_REQUEST['email'] ; $subject = $_REQUEST['subject'] ; $message = $_REQUEST['message'] ; mail( "<someemail>", "Subject: $subject", $message, "From: $email" ); echo "Thank you for using our mail form"; } else //if "email" is not filled out, display the form { echo "<form method='post' action='http://www.exam-vision.com/request-flip-up-instructions'> Email: <input name='email' type='text' /><br /> Subject: <input name='subject' type='text' /><br /> Message:<br /> <textarea name='message' rows='15' cols='40'> </textarea><br /> <input type='submit' /> </form>"; } ?>

    Read the article

  • sending email in php unable to use HTML tags

    - by JPro
    I am trying to send an email through the result sets generated in MySQL in PHP This is the code. <?php $txtMsg = '<table><th>Name</th>'; $txtMsg = ''; mysql_connect("localhost", "root", "pop") or die(mysql_error()); mysql_select_db("jpd") or die(mysql_error()); $oustanding = mysql_query("select Name from results") or die(mysql_error()); $num=mysql_num_rows($oustanding); while($row1 = mysql_fetch_array( $oustanding )) { ?> <tr> <td><h3><?php echo $row1['Name']; ?></h3></td> </tr> <?php $txtMsg .= "<tr><td>".$row1['Name']."</td></tr>"; } ini_set ( "SMTP", "xy.domain.com" ); $mail_to= '[email protected]'; $mail_from='[email protected]'; $mail_sub='OutStanding Results'; $mail_mesg=$txtMsg; //Check for success/failure of delivery if(mail($mail_to,$mail_sub,$mail_mesg,"From: $mail_from")) echo "<br><br>Email Successfully Sent!"; else echo "<br><br>Error Sending Email!"; } ?> The problem is , I want the results to be displayed in table format. But instead of processing the html tags, they are getting printed as well. How to get the email with table format? Thanks.

    Read the article

  • Cache Class compilation error using parent-child relationships and cache sql storage

    - by Fred Altman
    I have the global listed below that I'm trying to create a couple of cache classes using sql stoarage for: ^WHEAIPP(1,26,1)=2 ^WHEAIPP(1,26,1,1)="58074^^SMSNARE^58311" 2)="58074^59128^MPHILLIPS^59135" ^WHEAIPP(1,29,1)=2 ^WHEAIPP(1,29,1,1)="58074^^SMSNARE^58311" 2)="58074^59128^MPHILLIPS^59135" ^WHEAIPP(1,93,1)=2 ^WHEAIPP(1,93,1,1)="58884^^SSNARE^58948" 2)="58884^59128^MPHILLIPS^59135" ^WHEAIPP(1,166,1)=2 ^WHEAIPP(1,166,1,1)="58407^^SMSNARE^58420" 2)="58407^59128^MPHILLIPS^59135" ^WHEAIPP(1,324,1)=2 ^WHEAIPP(1,324,1,1)="58884^^SSNARE^58948" 2)="58884^59128^MPHILLIPS^59135" ^WHEAIPP(1,419,1)=3 ^WHEAIPP(1,419,1,1)="59707^^SSNARE^59708" 2)="59707^^MPHILLIPS^59910,58000^^^^" 3)="59707^59981^SSNARE^60117,53241^^^^" The first two subscripts of the global (Hmo and Keen) make a unique entry. The third subscript (Seq) has a property (IppLineCount) which is the number of IppLines in the fourth subscript level (Seq2). I create the class WIppProv below which is the parent class: /// <PRE> /// ============================ /// Generated Class Definition /// Table: WMCA_B_IPP_PROV /// Generated by: FXALTMAN /// Generated on: 05/21/2012 13:46:41 /// Generator: XWESTblClsGenV2 /// ---------------------------- /// </PRE> Class XFXA.MCA.WIppProv Extends (%Persistent, %XML.Adaptor) [ ClassType = persistent, Inheritance = right, ProcedureBlock, StorageStrategy = SQLMapping ] { /// .HMO Property Hmo As %Integer; /// .KEEN Property Keen As %Integer; /// .SEQ Property Seq As %String; Property IppLineCount As %Integer; Index iMaster On (Hmo, Keen, Seq) [ IdKey, Unique ]; Relationship IppLines As XFXA.MCA.WIppProvLine [ Cardinality = many, Inverse = relWIppProv ]; <Storage name="SQLMapping"> <DataLocation>^WHEAIPP</DataLocation> <ExtentSize>1000000</ExtentSize> <SQLMap name="DBMS"> <Data name="IppLineCount"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>1</Piece> </Data> <Global>^WHEAIPP</Global> <PopulationType>full</PopulationType> <Subscript name="1"> <AccessType>Sub</AccessType> <Expression>{Hmo}</Expression> <LoopInitValue>1</LoopInitValue> </Subscript> <Subscript name="2"> <AccessType>Sub</AccessType> <Expression>{Keen}</Expression> </Subscript> <Subscript name="3"> <AccessType>Sub</AccessType> <LoopInitValue>1</LoopInitValue> <Expression>{Seq}</Expression> </Subscript> <Type>data</Type> </SQLMap> <StreamLocation>^XFXA.MCA.WIppProvS</StreamLocation> <Type>%Library.CacheSQLStorage</Type> </Storage> } This class compiles fine. Next I created the WIppProvLine class listed below and made a parent-child relationship between the two: /// Used to represent a single line of IPP data Class XFXA.MCA.WIppProvLine Extends (%Persistent, %XML.Adaptor) [ ClassType = persistent, Inheritance = right, ProcedureBlock, StorageStrategy = SQLMapping ] { /// .CLM_AMT_ALLOWED node: 0 piece: 6<BR> /// This field should be used in conjunction with the Claim Operator field to /// define a whole claim dollar amount at which a particular claim should be /// flagged with a Pend status. Property ClmAmtAllowed As %String; /// .CLM_LINE_AMT_ALLOWED node: 0 piece: 8<BR> /// This field should be used in conjunction with the Clm Line Operator field to /// define a claim line dollar amount at which a particular claim should be flagged /// with a Pend status. Property ClmLineAmtAllowed As %String; /// .CLM_LINE_OP node: 0 piece: 7<BR> /// A new Table/Column Reference that gives the SIU (Special Investigative Unit) /// the ability to look for claim line dollars above, below, or equal to a set /// amount. Property ClmLineOp As %String; /// .CLM_OP node: 0 piece: 5<BR> /// A new Table/Column Reference that gives the SIU (Special Investigative Unit) /// the ability to look for claim dollars above, below, or equal to a set amount. Property ClmOp As %String; Property EffDt As %Date; Property Hmo As %Integer; /// .IPP_REASON node: 0 piece: 10<BR> /// IPP Reason Code Property IppCode As %Integer; Property Keen As %Integer; /// .LAST_CHG_DT node: 0 piece: 4<BR> /// Last Changed Date Property LastChgDt As %Date; /// .PX_DX_CDE_FLAG node: 0 piece: 9<BR> /// A Flag to indicate whether or not Procedure Codes or Diagnosis Codes are to be /// associated with this SIU Flag Type Entry. If the Flag = Y, then control would /// jump to a new screen where the user can enter the necessary codes. Property PxDxCdeFlag As %String; Property Seq As %String; Property Seq2 As %String; Index iMaster On (Hmo, Keen, Seq, Seq2) [ IdKey, PrimaryKey, Unique ]; /// .TERM_DT node: 0 piece: 2<BR> /// Term Date Property TermDt As %Date; /// .USER_INI node: 0 piece: 3 Property UserIni As %String; Relationship relWIppProv As XFXA.MCA.WIppProv [ Cardinality = one, Inverse = IppLines ]; Index relWIppProvIndex On relWIppProv; //Index NewIndex1 On (RelWIppProv, Seq2) [ IdKey, PrimaryKey, Unique ]; <Storage name="SQLMapping"> <ExtentSize>1000000</ExtentSize> <SQLMap name="DBMS"> <ConditionalWithHostVars></ConditionalWithHostVars> <Data name="ClmAmtAllowed"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>6</Piece> </Data> <Data name="ClmLineAmtAllowed"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>8</Piece> </Data> <Data name="ClmLineOp"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>7</Piece> </Data> <Data name="ClmOp"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>5</Piece> </Data> <Data name="EffDt"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>1</Piece> </Data> <Data name="Hmo"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>11</Piece> </Data> <Data name="IppCode"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>10</Piece> </Data> <Data name="LastChgDt"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>4</Piece> </Data> <Data name="PxDxCdeFlag"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>9</Piece> </Data> <Data name="TermDt"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>2</Piece> </Data> <Data name="UserIni"> <Delimiter>"^"</Delimiter> <Node>+0</Node> <Piece>3</Piece> </Data> <Global>^WHEAIPP</Global> <Subscript name="1"> <AccessType>Sub</AccessType> <Expression>{Hmo}</Expression> <LoopInitValue>1</LoopInitValue> </Subscript> <Subscript name="2"> <AccessType>Sub</AccessType> <Expression>{Keen}</Expression> <LoopInitValue>1</LoopInitValue> </Subscript> <Subscript name="3"> <AccessType>Sub</AccessType> <Expression>{Seq}</Expression> <LoopInitValue>1</LoopInitValue> </Subscript> <Subscript name="4"> <AccessType>Sub</AccessType> <Expression>{Seq2}</Expression> <LoopInitValue>1</LoopInitValue> </Subscript> <Type>data</Type> </SQLMap> <StreamLocation>^XFXA.MCA.WIppProvLineS</StreamLocation> <Type>%Library.CacheSQLStorage</Type> </Storage> } When I try to compile this one I get the following error: ERROR #5502: Error compiling SQL Table 'XFXA_MCA.WIppProvLine %msg: Table XFXA_MCA.WIppProvLine has the following unmapped (not defined on the data map) fields: relWIppProv' ERROR #5030: An error occurred while compiling class XFXA.MCA.WIppProvLine Detected 1 errors during compilation in 2.745s. What am I doing wrong? Thanks in Advance, Fred

    Read the article

  • CascadingDropDown ViewState Problem

    - by Steven
    I have two Ajax CascadingDropDown extenders on my page. After a postback, the value of the first dropdown is set (presumably) triggering an event for the second dropdown to refresh. Question: How do I maintain both the contents (from queries) and selected value of both dropdowns after postback? C# answers also welcome. Default.aspx Active States<br /><asp:DropDownList ID="StatesDrop" runat="server" /><br /> Active Cities<br /><asp:DropDownList ID="CitiesDrop" runat="server" /><br /> <ajax:CascadingDropDown ID="StatesCasc" TargetControlID="StatesDrop" ServicePath="WebService1.asmx" ServiceMethod="GetActiveStates" Category="States" runat="server" PromptText="Select a State" PromptValue="?" /> <ajax:CascadingDropDown ID="CitiesCasc" TargetControlID="CitiesDrop" ServicePath="WebService1.asmx" ServiceMethod="GetActiveCities" Category="Cities" runat="server" ParentControlID="StatesDrop" PromptText="Select a City" PromptValue="?" /> WebService1.asmx.vb Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System.Web.Script.Services Imports AjaxControlToolkit <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding _ (ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class WebService1: Inherits System.Web.Services.WebService <WebMethod()> _ Public Function GetActiveStates (ByVal knownCategoryValues As String, _ ByVal category As String) As CascadingDropDownNameValue() Dim values As New List(Of CascadingDropDownNameValue)() 'Populate values with query' Return values.ToArray() End Function <WebMethod()> _ Public Function GetActiveCities (ByVal knownCategoryValues As String, _ ByVal category As String) As CascadingDropDownNameValue() Dim kv As StringDictionary = _ CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues) Dim SelState As String = "" If kv.ContainsKey("State") Then SelState = kv("State") Dim values As New List(Of CascadingDropDownNameValue)() ' Populate values with query.' Return values.ToArray() End Function End Class

    Read the article

  • making check boxes clickable once in javascript?

    - by OVERTONE
    Sorry but im an absolute noob with javascript. Ive made a form for a simple quiz but cant figure out how to make radio's only click once. I can select two or three buttons as my answer. i want to change this. <form name = "Beginners Quiz"> <p>Film speed refers to:</p> <p><input type="radio" name="Answer 1" id="Answer1" value = "a" onclick = "recordAnswer(1,this.value"/>How long it takes to develop film. <br/> <p><input type="radio" name="Answer 2" id="Answer2" value = "b" onclick = "recordAnswer(1,this.value"/>How fast film moves through film-transport system. <br/> <p><input type="radio" name="Answer 3" id="Answer3" value = "c" onclick = "recordAnswer(1,this.value"/> How sensitive the film is to light. <br/> <p><input type="radio" name="Answer 4" id="Answer4" value = "d" onclick = "recordAnswer(1,this.value"/> None of these makes sense. <br/> ive been rooting around w3shcools tutorials to no avail. can someone shed some light?

    Read the article

< Previous Page | 19 20 21 22 23 24 25 26 27 28 29 30  | Next Page >