text:
Err, Where am I?
Oh no! I'm trapped in a big forest (Okay, not really, but just assume it) and I don't know where I am!
Thankfully, I brought my laptop. But when I searched 'Maps', It said 'No results', and I'm asking this as a last resort.
Please make a program which outputs my location's longitude and latitude in any two number format. any two number format includes:

A tuple.
A string including the longitude and the latitude.
A JSON Object.
etc..

Any API or Libraries may be used. That is, You can query Google Maps, etc. (I guess, They didn't trash their APIs :\)

PowerShell has gl for Get-Location, sadly I don't think C:\Users\Connor will help you escape the forest very much.

C:\Users@Connor>sudo yes

Mathematica, 4 bytes

Err, where am I?

Here

Evaluates to GeoPosition[{latitude, longitude}].

o_O Mathematica had a builtin for this?

@SIGSEGV Of course... (snippet #4)

Mathematica has a builtin for everything

this is pure gold

I read the challenge and briefly thought about a joke such as print("You are here"). Mwahahaha. And just after that, I scrolled down to your answer. :-)

Even better: the command Sunset[Here] - Now correctly returns the amount of time until sunset.

I'm amused to see an answer having this more votes than the question. Congrats

@SIGSEGV I think you can already accept this... Cannot (ever) be beaten

@Mr.Xcoder There is gl(Get-Location) on Powershell but Connor is saying gl(Good-Luck) instead :\

:))(( @SIGSEGV This is sad

There's a EasterSunday[year] builtin, and if you're not christian, there's EasterSundayGreekOrthodox[year] just for you. I have no words.

@sagiksp Greek Orthodox is Christian. It's just a different branch of Christianity (with a different way of calculating Easter).

@BrianMcCutchon Oh, I always thought it was a completely different religion, that's what you get for talking about christianity to a non christian haha. The builtin ridiculousness still stands though.

JavaScript (ES6), 89 82 bytes
navigator.geolocation.watchPosition(x=>alert([(y=x.coords).latitude,y.longitude]))

Try it online! (For some reason, this was not working in the snippet).
Explanation
navigator object is a part of BOM. geolocation is a property of its and is also an object, which contains geolocational data of the user. watchPosition() is a method of geolocation object. It takes in a callback function which is executed after the geolocational data has been retrieved. The callback function x=>alert((y=x.coords).latitude+","+y.longitude) is an anonymous (lambda) function that takes in an object x and alert()s the latitude and longitude properties of x.coords separated by a comma. Note that the object x is passed to the callback function by watchPosition() when the callback function is called (i.e. after the retrieval of the geolocational data).

Note: The geolocational data is GPS-based if GPS is available, otherwise it's based on IP.

watchPosition instead of getCurrentPosition saves 5 bytes. alert([(y=x.coords).latitude,y.longitude]) saves 2 more

1 character shorter, throws an error: for(f in r=navigator.geolocation)r=r[f](x=>alert((y=x.coords).latitude+","+y.longitude))

It's a rare occasion indeed when JS can be competitive while relying on its overly long property names.

@JohanKarlsson Thanks! Implemented it!

@Shaggy True, indeed.

PowerShell, 130 Bytes
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){}$b|select L*e

Ungolfed:
Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace
$GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object
$GeoWatcher.Start() #Begin resolving current locaton
whille ($GeoWatcher.Status -ne "Ready") do { sleep -Milliseconds 100 } #Wait for discovery.
$GeoWatcher.Position.Location | Select Latitude,Longitude #Select the relevent results.

Returns as:
PS C:\users\sweeneyc\Desktop> Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){}$b|select L*e

        Latitude         Longitude
        --------         ---------
53.4064177191653 -6.36202495701332

Turns out there is a way to do this, but it's not so pretty.
bonus: opens google maps on your current location.
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).Start();for(;($b=$a|% Po*n|% L*)|% I*){};saps "https://www.google.ie/maps/@$($b.Latitude),$($b.Longitude)z"

could save 3 bytes using TryStart but it outputs a true to the pipeline and costs more to suppress that.
Add-Type -A System.Device;($a=[Device.Location.GeoCoordinateWatcher]::new()).TryStart($true,[int]9e8);$a|% Po*n|% L*|select L*e

PowerShell (non-competing), 44 Bytes
(irm freegeoip.net/xml).Response|select *ude

Uses an external service since PowerShell has no internal builtins for 'current location' - this is IP-based Geolocation, so almost definitely won't return your actual location, it will return a 'default' location for your ISP, and if you run this over a VPN will present wherever the exit point is.
I've tried (not as a golf exercise) to get google maps API to work with the wireless-mac-address geolocation method, but it's far from accurate or golfable.
marked as non-competing due to the inaccuracy of the results.
PS C:\Users\sweeneyc> (irm freegeoip.net/xml).Response|select *ude
Latitude Longitude
-------- ---------
53.3472  -6.2439

this displays Central Dublin, Ireland when searched up, however i'm a bit outside the city center currently, about 8 miles from the returned point.

In C# the GeoCoordinateWatcher has a TryStart method which you could try which looks like it returns when the status is Ready instead of looping on it. If that method is available obviously.

@TheLethalCoder was the first thing I looked into, added in the example there, it only saves 3 bytes overall, but it dumps a true to the pipeline before I can output the lat/long, and I think it probably violates the spec when that's output.

@TheLethalCoder could feasibly save a byte(s) on the [int]9e8 part when you set the timeout in TryStart but i can't get it to work with 9999999 and [int]9e8 is the same as adding an extra 9.

Python with requests, 101 100 75 bytes
4 bytes saved thanks to @КириллМалышев
21 bytes saved thanks to @Rod
from requests import*;print(get('http://su0.ru/auls').text.split(',')[5:7])

If this is Python 2, you can save 1 byte by removing the parenthesis

Maybe it's better to use a short url? For example, http://su0.ru/auls. So you will save 4 bytes.

You don't need all this formatting, from requests import*;print(get('http://ip-api.com/json').text.split(',')[5:7]) should be enough

Link is broken! If you're going to use a URL shortener, best to use an established one.

Angolf, 110 107 bytes
❦™navigator.geolocation.getCurrentPosition#x=>™alert##y=x.coords▷.latitude+","+y.longitude▷▷●
    ❦                                   Define an IIFE
       ™                                Get the scope
         navigator                      Get JavaScript's navigator object from the scope
             geolocation                Get the geolocation property of the navigator object
                 getCurrentPosition     Get the current position and execute a function
                     x=>                Define a function with x as a parameter
                         ™              Get the scope
                            alert       Call alert and alert the following string:
                         #y=x.coords▷ Define y with the value of the coordinates of x
                         latitude       Get y's latitude
                         +","           Append "," to the string
                         +y.longitude   Append the longitude to the string
    ●                                   Close the IIFE and call it with the scope

Welcome to the site! I can't seem to find any information about Angolf; would you mind linking its website?

https://github.com/XtremePlayzCODE/angled/blob/master/angolf.js, Sorry for the late reply

C#, 132 bytes
_=>{var w=new System.Device.Location.GeoCoordinateWatcher();w.Start();var c=w.Position.Location;return c.Longitude+","+c.Latitude;};

Swift 4, 125 117 96 bytes
This can only be tested locally, unfortunately.
import CoreLocation;var c=CLLocationManager().location!.coordinate;print(c.longitude,c.latitude)

Excel VBA (Windows, Office 2016+ Only), 278 272 Bytes

Restricted to Windows, Office 2016+ for the use of the Microsoft.Mashup.OleDb.1 provider

Full subroutine that takes no input and outputs your current location as a Excel.ListObject typed table, including extra information.
Sub a
ThisWorkbook.Queries.Add"x","let S=Json.Document(Web.Contents(""su0.ru/auls""))in S
With Sheet1.ListObjects.Add(0,"OLEDB;Provider=Microsoft.Mashup.OleDb.1;Data Source=$Workbook$;Location=x",,,[A1]).QueryTable
.CommandText="SELECT * FROM [x]
.Refresh
End With
End Sub

Example output excluded for obvious reasons.
-2 Bytes for use of [Sheet1] over  Sheets(1)

authors: Кирилл Малышев


text:
Generating a random alphanumeric string of length N
What is the shortest way of generating a random string with a given length and with only alphanumeric characters allowed?

