|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Getting the Primes | |
I have written these functions in Python:
import math def is_prime(number): if number > 1: if number == 2: return True if number % 2 == 0: return False for current in range(3, int(math.sqrt(number) + 1), 2): if number % current == 0: return False return True return False def get_primes(number): while True: if is_prime(number): yield number number += 1I now do this: y = get_primes(25)What is y? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by DinoRS) |
BITting out the impossible? I have the following Table: CREATE TABLE #Bitwize ( bitcol bit) I add some value to this table like this: INSERT into #Bitwize VALUES (1) Then I check what I get from this: SELECT * from #Bitwize I then do some fancy stuff to the table like this: UPDATE #Bitwize SET bitcol = bitcol ^ 1 I ask myself if and what has happened to the statement and table so I issue this: SELECT * from #Bitwize What are my results? Answer: Output from first Select = 1, Update statement affects 1 rows, Output from second Select = 0 Explanation: A quick way to bit flip is ^ Math example: (0 ^ 1) 0000 0001 ---- 0001 (1 ^ 1) 0001 0001 ---- 0000 Reference: Bitwise Operators - https://docs.microsoft.com/en-us/sql/t-sql/language-elements/bitwise-operators-transact-sql?view=sql-server-2017 |
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Injection Attack Troubleshooting - We had a SQL Injection attack recently on our website. Looks like it came through a “Contact Us” PHP form. I’m not a PHP developer, and wondering who/what is a good resource to look at the PHP code to see what the vulnerabilities are. It’s about 500 lines, and handles the usual contact us type […] |
Help me figure out what SQL does with this query - Can anyone explain what happens in the third join? Does SQL rescan the join tables after the initial joins are done? |
Flyway - Have been taken directly to this survey several times after clicking on a topic and getting a “whoops that topic does not exist anymore” error message, have replied to survey several times as that seems the only way to move on!! Probably skewed survey results! Android version 7.0 using chrome, do I get extra points […] |
MAJOR ISSUE TO FIX ASAP: data loss for characters not included in code page 1252 - I have mentioned this in two others posts but need to make it very clearly visible given that fixing the issue will not retroactively fix the mangled data (unlike fixing other display issues, such as bulleted / numbered lists now appearing correctly): Characters that are not found on Code Page 1252 are not stored […] |
Briefcase nearly empty. - I suspect that this issue is related to the broken/missing links issues and I can’t tell you which links are missing because there were a whole lot and now they’re gone, but my BriefCase has very few items in it compared to what is used to contain. |
"Resource" section missing from articles. - Here are two examples where there used to be attachments in the “Resource” section that no longer have such attachments. Reaping the benefits of the Window functions in T-SQL Hierarchies on Steroids #1: Convert an Adjacency List to Nested Sets |
Quoted items in old posts are not fully encapsulated by the quote. - As an example, please see the following post. It’s difficult to see who said what and what’s being quoted by whom because the text being quoted is not encapsulated by the quote. Reaping the benefits of the Window functions in T-SQL I’m using the latest autoupdated version of FireFox. |
Leader Board is incorrect. - I suspect this goes along with the problem of external blog articles being mixed with SSC articles but I also have no blog articles. Yet, I’m listed has having 77 submissions when I actually only have 36. My suspicion is that reposting of articles is also being counted. While I certainly appreciate the kudo that […] |
site not respecting style(s) added by its own text editor - I just tried adding a color to some text in another topic and used the color-picker from the menu buttons at the top of the text editor. I also made the text bold. I did NOT attempt to manually enter the HTML. Yet, what shows up is the actual inline style via “span” tag with […] |
Blockquote does nothing when viewing the post - Using the blockquote button to show that text is quoted does nothing when viewing the post. In the editor it indents all the lines (and the P character, in the bottom left, changes to BLOCKQUOTE » P when your cursor is on the line), however, nothing actually changes: This text is in a blockquote As […] |
Ability to EDIT a post is timed. - The ability to edit a post simply disappears after a very short time. It sometimes takes months or more to realize that a mistake has been made and that a post needs to be edited (improved or change the tone based on new knowledge ) Please make it so that there is no […] |
Post submittal checkbox defaults are backwards. - During original and followup posts, the checkbox for “Notify me of follow-up replies via email” should default to being checked. Most people (especially newbie original posters) want to be notified of replies to posts/threads they’ve made. Also, when editing a post, the “Keep a log of this edit:” defaults to being checked. The log history […] |
There is no way to flag SPAM or other types of inappropriate posts. - The title says it all. |
blog vs author main page - Hi there. There are a few issues (or at least differences that may or may not be intentional) surrounding blog / author main pages: The old site distinguished between blog-specific posts and content authored specifically on SSC.com. Meaning, there used to be both “https://www.sqlservercentral.com/blogs/sql-quantum-leap/” (with just my blog posts) and “https://www.sqlservercentral.com/Authors/Articles/Solomon_Rutzky/294002/” (with just my SSC.com-specific […] |
Features. Which are not available anymore or hidden. - Some features are missing or hidden. Actions, in the old system I used the actions quite a lot to see what messages of me where read and still of interrest to me. I used this to reread my messages and learn from that. An anwser can ??? not ??? be marked as an solution. Ben |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |