Archive

Posts Tagged ‘Google’

HowTo: round a number up to N decimal digits in Javascript

Was just trying to round-off some Google Maps coordinates for display in Javascript up to 3 decimal digits and that was a bit like a blast from the past (the end of the ‘90s to be more accurate)…

So here’s my contributed answer at:
https://stackoverflow.com/questions/2221167/javascript-formatting-a-rounded-number-to-n-decimals

This works for rounding to N digits (if you just want to truncate to N digits remove the Math.round call and use the Math.trunc one):

function roundN(value, digits) {
   var tenToN = 10 ** digits;
   return /*Math.trunc*/(Math.round(value * tenToN)) / tenToN;
}

Had to resort to such logic at Java in the past when I was authoring data manipulation E-Slate components. That is since I had found out that adding 0.1 many times to 0 you’d end up with some unexpectedly long decimal part (this is due to floating point arithmetics).

A user comment at Format number to always show 2 decimal places calls this technique scaling.

Some mention there are cases that don’t round as expected and at http://www.jacklmoore.com/notes/rounding-in-javascript/ this is suggested instead:

function round(value, decimals) {
  return Number(Math.round(value+'e'+decimals)+'e-'+decimals);
}

image

YouTube (Google) 502 error page

Categories: Posts Tags: , , , , ,

Mistyping Gmail.com URL lures you into a pay-per-message scheme

A reader of my recent article on a page faking YouTube design to lure you into subscribing for a pay-per-message you receive scheme for mobile phones, told me that they came across a very similar one by typing wikipdia.org instead of Wikipedia.org. I noticed that also typing gmial.com instead of gmail.com takes one to exactly the same page design. Prominent is the “G” letter with a font that reminds a lot of Gmail/Google (but not of Wikipedia btw).

image

image

image

image

image

This time their last page seems broken, since it does ask for your phone number, but the UI to enter it is missing

image

Google: Χαμένοι στη μετάφραση

image

Τραγική η αυτόματη μετάφραση στα Ελληνικά πολλές φορές. Το Google Toolbar στην παραπάνω εικόνα έχει μεταφράσει το AD (Active Directory) σε μ.Χ. (Μετά Χριστόν) για τα χρήσιμα (για πληροφορικάριους μόνο φυσικά) εργαλεία AD Explorer και AD Insight της SysInternals (που είναι εδώ και κάμποσο καιρό πλέον μέρος της Microsoft).

Try IE9 with HTML5 showcases from Microsoft, Mozilla, Google and Apple

Since IE9 final version is being released today (http://www.beautyoftheweb.com), here are some HTML5 showcases from different browser makers to test it out against:

Could even try some of Google’s Chrome specific demos in case they work with IE9 too: http://www.chromeexperiments.com/

 

IE9 RC (Release Candidate) wasn’t fully HTML5 compliant last time tested mind you, but neither the other browsers were as you can see at W3C tests:

http://test.w3.org/html/tests/reporting/report.htm

http://www.w3.org/html/wg/wiki/Testing

IE9 is way better though than IE8: http://samples.msdn.microsoft.com/ietestcenter/

Can also see lots of HTML5 tests for browsers at: http://html5demos.com/

 

BTW, it is very interesting that IE9 also supports the WOFF format (Web Open Font Format). Typeface lovers can drool freely here: http://lostworldsfairs.com/

 

Here’s a relevant post with nice video of Mozilla’s showcase: http://techtimely.wordpress.com/2011/03/08/html5-showcase-demos/

 

So should we start drooling on future WebGL support in the browsers’ world too now?

http://techtimely.wordpress.com/2011/03/04/webgl-1-0-specification-releasedwebcl-coming/

(see video at that post and find more WebGL apps at http://learningwebgl.com/blog/)

Bug: Google Maps rendering exotic place names onto Patras, Greece

GoogleMapsRioArabia

Seems that day (8 Aug 2010), Google Maps system had been drinking or something, else I can’t explain how “Cara Oasis” and other exotic place names (in Arabic script?) were rendered onto a map for the outskirts of Patras, Greece.

Categories: Posts Tags: , , , ,
%d bloggers like this: