Daily Archives

Articles indexed Tuesday May 25 2010

Page 20/118 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • nextSibling issue, again... sorry...

    - by SoLoGHoST
    Ok, I am using insertRow to insert a TR element into a table, but for some reason it doesn't count that inserted TR element as a sibling of the others when I do nextSibling on it. For example, consider the following table. <table id="myTable"> <tr id="row_0"> <td colspan="3">Row 1</td> </tr> <tr id="tr_0_0"> <td>Option 1</td> <td>Option2</td> <td>Option 3</td> </tr> <tr id="tr_0_1"> <td>Option 1</td> <td>Option 2</td> <td>Option 3</td> </tr> </table> So after I do this: var lTable = document.getElementById("myTable"); var trEle = lTable.insertRow(-1); trEle.id = "tr_0_2"; var cell1 = trEle.insertCell(0); cell1.innerHTML = "Option 1"; var cell2 = trEle.insertCell(1); cell2.innerHTML = "Option 2"; var cell3 = trEle.insertCell(-1); cell3.innerHTML = "Option 3"; Then I use this approach to get all of the siblings, but it NEVER gives me the last sibling in here, but ONLY if it's been added via insertRow, because it gets all nextSiblings just fine, but once I add a sibling via insertRow it never gives me that last Sibling, argggg.... var tempTr = document.getElementById("row_0"); var totalSibs = 0; while(tempTr.nextSibling != null) { var tempId = tempTr.id; // If no id, not an element, or not a tr_0 id. if (!tempId || tempTr.nodeType != 1 || tempId.indexOf("tr_0") != 0) { tempTr = tempTr.nextSibling; continue; } // This NEVER ALERTS the last id of the row that was inserted using insertRow, arggg. alert(tempId); totalSibs++; tempTr = tempTr.nextSibling; } So, totalSibs should return 3 because after I inserted the row, there should be 3 Siblings, but instead returns 2 and never counts the 3rd Sibling.... arggg. Can someone please help me here?? Thank a lot, you guys/gals are Awesome!

    Read the article

  • How can Perl's print add a newline by default?

    - by Mike
    In Perl most of my print statements take the form print "hello." . "\n"; Is there a nice way to avoid keeping all the pesky "\n"s lying around? I know I could make a new function such as myprint that automatically appends \n, but it would be nice if I could override the existing print.

    Read the article

  • Why is the PrintDialog not displaying (in 64 bit)?

    - by Bill
    This code, when built in .Net for Any CPU platform and running on a 64-bit machine, simply returns a DialogResult of Cancel without showing the expected dialog box. Dim dlg As New System.Windows.Forms.PrintDialog If dlg.ShowDialog() = Windows.Forms.DialogResult.OK Then '... print the document ' End If However, it works fine when the application is built for the x86 platform, and run on a 64-bit machine. How can you display the dialog with a 64-bit compile?

    Read the article

  • I have this broken php upload script

    - by Anders Kitson
    I have this script for uploading a image and content from a form, it works in one project but not the other. I have spent a good few hours trying to debug it, I am hoping someone could point out the issue I might be having. Where there are comments is where I have tried to debug. The first error I got was the "echo invalid file" at the beginning of the last comment. With these specific areas commented out the upload name and type that I am supposed to be grabbing from the form is not being echoed, I am thinking this is where the error is occurring, but can't quite seem to find it. Thanks. <?php include("../includes/connect.php"); /* if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] < 2000000)) { */ if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; /* GRAB FORM DATA */ $title = $_POST['title']; $date = $_POST['date']; $content = $_POST['content']; $imageName1 = $_FILES["file"]["name"]; echo $title; echo "<br/>"; echo $date; echo "<br/>"; echo $content; echo "<br/>"; echo $imageName1; $sql = "INSERT INTO blog (title,date,content,image)VALUES( \"$title\", \"$date\", \"$content\", \"$imageName1\" )"; $results = mysql_query($sql)or die(mysql_error()); echo "<br/>"; if (file_exists("../images/blog/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "../images/blog/" . $_FILES["file"]["name"]); echo "Stored in: " . "../images/blog/" . $_FILES["file"]["name"]; } } /* } else { echo "Invalid file" . "<br/>"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; } */ //lets create a thumbnail of this uploaded image. /* $fileName = $_FILES["file"]["name"]; createThumb($fileName,310,"../images/blog/thumbs/"); function createThumb($thisFileName, $thisThumbWidth, $thisThumbDest){ $thisOriginalFilePath = "../images/blog/". $thisFileName; list($width, $height) = getimagesize($thisOriginalFilePath); $imgRatio =$width/$height; $thisThumbHeight = $thisThumbWidth/$imgRatio; $thumb = imagecreatetruecolor($thisThumbWidth,$thisThumbHeight); $source = imagecreatefromjpeg($thisOriginalFilePath); imagecopyresampled($thumb, $source, 0, 0, 0, 0, $thisThumbWidth,$thisThumbHeight, $width, $height); $newFileName = $thisThumbDest.$thisFileName; imagejpeg($thumb,$newFileName, 80); echo "<p><img src=\"$newFileName\" /></p>"; //header("location: http://www.google.ca"); } */ ?>

    Read the article

  • Help needed in pivoting (SQL Server 2005)

    - by Newbie
    I have a table like ID Grps Vals --- ---- ----- 1 1 1 1 1 3 1 1 45 1 2 23 1 2 34 1 2 66 1 3 10 1 3 17 1 3 77 2 1 144 2 1 344 2 1 555 2 2 11 2 2 22 2 2 33 2 3 55 2 3 67 2 3 77 The desired output being ID Record1 Record2 Record3 --- ------- ------- ------- 1 1 23 10 1 3 34 17 1 45 66 77 2 144 11 55 2 344 22 67 2 555 33 77 I have tried(using while loop) but the program is running slow. I have been asked to do so by using SET based approach. My approach so far is SELECT ID,[1] AS [Record1], [2] AS [Record2], [3] as [Record3] FROM ( Select Row_Number() Over(Partition By ID Order By Vals) records ,* From myTable)x PIVOT (MAX(vals) FOR Grps IN ([1],[2],[3])) p But it is not working. Can any one please help to solve this.(SQL SERVER 2005)

    Read the article

  • How To Edit XML File

    - by thebourneid
    I have a movie collection catalogue with local links to folders and files for an easy access. Recently I reorganaized my entire hard disk space and I need to update the links and I'm trying to do that automatically with perl. I can export the data in a xml file and import it again. I can extract the new filepaths with the use of File::Find but I'm stuck with two problems. I have no idea how to connect the $title from the new filepath with the corresponding $title from the xml file. I'm dealing with such files for the first time and I don't know how to proceed with the replacement process. Here is what I've done till now use strict; use warnings; use File::Basename; use File::Find; use File::Spec; use XML::Simple; use Data::Dumper; my $dir_target = 'somepath'; find(\&a, $dir_target); sub a { /\.iso$/ or return; my $fn = $File::Find::name; $fn =~ s/\//\\/g; $fn =~ /(.*\\)(.*)/; my $path = $1; my $filename = $2; my $title = (File::Spec->splitdir($fn))[2]; $title =~ s/(.*?)\s\(\d+\)$/$1/; $title =~ s/~/:/; $title =~ s/`/?/; my $link_local = '<link><description>Folder</description><url>'.$path.'</url><urltype>Movie</urltype></link><link><description>'.$filename.'</description><url>'.$fn.'</url><urltype>Movie</urltype></link>' unless $title eq ''; my $txt = 'somepath/log.txt'; my $xml_in = XMLin('somepath/test.xml', ForceArray => 1, KeepRoot => 1); my $xml_out = XMLout($xml_in, OutputFile => 'somepath/test_out.xml', KeepRoot=>1); open F, ">>", $txt; print F $link_local."\n\n"; close F; } And here is a snippet of the data I need to edit. If found imdb and dvdempire link - do not touch. if found local links replace, otherwise insert. I'm willing to complete the code myself but need some directions how to proceed further. Thanks. <title>$title</title> ....... <links> <link> <description>IMDB</description> <url>http://www.imdb.com/title/VARIABLE</url> <urltype>URL</urltype> </link> <link> <description>DVD Empire</description> <url>http://www.dvdempire.com/VARIABLE</url> <urltype>URL</urltype> </link> <link> <description>Folder</description> <url>OLD_FOLDERPATH</url> <urltype>Movie</urltype> </link> <link> <description>OLD_FILENAME</description> <url>OLD_FILENAMEPATH</url> <urltype>Movie</urltype> </link> </links>

    Read the article

  • SQL Server 2008 FTS CONTAINSTABLE Not Returning More Than Five Rows

    - by Elijah Glover
    I have a single table called "Indexes", it contains one nvarchar and three ntext columns (all Full Text Indexes). Index is up to date. CONTAINSTABLE(Indexes, *), 'test', 5) //5 results No matter what I change the above keyword too, it only returns the first 3-5 results. It should roughly return 90-120 results, for the above query. SELECT count(*) FROM Indexes WHERE [Description] like '%test%' //122 results How would I start to troubleshoot this problem?

    Read the article

  • Displaying pic for user through a question's answer

    - by bgadoci
    Ok, I am trying to display the profile pic of a user. The application I have set up allows users to create questions and answers (I am calling answers 'sites' in the code) the view in which I am trying to do so is in the /views/questions/show.html.erb file. It might also be of note that I am using the Paperclip gem. Here is the set up: Associations Users class User < ActiveRecord::Base has_many :questions, :dependent => :destroy has_many :sites, :dependent => :destroy has_many :notes, :dependent => :destroy has_many :likes, :through => :sites , :dependent => :destroy has_many :pics, :dependent => :destroy has_many :likes, :dependent => :destroy end Questions class Question < ActiveRecord::Base has_many :sites, :dependent => :destroy has_many :notes, :dependent => :destroy has_many :likes, :dependent => :destroy belongs_to :user end Answers (sites) class Site < ActiveRecord::Base belongs_to :question belongs_to :user has_many :notes, :dependent => :destroy has_many :likes, :dependent => :destroy has_attached_file :photo, :styles => { :small => "250x250>" } end Pics class Pic < ActiveRecord::Base has_attached_file :profile_pic, :styles => { :small => "100x100" } belongs_to :user end The /views/questions/show.html.erb is rendering the partial /views/sites/_site.html.erb which is calling the Answer (site) with: <% div_for site do %> <%=h site.description %> <% end %> I have been trying to do things like: <%=image_tag site.user.pic.profile_pic.url(:small) %> <%=image_tag site.user.profile_pic.url(:small) %> etc. But that is obviously wrong. My error directs me to the Questions#show action so I am imagining that I need to define something in there but not sure what. Is is possible to call the pic given the current associations, placement of the call, and if so what Controller additions do I need to make, and what line of code will call the pic? UPDATE: Here is the QuestionsController#show code: def show @question = Question.find(params[:id]) @sites = @question.sites.all(:select => "sites.*, SUM(likes.like) as like_total", :joins => "LEFT JOIN likes AS likes ON likes.site_id = sites.id", :group => "sites.id", :order => "like_total DESC") respond_to do |format| format.html # show.html.erb format.xml { render :xml => @question } end end

    Read the article

  • sharepoint approval workflow loop

    - by Sachin
    Hi All, I am trying to set up a Approval workflow when item created and item updated event on a list and then update the approval status as workflow complete. Now when I create a new Item the workflow kicks off as expected. When I edit the same item and approve the item new workflow get started as the item get edit. It seems to be workflow falls in loop if I se an Approval workflow on new item created and Item Edit events. I Google for it and I found that Microsoft has come up with hotfix to overcome this issue. I have installed it on my machine but still the problem persist. Is there are any prerequisites needed for this ? or any other service pack or specific version of service pack needs be installed on machine to make this hotfix running. Can any one tell me how shold I overcome this issue...? Thanks in Advance Sachin

    Read the article

  • I'm having trouble traversing a newly appended DOM element with jQuery

    - by culov
    I have a form that I want to be used to add entries. Once an entry is added, the original form should be reset to prepare it for the next entry, and the saved form should be duplicated prior to resetting and appended onto a div for 'storedEntries.' This much is working (for the most part), but Im having trouble accessing the newly created form... I need to change the value attribute of the submit button from 'add' to 'edit' so properly communicate what clicking that button should do. heres my form: <div class="newTruck"> <form id="addNewTruck" class='updateschedule' action="javascript:sub(sTime.value, eTime.value, lat.value, lng.value, street.value);"> <b style="color:green;">Opening at: </b> <input id="sTime" name="sTime" title="Opening time" value="Click to set opening time" class="datetimepicker"/> <b style="color:red;">Closing at: </b> <input id="eTime" name= "eTime" title="Closing time" value="Click to set closing time" class="datetimepicker"/> <label for='street'>Address</label> <input type='text' name='street' id='street' class='text' autocomplete='off'/> <input id='submit' class='submit' style="cursor: pointer; cursor: hand;" type="submit" value='Add new stop'/> <div id='suggests' class='auto_complete' style='display:none'></div> <input type='hidden' name='lat' id='lat'/> <input type='hidden' name='lng' id='lng'/> ive tried using a hundred different selectors with jquery to no avail... heres my script as it stands: function cloneAndClear(){ var id = name+now; $j("#addNewTruck").clone(true).attr("id",id).appendTo(".scheduledTrucks"); $j('#'+id).filter('#submit').attr('value', 'Edit'); $j("#addNewTruck")[0].reset(); createPickers(); } the element is properly cloned and inserted into the div, but i cant find a way to access this element... the third line in the script never works. Another problem i am having is that the 'values' in the cloned form revert back to the value in the source of the html rather than what the user inputs. advice on how to solve either of these issues is greatly appreciated!

    Read the article

  • windows control library in c sharp

    - by apals
    I have just added a textbox, button, label to validate ID of 12 characters. The library is called check_ID. It works fine. The only problem is i have to access the forecolor of label, backcolor of textbox , forecolor of button as per color scheme of the project. But it seems that none of the properties of the objects in check_ID are available for modification. I have even changed the modifier to public of all objects by repoening the check_ID project. Is there another way to access the properties of these objects that are created using windows control library?. A very big thanks in advance.

    Read the article

  • Cerification for Rails?

    - by Salil
    I have passed SCJP 1.5 for JAVA 3 years back it hepls me to clear BASICS of the JAVA and OOPS. I would like to know if there is any certification exam conducted for the Ruby or Ruby on Rails.providing url details will be more helpful.

    Read the article

  • Can Flash AS3 listbox data contain variable info?

    - by Anne
    I'm populating a listbox like this: dp.addItem( {label:"red dress", data:"OV4MP/23OL.swf"} ); Instead of data:"OV4MP/23OL.swf", I would like to make part of the data file name a variable from a dynamic textbox named centerPt that belongs to the parent movieclip, so I did this: dp.addItem( {label:"red dress", data:"OV4MP/23"+MovieClip(parent.parent).centerPt.text+".swf"} ); When I trace the selectedItem.data using: trace("you have selected: "+ overlays.selectedItem.data); trace(MovieClip(parent.parent).centerPt.text); I'm getting: you have selected: OV4MP/23.swf. What I should get is OV4MP/23OL.swf. It is not picking up what is in the dynamic centerPt.text field which are the letters OL eventhough that text field is tracing correctly. Is it possible that data can not hold a variable? Thank you in advance for any help. Anne

    Read the article

  • How do I clone an OpenLDAP database

    - by elzapp
    I know this is more like a serverfault question than a stackoverflow question, but since serverfault isn't up yet, here I go: I'm supposed to move an application from one redhat server to another, and without very good knowledge of the internal workings of the application, how would I move the OpenLDAP database from the one machine to the other, with schemas and all. What files would I need to copy over? I believe the setup is pretty standard.

    Read the article

  • Count the no of Visitors

    - by Domnic
    I have stored resumes in my database and i have retrive it from asp.net web page by creating linkbutton...i can view ,download the resumes which i stored in my database.My issuse is when i view one resume example (domnic resume)then no of visitor for domnic resume should be count .if again i view that resume no of visitor should be 2...how can i do that in asp.net?

    Read the article

  • rails error on create action

    - by ash34
    SQL (2.0ms) SELECT task_report_requests_seq.NEXTVAL id FROM dual TaskReportRequest Create (2.2ms) INSERT INTO task_report_requests (location, created_at, updated_at, id, freq, login, task_dt) VALUES('020', TO_DATE('2010-05-25 05:02:38','YYYY-MM-DD HH24:MI:SS'), TO_DATE('2010-05-25 05:02:38','YYYY-MM-DD HH24:MI:SS'), 10023, 'M', NULL, TO_DATE('2010-05-30 00:00:00','YYYY-MM-DD HH24:MI:SS')) NoMethodError (You have a nil object when you didn't expect it! The error occurred while evaluating nil.call): app/controllers/task_report_requests_controller.rb:45:in `create' It says error evaluating nil.call . Can someone tell me when I would get such an error. I am not able to figure out with this information. thanks, ash

    Read the article

  • Start Learning Android

    - by Shrewd Demon
    hi, i am a beginner with Android. I want to learn more about this new revolution. Kindly help me with links that will help me learn creating applications for Android. Please share if you have some simple source-code sites with you. Also show me a forum having high activity with Android users... thank you !

    Read the article

  • Application not releasing database connection Spring.net + NHibernate

    - by anupam3m
    Even after successful transaction.Application connection with the database persist.in Nhibernate log it shows Nhibernate Log 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - executing flush 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <(null) - registering flush begin 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <(null) - registering flush end 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - post flush 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - before transaction completion 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.ConnectionManager [(null)] <(null) - aggressively releasing database connection 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Connection.ConnectionProvider [(null)] <(null) - Closing connection 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - transaction completion 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Transaction.AdoTransaction [(null)] <(null) - running AdoTransaction.Dispose() 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null) - closing session 2010-05-21 14:45:08,428 [Worker] [0] DEBUG NHibernate.Impl.BatcherImpl [(null)] <(null) - running BatcherImpl.Dispose(true) Underneath given is my dataconfiguration file -- Risco.Rsp.Ac.RMAC.Mapping Risco.Rsp.Ac.Logging.Appenders -- Please help me out with this issue.Thanks

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >