LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-17-2013, 10:59 AM   #1
tautvilas
LQ Newbie
 
Registered: Nov 2012
Posts: 15

Rep: Reputation: Disabled
general question about javascript


here is a competition called js1k and they state in there page this rule :

Note that we're not counting in characters. JavaScript uses 16bit unicode values internally. The server will enforce this restriction and reject your submission if you try anyways.

Everybody submits ~1024 characters source files. Javascript uses 16 bit unicode to encode every character in the source code, which means that the submit file of ~1024 characters is ~2048 bytes size and this shouldn't be allowed to submit. What is that I don't get?

Thanks
 
Old 02-17-2013, 11:41 AM   #2
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Perhaps it points to size of the file to be submitted. As far as I understood, a file which is to be submitted, should have less than or equal to 1024 characters. (Note: A tilde "~" symbol means approximately). So in your case, server where you're submitting your source code file, will not accept files having more than 1024 characters.
Therefore, before submission, check no. of characters in your source code, as:
Code:
~$ wc -c source_code.txt

Last edited by shivaa; 02-17-2013 at 11:42 AM.
 
Old 02-19-2013, 03:06 AM   #3
AnanthaP
Member
 
Registered: Jul 2004
Location: Chennai, India
Distribution: UBUNTU 5.10 since Jul-18,2006 on Intel 820 DC
Posts: 805

Rep: Reputation: 186Reputation: 186
A character in ASCII usually needs 8 bits. As per the OP, Javascript needs 16 bits (or 2 bytes) internally for a character. So 1024 bytes gives only 512 characters. Submissions > 512 characters in size will not be accepted since they would require > 1024 bytes.

OK
 
  


Reply

Tags
encoding, javascript


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript Question akshay_satish Programming 1 02-09-2013 02:52 PM
Maturity of JavaScript in general Sergei Steshenko Programming 6 11-19-2012 02:13 PM


All times are GMT -5. The time now is 01:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration