• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

A Few Suggestions from my end

 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We welcome new people to our forums, is it possible that when a poster posts his first question, it should be highlighted in a different color or a new icon ?
Such posts can get better attention and well as lot of "Welcome to coderanch" messages from all

Another suggestion is code indentation. I have seen many people asking users to properly indent their code, How about a validation that disallows a user from posting badly indented code ?
or .... automatic indentation of text in code blocks ?!!

And finally, can we detect text as code and warn the user if he didn't use code blocks ? (eg if no of braces and semicolons and rounded brackets are many for a given set of lines, its probably java code)
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:We welcome new people to our forums, is it possible that when a poster posts his first question, it should be highlighted in a different color or a new icon ?
Such posts can get better attention and well as lot of "Welcome to coderanch" messages from all


I like to think that a welcome message is something personal. If we need automated assistance, what's the point of welcoming people at all?

Another suggestion is code indentation. I have seen many people asking users to properly indent their code, How about a validation that disallows a user from posting badly indented code ?
or .... automatic indentation of text in code blocks ?!!


In my opinion, this is a bad idea because automated formatting will lead to frustrations. I really dislike a certain text editor that is to remain unnamed, because it's "too smart for its own good".

And finally, can we detect text as code and warn the user if he didn't use code blocks ? (eg if no of braces and semicolons and rounded brackets are many for a given set of lines, its probably java code)


I like this idea. I'm afraid though that most people who can't be bothered to use code tags will not heed the warning either.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stephan van Hulst wrote:

salvin francis wrote:We welcome new people to our forums, is it possible that when a poster posts his first question, it should be highlighted in a different color or a new icon ?
Such posts can get better attention and well as lot of "Welcome to coderanch" messages from all


I like to think that a welcome message is something personal. If we need automated assistance, what's the point of welcoming people at all?


I thought the OP was saying that a first post by someone should be blue (or whatever). Then anyone who sees that post would know and could write a welcome message. I didn't think they meant the message itself should be automated.

It's be kind of like a "super-greenhorn" flag - when the post count == 1, do some kind of highlighting.
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:We welcome new people to our forums, is it possible that when a poster posts his first question, it should be highlighted in a different color or a new icon ?
Such posts can get better attention and well as lot of "Welcome to coderanch" messages from all


Hmm. We have the # posts displayed so one can see that it == 1. But that could certainly be more visible. I'm not a fan of highlighting the whole post. Ideas on an icon?

salvin francis wrote:And finally, can we detect text as code and warn the user if he didn't use code blocks ? (eg if no of braces and semicolons and rounded brackets are many for a given set of lines, its probably java code)


How would you feel about implementing JavaScript for this? Tim contributed JavaScript for the line # feature before he was a moderator. I integrated it and it worked great. And we gave him cows as a thank you. Seriously though - if you write the JavaScript logic to do the detection and alert, it'll get done a lot faster. Because then it won't be competing with all our other forum enhancements.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:
Hmm. We have the # posts displayed so one can see that it == 1. But that could certainly be more visible. I'm not a fan of highlighting the whole post. Ideas on an icon?


I can design an icon for it, give me 2 days

Jeanne Boyarsky wrote:
How would you feel about implementing JavaScript for this? Seriously though - if you write the JavaScript logic to do the detection and alert, it'll get done a lot faster. Because then it won't be competing with all our other forum enhancements.


Javascript isn't one of my core skills, But I can still do a bit on it though, give me a few days.
will something like this be okay? :



Jeanne Boyarsky wrote:
Tim contributed JavaScript for the line # feature before he was a moderator. I integrated it and it worked great. And we gave him cows as a thank you.



Interesting, back in 2009 , I too designed something that you see in all posts ;).
https://coderanch.com/t/455831/Ranch-Office/Social-media-integration
Just kidding though, I don't want cows.
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:. . .. . .

Surely that should read
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:I can design an icon for it, give me 2 days


No promises that we use it. But I promise the staff will vote on whether to use it.

salvin francis wrote:Javascript isn't one of my core skills, But I can still do a bit on it though, give me a few days. will something like this be okay?


So you'll learn something . Seriously though, don't worry if it isn't perfect. Even if I have to edit it, that's faster than starting from scratch. The function signature would be better if it didn't take a parameter. The form field id/name is fixed so the function can look it up. (Also note that we use jQuery a bunch on this site so you may find it easier to call jQuery functions.)

salvin francis wrote:J I too designed something that you see in all posts ;). Just kidding though, I don't want cows.


Too bad. I went and gave you two cows anyway. That contribution pre-dated the cows. Soon you will have a small herd!

Seriously though. Feature requests that come with someone to code them are awesome!
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Of course, this is a basic Regex, Let me know if there are more validations that you want me to add to this.

This is one of the most basic validations that a java code should have brackets and a semi colon.

We can also search for "class" and similar stuff if needed.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Better variation :


This will also match 'class MyClass {'
And most of all, the user will be shown the warning just as he has started typing his code
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Would like to see that working Looks nice.
 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would also like to see some test cases that demonstrate examples of what your code considers code and what it does not.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you explain in English what the regex does? I like regular expressions and I'm still having trouble parsing.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
/(class.*\{)|(\{([\s\S])*(;)([\s\S]*)\})/g;

Breaking down ...

If text contains class XXX {
Where XXX is any character its a match

Else

if text contains code snippet that is of the form :

{
XXX;
}
Where XXX is any multi-line text with one or more semicolons, it is a match


Examples of what will be considered as code:





 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jeanne Boyarsky wrote:...I'm still having trouble parsing.


It ran fine in firefox, didnt throw any error, did you try that html standalone tester code in my previous post ?
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Any updates for me ?
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I missed this over the weekend. I modified the code to fit in the existing validation routine. (I don't want the user to get prompted while typing because it is disruptive. Also, we have some other logic that runs then.) Your description of the reg exp helped. I didn't change that part at all. The "parsing issue" wasn't a browser problem. It was me trying to wrap my brain around it!

Here's the code I actually committed. We just had a deployment yesterday so it'll be a little while before the next one. But it is all set to go in that one. And I already gave you a cow.

 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the cow

I'll come up with a good icon for the first post by a user soon, give me some time.
 
Jeanne Boyarsky
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We had a deployment tonight because there was another feature we needed to get into production quickly. It works. Before I added the code tags, this post gave me a warning about how perhaps I want to add code tags. Feel free to test in this thread.

 
Ranch Hand
Posts: 417
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

salvin francis wrote:. . .. . .

Surely that should read



Well, maybe "detected" is an int, string or whatnot and he wants to narrow it down to a boolean value. I am half kidding of course but this is just to mention you can do if(anytype) in js since it has no type checking really ;-)

http://www.w3schools.com/js/js_booleans.asp
 
Campbell Ritchie
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good point
 
reply
    Bookmark Topic Watch Topic
  • New Topic