Skip to main content
Code Review

Return to Question

replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Source Link

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid like conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that Stack Exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column.

An example is as follows An example is as follows:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid like conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that Stack Exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column.

An example is as follows:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid like conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that Stack Exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column.

An example is as follows:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>
deleted 61 characters in body; edited title
Source Link
Jamal
  • 35.2k
  • 13
  • 134
  • 238

CodeLess Questions query

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid 'like'like conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that stack exchangeStack Exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column. An example is as follows

Checking if variableAn example is defined before accessing its propertiesas follows:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>

CodeLess Questions

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid 'like' conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that stack exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column. An example is as follows Checking if variable is defined before accessing its properties:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>

CodeLess Questions query

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid like conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that Stack Exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column.

An example is as follows:

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>
Tweeted twitter.com/#!/StackCodeReview/status/608012215883558913
Add example question
Source Link
rolfl
  • 98.1k
  • 17
  • 219
  • 419

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid 'like' conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that stack exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column. An example is as follows Checking if variable is defined before accessing its properties :

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid 'like' conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that stack exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

As part of an exercise by Jamal to clean up old questions on Code Review that have no code in them, I helped by writing this query on Stack Exchange Data Explorer: CodeLess Questions

select Id as [Post Link], CreationDate
from Posts
where PostTypeId = 1 --questions
 and Body not like '%</code></pre>%'
 and ClosedDate is null
order by CreationDate

I realize this is a relatively simple query, but I am always looking for ways to avoid 'like' conditions (and not like), and this query irks me.

Note that the like condition is %</code></pre>% - this is to trap the automatically managed code blocks that stack exchange uses to identify code. I cannot easily trap the open-tags because sometimes, when a custom syntax is used, the open tags are hard to search on.

I am looking for insights on whether the query can be improved or whether there are alternatives to the systems I have used for identifying code-less questions.

For reference, when Stack Exchange gets a question, the markup is converted to HTML and stored in the Body column. An example is as follows Checking if variable is defined before accessing its properties :

MarkDown:

I didn't write this but I noticed it in our codebase at work.
 var data = object && object.attribute && object.attribute.data ? object.attribute.data : {};
I get that the programmer is trying to check that the variable
`object.attribute.data` is defined before using it, but is seems like
so much repeated code. What's the best way to assign `data` the value
of `object.attribute.data` if it's defined, otherwise giving it a
value of `{}`?

HTML Encoding:

<p>I didn't write this but I noticed it in our codebase at work.</p>
<pre><code>var data = object &amp;&amp; object.attribute &amp;&amp; object.attribute.data ? object.attribute.data : {};
</code></pre>
<p>I get that the programmer is trying to check that the variable <code>object.attribute.data</code>is defined before using it, but is
seems like so much repeated code. What's the best way to assign
<code>data</code> the value of <code>object.attribute.data</code> if
it's defined, otherwise giving it a value of <code>{}</code>?</p>
added 17 characters in body
Source Link
rolfl
  • 98.1k
  • 17
  • 219
  • 419
Loading
Source Link
rolfl
  • 98.1k
  • 17
  • 219
  • 419
Loading
lang-sql

AltStyle によって変換されたページ (->オリジナル) /