units-of-measurement

SQL Server 2008 Geography .STBuffer() distance measurement units

旧时模样 提交于 2019-12-05 02:03:17
I'm working with a geographic point using lat/long and need to find other points in our database within a 5 mile radius of that point. However, I can't seem to find out what the "units" are for STBuffer, it doesn't seem to conform to feet, miles, meters, kilometers, etc. The documentation only refers to them as "units", any suggestions? Thanks [...] from geography::STGeomFromText('POINT(x y)', 4326).STBuffer(z).STIntersects(geography::STGeomFromText('POINT(' + CAST(v.Longitude as varchar(max)) + ' ' + CAST(v.Latitude as varchar(max)) + ')', 4326)) = 1 STBuffer is in meters. More info here. To

Which unit of measurement does the Paint.setTextSize(float) use?

筅森魡賤 提交于 2019-12-04 23:39:01
I want to draw text with an specific height(in pixels) on a view using Canvas . Can you simply use Paint.setTextSize(float) with the number of pixels or is this using dp or sp ? It uses pixels, but you can convert it to dp using this code: double getDPFromPixels(double pixels) { DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); switch(metrics.densityDpi){ case DisplayMetrics.DENSITY_LOW: pixels = pixels * 0.75; break; case DisplayMetrics.DENSITY_MEDIUM: //pixels = pixels * 1; break; case DisplayMetrics.DENSITY_HIGH: pixels = pixels * 1.5

Is it possible to define units of measure for kB, GB, … with explicit or implicit conversion?

谁说胖子不能爱 提交于 2019-12-04 05:51:30
问题 I would like to define a Measure type [<Measure>] type kB that converts to the number of bytes when explicitly cast to an int: (int)7<kB> // would result 1024kB - explicit would be fine Since there is no way to add an explicit conversion operator to a type like in C#, I am stuck. Anyone has an idea? Even better would be an implicit conversion , so that when a function requires numbers of bytes, it can be called like Allocate(7<kB>) // implicit would be superfine Special conversion functions

What measurement units does Silverlight and WPF use?

一个人想着一个人 提交于 2019-12-04 02:54:04
问题 Does anyone know what measurement units are used by Silverlight/WFP? For example, if I create a new button and set its height to 150, is that 150 pixels? points? millimeters? I design all of my applications in Adobe Illustrator before proceeding to code, and although I try and set everything to the dimensions in my Illustrator file, the Silverlight application is usually larger. 回答1: MSDN's documentation states that the FrameworkElement.Height property (for Silverlight) refers to: The height,

F# Unit of Measure, Casting without losing the measure type

不打扰是莪最后的温柔 提交于 2019-12-04 00:08:18
Is there built in version of the type casting functions that preserves units and if not how would I make them? So for example with this code how would I cast intWithSecondsMeasure to a float without losing the measure or multiplying by 1.0<s> ? [<Measure>] type s let intWithSecondsMeasure = 1<s> let justAFloat = float intWithSecondsMeasure The answer provided by @kvb certainly works, but I'd prefer not to use the unbox operator for this conversion. There's a better, built in way that I think should be compiled as a NOP to IL (I haven't checked but unbox is probably going to end up as a unbox

WPF Units and Code-Behind

夙愿已清 提交于 2019-12-03 23:45:36
Recently I discovered WPF supports different measurement units in XAML. Besides default DIPs, there is also support for pixels, inches and centimeters (as far as I know). This allows designer to write XAML such as this: <Canvas> <Line X1="0cm" X2="3cm" Y1="1cm" Y2="3cm" Stroke="Black"/> </Canvas> However, you cannot bind these values. Imagine we have a ViewModel with Dimension property which is a String, for example "7cm". Following won't work: <Button Width="{Binding Dimension}">Test</Button> FormatException gets thrown. Similarly, when creating a FrameworkElement in code-behind, like this:

Best unit for font-sizes in CSS

99封情书 提交于 2019-12-03 16:31:43
问题 What are the advantages & disadvantages of each? em , px , % and pt ? My current choice are percentages, the only reason is because I can globally change the font-size of all elements, just by modifying the font size on the root element (body) 回答1: I would recommend EM — simply because I use Baseline CSS for my basic set up of forms, layout and most importantly type. Can't recommend it enough : http://baselinecss.com/ 回答2: My original design training said em's where possible. I believe a main

Should I use % or 'px' in HTML

风格不统一 提交于 2019-12-03 16:24:19
Regardless of whether it is HTML, XHTML or HTML5 you find those annoying percentages littered throughout the place. Yet... I see an awful lot of websites dare not go near them. Yet I was always encouraged through uni to use them. So which should I be using? Which would lead to better site design and why? I'm aware to avoid the use of height although HTML5 really doesn't like me not specifying height if I want to use percentages. Thanks for taking the time to read. It really depends on what you do you want to build up. Sometimes I need to build a website which could be read by people with

Converting from m/s to km/h using F# Units of Measure

允我心安 提交于 2019-12-03 13:00:58
I'm in the process of learning F# - and is currently looking into Units of Measure. I have a simple calculation returning meters per second, and I want to introduce a function converting it to kilometres per hour. My code looks like this: [<Measure>] type kg [<Measure>] type s [<Measure>] type m [<Measure>] type km [<Measure>] type h let msToKmph(speed : float<m/s>) = (float speed) * 3.6<km/h> let gravityOnEarth = 9.81<m/s^2> let heightOfJump = 3.5<m> let speedOfImpact = sqrt (2.0 * gravityOnEarth * heightOfJump) let speedOfImpactKmh = msToKmph(speedOfImpact) This works - I get 8.28673639 m/s

Units of measurement in C++

北慕城南 提交于 2019-12-03 07:11:47
问题 I'm working on a game engine, and currently I'm stuck designing the IO system. I've made it so, the engine itself doesn't handle any file formats, but rather lets the user implement anything he wants by creating a *.dll file with appropriately named functions inside. While that itself wasn't much of a problem, my main concerns are the implications that'll probably be visible during the usage of the engine. I designed a simple resource interface as a base class for all the things the user can