Jump to content

Wikipedia:Reference desk/Archives/Computing/2019 June 26

From Wikipedia, the free encyclopedia
Computing desk
< June 25 << May | June | Jul >> June 27 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is a transcluded archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


June 26

[edit]

Manually referencing a wiki article without Cite extension

[edit]

I have installed MediaWiki on a webserver and I want to add some references to an article.
I don't have any extensions installed and I don't want to install any (from long-term maintenance reasons).

I can add after any sentence a <ref> tag with text inside it, but how could I make these refs appear in a list in the end of the article?
I don't care if I should do the sorting manually or automatically as of this moment, I just need to learn how I display these in a list in a "Footnotes" section. Thanks. — Preceding unsigned comment added by 49.230.75.149 (talk) 08:17, 26 June 2019 (UTC)[reply]

I would add the Cite extension. Wikis are so much better with extensions added. If you don't have WP's performance constraints, you can have useful extensions like DPL too.
To work without it, you might find the easiest is to create the cites on a Wiki with the extension in place (such as en:WP) and subst: its results, then copy them off to your wiki. Andy Dingley (talk) 08:57, 26 June 2019 (UTC)[reply]
Hello, I think that if a Wiki does better with or without extensions depends on the wiki itself and it's audience, but to the issue --- what about no-extension solutions that are being based only on Wiki syntax and maybe also some JavaScript, is there nothing for this particular need?... 49.230.75.149 (talk) 09:15, 26 June 2019 (UTC)[reply]
If I understand correctly, you just wish to directly link to the resource, or to an anchor on your own page. For that, see the MediaWiki syntax for linking: specifically, Link to an anchor on the same page.
Then, somewhere (at the bottom of your page, for example), you create your list of references, and following the same syntax guide, Setting an anchor for incoming link, tag each item in your list of references.
This procedure uses the built-in features of MediaWiki, and entails only slightly more manual effort than using the various reference extensions that are installed on the English Wikipedia.
Distinct from this procedure, you may (optionally) wish to clone your favorite Wikipedia MediaWiki templates that are commonly used to format reference links.
Nimur (talk) 16:28, 26 June 2019 (UTC)[reply]

MediaWiki wraps all space-indented nested content in <pre> HTML tags

[edit]

To reproduce go to a MediaWiki web site with the skin "Vector", go to an edit page, add some non <pre> HTML content, add some non <pre> space-indented nested HTML content inside it, and save the page.

How can one turn off this behavior in MediaWiki? Thanks, 49.230.75.149 (talk) 08:45, 26 June 2019 (UTC)[reply]

Don't indent with spaces? This is a pretty deeply embedded behaviour in Wikitext. You're not going to remove it easily with just a bit of CSS skinning. Andy Dingley (talk) 09:29, 26 June 2019 (UTC)[reply]
User:Andy Dingley; okay, even if I don't indent with spaces; my keyboard doesn't have a key for tabulation-indentation and searching-finding-copying-pasting tabulation-characters feels bad to me to do repeatedly. Using an AHk approach to create a Windows keyboard shortcut is nice but not a solution for Linux users. Any another approach? 182.232.21.241 (talk) 14:57, 26 June 2019 (UTC)[reply]
Wiki markup uses ":" as the indent character, just as we're doing in these threads. You can either work with that, or rail against it. I find doing what it wants me to is much easier. Andy Dingley (talk) 15:00, 26 June 2019 (UTC)[reply]
Andy I tried that but sadly the outcome is the same (maybe ":" is actually a space-indentation and not tabulation-indentation)... The original problem seems to be in how MediaWiki PHP creates HTML and not by type of indentation (i.e spaces or tabulations). Any other idea? 182.232.21.241 (talk) 16:30, 26 June 2019 (UTC)[reply]
Please see WP:CHEATSHEET and H:MARKUP. These techniques were laid down eighteen years ago, they're not going to change. --Redrose64 🌹 (talk) 19:40, 26 June 2019 (UTC)[reply]
Hello, User:Redrose64, I read the <pre> section in the second link you provided but I miss why nested content (in the context I described above), appears in a few different <pre> tags instead just the parent tag (which is in my case <code> but could instead be <div> or <span> or whatever other tag), and most important of all for me - what can I do to prevent this situation. — Preceding unsigned comment added by 182.232.21.241 (talk) 19:52, 26 June 2019 (UTC)[reply]
For a start, please provide a link to the article that you are working on. Then describe where you want indentation to occur, and explain why this would be beneficial compared to the default behaviour of hard-left. --Redrose64 🌹 (talk) 20:10, 26 June 2019 (UTC)[reply]
User:Redrose64; I prefer not to link for the site at this point but I will open a new thread with a better description of the problem.