example of a random string: with N = 9 output would be aZua7I0Lk
the given length N can be assumed to be always greater than 0
if necessary you can assume 256 as a maximum value for N, but solutions with higher limits for N and still having a fast computation time are preferred
allowed characters: 0-9, a-z and A-Z
a character can occur more than once in the output string
each possible string should be equally likely (to the accuracy of your language's random number generator)

Can we assume a maximum value for N?

Related.

Jelly, 4 bytes
ØBṗX

Try it online!
Explanation
ØBṗX
ØB     All letters (uppercase and lowercase) and digits
  ṗ    Cartesian power with {the input}
   X   Select a random possibility

Cartesian power basically generates all list of a given length that can be formed out of a given set of elements; that's exactly what we need here.

If there are UTF-8 characters involved could that be really just 4 bytes? One UTF-8 character could be more than just one byte...

@m13r Jelly uses its own code page where these are all single byte characters

Taxi, 2577 bytes
Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:s 1 l 1 r.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:n 1 l 1 l 1 r.[a]Go to Heisenberg's:n 1 r 1 r 3 r.Pickup a passenger going to Cyclone.Go to Go More:n 1 l 3 l 3 l.Go to Starchild Numerology:e 2 r.62 is waiting at Starchild Numerology.Pickup a passenger going to Cyclone.Go to Cyclone:e 1 l 2 r.Pickup a passenger going to What's The Difference.Pickup a passenger going to Divide and Conquer.Pickup a passenger going to Divide and Conquer.Go to Divide and Conquer:n 2 r 2 r 1 r.Pickup a passenger going to Trunkers.Go to Trunkers:e 1 r 3 r 1 l.Pickup a passenger going to Multiplication Station.Go to Cyclone:w 2 r.Pickup a passenger going to Multiplication Station.Go to Multiplication Station:s 1 l 2 r 4 l.Pickup a passenger going to What's The Difference.Go to What's The Difference:n 2 l 1 r 3 l.Pickup a passenger going to Addition Alley.Go to Starchild Numerology:e 1 r 3 l 2 r.1 is waiting at Starchild Numerology.63 is waiting at Starchild Numerology.Pickup a passenger going to Addition Alley.Pickup a passenger going to The Underground.Go to Addition Alley:e 1 l 2 r 3 r 1 r.Pickup a passenger going to Joyless Park.Go to Writer's Depot:n 1 l 1 l.ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789- is waiting at Writer's Depot.Pickup a passenger going to Chop Suey.Go to Joyless Park:n 3 r 2 r 2 l.Go to Chop Suey:w 1 r 1 r 1 l.[b]Pickup a passenger going to Narrow Path Park.Go to Narrow Path Park:n 1 l 1 r 1 l.Go to The Underground:e 1 r.Switch to plan "c" if no one is waiting.Pickup a passenger going to The Underground.Go to Fueler Up:s.Go to Chop Suey:n 3 r 1 l.Switch to plan "b".[c]Go to Joyless Park:n 1 r.Pickup a passenger going to The Underground.Go to Narrow Path Park:w 1 r 3 l.[d]Pickup a passenger going to KonKat's.Go to KonKat's:e 1 r.Pickup a passenger going to KonKat's.Go to The Underground:s.Switch to plan "e" if no one is waiting.Pickup a passenger going to The Underground.Go to Fueler Up:s.Go to Narrow Path Park:n 4 l.Switch to plan "d".[e]Go to KonKat's:n.Pickup a passenger going to Riverview Bridge.Go to Riverview Bridge:n 1 l.Go to Narrow Path Park:e 1 l 1 r.Pickup a passenger going to Post Office.Go to Post Office:e 1 r 4 r 1 l.Go to Sunny Skies Park:s 1 r 1 l 1 r.Pickup a passenger going to The Underground.Go to The Underground:n 1 r 1 r 2 r.Switch to plan "f" if no one is waiting.Pickup a passenger going to Sunny Skies Park.Go to Sunny Skies Park:n 3 l 2 l 1 l.Switch to plan "a".[f]

Try it online!
Taxi is super not made for this but you can do it! I'll try to explain what's happening below the un-golfed version.
Go to Post Office: west 1st left 1st right 1st left.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: south 1st left 1st right.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park: north 1st left 1st left 1st right.
[a]
Go to Heisenberg's: north 1st right 1st right 3rd right.
Pickup a passenger going to Cyclone.
Go to Go More: north 1st left 3rd left 3rd left.
Go to Starchild Numerology: east 2nd right.
62 is waiting at Starchild Numerology.
Pickup a passenger going to Cyclone.
Go to Cyclone: east 1st left 2nd right.
Pickup a passenger going to What's The Difference.
Pickup a passenger going to Divide and Conquer.
Pickup a passenger going to Divide and Conquer.
Go to Divide and Conquer: north 2nd right 2nd right 1st right.
Pickup a passenger going to Trunkers.
Go to Trunkers: east 1st right 3rd right 1st left.
Pickup a passenger going to Multiplication Station.
Go to Cyclone: west 2nd right.
Pickup a passenger going to Multiplication Station.
Go to Multiplication Station: south 1st left 2nd right 4th left.
Pickup a passenger going to What's The Difference.
Go to What's The Difference: north 2nd left 1st right 3rd left.
Pickup a passenger going to Addition Alley.
Go to Starchild Numerology: east 1st right 3rd left 2nd right.
1 is waiting at Starchild Numerology.
63 is waiting at Starchild Numerology.
Pickup a passenger going to Addition Alley.
Pickup a passenger going to The Underground.
Go to Addition Alley: east 1st left 2nd right 3rd right 1st right.
Pickup a passenger going to Joyless Park.
Go to Writer's Depot: north 1st left 1st left.
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789- is waiting at Writer's Depot.
Pickup a passenger going to Chop Suey.
Go to Joyless Park: north 3rd right 2nd right 2nd left.
Go to Chop Suey: west 1st right 1st right 1st left.
[b]
Pickup a passenger going to Narrow Path Park.
Go to Narrow Path Park: north 1st left 1st right 1st left.
Go to The Underground: east 1st right.
Switch to plan "c" if no one is waiting.
Pickup a passenger going to The Underground.
Go to Fueler Up: south.
Go to Chop Suey: north 3rd right 1st left.
Switch to plan "b".
[c]
Go to Joyless Park: north 1st right.
Pickup a passenger going to The Underground.
Go to Narrow Path Park: west 1st right 3rd left.
[d]
Pickup a passenger going to KonKat's.
Go to KonKat's: east 1st right.
Pickup a passenger going to KonKat's.
Go to The Underground: south.
Switch to plan "e" if no one is waiting.
Pickup a passenger going to The Underground.
Go to Fueler Up: south.
Go to Narrow Path Park: north 4th left.
Switch to plan "d".
[e]
Go to KonKat's: north.
Pickup a passenger going to Riverview Bridge.
Go to Riverview Bridge: north 1st left.
Go to Narrow Path Park: east 1st left 1st right.
Pickup a passenger going to Post Office.
Go to Post Office: east 1st right 4th right 1st left.
Go to Sunny Skies Park: south 1st right 1st left 1st right.
Pickup a passenger going to The Underground.
Go to The Underground: north 1st right 1st right 2nd right.
Switch to plan "f" if no one is waiting.
Pickup a passenger going to Sunny Skies Park.
Go to Sunny Skies Park: north 3rd left 2nd left 1st left.
Switch to plan "a".
[f]

Start: Get stdin
Pick up the stdin value as text, convert it to a number, and go stick it somewhere to wait.
Plan A Part 1: Get a random integer 1-62
Get a random integer and then get 62 as a number. Duplicate both the random integer and the 62 because we'll need them later. You can only carry 3 passengers at once so we end up with rand, rand, and 62. (The other 62 will wait around until we get back.) Go divide rand by 62 and truncate the result to get an integer. Go back to get the other copy of 62 and multiply it by the truncated integer from the division. Finally, subtract the product from the first copy of rand. This gives us a number 0-61. Now we have to go back to pickup a 1 and add it to the result to get a number 1-62. Yes, all those many lines of text are just mod(rand(),62)+1.
Plan A Part 2: Create an array of characters from which to choose
Pickup a string with all the valid characters and also one at the end we don't want (more on that later). The 63 we picked up earlier matches this string length. Take it over to Chop Suey to have it broken into individual passengers.
Plan B: Move the array so we can select a character
One by one, move every character over to Narrow Path Park. It's the only stack available and the only way to not have leftover passengers getting in the way. Everything else in Townsburg is FIFO so I would have to go back and clear out all the passengers every iteration of the overall loop. This way, I can just leave them at the park and they'll get pushed out of the way by the 63 new characters every time. The very first A is likely to never escape.
Plan C: Prepare to select a character
This is really just a few stops that didn't need to be in Plan D. Re-position the taxi in preparation.
Plan D: Get all the characters we dont want
Starting with the first character in the reversed "array" (this is the 63rd character we don't want), keep picking up and concatenating characters as we count down from the result of the mod function in Plan A. Once you hit zero, the next character is the one you want.
Plan E: Drown the ones you don't want and return the chosen one.
"[P]assengers dropped off at Riverview Bridge seem to always fall over the side and into the river..." Well, that gets rid of that concatenated string of losers. Go pick up the next character and send it to stdout. Finally, let's check how many characters we've printed thus far. Back to Sunny Skies to pick up the stdin value we left so long ago. Subtract one and, if the result is more than zero, send it back to wait and start over again at Plan A.

Is this a Turing complete language?  I have never heard of it?  If so, then this may qualify as the longest code golf answer in history!

@maple_shaft Taxi is kind of fun but I can guarantee this is not the longest code golf answer. There are some Unary answers that seriously trump it.

@maple_shaft I did some digging. The largest answer I can find on PPCG is the original version of this answer from @Dennis♦ (of course it's Dennis♦) but that's from code-bowling and was revised down. The longest code-golf answer I could find is the  original Brain-Flak submission on the basic quine challenge. It comes it at 9.510^580 bytes. The longest current answer I found was a prime tester in Unary: 1.6510^56 bytes.

C (gcc), 57 55 52 bytes
Thanks to 2501 for the pointers...
i;f(n){for(;n-=isalnum(i=rand()%150)&&putchar(i););}

Try it online!

rand()%74 should be rand()%75

@2501 good call.

You can further reduce the size by using &&putchar(i) instead of the ternary operator.

Nice! that's great, thanks.

Jelly, 5 bytes
Missed a trick - see ais523's 4 byter
ØBX$€

Try it online!
How?
ØBX$€ - Main link: n
    € - for each in range(n):
   $  -   last two links as a monad:
ØB    -     "base digits" - yields list of chars "01..9AB...Zab...z"
  X   -     random choice

I would not consider a UTF-8 character as having a length of one byte oO ?

@m13r Jelly has its own code page - click bytes in the header of my answer to see it.

Java 8, 183 149 97 88 bytes
n->{for(int t;n-->0;t*=Math.random(),System.out.printf("%c",t+=t>9?t>35?61:55:48))t=62;}

Try it online.
-9 bytes by porting @2501's C answer, so make sure to upvote him as well!
Old answer, 97 bytes
n->{for(int t;n-->0;t*=Math.random(),System.out.printf("%c",t>9?(t<36?65:97)+t%26:48+t%10))t=62;}

Try it online.
Explanation:
n->{                           // Method with integer parameter and String return-type
  for(int t;                   //  Temp integer
      n-->0                    //  Loop the input amount of times:
      ;                        //    After every iteration:
       t*=Math.random(),       //     Set `t` to a random integer in the range [0,62)
       System.out.printf("%c", //     Print as character:
         t+=                   //      The random integer, after we've added:
            t>9?               //       If the random integer is larger than 9:
             t>35?             //        If the random integer is larger than 35:
              61               //         Add 61
             :                 //        Else:
              55               //         Add 55
            :                  //       Else:
             48))              //        Add 48
    t=62;}                     //   (Re)set `t` to 62 for the random

n->{for(int t;n-->0;t*=Math.random(),System.out.printf("%c",...))t=62;}
                               // Similar as above
         t>9?                  //      If the random integer is larger than 9:
          (t<36?               //       If the random integer is smaller than 36:
            65                 //        Start with 65 ('A')
           :                   //       Else:
            97)                //        Start with 97 ('a')
               +t%26           //       And add the random integer modulo-26
         :                     //      Else:
          48                   //       Start with 48 ('0')
            +t%10)             //       And add the random integer modulo-10

Shell + pwgen, 13 bytes
pwgen -s $1 1

-s, --secure
Generate completely random, hard-to-memorize passwords.

Sample output
%pwgen -s 10 1
2cyhLovbfT

C, 60 bytes
r;f(n){for(;n--;)r=rand()%62,putchar(r+=r>9?r>35?61:55:48);}

See it work here.
See the distribution here.
It is uniformly distributed, assuming rand() % 62 produces a uniform distribution. Since 62 usually doesn't evenly divide RAND_MAX, there is a very small bias.

Snowman, 58 bytes
((}#`""*:48vn58nR|65vn91nR,aC|97vn123nR,aCAsH1AaL#aC*;bR))

Try it online!
This is a subroutine that takes an integer as input and returns the random string.
((             subroutine
  }            make b, e, g active
  #`           e = input (from +)
  ""*          store an empty string in +
  :            what follows is the block to prepend a random char to +
    48vn58nR|  generate range(48..58) and place in g (need b and e for next step)
    65vn91nR   generate range(65..91) in b
    ,aC|       move g to e, concatenate b and e, and move the result to g
    97vn123nR  generate range(97..123) in b
    ,aC        move g to e, concatenate b and e, keeping the result in b
    AsH        shuffle the array of candidate ASCII codes stored in b
    1AaL       equivalent to 0aAwR - get the first element wrapped in an array
    #aC        retrieve + and prepend the randomly generated character
    *          store back into +
  ;bR          repeat this block e times, where e has been set to the input
))             output is given via +

It should be: ((}#\"":48vn58nR|65vn91nR,aC|97vn123nR,aCAsH1AaL#aC;bR))`.

@2501 Ah, you're right. Fixed, thanks.

PowerShell, 58 54 Bytes
-4 thanks to Andrei Odegov - casting to a char array instead of looping to create a char array.
-join[char[]](65..90+97..122+48..57|random -C "$args")

generates a range 1..2+4..5 = 1,2,4,5 of all the acceptable charachter codes, then selects $args number of elements randomly using random -Count - the resulting elements are looped through |%{} and turned into [char]s, are cast to an array of chars using [char[]] - then the whole thing is encapsulated in brackets and -joined together.
PS C:\users\sweeneyc\Desktop> .\grstr.ps1 5
oaCE5
PS C:\users\sweeneyc\Desktop> .\grstr.ps1 10
UReh6McG7D
PS C:\users\sweeneyc\Desktop> .\grstr.ps1 30
t1YrhZf5egyzqnPlWUKV3cEoIudMTs

Does not work for an input of 0 as Get-Random only accepts numbers above 1 for the -Count parameter.

You can cast the obtained array of bytes as a single whole to an array of chars. This'll help to save 4 bytes: -join[char[]](65..90+97..122+48..57|random -C "$args")

PHP, 56 Bytes
for(;$argn;)ctype_alnum($l=chr(rand()))&&$argn-=print$l;

Online Version
ctype_alnum

APL (Dyalog Extended), 17 bytes
Full program. Prompts for length.
(?⎕⍴62)⊇⎕A,⎕D,⌊⎕A

Try it online!
⎕A uppercase Alphabet
⌊ Lowercased
⎕D, prepended by the Digits
⎕A, prepended by the uppercase Alphabet
(…)⊇ select the following indices from that:
 ⍴62 reshape 62 to the following shape:
 ⎕ prompt for a number
 ? random indices in in those ranges

R, 54 52 51 49 bytes
intToUtf8(sample(c(65:90,97:122,48:57),scan(),T))

Explanation:

Read input integer n: scan()
Vector with ASCII values: c(65:90,97:122,48:57)
Sample n ASCII values with replacement: sample(c(65:90,97:122,48:57),scan(),T)
Transform ASCII values to a character string with intToUtf8

I found another approach with the same length.

@JarkoDubbeldam Good idea, this helped me to save two bytes

D'oh!
nice job :)

R, 51 bytes
Same length as the other R answer, but a different approach.
cat(sample(c(letters,LETTERS,0:9),scan(),T),sep="")

letters and LETTERS both are built-in variables containing all lower and uppercase letters respectively. Adding 0:9 to that and we have the entire set of alphanumeric characters.

Alice, 24 bytes
/w9u"Uz;r
\0.rdao"ki@/t&

Try it online!
This layout is already a lot better than what I originally had (32 bytes), but I'm sure it's not optimal yet...
Explanation
/      Reflect to SE. Switch to Ordinal.
       The IP now bounces diagonally up and down through the code.
09     Append 0 and 9 to an (implicit) empty string to create "09".
r      Range expansion, turns the string into "0123456789".
"az"   Push this string.
r      Range expansion, turns it into the lower-case alphabet.
i      Read all input as a string.
/      Reflect to E. Switch to Cardinal.
t      Implicitly convert the input string to the integer value N it
       contains and decrement it.
&      Run the next command N-1 times.
       The IP wraps around to the first column.
\      Reflect to NE. Switch to Ordinal. (This is not a command.)
w      Push the current IP address to the return address stack N-1
       times. This starts a loop whose body will run N times.
  .      Duplicate the lower-case alphabet.
  u      Convert it to upper case.
  d      Push the concatenation of all values on the stack. This pushes
         a single string with digits, lower-case and upper-case alphabet.
  U      Random choice. Pick a character from this string uniformly at random.
  o      Print it.
  ;      Discard the upper-case alphabet, because it will be regenerated
         in the next loop iteration (and if we leave it, then upper-case
         letters will become more and more likely as the output grows).
k      As long as there is still an address on the return address stack,
       jump back to that address (i.e. to the w). Once the return address
       stack has been depleted, this does nothing and the loop is exited.
@      Terminate the program.

Python + exrex, 81 bytes
import exrex,random
lambda n:random.choice(list(exrex.generate("[A-Za-z0-9]"*n)))

Python 2, 79 83 79 bytes
import random as r,string as s;lambda x:''.join(r.sample(s.printable[:62]*x,x))

+4 bytes (didn't account for repetition)
-4 bytes (Thanks to @Rod for the suggestion for using printable[:62])

You can also use \r.sample(...)`[2::5]instead''.join(r.sample(...))to save a byte (python 2 only) and(s.letters+s.digits)*xcan be switched tos.printable[:62]*x` to save 4 bytes

@Rod Thanks for the suggestions. I implemented printable, couldn't get the [2::5] to work (maybe I was doing it wrong?)

you need to surround the list r.sample() with backticks \`` some info about it

@Rod Ah-ha, I got it figured out. But it actually adds a byte after switching to printable (which is py2 and py3 compatible)

05AB1E, 6 bytes
FžK.RJ

Try it online!
Explanation
F        # input number of times do
 žK      # push [a-zA-Z0-9]
   .R    # pick one at random
     J   # join to string

Perl 5, 41 bytes
40 bytes of code + -p flag.
$\.=(a..z,A..Z,0..9)[rand 62]for 1..$_}{

Try it online!
(a..z,A..Z,0..9) creates an array containing all letters and numbers, [rand 62] returns an random element of this array, which is append (.=) to $\, which is implicitly printed at the end thanks to -p flag with }{.

Or, for the same bytecount, but using the parameters rather than the standart input:
print+(a..z,A..Z,0..9)[rand 62]for 1..pop

Try it online!

JavaScript (ES6), 61 54 39 52 64 bytes
This is almost like reverse-golf! Took a big hit on the byte count ensuring that the full range of characters from all three groups would be used.
f=n=>n--?btoa(String.fromCharCode(Math.random()*248))[0]+f(n):""

15 bytes saved (at one stage) thanks to Arnauld's suggestion of using a recursive function.

Try it

f=n=>n--?btoa(String.fromCharCode(Math.random()*248))[0]+f(n):""
i.addEventListener("input",_=>o.innerText=f(+i.value))
<input id=i type=number><pre id=o>

I've updated it so that all 3 character groups are included, @Arnauld; I'm just trying to find an index that can contain more than 2 of them. Thanks for suggesting the recursive option.

I like the idea, but I think you're now generating characters in [0-5w-z] exclusively.

I'd suggest btoa(String.fromCharCode(Math.random()*248))[0] to cover the whole range uniformly.

Just noticed that myself, @Arnauld. It looks like I'm going to have to combine both methods (convert toString and then encode) in order to guarantee a full range of characters from all 3 groups can be returned.

That's better but still incomplete: 014589ABEFIJMNQRUVYZcdghklopstwx (and not uniform).

@Arnauld, I've asked if "pseudo-randomness" is OK; will update again when m13r clarifies that.

The snipped doesn't work for me. Can you post an example on https://tio.run ?

What browser are you using, @2501? As far as I know, TIO doesn't support vanilla JavaScript and, if it's a browser issue, you'll just run into the same problems there.

I'm sure it is a problem with my browser. You don't have to bother.

@2501, it won't work in IE, if that's what you're using but it works in Chrome, FF & Edge.

Yeah, @ETHproductions, I've just updated to Arnauld's solution above. Shame, but them's the rules.

Bash, 43 bytes
shuf -ern$1 {a..z} {A..Z} {0..9}|tr -d "\n"

Try it online!

You can save 4 bytes using rs -g0 instead of tr -d"\n"

Pip, 13 bytes
LaORCz.AZ.J,t

Try it online!
Explanation
               a is cmdline arg; t is 10; z is lcase alphabet; AZ is ucase (implicit)
La             Do the following, a times:
  O             Output (without newline)
   RC           random choice from:
     z           Lowercase letters
      .AZ        concatenated with uppercase letters
         .J,t    concatenated with range(10) joined into a string

Zsh, 33 bytes
tr -dc a-zA-Z0-9</*/ur*|head -c$1

Try it online!

Thunno 2 J, 4 bytes
ıkȦɼ

Try it online!
Explanation
ıkȦɼ  # Implicit input
ı     # Input number of times:
 kȦ   #  Push [a-zA-Z0-9]
   ɼ  #  Random choice
      # Implicit output

Swift, 138 127 124 115 bytes
var s={String((1...$0).map{_ in"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".randomElement()!})}

Pyth, 7 11 bytes
O^s++rG1GUT

Try it online
Explanation
O^s++rG1GUT
    +rG1G      Take the uppercase and lowercase alphabets.
   +     UT    Add it to the list [0, ..., 9].
  s            Concatenate to get a string.
 ^         Q   Get all strings of length N.
O              Choose one at random.

This only includes the lowercase alphabet and numbers, not the uppercase letters

@muddyfish Good catch.  Fixed.

MATL, 8 bytes
8Y2iT&Zr

Try it online!
8Y2      % Push string '012...89ABC...YZabc...yz'
i        % Input N
T&Zr     % Sample with replacement. Implicitly display

Brachylog, 14 bytes
~l{Ạụ:Ạ:Ịcṛ}ᵐc

Try it online!
Explanation
~l                 Create a list of length Input
  {        }ᵐ      Map on each element of that list:
   Ạụ:Ạ:Ịc           The string "A…Za…z0…9"
          ṛ          Pick a character at random
             c     Concatenate into a single string

Batch, 175 bytes
@set s=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
@for /l %%i in (1,1,%1)do @call :c
@echo %s:~62%
:c
@set/an=%random%%%62
@call set s=%s%%%s:~%n%,1%%

s performs double duty here as it contains both the alphanumeric list and the randomly selected characters. After printing the result the code falls through to the subroutine whose result is ignored.

Pyke, 4 bytes
~JfH

Try it online!
~J   -   "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  f  -  cominbations(^, length=input)
   H - random.choice(^)

This doesn't seem to work for any input greater than 3, and I'm not sure it can generate the same character more than once.

This does not work for inputs greater than 3. I've tried it here: http://pyke.catbus.co.uk/

This needs about 1 GB of RAM just to create a string of 4 alphanumeric characters... Did not get it to work for an input of 10. The program crashed with a MemoryError

C, 67 Bytes
c;f(n){char b[1],*p=b+64;for(;n;)isalnum(c=*p++)?putchar(c),n--:0;}

Try it online
I'm getting some strange results - keep on hitting the run button - feels like I'm a character in Lost:
PoPPmyE79hmy
arcPaTasITJK
PCFaniHSAKPS
yPytyxQoAKMA
DOPrgDONeDO8
...

Can anyone explain why there is always a 'P' or 'p' in the output?

How does this solution fulfill the last condition "each possible string should be equally likely (to the accuracy of your language's random number generator)"?

It doesn't. This is what happens when you mix coding and alcohol ;)

This can random seg fault because it read memory possible do not own from the program

65 bytes

C# - 121 bytes
void g(int n){Console.Write(Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(new Random().Next().ToString())).Substring(0,n));}

Ruby, 47 bytes
->n{([*?a..?z,*?A..?Z,*?0..?9]*n).sample(n)*''}

Try it online!

Sinclair ZX81/Timex TS1000/1500 BASIC, ~63 tokenized BASIC bytes
 1 INPUT N
 2 IF NOT N THEN STOP
 3 FOR N=SGN PI TO N
 4 PRINT CHR$ (CODE "A"+RND*26);
 5 NEXT N

There are no lower-case characters in ZX81 without using assembly or having some sort of UDG ROM or something, and for the time being, it only outputs A-Z. If zero is entered then the program halts and returns to direct mode.

Japt, 12 8 bytes
;BiCí)öU

Try it

PHP, 51 bytes
while($argn-=ctype_alnum($c=chr(rand()))&&print$c);

Run as pipe with -nR or try it online.

05AB1E, 4 bytes
žKãΩ

Try it online! Times out on TIO for inputs \$>3\$, but it does work in theory.
žKãΩ  # full program
   Ω  # random element from...
žK    # "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"...
  ã   # to the cartesian power of...
      # implicit input
      # implicit output

Alternative, 4 bytes
žLãΩ

Try it online!
žLãΩ  # full program
   Ω  # random element from...
žL    # "zyxwvutsrqponmlkjihgfedcbaZYXWVUTSRQPONMLKJIHGFEDCBA9876543210"...
  ã   # to the cartesian power of...
      # implicit input
      # implicit output

Javascript, 83 bytes
f=n=>n?f(--n)+String.fromCharCode((k=Math.random()*62|0)+(k<10?48:(k<36?87:29))):''

Explained:
f=n=>  //Define function, n =  string length
n?      // if n is not falsy (0)
f(--n)+ //return f(n-1) (1 char shorter) plus
String.fromCharCode( // the character of
(k=Math.random()*62|0) //random number between 0 and 62 (num of chars)
+(
k<10?          //plus, if k < 10 (char is number)
48             //k + 48
:(k<36?        //else, if k < 36 (char is lowercase)
87             //k + 87
:29)           // else k + 29
)
)
:''   //if n is falsy, return empty string.

The numbers (48,29,etc) come from lining the charcodes up:
|char|num|charcode|num - charcode|
| - | - | - | - |
| 0 | 0 | 48 | 48 |
| 1 | 1 | 49 | 48 |
| ... | ... | ... | ... |
| 9 | 9 | 57 | 48 |
So random + 48 for numbers.  For lowercase,

char
num
charcode
num - charcode

a
10
97
87

b
11
98
87

...
...
...
...

z
35
122
87

so rand + 87, and for uppercase,
|char|num|charcode|num - charcode|
| - | - | - | - |
| A | 36 | 65 | 29 |
| B | 37 | 66 | 29 |
| ... | ... | ... | ... |
| Z | 61 | 90 | 29 |

PowerShell, 56 bytes
param($n)-join((0..9+'a'..'z'+'A'..'Z')*$n|random -C $n)

Try it online!

Vyxal, 18 bitsv2, 2.25 bytes
krƈ

Try it Online!
What can I say, there's a built-in for choosing n random characters from a string.
Explained
krƈ
  ƈ  # Choose n random characters from
kr   # the string 0-9a-zA-Z

Google Sheets, 106 bytes
=REDUCE(,SEQUENCE(N),LAMBDA(s,_,s&SORTN({ROW(1:9);CHAR(ROW(65:90));CHAR(ROW(97:122))},1,,RANDARRAY(61),)))

Scala 3, 123 bytes
A port of @Kevin Cruijssen's Java answer in Scala.

Golfed version. Attempt This Online!
n=>{var t=62;for(_<-0 to n-1){t=(t*scala.math.random).toInt;if(t>9)t+=(if(t>35)61 else 55)else t+=48;print(t.toChar);t=62}}

Ungolfed version. Attempt This Online!
object Main {
  trait N {
    def c(n: Int): Unit
  }

  val n: N = (n: Int) => {
    var t = 62
    for (_ <- 0 until n) {
      t = (t * scala.math.random()).toInt
      if (t > 9) t += (if (t > 35) 61 else 55) else t += 48
      print(t.toChar)
      t = 62
    }
  }

  def main(args: Array[String]): Unit = {
    for (_ <- 1 to 3) {
      n.c(5)
      println()
      n.c(10)
      println()
      n.c(20)
      println()
      n.c(33)
      println()
      println()
    }
  }
}

Ruby -rsecurerandom, 32 bytes
->n{SecureRandom.alphanumeric n}

Attempt This Online!
J-uby -rsecurerandom, 26 bytes
:alphanumeric&SecureRandom

Attempt This Online!

Stacked, 33 bytes
:>[alpha 10:>ALPHA,,''#`randin]"!

Try it online! Takes input from the top of the stack and leaves output on the top of the stack.
:>[alpha 10:>ALPHA,,''#`randin]"!
:>                                  range from 0 to n-1
  [                           ]"!   on each, do:
   alpha                            push "abc...xyz"
         10:>                       push (0 1 2 ... 8 9)
             ALPHA                  push "ABC...XYZ"
                  ,,                concat twice
                    ''#`            join by nothing
                        randin      select random member in it

C#, 214 177 bytes
Sorry to embarrass myself like this but:
void q(){int k=int.Parse(Console.ReadLine());Random r=new Random();for(;k>0;k--){Console.Write((char)(r.Next(1,4)>2?r.Next(1,3)>1?r.Next(97,123):r.Next(48,58):r.Next(65,91)));}}}}

Shaved some bytes off due to suggestion to just make it a function.

Hi, welcome to PPCG! The default on PPCG is program or function, unless other specified by OP. Since this isn't the case, you can remove the namespace System{class P{static void Main(){int k=int.Parse(Console.ReadLine());...}}} part, and use a method (i.e. void f(int k){...}) instead. So it becomes void f(int k){Random r=new Random();for(;k>0;k--){Console.Write((char)(r.Next(1,4)>2?r.Next(1,3)>1?r.Next(97,123):r.Next(48,58):r.Next(65,91)));}}.

Python 3, 132 124 123 bytes
...I most probably can golf this further. Might be able to do that by using ASCII numbers. Tried and ended up longer than Java.
from random import*
a='abcdefghijklmnopqrstuvwxyz0123456789'
f=lambda n:''.join(choice(a+a[:-10].upper())for i in range(n))

Try it online!

Here is an improved version based on an older revision (114 bytes)

I had to downvote for a meme but you said it was fine :P

Mathematica 66 Bytes
""<>Cases[1~CharacterRange~122,_?LetterQ|_?DigitQ]~RandomChoice~#&

which is a little bit shorter than using the WordCharacter pattern with StringCases

Lua, 105 98 bytes
s,n="",io.read()while#s<n do c=s.char(math.random(48,122))s=s..(c:match"%w"and c or'')end print(s)

Generate any character between 48 and 122, if alphanumeric, add to output string. When output string is length n, stop and output.
Edit: Saved 7 bytes thanks to suggestions from Josh.

You can save five bytes by replacing string.char with s.char.

@Josh while it is frustrating for people to not respond to your suggestions, edits are not for improving someone else's code.

@Josh Change made. Didn't actually know I could do that. Good to know for the future. Thanks.

You can also replace c:match("%w") with c:match"%w" for another two bytes saved. s refers to your empty string variable by the way, it cannot always be used.

CJam, 18 bytes
ri{;'],_el^9,+mR}%

Explanation:
ri   e# Read integer
{    e# For each (loops from 0..n-1):
 ;   e#   Delete the index from the top of the stack
 '], e#   Get all the characters 0x00 to 0x5b ("[")
 _el e#   Duplicate and convert letters to lowercase
 ^   e#   Symmetric set difference - this keeps only
     e#     uppercase and lowercase letters
 A,+ e#   Add all the digits into this string
 mR  e#   Random choice of one element in the array
}%   e# End for loop
e# Implicit output

C, 54 52 bytes

-2 bytes, thanks to @RosLuP

Try Online
i;f(n){n&&f(n-(isalnum(i=rand()%128)&&putchar(i)));}

Why not C:
i;f(n){n&&f(n-(isalnum(i=rand()%128)&&putchar(i)));} but this can seg fault the program in case of input too much long...

Clojure, 80 bytes
#(apply str(for[i(range %)](char(rand-nth(mapcat range[48 97 65][57 122 90])))))

I guess the only smart part is building that set of ASCII integer values.

Axiom, 150 bytes
f(x:NNI):Union(String,Complex INT)==(x>9.E8=>%i;c:=alphanumeric()::String;r:="";repeat(x=0=>break;x:=x-1;w:=1+random()@INT rem 62;r:=concat(c.w,r));r)

i find repeat( ...break...) the most versatile type of loop in Axiom as for(;;) in C. I find functions without some think or reflection on their input only danger toys
   [0,""]
   [1,"t"]
   [2,"rT"]
   [10,"fcCOgd2aoP"]
   [100,
    "byFH5ikoQTIEA3TdJ4thNueA0vuowxz5PC7N1yUEgZUkuddjfwbRjYMim1mAYzLhZ8hDJskOUZ
    SckbflbU1ZL2q0KTWUMF9dx6jX"
     ]
   [10000000000000000,%i]

APL NARS, 65 bytes, 35 chars
{(⍵≤0)∨⍵≥1E6:''⋄t[?¨⍵⍴⍴t←⎕A,⎕a,⎕D]}

As usual here do not is specificied the range of validity for the function...
I agree in check for range but not agree 100% in checking the type, because some time is possible
one extention for one function (possible not in this case). Test:
  g←{(⍵≤0)∨⍵≥1E6:''⋄t[?¨⍵⍴⍴t←⎕A,⎕a,⎕D]}
  g ¯2000000

  g 0

  g ¯3

  g 23
86uSfWH1zfpj4JE439he9Jp
  g 3
ueQ
  g 2
l3
  g 1
M
  g 100
pkHi07YmFmZpr9TpUNCIEtQf20CURGszkP2LvzgpnfaZTKPg3nYvo4PK0Rg
  1cMxcjSRGWLrtf1RP8NEC3HlIcjW6TqfSOdqmrSqu

Alchemist, 577 689 bytes
Contains a line for every character [0-9A-Za-z]:
_->In_n
n->Out_"0"
...
n->Out_"9"
n->Out_"A"
...
n->Out_"Z"
n->Out_"a"
...
n->Out_"z"

Input from stdin, try it online!
Explanation
The universe of Alchemist will start with one _-atom, so the only thing that can happen is to read the number of n-atoms. Then one of the remaining rules will be matched pseudo-uniformly at random until no n-atoms remain.

no longer valid

@ASCII-only: Updated.

So much for code-golf... :P

Uiua SBCS, 26 bytes
⊏⌊×62∵⋅⚂⊚:⊂+@0⇡10⊂⌵.+@a⇡26

Try it!
⊏⌊×62∵⋅⚂⊚:⊂+@0⇡10⊂⌵.+@a⇡26
                    +@a⇡26  # lowercase alphabet
                 ⊂⌵.        # join uppercase alphabet
          ⊂+@0⇡10           # join digits
        ⊚:                  # create array of length n
     ∵⋅⚂                    # fill with random numbers in [0, 1)
  ×62                       # times 62
 ⌊                          # floor
⊏                           # select

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

authors: n̴̖̋h̷͉̃a̷̭̿h̸̡̅ẗ̵̨́d̷̰̀ĥ̷̳

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Shorten the Java Package
Briefing
Given a Fully Qualified Java Class/ Package name, you must shorten it as such:
Each part of the dot separated package will be shortened to its first letter, apart from the last section and the class (if it exists).
package names will be all lower case, and the class (if it exists) will start with a capital letter and be UpperCamelCase. packages come in the form of:
foo.bar.foo

and
foo.bar.foo.Class

Examples
(No Class)
Input com.stackoverflow.main
Output c.s.main

(Class)
Input com.google.parser.Gson
Output c.g.parser.Gson

(Class)
Input com.google.longer.package.TestClass
Output c.g.l.package.TestClass

Rules

Shortest code in bytes wins
Standard loopholes apply

Does the class name always come last?

@Shaggy yes it does

Related

Would fantastic.foo.func.bar become f.f.f.bar or is it guaranteed that 2 packages can't start with the same letter?

f.f.f.bar would be correct.

What are the naming conventions for packages/classes? Can we assume that a class name always starts with a capital letter and not, say, an underscore?

Is returning an array of the names allowed?

Will the input ever contain single letter classes? Such as f.b.class?

@DJMcMayhem sure.

Good challenge! This has my upvote! But, don't you think that you should appreciate the efforts of those people who have answered your challenge and haven't got even a single upvote! Of course, mine is in the list too! One possible way to appreciate their efforts is to upvote!

Retina, 17 bytes
\B\w+(\.[a-z])
$1

Try it online!
Explanation
\B         # Start from a position that isn't a word boundary. This ensures that
           # the first letter of the package name is skipped.
\w+        # Match one or more word characters. This is the remainder of the
           # package name which we want to remove.
(          # Capture the next part in group 1, because we want to keep it...
  \.[a-z]  #   Match a period and a lower-case letter. This ensures that we
           #   don't match the package that precedes the class, or the package or
           #   class at the end of the input.
)

This is replaced with $1, which is the period and lower case letter which shouldn't be removed.

I wanted to try my first Retina answer but the Retina god Martin showed up. Way to go, Me!

JavaScript (ES6), 68 53 bytes
s=>s.split`.`.map((x,y,z)=>z[y+1]>"["?x[0]:x).join`.`

15 bytes saved thanks to Arnauld.

See my other solution here.

Try it

f=
s=>s.split`.`.map((x,y,z)=>z[y+1]>"["?x[0]:x).join`.`
i.addEventListener("input",_=>o.innerText=f(i.value))
console.log(f("com.stackoverflow.main"))
console.log(f("c.g.parser.Gson"))
console.log(f("com.google.longer.package.TestClass"))
<input id=i>

Could it be simplified to s=>s.split\.`.map((x,y,z)=>z[y+1]>"["?x[0]:x).join`.` `?

Seems like it can, thanks, @Arnauld.

Innovative solution but only 2 upvotes. But I will upvote this!

Java 8, 66 41 bytes
s->s.replaceAll("\\B\\w+(\\.[a-z])","$1")

Port from @MartinEnder's amazing Retina answer.
Try it online.

Python 2, 88 81 bytes
f=lambda s,d=".":s.count(d)>(s.split(d)[-1]<"[")and s[0]+d+f(s[s.find(d)+1:])or s

Try it online!

Japt, 30 27 25 bytes
¡Y>Zl -('[>ZgJ)-2?X:Xg}'.

Try it online!

Nice one! I think you can save two bytes with ('[>ZgJ)

I just realised that as well ;-)

Python 2, 76 73 bytes
q=input().split('.')
i=~(q[-1]<'_')
q[:i]=zip(*q[:i])[0]
print'.'.join(q)

Try it online! or Try all test cases

V, 9 bytes
Íì“ƒ…®õÀ!

Try it online!
Hexdump:
00000000: cdec 9383 85ae f5c0 21                   ........!

This is a wonderful example of V's signature regex compression.
Explanation:
Í          " Remove every match on every line:
 ì         " A lower case letter
  “ …      "   *ONLY MATCH THIS PART:*
   ƒ       "   As few characters as possible
      ®    " Followed by a dot
       õÀ! " Not followed by an uppercase letter

Haskell, 58 bytes
f s|[(a:t,p:x:r)]<-lex s=a:concat[t|x<'a']++p:f(x:r)|1<3=s

Try it online! Usage: f "some.string".
lex parses a string as Haskell tokens, so lex "some.string" returns [("some",".string")]. f recurses over the tokens in the string and always appends the first char  a of the current token, but the rest t of the token only if the remaining string after the colon p starts with an uppercase char, that is x<'a'. If the pattern match failed, we have reached the last token and simply return s.

Mathematica, 75 bytes
#[[;;-3]]~StringTake~1~Join~#[[-2;;]]~StringRiffle~"."&[#~StringSplit~"."]&

Anonymous function. Takes a string as input and returns a string as output.

JS scoring lower than, Mathematica?! That can't be right - I've done something wrong, haven't I?

@Shaggy Java 7 scoring lower than JS and Mathematica?! That can't be right - I've done something wrong, haven't I? (Couldn't resist it. ;) All credit goes to MartinEnder's Retina's port btw).

@KevinCruijssen, thanks for drawing my attention to Martin's answer - I've now fixed the problem of Java out-scoring JS! :D

JavaScript (ES6), 36 bytes
Another port of Martin's Retina answer. See my other solution here.
s=>s.replace(/\B\w+(\.[a-z])/g,"$1")

f=
s=>s.replace(/\B\w+(\.[a-z])/g,"$1")
i.addEventListener("input",_=>o.innerText=f(i.value))
console.log(f("com.stackoverflow.main"))
console.log(f("c.g.parser.Gson"))
console.log(f("com.google.longer.package.TestClass"))
<input id=i>

A good solution but no upvotes. It deserves more than a 0 score. I will turn it into 1! :)

sed, 57 22 bytes
I expected sed solution to be a little shorter than this...
Edit:
The shorter solution uses regex from Martin Ender's answer.
21 bytes sourcecode + 1 byte for -r flag (or -E flag for BSD sed).
s|\B\w+(\.[a-z])|\1|g

Can't you also use the substitution from my Retina answer? s|\B\w+(\.[a-z])|\1|g?

@MartinEnder I spent quite some time trying to come up with one-liner without looking at anyone's answers first but failed. I don't think there is a shorter way to do it, so I will use yours. Thank you!

Python 2, 108 97 89 bytes
i=input().split(".")
for x in range(len(i)+~(i[-1][0]<"[")):i[x]=i[x][0]
print".".join(i)

Try it online!
-8 with many thanks to @ovs for the tip

for x in range(len(i)+~(i[-1][0]<"[")):i[x]=i[x][0] for -8

05AB1E, 20 15 bytes
ΔA3ãvy'.«ÀDõ1ǝ:

Try it online or verify all test cases. (Extremely slow, so the A has been replaced with Dálê (duplicate; keep letters; convert to lowercase; sorted-uniquify) in the TIO-links.)
Original 20 bytes approach:
'.©¡Rć¬.uisć}s€н`r®ý

Try it online or verify all test cases.
Explanation:
I basically keep replacing every ab.c to a.c, where abc are any combination of lowercase letter including duplicates:
Δ                 # Loop until the result no longer changes,
                  # using the (implicit) input-string in the first iteration
 A                #  Push the lowercase alphabet
  3ã              #  Create all possible triplets of lowercase letters with the
                  #  cartesian power of 3
    v             #  Loop over each triplet `y`:
     y'.«        '#   Append a "." to the triplet
         À        #   Rotate it once towards the right: "abc." to "ab.c"
          D       #   Duplicate it
           õ1ǝ    #   Replace the character at index 1 with "": "ab.c" to "a.c"
              :   #   Replace all "ab.c" in the string to "a.c"
                  # (after which the resulting string is output implicitly)

'.               '# Push "."
  ©               # Store it in variable `®` (without popping)
   ¡              # Pop and split the (implicit) input by this "."
    R             # Reverse this list
     ć            # Extract head; pop and push remainder-list and first item separated
                  # to the stack
      ¬           # Get the first character (without popping the string)
       .ui        # Pop, and if it's uppercase:
          s       #  Swap so the remainder-list is at the top of the stack
           ć      #  Extract its head again
         }        # Close the if-statement
          s       # Swap so the remainder-list is at the top of the stack
           €      # Map over each string in this list:
            н     #  Pop and only leave its first character
             `    # Pop and dump these characters to the stack
              r   # Reverse the stack
               ®ý # Join the stack by the "."-delimiter from variable `®`
                  # (after which the result is output implicitly)

Go, 101 bytes
import."regexp"
func f(B string)string{return MustCompile(`\B\w+(\.[a-z])`).ReplaceAllString(B,`$1`)}

Attempt This Online!
Port of Martin's Retina answer.

Pip, 22 19 bytes
aR`\B\w+(\.[a-z])`B

-3 thanks to DLosc!
Yet another port of Martin's Regex.
Try It Online!

First Attempt(Non-Competing)
Pip, 45 bytes
d:"."c:dNae:XU Na?c-1ca:a^dFi,e{a@i:a@i@0}aJd

Try It Online!

Instead of using a pattern for the replacement, you can use a callback function. Within the function, group 1 is bound to the local variable b, so for this replacement you can use {b} or just B for short: Try it online!

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Determine the busiest time
This challenge was greatly inspired by this Stack Overflow post.
Challenge
Given a bunch of clients in terms of when they enter a room and when they exit it, determine the period(s) of time when the room has a maximum number of people. The time resolution should be to the minute.
For example, if there are three clients 8 - 10, 9 - 11, 10 - 12, then the correct answer would be 9 - 11; during this time period, there are two clients in the room, which is the largest possible.
Input
Input will be a list of pairs in some form. That can be either a list of 2-tuples, an even-length list with elements interleaved, etc, any reasonable input format. The times can be given in any reasonable format, in either 12- or 24- hour time. You may also input time as the number of minutes past midnight.
Output
Output should be a list of pairs in some form, but the output is stricter. The output cannot be a flat list, it must be a list of 2-tuples or a list of lists, etc. The times can be output in any reasonable format, in either 12- or 24- hour time. You may also output time as the number of minutes past midnight.
Examples
input
output

INPUT
08:00 - 10:00
09:00 - 11:00
10:00 - 12:00
OUTPUT
09:00 - 11:00

INPUT
08:20 - 09:20
09:00 - 09:10
08:00 - 09:30
08:50 - 10:40
OUTPUT
09:00 - 09:10

INPUT
08:00 - 10:00
09:00 - 10:00
09:30 - 11:00
OUTPUT
09:30 - 10:00 # The output is not always in the input list

INPUT
00:00 - 02:00
01:00 - 03:00
04:00 - 06:00
05:00 - 07:00
OUTPUT # This is the expected output for when there are multiple time ranges with the same "business".
01:00 - 02:00
05:00 - 06:00

You may assume that the second time in a pair will always be after the first time. Time ranges will not run over midnight.

What if there are multiple time ranges?

@Challenger5 What do you mean by multiple time ranges, Input or output?

@HyperNeutrino Output.

@Challenger5 Added a test case, thanks.

Is 09:00 - 10:00, 10:00 - 11:00 a valid output for the first test case?

@LeakyNun I will say no; consecutive ranges need to be combined together.

Brachylog, 25 bytes
⟦₂ᵐkᵐcoḅlᵒlᵍthᵐ~c{~k~⟦₂}ᵐ

Try it online!
There's an obvious structure to this answer, which becomes even more obvious if you write it like this:
{⟦₂k}ᵐc oḅ lᵒlᵍ thᵐ ~c{~k~⟦₂}ᵐ

Unfortunately, Brachylog's evaluation order makes it so that the program goes into an infinite loop if you try to take advantage of the structure in question. Still, it's certainly possible to imagine a Brachylog-like language in which this is much shorter.

Jelly, 22 21 20 bytes
r/€Ṗ€F©®ċ$ÐṀQœ^‘$Ṣs2

Try it online!

Brachylog, 58 bytes
⟦₂ᵐkᵐcoḅBlᵐ⌉;B↔z{hl~t?}ˢhᵐhᵐ{∋+₁.¬∈?∧|∋.-₁¬∈?∧}ᶠo~c.{l2}ᵐ∧

Try it online!
This has to be the longest Brachylog answer ever...

Pyth, 33 24 bytes
JsrMQcSs-M_BhMBS{.M/JZJ2

Try it online!

This appears to behave incorrectly for this. I will add this as a test case into the question as well.

@HyperNeutrino fixed.

Well, that was a fast answer. Nice job!

Mathematica, 104 bytes
Reduce[#==#~MaxValue~x,x]&@PiecewiseExpand@Tr[Piecewise@{{1,#<=x<#2}}&@@@#]/.{Or->List,a_<=x<b_->{a,b}}&

Of course, this assumes that several high-power Mathematica built-ins are correct...


text:
Ring me when our cup noodles are ready
I'm currently cooking us some cup noodles, but we're really sleepy at the moment. They'll be finished in 50 seconds from now, can you wake me up then?
Problem:
Write a program or function that waits 50 seconds of busy waiting (so that you too doesn't sleep) and then outputs at least 1 visible character to wake me up.
Busy waiting:
You can't use functions like sleep or delay or pause to wait for the 50 seconds, you have to keep checking the elapsed time.
Rules:

Your code must be somewhat consistent in time, between runs and between computers. A small error of +- 1 seconds is acceptable.
You can't output any visible characters between 1 and 50 seconds (let me sleep).
Whitespace characters (newline, space, tab, ...) are not considered visible characters for this challenge.
This is code-golf, so shortest code wins.

Can the output be non-deterministic (something different every time)?

@ComradeSparklePony if it always outputs at least 1 visible character, sure

The problem with this approach is the risk that the CPU fan will wake you up early...

Is it ok to reboot the machine after printing the "visible characters"?

@MatteoItalia would the SO print the characters or your program?

@FelipeNardiBatista: difficult to say, it's always the OS that prints the characters in response to an interrupt.

@MatteoItalia if you try to shutdown the computer, your program will close, and the SO will print it's log msgs (unix i mean). so that would not be your program that is printing. what do you have in mind?

@FelipeNardiBatista: with int 21h/ah=2 I tell DOS what character and it'll print it, with int 18h it prints some stuff and then (usually) reboots.

@MatteoItalia i'll say you can't reboot your computer, if i'd allow that, shutdown 50 in linux would be a valid answer

@FelipeNardiBatista: jeez, that would actually be a great answer. :-(

Can we return a value from a method or do we have to print to screen or similar?

@TheLethalCoder it can be a value returned by a method, but when printed must have at least 1 visible character

@FelipeNardiBatista Awesome saved 14 bytes from that :)

Can it be printed to STDERR?

@totallyhuman stdout, i'm waiting my cup noodles, not errors ;D

Is input allowed?

@RobertBenson no

MATL, 7 bytes
1`Z`50<

Try it online! The linked code uses 10 instead of 50.
Explanation
1        % Push 1
`        % Do...while
  Z`     %   Elapsed time since program started
  50     %   Push 50
  <      %   Less than?
         % End (implicit). The loop continues if top of the stack is truthy
         % Display (implicit)

I think this code is pretty self-explanatory.

@Erik And very similar to Stewie's answer. Anyway I'll add an explanation later

Octave, 22 21 bytes
Saved one byte by changing from while ... end to do ... until.
tic;do
until toc>50;1

tic starts a timer, while toc returns the number of decimal seconds since the last call to tic. We initiate a do - until loop, where we'll loop until toc>50, doing nothing inside the loop. The loop stops after 50 seconds, followed by ans = 1 on the screen.
Try it on TIO (time changed to 5 seconds) or paste it into Octave Online.

Does this also work in Octave online?

@Michthan yes. Links added to TIO and Octave Online. I recommend choosing a lower time than 50 seconds when testing it :)

Lua, 35 bytes
while os.clock()<50 do end;print'!'

odd thing is that it has exactly the same length as:
repeat until os.clock()>50;print'!'

Try it online!

I don't know Lua, but can't you print a number and save 2 bytes?

For @totallyhuman and those curious: print 2 results in a syntax error, whereas print'!' will print !. See section 3.4.10 of the lua manual. Arguments have the following syntax: ‘(’ [explist] ‘)’ | tableconstructor | LiteralString (I shortened the BNF because line breaks don't work in comments)

TI-Basic, 14 12 bytes
startTmr
While 50>checkTmr(Ans
End

(Ab)uses the fact that TI programs output Done if nothing is evaluated on the last line.

I'm new to golfing, so can  you explain to me how this is 12 bytes. I count 35. Thx.

@gogators Check out this answer I wrote on this subject, it will explain everything for you: https://codegolf.meta.stackexchange.com/a/4764/10740

Perl 5.10, 21 bytes
{$^T+50<time?do:redo}

Outputs "Null filename used at -e line 1." after [50,51) seconds.
Or 22 bytes for Perl 5.22:
{$^T+50<time?die:redo}

Welcome to PPCG! It's easier for people to understand your byte count if you just present it as {$^T+50<time?do:redo} (most people will know how to invoke it or those who don't know probably also don't need to know).

Does this require any specific Perl version? The 5.22.2 I have displays “syntax error at -e line 1, near "do:"” immediately.

@manatwork I verified that you are correct and that it works with perl 5.10.

as stderr is ignored by default, could you change it to output to stdout?

@FelipeNardiBatista That link says 'STDERR can be ignored completely, as long as STDOUT has the required output' (emphasis mine), it does not specify that stderr is an invalid form of output if stdout is not used to output the required result.

@pizzapants184 does the stdout have the output? no. i didn't say you can't cause erros, i said that everything that goes there is ignored, the output must be in stdout

@pizzapants184 if all the output is in stdout, you can have anything you want in stderr, that's what it says. but all the output is in stderr, none in stdout

Explicitly, it say "STDERR can be ignored completely, as long as STDOUT has the required output". Which means the same as "STDERR may be considered if STDOUT does not have the required output". In this case STDOUT does not have the required output, so STDERR need not be ignored.

Python 2, 57 54 bytes
-3 bytes thanks to Felipe Nardi Batista.
from time import*
b=time()+50
while time()<b:0
print 1

Try it online!
Another solution, 48 bytes
This answer will only work if printing to STDERR is allowed. This will end in a NameError, printing much more than one character.
from time import*
b=time()+50
while time()<b:0
a

C, 45 44 43 bytes
i;f(){for(time(&i);time(0)-i<50;);puts(f);}

See it work here.

is it guaranteed that the puts(f) will always have at least 1 visible character?

@FelipeNardiBatista It will on the implementation I choose (See the link). Otherwise It is necessary to check that the function f isn't aligned to or more than 0xFF bytes. This can be manipulated using compiler flags.

APL (Dyalog), 21 bytes
-1 thanks to marinus.
{3⊃⍵≥⎕AI:∇⍵⋄1}5e4+⎕AI

⎕AI Account Information (UserID, ComputeTime, ConnectTime, KeyingTime)
5E4+ add 50000 (milliseconds)
{ apply the following anonymous function where the argument is represented by ⍵
 [if the]
  3⊃ third item (truth value, i.e that of ConnectTime) of
  ⍵≥⎕AI ⍵ is greater than or equal to Account Information
 : then
  ∇⍵ recurse this function on the unmodified argument
 ⋄ else
  1 return one
} [end of anonymous function]
Try it online! Debug says Real time: 50.039 s, or disable output cache for real-time effect.

With a d-fn it's one shorter: {3⌷⍵≥⎕AI:∇⍵⋄1}5e4+⎕AI

Bash, 26 bytes
f()(((SECONDS<50))&&f);f;.

Partially ungolfed:
f () (
  ((SECONDS < 50)) && f
)
f
.

SECONDS is a magic variable that counts the number of seconds since the shell started. I define a function that recurses until the value is below the threshold. Once the wait is over, run the builtin . which prints an error message because it's missing an argument.
Beware that since the function's body is in parentheses, bash forks a new process for each recursive invocation, which may consume a lot of entries in your process table. A loop would keep resource usage down, but it's longer.
for((;SECONDS<50;));do :;done;.

If you want to have output on standard output rather than to the screen and you're running a sufficiently Unix-like system with at least one user logged in, you can replace the final . by w. If you want to stick to pure bash then I can't think of a way to produce output in less than 28 bytes.
f()(((SECONDS<50))&&f);f;pwd

as stderr is ignored by default, could you change it to output to stdout?

@FelipeNardiBatista At the time I posted, the requirement was to output to the screen, not to standard output.

yes, but as the default is ignoring stderr, your answer would not output anything

05AB1E, 16 14 bytes
žc50+60%[DžcQ#

Try it online!
I'm new to 05AB1E, so any golfing tips would be appreciated.
Explanation:
žc50+60%[DžcQ#
žc               Push current amount of seconds.
  50+            Add 50.
     60%         Modulo 60.
        [        Infinite loop.
         D       Duplicate top of stack
          žc     Push current seconds.
            Q#   If current seconds, and start time+50 are the same, break.
                 Implicit print.

The basic idea of this program is to get what the time will be in 50 secs and loop until the current time is equal. So to get the time in 50 seconds, it gets the current time and adds 50. Then, since 05AB1E's clock returns the time since the last minute change, it needs to modulo 60, to get back in the correct range. Then the program loops until the second amount is the same as the desired.

Pyth, 9 bytes
W>50.d1;G

Try it here.

Javascript, 43 39 37 35 34 33 bytes
for(t=+new Date;new Date<t+5e4;)1

Outputs 1 after 50 seconds.
Open console and run snippet. The snippet only runs for 5 seconds, so your page won't stall for too long :)

for(t=+new Date;new Date<t+5e3;)1

Saved 10(!) bytes thanks to @CraigAyre:

43 : t=+new Date();while(+new Date()<t+50000)0;x
39 : t=+new Date;while(+new Date<t+50000)0;x
37 : t=+new Date;while(+new Date<t+5e4)0;x
35 : t=+new Date;while(new Date<t+5e4);x
34 : t=+new Date;while(new Date<t+5e4)1
33 : for(t=+new Date;new Date<t+5e4;)1

Let us continue this discussion in chat.

in the console it does outputs 1, but not in the snippet, it just freezes my browser for 5 secs. isn't that a JS REPL answer?

@FelipeNardiBatista I don't know what a JS REPL answer is, but you're right. The previous version of my snippet did output when run. Is it a requirement that it should function when ran as a snippet?

PHP, 42 36 bytes
for($t=time();time()-$t<50;);echo 1;

-6 bytes, thanks to @Titus

How to run
> php -r <code>

Use -r to avoid the PHP tag.

@Titus note taken, thx.

Processing, 47 bytes
void draw(){if(millis()>5e4){print(X);exit();}}

After 50 seconds, the program prints 0 and exits.

What language is that?

@2501 It's Processing: https://processing.org/

What is X, where is it being defined?

@Phoenix It is one of Processing's constants, PI is an example. They do not have to be initialised. You can see the implementation of X here: https://github.com/processing/processing/blob/master/core/src/processing/core/PConstants.java#L42

Bash, 68 43 bytes
for((e=`date +%s`+50;`date +%s`<e;)){ :;};w

Lists logged in users after 50 seconds.
Edit: Thanks a lot, manatwork! -25 bytes.
Try it online!

As I count, would be shorter without variable $t. And avoid expr, Bash can do integer arithmetic itself. And better list the logged in users with w – not just shorter but produces output on TIO too. for((e=\date +%s`+50;`date +%s`<e;)){ :;};w`

I had no idea that there is a way to do arithmetic without expr command. From what I read so far, it only works if it's done inside ((...)). Thanks for your help!

Java, 116 114 109 105 bytes

-2 bytes, thanks to @jaxad0127
-4 bytes, thanks to @KevinCruijssen

Try Online
double t(){return System.nanoTime();}
void w(){for(double s=t();t()-s<5e+10;);System.out.print("\0007!");}

Note on unix, this should ring a beep.

You can save some bytes by using 5e4 instead of 50000.

@jaxad0127 done, thanx for the tip

You can save a byte by changing the while to a for and put s inside it: for(long s=t();t()-s<5e4;); Also, I count 109 bytes in your current answer instead of 108 (after removing the newline). With the while to for loop change it becomes 108 however. Also, why use System.currentTimeMillis() when System.nanoTime() is shorter?

@KevinCruijssen yes, change considered now.

you don't need the \a (\0007), you'll just lose some bytes

PowerShell, 38
for($d=(date)+[int]5e8;(date)-lt$d){}1

Very trivial; will just wait until the time is 50 seconds later and then prints 1.

C# - 100 bytes
using System;
void q(){var t=DateTime.Now.AddSeconds(50);
while(DateTime.Now<t);
Console.Write(t);
}

Welcome to PPCG! It looks like there is some white space left which can be removed, e.g. var t=DateTime ....

Not sure where you're getting 79 bytes from, because your code in it's current state is 92 bytes. Even golfed to remove all whitespace it's still 83 bytes

This is 96 bytes if you remove the new lines.

x86 16 bit machine code on MS-DOS - 21 bytes
00000000  53 1f a1 6c 04 05 8e 03  3b 06 6c 04 77 fa b2 6e  |S..l....;.l.w..n|
00000010  b4 02 cd 21 c3                                    |...!.|
00000015

Commented assembly:
    org 100h

section .text

start:
    push bx             ; notice: bx starts as 0
    pop ds              ; set the data segment to 0; this allows us to
                        ; read the tick count without segment selectors
    mov ax,word [046ch] ; read the low 16 bit of the tick count
    add ax,910          ; 910 ticks = 49.98 seconds
                        ; here we used ax because the encoding for both
                        ; the mov and the add is one byte shorter
lop:
    cmp ax,word [046ch] ; compare the stop time with the current time
    ja lop              ; loop if still above
    mov dl,'n'          ; n is for noodles
    mov ah,2
    int 21h             ; print
    ret                 ; quit

This could be shaved down to 16 bytes by replacing the final three instructions with int 18h, which on ancient machines would invoke the ROM built-in BASIC interpreter and almost everywhere else prints something like "No ROM BASIC" and reboot after a key press, but after discussing this with OP it was decided that this wouldn't be allowed.
Interrupt + self-modifying code approach - 23 bytes
This is another approach; it turns out to be bigger, but I post it anyway because it is way more fun.
00000000  b8 1c 25 ba 12 01 cd 21  b9 8e 03 e2 fb b4 02 cd  |..%....!........|
00000010  21 c3 ff 0e 09 01 cf                              |!......|
00000017

    org 100h

section .text

%define counter lop+1   ; see below
start:
    ; setup interrupt handler
    mov ax,251ch                ; function 25h (replace interrupt vector)
                                ; interrupt 1ch (user timer)
    mov dx,interrupt_handler    ; timer ISR
    int 21h
lop:
    mov cx,910  ; the 910 immediate value is actually pointed by counter,
                ; which is decremented in interrupt_handler
    loop lop    ; decrement and loop as long as cx is nonzero (the decrement is
                ; not relevant, we are always resetting cx at each iteration)
    mov ah,2    ; function 2 (print character); dl is already a printable character
    int 21h
    ret         ; quit

interrupt_handler:
    dec word[counter]   ; at every tick decrement the counter
    iret

PHP, 43 bytes
I think when you´re sleepy, your ears are more alert than your eyes, so:
for($t=time();;)echo chr(time()-$t<50?9:7);

prints horizontal tabs in the first 50 seconds, BEL codes after that. Run with -r.

I haven't thought about printing (non visible) characters before the time limit, nice.

Is the Elvis operator a thing in PHP? ?:, could save a byte by printing the time()-$t implicitly instead of tabs?

@carusocomputing Elvis would print the difference or the else branch; i.e. some ASCII between 0 and 49; but there shouldn´t be any printable in the first 50 seconds -> not applicable here.

Then why is printing tabs acceptable?

@carusocomputing Whitespace characters (newline, space, tab, ...) are not considered visible characters for this challenge.

R, 41 bytes
s=Sys.time;x=s();while(s()-x<50){};cat(1)

cat(1) saves 2 bytes

@FelipeNardiBatista Good idea, thanks.

Ruby, 36 33 35 bytes
t=Time.now;1until Time.now-t>50;p 1

Ruby handily supports subtraction of Time objects, returning the difference in seconds. Prints the character 1 (being Ruby's internal representation of the entity 1) when done.
Edit: saved 2 bytes by changing to an error message, 1 byte thanks to G B
Edit: re-added 2 bytes (stderr doesn't count)

I can shave two characters (the  1 from the end) if throwing an error counts as displaying output :)

You could use 1while instead of {}while to save another character.

as stderr is ignored by default, could you change it to output to stdout?

Shame. That's two bytes longer.

C#, 73 bytes
var n=DateTime.Now.AddSeconds(50);while(DateTime.Now<n);Console.Write(n);

Hi, you can shave of 8 bytes of this if you change Console.Write(n) to n.Dump(). .Dump()  is a LinQPad specific method not a C# one if I'm not mistaken, so I don't know if that is allowed by the rules. (If it is, it saves 8 bytes)

Aceto, 16 bytes
6+_p
*-iX
59
Tt<

Sets a Timer, reads the timer difference and pushes it on the stack. Pushes 9 and 5, multipl*es them, pushes 6, +dds them. We now have a 51 on the stack (on top of the initially small-ish timer number). We substr-ct them from each other, getting initially something a little bit bigger than 51. We cast it to an integer, and mirror (_) if the integer is truthy (i.e. not 0). In that case, we go to the left (<) and check our timer again, going into a loop. Otherwise, we print 0 from the empty stack, and eXit.
After 50 seconds, the timer will be 50+ε for some small ε, meaning our subtraction yields 50+ε-51 = -ε, since ε is smaller than 1 the corresponding integer will be 0.

C, 41 43 39 Bytes
a;b(c){time(c?0:&a)-a>50?puts(b):b(1);}

Try it online

as a function, i can call it as f("") and it won't print anything. you could use 2501's trick to even cut out 1 byte

Great!. It is still better than mine.

Damn.. I'm out of ideas

@2501, I'm out of ideas ;-)

That is invalid in my opinion, because the function requires an argument. This is similar to having information stored in globals, but isn't counted in the byte score count. (Or resetting globals in between function calls, which is what the argument is doing basically.)

REXX, 33 bytes
do while time(e)<50
  nop
  end
say a

C#, 91 77 bytes
n=()=>System.DateTime.Now;_=>{var t=n();while((n()-t).Seconds<50);return t;};

T-SQL, 62 bytes
DECLARE @ DATETIME=GETDATE()WHILE DATEDIFF(S,@,GETDATE())<50_:

After the execution in SSMS, this will print the message "Command(s) completed successfully." plus a bell sound [bonus :)].

AWK, 48 bytes
BEGIN{for($0=systime();systime()-$0<50;)1;print}

Try it online!
This assumes that input is not allowed.

Swift - 41 bytes
Just outgolfing @Samira's answer, improving it drastically
var d=Date()+50;while Date()<d{};print(d)

Prints the date it started running to wake one up, e.g: if it's ran at 12:38 UTC, it outputs 2017-05-12 12:38:51 +0000 after 50 seconds.

Swift , 108 bytes
 var a=Date().addingTimeInterval(59.0);while(Date().timeIntervalSinceNow<a.timeIntervalSinceNow){};print("W")

Please add comment before doing a downvote.

Welcome to PPCG! The goal of code-golf challenges is to use as few bytes as possible and the challenge allows to output only a single character as wake-up signal, so you don't need "WakeUp" as a string, just for example "W" would suffice.

Also can the spaces at the beginning be omitted? var a=Date().

Agreed the space can be omitted also its written a tleast one character to wakeup that I didn't read. But there is no wrong logic used in this code. Neither a timer nor a sleep command.

This solution is terribly inefficient. The purpose here is to shorten the code as much as possible. This answer is an outgolfing of this one.

@Mr.Xcoder couldn't add comment on your code being new to this Coding Golf. A new thing I got to learn from your code that how we can deal with Date. Everyone has their own logic and I have my own. So may be my code can be bigger than you. But still its better than other languages that are having more bytes than my code. Happy Coding!!

VBA, 98 Bytes
Not sure if allowed...but here! It waits a single second, but doesn't wait the whole time. Still working on the language!
Sub Tm()
For i = 0 To 50
    If i = 50 Then
        MsgBox "!"
    Else
    Application.Wait (Now + TimeValue("0:00:01"))
    End If
Next i
End Sub

@Ben, by using Application.Wait(Now + TimeValue ("0:00:50"), it invalidates the entire code, as it cannot just wait 50 seconds. It specifically says in the challenge to check every second to determine when to ring.

that's not exactly right, you're not checking for the elapsed time, you're calling 50x the function that it is not allowed

C#, 72 bytes
for(var x=DateTime.Now;DateTime.Now<x.AddSeconds(50););Console.Write(0);

JS (ES6), 64 bytes
i=0,r=Date.now();while(1)Math.abs(Date.now()-r-5e4)>50?0:alert()

Windows Batch, 123 121 126 122 112 111 107 100 95 bytes
@set/ae=1%TIME:~6,2%+50-100
@if %e% geq 60 @set/ae-=60
:w
@if %e% neq %TIME:~6,2% @goto w
@cd

Explanation:
@set /a e=1%Time:~6,2%+50-100               ::Calcuate the result time
@if %e% geq 60 @set/ae-=60                  ::If result time > 59, set it to correct time

:w                                          :: Marker of the wait loop
@if %e% equ %TIME:~6,2% (cd)else (@goto w)  ::Returns current dir when program ended
                                            :: Or Else go back to wait for loop

you need to output to stdout

You didn't specific this in the rules....

read comments in the post

Well then why wouldn't you tell the Python2 answerer, Bash answerer, Ruby answerer but ME

python2's is an alternative, the original is stdout, i haven't read all of them yet, i'm reading the new ones as they come. chill

Let us continue this discussion in chat.

you can replace echo a with echo

can't you remove 2>nul ? as stderr is ignored?

Sometimes the code gives strange error because of octal...

yes, but errors are ignored by default if stdout has the correct answer

In batch and cmd, STDOUT and STDERR are all displayed on console

you can filter it out in your call, so it is ignored in the rules

If you say that's ok, then I will change it.

i count 112 bytes, you have extra spaces in 1st line

i counted 120 bytes, does [cr\lf] count as 1 byte?

yes, 1 byte as \n

i'll change....

This may be foul play.
Bash, 24 Bytes
ping 192.0.0.8 -rqc50|wc

To verify +6 bytes
ping 192.0.0.8 -rqc50|tail -n2

192.0.0.8 is IPv4 dummy address.
It send packet for 50 times in one second interval because it would not be reached.

That's includes in functions that wait for time. And woundn't that print stuff like unreachable dest?

As expected after all -- this is kind of wait. It dose not print any characters while it is sending 50 packets. wc is WordCount. It is not return until end of stream. In some environments, it shows help because ping -r option is not supported. (ex. http://s-macke.github.io/jor1k/demos/main.html  Try:ping 192.0.0.8 -qc50|wc)