|
2, 4, 8, 16, 32, 64, 128, 256. Cause it's still stored that way for space efficiency.
|
|
|
|
|
Yes, it's stored in multiples (normally) of 8 bits, one byte, but 255 is the maximum for one byte, and the max length for an nvarchar can't fit into one byte, and is normally stored in a four byte structure, making 255 a totally arbitrary value based on archaic systems where the value was stored in only one byte.
Storing a value of 3 in 8 bits is no less efficient than storing the value 2 in those same 8 bits.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
To make importing from Excel easier?
Or so Pascal-style calls can be used?
|
|
|
|
|
Brady Kelly wrote: makes much more sense
No it doesn't. There aren't degrees of arbitrariness. If 255 is arbitrary then so is 200 or 300. Any number is as arbitrary as any other. The question 'why not' applies equally to 200 and 255!
|
|
|
|
|
But the question here is just how arbitrary is 255? This number has a long and well known history as a one byte maximum, so when I see it, I don't think it was arbitrarily chosen, but rather a left-over from very old legacy code, or a question of monkey see, monkey do.
Granted, without that history, any valid choice for a default maximum length for nvarchar is equally arbitrary. I think I may even start using numbers like 347.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
Brady Kelly wrote: This number has a long and well known history
I don't disagree. "That's the way we've always done it", and "Being bears of little brain an easy to remember number is always best" both seem like perfectly sound justifications to me. I was merely pointing out that if one is going to call 255 arbitrary as the foundation of one's argument one can't then replace it with an equally arbitrary number and present it as an improvement.
|
|
|
|
|
It may be a performance thing.
Even though the size of the field has to be more than one byte, having the size of the actual field be a power of two makes it fit more efficiently into caches, which are organised into multiples of the machine word, partly because the physical address lines naturally do the same.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
That does make sense, and would make more sense if we were talking about the vast quantities of numbers representing the actual field size, which occur once per row, and sometimes in tens of millions or more, but we're talking about the maximum length for a row, which only occurs (I assume) once per row definition.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
Brady Kelly wrote: Why not a nice, round default like 200 or 300? powers of 2 are round sizes for computers.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I know, but except in rare cases, us humans using numbers that are round for computers makes no more sense than numbers that are round for humans.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
Brady Kelly wrote: makes no more sense
Nor does it make less. The problem with you young things is that you think the whole world is based on tens and always has been. Those of us old and wise enough to think in gallons and pints, feet and inches, pounds and ounces (what I call natural measures) don't have this short sightedness. Using convenient binary and hexadecimal numbers (what could be easier to remember than #FF?) just makes sense to us.
And what's wrong with having a standard that everybody can work with rather than trying to guess what you consider to be a 'nice, round number' anyway? It's just reinventing the wheel and relearning to slice bread. Wasteful, pointless and frustrating effort trying to read other people's minds is precisely what programming is meant not to be about.
You don't presumably ask why there are 24 hours in a day when it could have have been a nice round number like 10 or 50 every time you encounter a date/time variable? How is your bugbear any different?
|
|
|
|
|
SQL Server itself uses 50 as the default max length for an nvarchar , and EF uses MAX . Both seem easy enough to remember for someone who counts himself lucky, but not that young (46), enough to not have to directly use hex in my coding work, like most modern programmers.
Do what thou wilt shall be the whole of the Law. - Liber AL vel Legis 1:40, Aleister Crowley
|
|
|
|
|
Blame it on the person who first thought of the range 0-255; he did not think of a 'nice, round' one like 200 or 300.
100 is nicer, rounder, isn't it?
|
|
|
|
|
If the data base value corresponds to an external value from another system (business logic, data acquisition, etc.), it may make sense to have them match.
Software Zen: delete this;
|
|
|
|
|
Very early, as I've a lot to do today...
Would Darth Vader wish you all a Very Merry Sithmas and a Hothy New Year?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Before or after he sliced your arm off with a lightsabre?
|
|
|
|
|
What are you doing replying today. Oh dear face + palm ! Happy Christmas!
|
|
|
|
|
What are you doing reading this today. Oh dear face + Palm. Hope had a happy christmas
|
|
|
|
|
Of course he would! I find your lack of faith disturbing.
You have just been Sharapova'd.
|
|
|
|
|
These aren't the puns you're looking for.
You can go about your business.
Move along.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Wow! You really were having a bad day, weren't you?
You have just been Sharapova'd.
|
|
|
|
|
And he sings Christmas classics such as "O Dark Side":
"O dark side! The Death Star's brightly shining,
It is the night of the Death Star's birth.
Long lay the galaxy in sin and error pining.
Till the Emperor appeared and the shift in the force felt its worth."
And "Dark Christmas":
"I'm dreaming of a dark Christmas
Just like the ones I used to know
Where the Death Star glisten,
and rebels listen
To hear death rays in the snowy planet Hoth."
And the all time favorite "Darth Jingle":
"Dashing past the stars
In Vader's TIE advanced
O'er the galaxy we go
Imperial marching all the way
Bells on the Death Star ring
Exploding planets bright
What fun it is to laugh and sing
A dark side song tonight."
And the light show is quite spectacular as well
|
|
|
|
|
Merry Xmas ! (it's near 2pm on Xmas day where I am, and a sunny 29.1C)
Perhaps believing in Santa, and that Santa is omnipotent, the OP of this question asked [^] asked: [sic] "I want to see satellite view of any Place"
In a foolish moment ... perhaps weakened mentally by Xmas cheer ... of assuming that statement ... by a first-time poster whose mother-tongue is not English ... was a question that actually had meaning lost in translation ... I posted an answer with links to CP articles on using Google Maps, and Google Earth.
The OP, today, I see from my ephemeral-glory-reputation-meter on CP, accepted the answer, and then un-accepted it with the comment [sic]:
"its can"t show that what activity is goning there"
well, sic transit gloria mundi
It's moments, like these, make the hours spent cleaning the muck off my hip-boots after I wade back bloodied from QA onto terra firma, worthwhile ... that's not a complaint: the continuing ego-reduction via synaptic liposuction remains ... very valuable, and, all it costs me is some humility.
cheers, Bill
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
|
|
|
|
|
Perhaps the solution the OP wants: is to connect all CCTV cameras in an area, and get live feed.
Those who are security-conscious can cover their cameras' eyes.
|
|
|
|
|
Sri Avijnata, I defer to your siddhi powers in reading this OP's mind
cheers, Bill
«Tell me and I forget. Teach me and I remember. Involve me and I learn.» Benjamin Franklin
|
|
|
|