Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 02-17-2013, 09:59 AM   #1
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?

Old 02-17-2013, 10:41 AM   #2
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:
~$ wc -c source_code.txt

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

Rep: Reputation: 201Reputation: 201Reputation: 201
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.



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 01:52 PM
Maturity of JavaScript in general Sergei Steshenko Programming 6 11-19-2012 01:13 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:08 PM.

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