Search Results

Search found 5136 results on 206 pages for 'comment bot'.

Page 26/206 | < Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >

  • How to JOIN a COUNT from a table, and then effect that COUNT with another JOIN

    - by jakenoble
    Hi I have three tables Post ID Name 1 'Something' 2 'Something else' 3 'One more' Comment ID PostId ProfileID Comment 1 1 1 'Hi my name is' 2 2 2 'I like cakes' 3 3 3 'I hate cakes' Profile ID Approved 1 1 2 0 3 1 I want to count the comments for a post where the profile for the comment is approved I can select the data from Post and then join a count from Comment fine. But this count should be dependent on if the Profile is approved or not. The results I am expecting is CommentCount PostId Count 1 1 2 0 3 1 Thanks for any help.

    Read the article

  • HTML comments in Spark view engine

    - by Rory Fitzpatrick
    How can I comment out parts of a Spark view so they aren't rendered to the client? In aspx pages I can do this: <%-- server-side comment --%> I had thought using three dashes would work: <!--- server-side comment ---> but it doesn't work and I now can't find the resource where I read that.

    Read the article

  • Regex to Match White Space or End of String

    - by Kirk
    I'm trying to find every instance of @username in comment text and replace it with a link. Here's my PHP so far: $comment = preg_replace('/@(.+?)\s/', '<a href="/users/${1}/">@${1}</a> ', $comment); The only problem is the regex is dependent upon there being whitespace after the @username reference. Can anyone help me tweak this so it will also match if it is at the end of the string?

    Read the article

  • Adding a third table to a Join

    - by John
    Hello, This query works fine: $sqlStr = "SELECT s.loginid, s.title, s.url, s.displayurl, l.username FROM submission AS s, login AS l WHERE s.loginid = l.loginid ORDER BY s.datesubmitted DESC LIMIT 10"; Would this work if I wanted to join a third MySQL table (called "comment") to it? $sqlStr = "SELECT s.loginid, s.submissionid s.title, s.url, s.displayurl, l.username, count(c.comment) countComments FROM submission AS s, login AS l, comment AS c, WHERE s.loginid = l.loginid AND s.submissionid = c.submissionid ORDER BY s.datesubmitted DESC LIMIT 10"; Thanks in advance, John

    Read the article

  • Ruby / Rails - How to aggregate a Query Results in an Array?

    - by AnApprentice
    Hello, I have a large data set that I want to clean up for the user. The data set from the DB looks something like this: ID | project_id | thread_id | action_type |description 1 | 10 | 30 | comment | yada yada yada yada yada 1 | 10 | 30 | comment | xxx 1 | 10 | 30 | comment | yada 313133 1 | 10 | 33 | comment | fdsdfsdfsdfsdfs 1 | 10 | 33 | comment | yada yada yada yada yada 1 | 10 | | attachment | fddgaasddsadasdsadsa 1 | 10 | | attachment | xcvcvxcvxcvxxcvcvxxcv Right now, when I output the above in my view its in the very same order as above, problem is it is very repetitive. For example, for project_id 10 & thread_id 30 you see: 10 - 30 - yada yada yada yada yada 10 - 30 - xxxxx 10 - 30 - yada yada yada yada yada What I would like to learn how to do in ruby, is some how create an array and aggreate descriptions under a project_id and thread_id, so instead the output is: 10 - 30 - yada yada yada yada yada - xxxxx - yada yada yada yada yada Any advice on where to get started? This requirement is new for me so I would appreciate your thoughts on what you're thinking the best way to solve this is.Hopefully this can be done in ruby and not sql, as the activity feed is likely going to grow in event types and complexity. Thanks

    Read the article

  • Pylons paginator question

    - by Timmy
    Only comments associated with the current page should be listed, so once again the query is modified to include the page ID. In this case, though, we also have to pass the pageid argument, which will in turn get passed to any h.url_for() calls in the paginator. from http://pylonsbook.com/en/1.1/simplesite-tutorial-part-2.html i cannot get this to work, the paginator does not pass things to the h.url_for, i followed the tutorial. i had to add pageid to the h.url_for in list.html. how do i solve? part of the code: ${h.link_to( comment.id, h.url_for( controller=u'comment', action='view', id=unicode(comment.id) ) )} but it does not work properly until i put in ${h.link_to( comment.id, h.url_for( controller=u'comment', action='view', id=unicode(comment.id), pageid = c.page.id ) )}

    Read the article

  • Microsoft Word Macro - Exporting Word Review Comments - How do you reference the sentence related to

    - by jspeaks
    I am trying to export of a Word document review comments. I want to export the sentence selection that was commented on followed by the comment. Screen shot of the image: http://jspeaks.com/mswordcomment.png I have found code to loop through the document comments, but I cannot figure out how to reference the sentence selection that the comment was related to. The current logic is: Sub ExportComments() Dim s As String Dim cmt As Word.Comment Dim doc As Word.Document For Each cmt In ActiveDocument.Comments s = s & cmt.Initial & cmt.Index & "," & cmt.Range.Text & vbCr Next Set doc = Documents.Add doc.Range.Text = s End Sub I tinkered with Selection.Range, however I cannot determine the proper object or property that contains the referenced sentence. I would like to produce output like the follow (if we use the example in picture above): Sentence: Here are more sentences that contain interesting facts - Comment: This is an interesting fact. Sentence: Here are more sentences that contain interesting facts. Here are more sentences that contain interesting facts. - Comment: This is a very interesting fact

    Read the article

  • Doxygen, too heavy to maintain ?

    - by Phong
    I am currently starting using doxygen to document my source code. I have notice that the syntax is very heavy, every time I modify the source code, I also need to change the comment and I really have the impression to pass too much time modifying the comment for every change I make in the source code. Do you have some tips to document my source code efficiently ? Does some editor (or plugin for existing editor) for doxygen to do the following exist? automatically track unsynchronized code/comment and warn the programmer about it. automatically add doxygen comment format (template with parameter name in it for example) in the source code (template) for every new item PS: I am working on a C/C++ project.

    Read the article

  • lexer/parser ambiguity

    - by John Leidegren
    How does a lexer solve this ambiguity? /*/*/ How is it that it doesn't just say, oh yeah, that's the begining of a multi-line comment, followed by another multi-line comment. Wouldn't a greedy lexer just return the following tokens? /* /* / I'm in the midst of writing a shift-reduce parser for CSS and yet this simple comment thing is in my way. You can read this question if you wan't some more background information.

    Read the article

  • CKEDITOR - Is there anyway to prevent formatting code in SOURCE mode?

    - by Lev
    I've spent the good portion of my day trying to figure this out, and I figured I'd finally just give in and ask. How can you prevent ANY automatic formatting when in SOURCE mode? I like to edit HTML source code directly instead of using the WYSIWYG interface, but whenever I write new lines, or layout tags how I would indent them, it all gets formatted when I switch to WYSIWYG mode and then back to SOURCE mode again. I stumbled upon this earlier: http://dev.fckeditor.net/ticket/993 That alluded to a setting which may have existed once upon a time which would be exactly what I'm after. I just want to know how I can completely turn off all automatic formatting when editing in SOURCE mode. After browsing this site for hours on end and finding absolutely nothing on here or on Google, I came up with a solution I thought would be foolproof (albeit not a pleasant one). I learned about the "protectedSource" setting, so I thought, well maybe I can just use that and create an HTML comment tag before all my HTML and another after it and then push a regular expression finding the comment tags into the protectedSource array, but even that (believe it or not) doesn't work. I've tried my expression straight up in the browser outside of CKEDITOR and it is working, but CKEDITOR doesn't protect the code as expected (which I suspect is a bug involving comment tags, since I can get it to work with other strings). In case you are wondering, this is what I had hoped would work as a work-around, but doesn't: config.protectedSource.push( /<!-- src -->[\s\S]*<!-- end src-->/gi ); .. and what I planned on doing (for what appears to be the lack of a setting to disable formatting in SOURCE mode) was to nest all my HTML within the commented tags like this: <!-- src --> <div>some code that shouldn't be messed with (but is)</div> <!-- end src --> I'd love to hear if you anyone has any suggestions for this scenario, or knows of a setting which I have described, or even if someone can just fill me in as to why I can't get protectedSource to work properly with two comment tags. I really thing it's gotta be a bug because I can get so many other expressions to work fine, and I can even protect HTML within the area of a single comment tag, but I simply cannot get HTML within two different comment tags to stay untouched. :( I've wasted about 6-7 hours on this so far today so if anyone can shed any light on it I would be very grateful! Thanks for reading! ;)

    Read the article

  • effective retrieve for a voting system in PHP and MySQL

    - by Adnan
    Hello, I have a system where registered users can vote up/vote down comment for a picture. Something very similar to SO's voting system. I store the votes in a table with values as such; vote_id | vote_comment_id | vote_user_id | vote_date | vote_type Now I have few a question concerned the speed and efficiency for the following; PROB: Once a user opens the picture page with comments I need, if that user has already voted UP/DOWN a comment to show it like; "you voted up" or "you voted down" next to the comment (in SO it the vote image is highlighted) MY POSSIBLE SOL: Right now when I open a picture page for each comment I loop thru, I loop thru my table of votes as well and check if a user has voted and show the status (I compare the vote_user_id with the user's session). How efficient is this? Anyone have a better approach to tackle this kind of problem?

    Read the article

  • Prepared statement help, Number of variables doesn't match number of parameters in prepared statement

    - by Sam Gabriel
    I'm getting this error : Number of variables doesn't match number of parameters in prepared statement every time I run this code: $dbh = new mysqli("localhost", "***", "***", "pics"); $stmt = $dbh->prepare("INSERT INTO comments (username, picture, comment) VALUES (?, ?, ?)"); $stmt->bind_Param('s', $username); $stmt->bind_Param('d', $picture); $stmt->bind_Param('s', $comment); $username=$_SESSION['username']; $picture=$_GET['id']; $comment=$_POST['comment']; $stmt->execute(); What's the problem?

    Read the article

  • Comments in Activity Stream

    - by fesja
    Hi, I'm starting to develop an activity stream. I've read both How to implement the activity stream in a social network and What’s the best manner of implementing a social activity stream?. What I haven't found is the best way to add comments to the activities. As in facebook, each comment can be commented by another person. If each activity comment is saved as another activity, then I would not be able to get the activity of that comment without doing a query. So the solution I'm thinking is to save the comments inside the serialize data field of each activity. If the user wants to delete his comment, I would have to update that activity. Is this the correct solution? Is there a better approach? Thanks!

    Read the article

  • effective retrieve for a voting system in PHP

    - by Adnan
    Hello, I have a system where registered users can vote up/vote down comment for a picture. Something very similar to SO's voting system. I store the votes in a table with values as such; vote_id | vote_comment_id | vote_user_id | vote_date Now I have few a question concerned the speed and efficiency for the following; PROB: Once a user opens the picture page with comments I need, if that user has already voted UP/DOWN a comment to show it like; "you voted up" or "you voted down" next to the comment (in SO it the vote image is highlighted) MY POSSIBLE SOL: Right now when I open a picture page for each comment I loop thru, I loop thru my table of votes as well and check if a user has voted and show the status (I compare the vote_user_id with the user's session). How efficient is this? Anyone have a better approach to tackle this kind of problem?

    Read the article

  • Using NHibernate to select entities based on activity of children entities

    - by mannish
    I'm having a case of the Mondays... I need to select blog posts based on recent activity in the post's comments collection (a Post has a List<Comment> property and likewise, a Comment has a Post property, establishing the relationship. I don't want to show the same post twice, and I only need a subset of the entities, not all of the posts. First thought was to grab all posts that have comments, then order those based on the most recent comment. For this to work, I'm pretty sure I'd have to limit the comments for each Post to the first/newest Comment. Last I'd simply take the top 5 (or whatever max results number I want to pass into the method). Second thought would be to grab all of the comments, ordered by CreatedOn, and filter so there's only one Comment per Post. Then return those top (whatever) posts. This seems like the same as the first option, just going through the back door. I've got an ugly, two query option I've got working with some LINQ on the side for filtering, but I know there's a more elegant way to do it in using the NHibernate API. Hoping to see some good ideas here.

    Read the article

  • ActiveScaffold complains about association

    - by Bilal Aslam
    I'm using ActiveScaffold to create an Admin UI. I have two models: Post and Comments. A Post has-many Comments, and a Comment belongs-to a post. There's a validates_presences_of :text validation the Comment model. The problem is that when I create a new Post from the Admin UI without creating a new Comment in the subform, ActiveScaffold complains about the validation. I can create the Post if I also create a Comment associated with it, which is not what I Want. I can create a new Post manually from script/console. What gives?

    Read the article

  • Rails: three most recent comments with unique users

    - by Dennis Collective
    what would I put in the named scope :by_unique_users so that I can do Comment.recent.by_unique_users.limit(3), and only get one comment per user? class User has_many :comments end class Comment belongs_to :user named_scope :recent, :order => 'comments.created_at DESC' named_scope :limit, lambda { |limit| {:limit => limit}} named_scope :by_unique_users end on sqlite named_scope :by_unique_user, :group = "user_id" works, but makes it freak out on postgres, which is deployed on production PGError: ERROR: column "comments.id" must appear in the GROUP BY clause or be used in an aggregate function

    Read the article

  • Conventions for order of parameters in a function

    - by Andy
    In writing functions my brain always spends a few milliseconds to check which order of parameters would be best for a given function. should I write: public Comment AddComment(long userID, string title, string text) Or probably: public Comment AddComment(string title, string text, long userID) Why not: public Comment AddComment(string title, long userID, string text) Do you follow any rules when ordering the parameters for your functions? Which parameter would you place first and which would follow?

    Read the article

  • jQuery UI Dialog and Textarea Focus Issue

    - by Gimli
    I'm working on a modal comment system using jQuery and jQuery UI, but I'm having some issues with focus. I have a series of divs inside the modal to switch between Login and Add comment, as below: <div id="modal" title="Loading"> <div id="modalContent"></div> <div id="modalLogin"> <div class="loginBox"></div> <div class="addCommentBox"></div> <div class="commentReview"></div> </div> </div> Inside of the addCommentBox div, I've got the comment code: <form action="/comments/add" class="addCommentForm" name="addCommentForm" method="post"> <textarea name="content" class="addCommentContent"></textarea> <button value="Add Comment" type="submit" class="commentPost"/> <button value="Clear Comment" type="submit" id="clearComment"/> </form> The issue is that about half the time after opening the dialog the textarea inside the addCommentBox div doesn't react to keyboard inputs when selected. The mouse works correctly and will allow text to be selected, but keyboard control does nothing. I have no event listeners on the textarea. I've got some on the buttons, but they are targeting only the buttons. The only thing that happens in the HTML seems to be the fact that every time I click on the modal, the z-index increases for the overall modal div. I have set the addCommentBox div to have a z-index of 9999, greater than the z-index of the modal. Any suggestions or directions to research would be greatly appreciated. Thanks!

    Read the article

  • Join Query Help

    - by John
    Hello, The query below works well. It pulls data from two MySQL tables, "submission" and "login." I would like to also pull data from a third table called "comment" in the same database. The table "comment" has the following fields: commentid, loginid, submissionid, comment, datecommented Two of the fields in the table "login" are called "loginid" and "username." In the query below, I would like to count all "commentid" in "comment" where "loginid" equals the "loginid" in "login" where "username" equals "$profile." How can I do this? Thanks in advance, John $sqlStr1 = "SELECT l.username, l.loginid, s.loginid, s.submissionid, s.title, s.url, s.datesubmitted, s.displayurl, l.created, count(s.submissionid) countSubmissions FROM submission AS s INNER JOIN login AS l ON s.loginid = l.loginid WHERE l.username = '$profile'";

    Read the article

  • cant access nested ressource 'comments' in rails 3.0.1

    - by DannyRe
    Hey, I hope you can help me. /config/routes.rb resources :deadlines do resources :comments end /model/comment.rb class Comment < ActiveRecord::Base belongs_to :post, :class_name = "Post", :foreign_key = "post_id" end /model/post.rb class Post < ActiveRecord::Base has_many :comments end When I want to visit: http://localhost:3000/posts/1/comments/new it says: undefined method `comments_path' for #<#:0x4887138 in _form.html I use 'formtastic' and the _form.html.erb looks like this: <% semantic_form_for [@comment] do |form| % <% form.inputs do % <%= form.input :content % <% end % <% form.buttons do % <%= form.commit_button % <% end % <% end %

    Read the article

  • How can I apply a style to existing tikz node on specific slides

    - by Eugene Pimenov
    This is what I'm trying to do \begin{tikzpicture} [node distance = 1cm, auto,font=\footnotesize, % STYLES every node/.style={node distance=1.3cm}, comment/.style={rectangle, inner sep= 5pt, text width=4cm, node distance=0.25cm, font=}, module/.style={rectangle, drop shadow, draw, fill=black!10, inner sep=5pt, text width=3cm, text badly centered, minimum height=0.8cm, font=\bfseries\footnotesize\sffamily,rounded corners}, selected/.style={fill=red!40}] \node [module] (nodeA) {node A}; \node [module, below of=nodeA] (nodeA) {node B}; \only<1>{ \node [comment, text width=6cm, right=0.25 of nodeA] {short description of Node A}; \node [comment, text width=6cm, right=0.25 of nodeB] {short description of Node B}; } \only<2>{ \node [selected] (nodeA) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node A}; } \only<3>{ \node [selected] (nodeB) {}; \node [comment, text width=6cm, right=0.25 of nodeA] {long description of node B}; } \end{tikzpicture} The problem is \node [selected] (nodeB) {}; creates a new node, but I want it to apply the style for the existing node. Is there any way to do so? Of course I could have copies of every node in selected state and not-selected state, but I really want to have a normal solution.

    Read the article

  • Rails: three most recent comments for unique users

    - by Dennis Collective
    class User has_many :comments end class Comment belongs_to :user named_scope :recent, :order => 'comments.created_at DESC' named_scope :limit, lambda { |limit| {:limit => limit}} named_scope :by_unique_users end what would I put in the :by_unique_users so that I can do Comment.recent.by_unique_users.limit(3), and only get one comment per user

    Read the article

  • Method for defining simultaneous has-many and has-one associations between two models in CakePHP?

    - by Hobonium
    One thing with which I have long had problems, within the CakePHP framework, is defining simultaneous hasOne and hasMany relationships between two models. For example: BlogEntry hasMany Comment BlogEntry hasOne MostRecentComment (where MostRecentComment is the Comment with the most recent created field) Defining these relationships in the BlogEntry model properties is problematic. CakePHP's ORM implements a has-one relationship as an INNER JOIN, so as soon as there is more than one Comment, BlogEntry::find('all') calls return multiple results per BlogEntry. I've worked around these situations in the past in a few ways: Using a model callback (or, sometimes, even in the controller or view!), I've simulated a MostRecentComment with: $this->data['MostRecentComment'] = $this->data['Comment'][0]; This gets ugly fast if, say, I need to order the Comments any way other than by Comment.created. It also doesn't Cake's in-built pagination features to sort by MostRecentComment fields (e.g. sort BlogEntry results reverse-chronologically by MostRecentComment.created. Maintaining an additional foreign key, BlogEntry.most_recent_comment_id. This is annoying to maintain, and breaks Cake's ORM: the implication is BlogEntry belongsTo MostRecentComment. It works, but just looks...wrong. These solutions left much to be desired, so I sat down with this problem the other day, and worked on a better solution. I've posted my eventual solution below, but I'd be thrilled (and maybe just a little mortified) to discover there is some mind-blowingly simple solution that has escaped me this whole time. Or any other solution that meets my criteria: it must be able to sort by MostRecentComment fields at the Model::find level (ie. not just a massage of the results); it shouldn't require additional fields in the comments or blog_entries tables; it should respect the 'spirit' of the CakePHP ORM. (I'm also not sure the title of this question is as concise/informative as it could be.)

    Read the article

  • Removing a Preceding Backslash from Apostrophes

    - by John
    Hello, When I add a comment using the variable below, apostrophes are printed with a backslash in front of them. How can I get rid of the backslashes? Thanks in advance, John Example of printed result: My roommate\'s brother\'s ex-girlfriend\'s aunt drive a Toyota. $comment = mysql_real_escape_string($_POST['comment']);

    Read the article

< Previous Page | 22 23 24 25 26 27 28 29 30 31 32 33  | Next Page >