where are operands stored in blackfin?? — Preceding unsigned comment added by 103.42.74.18 (talk) 13:06, 26 June 2019 (UTC)[reply]

While this question sounds suspiciously like WP:HOMEWORK, you might find the official processor reference manual linked from our article. All compute operands are stored in the register file in the Blackfin processor architecture.
Nimur (talk) 15:52, 26 June 2019 (UTC)[reply]

Database operation question

[edit]

Here's a thing I have run into at work. We are using Microsoft SQL Server as the database. I have a table containing rows with IDs and some status flag columns.

There's an operation that calculates a list of row IDs and then performs a database update that sets a status flag column on these rows to a specific value. This is done with an SQL UPDATE clause with a WHERE condition that has a large IN () list with all the desired IDs.

However, some of the rows might already have the status flag column at the desired value.

So my question is, which is more efficient?

  • First fetch the IDs of the rows where the status flag is already at the desired value, and exclude them from the IN () list, or
  • Just do the operation with the large IN () list, allowing it to update even those rows with the flag already at the desired value?

JIP | Talk 21:17, 26 June 2019 (UTC)[reply]

Benchmark both. Andy Dingley (talk) 21:25, 26 June 2019 (UTC)[reply]
Yes. It would be interesting to do it both ways and then try to explain why the winner is faster. Bearing in mind that we don't have all the facts about the database structure, or how many rows it has or how many "some" is. So trying to guess which one might be more efficient is a weak alternative to actually trying it! ←Baseball Bugs What's up, Doc? carrots21:56, 26 June 2019 (UTC)[reply]
Generally speaking, updating a record is more expensive than performing a query on it. However, it's possible the DB management system might be smart enough to see that the update will result in no change to that record, and skip it. If bench-marking shows that this is not the case, then I suggest a clause on the UPDATE something like AND STATUS_FLAG <> "Y". You want the DBMS to do the work for you, as opposed to returning a couple lists and you then filtering the one based on the other, and doing updates accordingly, which would certainly be slower. SinisterLefty (talk) 22:07, 26 June 2019 (UTC)[reply]
Or if there are only two possible values, Y and N, have it update where status_flag = "N". ←Baseball Bugs What's up, Doc? carrots22:11, 26 June 2019 (UTC)[reply]
That would work, but I don't believe there would be any performance difference, and we should also consider what happens if additional values are ever added, like "?". Of course, if it was a logical (T/F) value, then this isn't possible. SinisterLefty (talk) 13:07, 27 June 2019 (UTC)[reply]
Does SQL Server have an "explain plan" function as Oracle does? ←Baseball Bugs What's up, Doc? carrots15:13, 27 June 2019 (UTC)[reply]
  • Of course. But even this isn't a guarantee of performance on its own, as we don't know the size of the tables, the distribution of data within them, and the indexing available. Many such factors will affect the performance of both queries and it's hard to choose without knowing the sizes.
Then again, whenever I hear "a list of row IDs" my teeth start to grate. Why isn't this list selected within the database? If it has to be imported from outside, then are "row IDs" really a dimension which the database model should be publishing to the outside world (it's hard to do this without them either being too constrained by the outside world to make a good table key, or else a good primary key within the DB is opaque, unwieldy or even unstable for use outside). Andy Dingley (talk) 16:42, 27 June 2019 (UTC)[reply]
Maybe the OP will get back and offer some more details. ←Baseball Bugs What's up, Doc? carrots16:48, 27 June 2019 (UTC)[reply]
Agreed. If they had in mind doing something like SELECT ROW_ID WHERE (condition X) followed by UPDATE STATUS_FLAG = "Y" WHERE ROW_ID = {...}, then it would be much better to just do UPDATE STATUS_FLAG = "Y" WHERE (condition = X). It's possible they also retrieve the ROW_ID's for some type of log they keep, but then it would still make sense to do the SELECT followed by the last UPDATE. That is, don't send the same list of ROW_ID's back in the UPDATE. (The SELECT and UPDATE should perhaps be handled within a single TRANSACTION, to eliminate the possibility of a DB change happening between the SELECT and UPDATE which alters which ROW_ID's match condition X.) SinisterLefty (talk) 17:19, 27 June 2019 (UTC)[reply]