Search Results

Search found 47805 results on 1913 pages for 'return address'.

Page 105/1913 | < Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >

  • Return only the new database items since last check in Rails

    - by Smith
    I'm fairly new to Ruby, and currently trying to implement an AJAX style commenting system. When the user views a topic, all the current comments on that topic will be displayed. The user can post a comment on the page of a topic and it should automatically display without having to refresh the page, along with any new comments that have been posted since the last comment currently displayed to the user. The comments should also automatically refresh at a specified frequency. I currently have the following code: views/idea/view.html.erb <%= periodically_call_remote(:update => "div_chat", :frequency => 1, :position => "top", :url => {:controller => "comment", :action => :test_view, :idea_id => @idea.id } ) %> <div id="div_chat"> </div> views/comment/test_view.html.erb <% @comments.each do |c| %><div id="comment"> <%= c.comment %> </div> <% end %> controllers/comment_controller.rb class CommentController < ApplicationController before_filter :start_defs def add_comment @comment = Comment.new params[:comment] if @comment.save flash[:notice] = "Successfully commented." else flash[:notice] = "UnSuccessfully commented." end end def test_render @comments = Comment.find_all_by_idea_id(params[:idea_id], :order => "created_at DESC", :conditions => ["created_at > ?", @latest_time] ) @latest = Comment.find(:first, :order => "created_at DESC") @latest_time = @latest.created_at end def start_defs @latest = Comment.find(:first, :order => "created_at ASC") @latest_time = @latest.created_at end end The problem is that every time periodically_call_remote makes a call, it returns the entire list of comments for that topic. From what I can tell, the @latest_time gets constantly reset to the earliest created_at, rather than staying updated to the latest created_at after the comments have been retrieved. I'm also not sure how I should directly refresh the comments when a comment is posted. Is it possible to force a call to periodically_call_remote on a successful save?

    Read the article

  • CKEDITOR, is return some strange characters

    - by nobosh
    With CKEDITOR, when I use JS to get the contents of the Text Editor, I'm getting back: <p>\u000a\u0009&nbsp;ad adad ad asd</p>\u000a When I should have gotten: <p>ad adad ad asd</p> Any idea what's going on here? The only difference that could be the cause is that I'm dynamically created textareas on load, and using a class to find the editor: $('.guideItem-textarea').each(function(index, value){ // ID of the textarea var targeteditor = $(this).attr('id'); var targeteditorID = $(this).attr('id').replace('noteguide',''); // Contents in the editor textareacontents = CKEDITOR.instances[targeteditor].getData(); }); Any ideas?

    Read the article

  • SQL Query Help - Return row in table which relates to another table row with max(column)

    - by Seth
    I have two tables: Table1 = Schools Columns: id(PK), state(nvchar(100)), schoolname Table2 = Grades Columns: id(PK), id_schools(FK), Year, Reading, Writing... I would like to develop a query to find the schoolname which has the highest grade for Reading. So far I have the following and need help to fill in the blanks: SELECT Schools.schoolname, Grades.Reading FROM Schools, Grades WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)

    Read the article

  • Jquery - return html as a string

    - by McNabbToSkins
    I am using the Jquery Wysiwyg editor and I am trying to capture the html that makes up the content area to store in a DB. Is there anyway to get html of a element and save it as a string? My code looks like tihs <iframe id="wysiwyg_IFrame> <html> <head></head> <body> <ul> <li>This is a test</li> </ul> </body> </html> </iframe> I would either like to get a string that starts with <html>....</html> or just the body <body>...</body> does anyone know if this is possible? Thanks

    Read the article

  • IP address numbers in MySQL subquery

    - by Iain Collins
    I have a problem with a subquery involving IPV4 addresses stored in MySQL (MySQL 5.0). The IP addresses are stored in two tables, both in network number format - e.g. the format output by MySQL's INET_ATON(). The first table ('events') contains lots of rows with IP addresses associated with them, the second table ('network_providers') contains a list of provider information for given netblocks. events table (~4,000,000 rows): event_id (int) event_name (varchar) ip_address (unsigned 4 byte int) network_providers table (~60,000 rows): ip_start (unsigned 4 byte int) ip_end (unsigned 4 byte int) provider_name (varchar) Simplified for the purposes of the problem I'm having, the goal is to create an export along the lines of: event_id,event_name,ip_address,provider_name If do a query along the lines of either of the following, I get the result I expect: SELECT provider_name FROM network_providers WHERE INET_ATON('192.168.0.1') >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1 SELECT provider_name FROM network_providers WHERE 3232235521 >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1 That is to say, it returns the correct provider_name for whatever IP I look up (of course I'm not really using 192.168.0.1 in my queries). However, when performing this same query as a subquery, in the following manner, it doesn't yield the result I would expect: SELECT event.id, event.event_name, (SELECT provider_name FROM network_providers WHERE event.ip_address >= network_providers.ip_start ORDER BY network_providers.ip_start DESC LIMIT 1) as provider FROM events Instead the a different (incorrect) value for network_provider is returned - over 90% (but curiously not all) values returned in the provider column contain the wrong provider information for that IP. Using event.ip_address in a subquery just to echo out the value confirms it contains the value I'd expect and that the subquery can parse it. Replacing event.ip_address with an actual network number also works, just using it dynamically in the subquery in this manner that doesn't work for me. I suspect the problem is there is something fundamental and important about subqueries in MySQL that I don't get. I've worked with IP addresses like this in MySQL quite a bit before, but haven't previously done lookups for them using a subquery. The question: I'd really appreciate an example of how I could get the output I want, and if someone here knows, some enlightenment as to why what I'm doing doesn't work so I can avoid making this mistake again. Notes: The actual real-world usage I'm trying to do is considerably more complicated (involving joining two or three tables). This is a simplified version, to avoid overly complicating the question. Additionally, I know I'm not using a between on ip_start & ip_end - that's intentional (the DB's can be out of date, and such cases the owner in the DB is almost always in the next specified range and 'best guess' is fine in this context) however I'm grateful for any suggestions for improvement that relate to the question. Efficiency is always nice, but in this case absolutely not essential - any help appreciated.

    Read the article

  • Carriage Return\Line feed in Java

    - by Manu
    Guys, i have created text file in unix enviroment using java code. For writing the text file i am using java.io.FileWriter and BufferedWriter. and for newline after each row i am using bw.newLine() method. (where bw is object of BufferedWriter ) and sending that text file by attaching in mail from unix environment itself (automated that using unix commands). My issue is, after i download the text file from mail in windows system, if i opened that text file the data's are not properly aligned. newline() character is not working i think so. I want same text file alignment as it is in unix environment, if i opened the text file in windows environment also. How to resolve the problem.Please help ASAP. Thanks for your help in advance. pasting my java code here for your reference..(running java code in unix environment) File f = new File(strFileGenLoc); BufferedWriter bw = new BufferedWriter(new FileWriter(f, false)); rs = stmt.executeQuery("select * from jpdata"); while ( rs.next() ) { bw.write(rs.getString(1)==null? "":rs.getString(1)); bw.newLine(); }

    Read the article

  • Return tiff file from outputstream on JSP

    - by YYY
    I am using a JSP to display a single TIFF file. The flow is as follows: I am given a PDF to convert to a TIFF. I feed a 'black box' API the PDF in the form of a File object and an OutputStream (I am currently using a ByteArrayOutputStream but that can change as needed. The 'black box' converts the PDF to a TIFF and saves the result to the OutputStream. I use out.println(outputstream) to spit out the TIFF. The problem is that I am getting a text stream instead of a displayed image. I have used the following head/meta tag: <head><title>PDF to TIFF tester</title> <META HTTP-EQUIV="Content-Script-Type" CONTENT="image/tiff"></head> <body> But that does not change the end result. Any help?

    Read the article

  • SQL string manipulation to return multiple rows

    - by Andy Jacobs
    I'm an experienced programmer, but relatively new to SQL. We're using Oracle 10 and 11. I have a system in place using SQL that combines actual rows with virtual rows (e.g. "SELECT 1 from DUAL") doing unions and intersects as needed, which all seems to work. My problem is that I need to combine this system which is expecting rows of data, with new data that will have the data in (let's say for simplification) comma delimited strings. So I think what I need is a way to convert a string like: "5,6,7,8" into 4 rows with one column each, with "5" in the first row, "6" in the second, etc. In other languages, I'd do a "Split" with comma as the delimiter. Of course, the data won't always have 4 entries. There's a second question, but I'll ask it separately. But I suspect it will simplify things, if possible, if the solution to the above could be used as a table in another SQL statement (i.e., to work with my existing system). Thanks for any help.

    Read the article

  • return by reference - which of the two is the correct one

    - by eriks
    i have the function: const A& f(...) {...} a. const A a1 = f(..); b. const A &a2 = f(...); which of the is the better one to use? in both cases, if i understand correctly, i prevent the possibility of modifying the returned object. in the first option, the copy constructor of A will be called - am i correct?

    Read the article

  • Webcombo return error when trying to populate based on another WebCombo

    - by mattgcon
    I have a few webcombo boxes that are hierachial: Continent Country When the form loads everything works fine, when I change the continent the first time, the country repopulates correctly. However if I change the continent a second time I receive an error: Specified argument was out of the range of valid values.Parameter name: The DataValueField of ValueField was not found in the Columns collection. Can anyone tell me why? P.S. This is all I have in the Page_Load event if (!IsPostBack) { this.Load_AreaList(); this.Load_AreasOfInterest(); this.Load_Degrees(); this.Load_GenderList(); this.Load_ParticipationDateModifiers(); this.Load_ProgramCategories(nEventID); this.Load_YesNoList(); this.Load_ParticipantInformation(nParticipantID); }

    Read the article

  • Return number of rows affected by SQL UPDATE statement in Java

    - by Krt_Malta
    I'm using a MySQL database and accessing it through Java. PreparedStatement prep1 = this.connection.prepareStatement("UPDATE user_table SET Level = 'Super' WHERE Username = ?"); prep1.setString(1, username); The update statement above works fine however I'd like to get the number of rows affected with this statement. Is this possible please?

    Read the article

  • Return number of objects in NSArray

    - by Viral
    hi friends I am making a book application, in that for moving to next topic i am keeping a button. The Button works as it passes to the next topic , but at the end of the file my application gets message obj_fatal and it crashes. So if i can know that how many number of objects are there in my array(NSARRAY)den the problem will be solved. I am getting the details from a .plist file and storing it in to a array. So if any one know it please let me know. Thanks in advance. Viral.

    Read the article

  • XMLHttpRequst return null on Chrome

    - by BoltBait
    I have the following code that works fine in IE: <HTML> <BODY> <script language="JavaScript"> text=""; req = new XMLHttpRequest(); if (req) { req.onreadystatechange = processStateChange; req.open("GET", "http://www.boltbait.com", true); req.send(); } function processStateChange() { // is the data ready for use? if (req.readyState == 4) { // process my data alert(req.status); alert(req.responseText); } } </script> </BODY> </HTML> In IE, the first alert returns 200, the second returns the web page. However, in Chrome the first alert returns 0 and the second returns the empty string. My intent is to grab a web page into a string for processing. If I'm not doing this right, how should I be doing this? Thanks.

    Read the article

  • MySQL query does not return any data

    - by Alex L
    Hi, I need to retrieve data from a specific time period. The query works fine until I specify the time period. Is there something wrong with the way I specify time period? I know there are many entries within that time-frame. This query returns empty: SELECT stop_times.stop_id, STR_TO_DATE(stop_times.arrival_time, '%H:%i:%s') as stopTime, routes.route_short_name, routes.route_long_name, trips.trip_headsign FROM trips JOIN stop_times ON trips.trip_id = stop_times.trip_id JOIN routes ON routes.route_id = trips.route_id WHERE stop_times.stop_id = 5508 HAVING stopTime BETWEEN DATE_SUB(stopTime,INTERVAL 1 MINUTE) AND DATE_ADD(stopTime,INTERVAL 20 MINUTE); Here is it's EXPLAIN: +----+-------------+------------+--------+------------------+---------+---------+-------------------------------+------+-------------+ | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra | +----+-------------+------------+--------+------------------+---------+---------+-------------------------------+------+-------------+ | 1 | SIMPLE | stop_times | ref | trip_id,stop_id | stop_id | 5 | const | 605 | Using where | | 1 | SIMPLE | trips | eq_ref | PRIMARY,route_id | PRIMARY | 4 | wmata_gtfs.stop_times.trip_id | 1 | | | 1 | SIMPLE | routes | eq_ref | PRIMARY | PRIMARY | 4 | wmata_gtfs.trips.route_id | 1 | | +----+-------------+------------+--------+------------------+---------+---------+-------------------------------+------+-------------+ 3 rows in set (0.00 sec) The query works if I remove the HAVING clause (don't specify time range). Returns: +---------+----------+------------------+-----------------+---------------+ | stop_id | stopTime | route_short_name | route_long_name | trip_headsign | +---------+----------+------------------+-----------------+---------------+ | 5508 | 06:31:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 06:57:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 07:23:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 07:49:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 08:15:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 08:41:00 | "80" | "" | "FORT TOTTEN" | | 5508 | 09:08:00 | "80" | "" | "FORT TOTTEN" | I am using Google Transit format Data loaded into MySQL. The query is supposed to provide stop times and bus routes for a given bus stop. For a bus stop, I am trying to get: Route Name Bus Name Bus Direction (headsign) Stop time The results should be limited only to buses times from 1 min ago to 20 min from now. Please let me know if you could help.

    Read the article

  • Applescript, how to get network address of a file

    - by CRP
    We are a network of Mac computers. I would like to send email addresses to colleagues with links to files on network locations. I made the following applescript: tell application "Finder" set uuu to URL of the first item of (get the selection) set the clipboard to uuu end tell which puts the URL of the currently selected file into the clipboard, which can then be pasted into the message (using the Add Link menu item), providing, for example: file://localhost/Volumes/Commerciale/Clienti/ unfortunately these links do not work. If I select Go To Folder from the menu item, I can get to the folder using an afp:// type url. Is there any way to get this via applescript like I do with url above? Thanks

    Read the article

  • Facebook Like box and Like buttons return Error

    - by spartan
    I'm integrating FB social plugins - Like box and Like buttons (as iframes) - on a web page, but they don't work. When I click on Like in "Like box", I get "Error" text with link, which displays a message dialog "The page at https://www.facebook.com/provocateur.eu could not be reached.". JSON response is: for (;;);{"__ar":1,"payload":{"requires_login":false,"success":false,"already_connected":false,"is_admin":false,"show_error":true,"error_info":{"brief":"Website Inaccessible","full":"The page at https:\/\/www.facebook.com\/provocateur.eu could not be reached.","errorUri":"\/connect\/connect_to_node_error.php?title=Website+Inaccessible&body=The+page+at+https\u00253A\u00252F\u00252Fwww.facebook.com\u00252Fprovocateur.eu+could+not+be+reached.&hash=AQARp73z7huT0Eiu"}}} When I click on the Like button, the JSON response is: for (;;);{"__ar":1,"payload":{"requires_login":false,"success":false,"already_connected":false,"is_admin":false,"show_error":true,"error_info":{"brief":"An error occurred.","full":"There was an error liking the page. If you are the page owner, please try running your page through the linter on the Facebook devsite (https:\/\/developers.facebook.com\/tools\/lint\/) and fixing any errors.","errorUri":"\/connect\/connect_to_node_error.php?title=An+error+occurred.&body=There+was+an+error+liking+the+page.+If+you+are+the+page+owner\u00252C+please+try+running+your+page+through+the+linter+on+the+Facebook+devsite+\u002528https\u00253A\u00252F\u00252Fdevelopers.facebook.com\u00252Ftools\u00252Flint\u00252F\u002529+and+fixing+any+errors.&hash=AQAFI_8ieMUGPPxS"}}} This is the "Like box" iframe code: <iframe frameborder="0" scrolling="no" style="border:none; overflow:hidden; width:240px; height:70px;" src="//www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fprovocateur.eu&width=240&height=70&colorscheme=dark&show_faces=false&border_color&stream=false&header=true&appId=283499041689204"></iframe> and this is the "Like button" iframe code: <iframe frameborder="0" scrolling="no" style="border:none; overflow:hidden; width:203px; height:21px;" src="//www.facebook.com/plugins/like.php?href&amp;send=false&amp;layout=button_count&amp;width=203&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21&amp;appId=283499041689204"></iframe> The behaviour is the same for admin and non-admin visitors and for any browser. I created application with the same name as FB page with appId 283499041689204. Web page is XHTML transitional valid, and it contains no errors according FB debugger/linter. Formely there was age restriction (17+), but I removed it and for the moment it is accessible for anyone (13+). URL of web page: http://provocateur.eu/ URL of FB page: in the first error message Any help appriciated. Thanks in advance.

    Read the article

  • Using type hints in Clojure for Java return values

    - by mikera
    I'm working on some Java / Clojure interoperability and came across a reflection warning for the following code: (defn load-image [resource-name] (javax.imageio.ImageIO/read (.getResource (class javax.imageio.ImageIO) resource-name))) => Reflection warning, clojure/repl.clj:37 - reference to field read can't be resolved. I'm surprised at this because getResource always returns a URL and I would therefore expect the compiler to use the appropriate static method in javax.imageio.ImageIO/read. The code works fine BTW so it is clearly finding the right method at run time. So two questions: Why is this returning a reflection warning? What type hint do I need to fix this?

    Read the article

  • SQL Query to return maximums over decades

    - by Abraham Lincoln
    My question is the following. I have a baseball database, and in that baseball database there is a master table which lists every player that has ever played. There is also a batting table, which tracks every players' batting statistics. I created a view to join those two together; hence the masterplusbatting table. CREATE TABLE `Master` ( `lahmanID` int(9) NOT NULL auto_increment, `playerID` varchar(10) NOT NULL default '', `nameFirst` varchar(50) default NULL, `nameLast` varchar(50) NOT NULL default '', PRIMARY KEY (`lahmanID`), KEY `playerID` (`playerID`), ) ENGINE=MyISAM AUTO_INCREMENT=18968 DEFAULT CHARSET=latin1; CREATE TABLE `Batting` ( `playerID` varchar(9) NOT NULL default '', `yearID` smallint(4) unsigned NOT NULL default '0', `teamID` char(3) NOT NULL default '', `lgID` char(2) NOT NULL default '', `HR` smallint(3) unsigned default NULL, PRIMARY KEY (`playerID`,`yearID`,`stint`), KEY `playerID` (`playerID`), KEY `team` (`teamID`,`yearID`,`lgID`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; Anyway, my first query involved finding the most home runs hit every year since baseball began, including ties. The query to do that is the following.... select f.yearID, f.nameFirst, f.nameLast, f.HR from ( select yearID, max(HR) as HOMERS from masterplusbatting group by yearID )as x inner join masterplusbatting as f on f.yearID = x.yearId and f.HR = x.HOMERS This worked great. However, I now want to find the highest HR hitter in each decade since baseball began. Here is what I tried. select f.yearID, truncate(f.yearid/10,0) as decade,f.nameFirst, f.nameLast, f.HR from ( select yearID, max(HR) as HOMERS from masterplusbatting group by yearID )as x inner join masterplusbatting as f on f.yearID = x.yearId and f.HR = x.HOMERS group by decade You can see that I truncated the yearID in order to get 187, 188, 189 etc instead of 1897, 1885,. I then grouped by the decade, thinking that it would give me the highest per decade, but it is not returning the correct values. For example, it's giving me Adrian Beltre with 48 HR's in 2004 but everyone knows that Barry Bonds hit 73 HR in 2001. Can anyone give me some pointers?

    Read the article

  • Oracle Sql Query taking a day long to return results using dblink

    - by Suresh S
    Guys i have the following oracle sql query that gives me the monthwise report between the dates. Basically for nov month i want sum of values between the dates 01nov to 30 nov. The table tha is being queried is residing in another database and accesssed using dblink. The DT columns is of NUMBER type (for ex 20101201) .The execution of the query is taking a day long and not completed. kindly suggest me , if their is any optimisation that can be suggested to my DBA on the dblink, or any tuning that can be done on the query , or rewriting the same. SELECT /*+ PARALLEL (A 8) */ TO_CHAR(TRUNC(TRUNC(SYSDATE,'MM')- 1,'MM'),'MONYYYY') "MONTH", TYPE AS "TYPE", COLUMN, COUNT (DISTINCT A) AS "A_COUNT", COUNT (COLUMN) AS NO_OF_COLS, SUM (DURATION) AS "SUM_DURATION", SUM (COST) AS "COST" FROM **A@LN_PROD A** WHERE DT >=TO_NUMBER(TO_CHAR(TRUNC(TRUNC(SYSDATE,'MM')-1,'MM'),'YYYYMMDD')) AND DT < TO_NUMBER(TO_CHAR(TRUNC(TRUNC(SYSDATE,'MM'),'MM'),'YYYYMMDD')) GROUP BY TYPE, COLUMN

    Read the article

  • jquery $(window).width() and $(window).height() return different values when viewport has not been r

    - by Manca Weeks
    I am writing a site using jquery that repeatedly repeatedly calls $(window).width() and $(window).height() to position and size elements based on the viewport size... In troubleshooting I discovered that I am getting slightly different viewport size reports in repeated calls to the above jquery functions when the viewport is not resized... Wondering if there is any special case anyone knows of when this happens, or if this is just the way it is. The difference in sizes reported are 20px or less, it appears. It happens in Safari 4.0.4, Firefox 3.6.2 and Chrome 5.0.342.7 beta on Mac OS X 10.6.2... I didn't test other browsers yet because it doesn't appear to be specific to the browser. I was also unable to figure out what the difference depends upon - if it isn't the viewport size, could there be another factor that makes the results differ? Any insight would be appreciated... Thanks MAnca

    Read the article

  • the shema return by the new query differ from the base query

    - by sochandara
    I am working on class project which required to work with Windows Application and this issue occurred to me that i don understand how to solved it can anybody help please? I want to show the NATIONALITYNAME instead of showing NATIONALITYID in the grid view SELECT COACH.COACHID , COACH.COACHFIRSTNAME , COACH.COACHLASTNAME , NATIONALITY.NATIONALITY FROM COACH INNER JOIN NATIONALITY ON COACH.NATIONALITYID = NATIONALITY.NATIONALITYID Error Message: "The Schema returned by the new query differ from the base query"

    Read the article

< Previous Page | 101 102 103 104 105 106 107 108 109 110 111 112  | Next Page >