By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,598 Members | 1,894 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,598 IT Pros & Developers. It's quick & easy.

url parsing

P: n/a
I use the following to parse the url

var srch = window.location.search.substring(1);
// then split srch at the ampersand:
var parts = srch.split("&");
// write the parameters into the variables
for(var i in parts) {
var temp = parts[i].split("=");
if (temp[0] == "xx") { xx = 1 * temp[1]; }
if (temp[0] == "yy") { yy = 1 * temp[1]; }
if (temp[0] == "ff") { ff = 1 * temp[1]; }
if (temp[0] == "level") { level = 1 * temp[1]; }
}

However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character somehow?
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #1
Share this Question
Share on Google+
28 Replies


P: n/a
Fabian hu kiteb:
I use the following to parse the url

var srch = window.location.search.substring(1);
// then split srch at the ampersand:
var parts = srch.split("&");


This line is definately the big isue. When I use "a" instead of "&", it
parses multiple substrings correctly.

var parts = srch.split("a");

Unfortunately, this isn't the standard approach to including data in an
url, so while it works, it is sub-optimal.

--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #2

P: n/a
"Fabian" <la****@hotmail.com> writes:
I use the following to parse the url

var srch = window.location.search.substring(1);
// then split srch at the ampersand:
var parts = srch.split("&"); .... However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character somehow?


That depends.

If the code is embedded in an HTML page, then the ampersand should be
escaped (as an HTML entity, "&amp;", not a Javascript string escape
"\&"). If it is in an external javascript file, then it should not.

So, probably. Have you tried escaping it?

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #3

P: n/a
Lasse Reichstein Nielsen hu kiteb:
However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character
somehow?


That depends.

If the code is embedded in an HTML page, then the ampersand should be
escaped (as an HTML entity, "&amp;", not a Javascript string escape
"\&"). If it is in an external javascript file, then it should not.

So, probably. Have you tried escaping it?


It is in an external javascript file. I have tried escaping it, and none
of the escape sequences I know seem to make much different. I've tried
%26, , &amp;, and \u0026. I'm not aware of other methods for
escaping the character.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk
Jul 20 '05 #4

P: n/a
Fabian wrote:
var srch = window.location.search.substring(1);
// then split srch at the ampersand:
var parts = srch.split("&");
// write the parameters into the variables
for(var i in parts) {
Not so. If successful, String.split(...) returns an Array object.
Iterate only over the array's elements, not over all the object's
enumerable properties:

for (var i = 0; i < parts.length; i++)
{
// ...
}
var temp = parts[i].split("=");
if (temp[0] == "xx") { xx = 1 * temp[1]; }
xx = +temp[1];

is faster (should be available from Netscape 4.06 on.)
I do hope `xx' aso. are not global variables used in a
local execution context.
if (temp[0] == "yy") { yy = 1 * temp[1]; }
if (temp[0] == "ff") { ff = 1 * temp[1]; }
if (temp[0] == "level") { level = 1 * temp[1]; }
Make use of either switch...case

switch (temp[0])
{
case "yy": yy = +temp[1]; break;
case "ff": ff = +temp[1]; break;
case "level": level = +temp[1]; break;
}

or a container object (here: window):

window[temp[0]] = temp[1];
}

However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character somehow?


Yes, RFC 2396 states that `&' is a special character and must be
escaped in URIs if not used with that special meaning. Since its
decimal ASCII code is 38, it can be escaped in URIs with the
hexadecimal representation of `%26'.

You may find http://pointedears.de.vu/scripts/search.htm useful.
(Please pay attention to the license agreement.)
Merry Christmas! (if you celebrate it)

PointedEars
Jul 20 '05 #5

P: n/a
Fabian wrote:
It is in an external javascript file. I have tried escaping it, and none
of the escape sequences I know seem to make much different. I've tried
%26, , &amp;, and \u0026. I'm not aware of other methods for
escaping the character.


`%26' and `\u0026' represent characters different from `'. While
the former are hexadecimal representations of the code of the character,
the latter is a decimal one. Only `&#x26;' (case-insensitive) and
`&#x0026;' would represent the same as the former.

http://www.w3.org/TR/html4/charset.html#h-5.3.1
PointedEars
Jul 20 '05 #6

P: n/a
Thomas 'PointedEars' Lahn hu kiteb:
if (temp[0] == "xx") { xx = 1 * temp[1]; }
xx = +temp[1];


I made this change about 5 minutes after posting when I saw a similar
response to making javascript recognise strings as numbers.
Make use of either switch...case

switch (temp[0])
{
case "yy": yy = +temp[1]; break;
case "ff": ff = +temp[1]; break;
case "level": level = +temp[1]; break;
}


Now using this code. Thanks.
However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character
somehow?


Yes, RFC 2396 states that `&' is a special character and must be
escaped in URIs if not used with that special meaning. Since its
decimal ASCII code is 38, it can be escaped in URIs with the
hexadecimal representation of `%26'.


I tried using srch.split("%26") but that would not split on an actual
question mark, only the literal string "%26". It finally turns out that
what I need is to split on "\?".

var srch = window.location.search.substring(1);
var parts = srch.split("\?");
for (var i = 0; i < parts.length; i++) {
var temp = parts[i].split("=");
switch (temp[0]) {
case "xx": xx = +temp[1]; break;
case "yy": yy = +temp[1]; break;
case "ff": ff = +temp[1]; break;
case "ll": level = +temp[1]; break;
}
}

Does this look good?
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk
Jul 20 '05 #7

P: n/a
Thomas 'PointedEars' Lahn <Po*********@web.de> writes:
Not so. If successful, String.split(...) returns an Array object.
Iterate only over the array's elements, not over all the object's
enumerable properties:
The only enumerable properties of an Array instance are the elements
of the array by default. All methods of Array.prototype and the length
property are non-enumerable.
for (var i = 0; i < parts.length; i++)


So unless you have extended Array.prototype or Object.prototype, this is
equivalent to
for (var i in parts)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #8

P: n/a
Lasse Reichstein Nielsen wrote:
Thomas 'PointedEars' Lahn <Po*********@web.de> writes:
Not so. If successful, String.split(...) returns an Array object.
Iterate only over the array's elements, not over all the object's
enumerable properties:


The only enumerable properties of an Array instance are the elements
of the array by default. All methods of Array.prototype and the length
property are non-enumerable.


Maybe, but I prefer it this way since it is independent
of flawed implementations and extensions to the prototype.
for (var i = 0; i < parts.length; i++)


So unless you have extended Array.prototype or Object.prototype, this is
equivalent to
for (var i in parts)


It is not since the order of the retrieved properties is
then undefined.
PointedEars
Jul 20 '05 #9

P: n/a
Fabian wrote:
Thomas 'PointedEars' Lahn hu kiteb:
However, when I parse the url, it consistently chokes when presented
with an ampersand character. Do I need to escape this character
somehow?
Yes, RFC 2396 states that `&' is a special character and must be
escaped in URIs if not used with that special meaning. Since its
decimal ASCII code is 38, it can be escaped in URIs with the
hexadecimal representation of `%26'.


I tried using srch.split("%26") but that would not split on an actual
question mark, only the literal string "%26".


Of course. You need to understand the difference between special
characters used as special characters, and special characters used
as ordinary characters within URI components. The latter needs to
be escaped, the former should not be escaped.
It finally turns out that what I need is to split on "\?".
"\?" is semantically equal to "?" since there is no such escape sequence
in _string_ literals. And no, you should not need to split on `?'. If
you need a *literal* `?' character, you need to escape it then in the URI.
var srch = window.location.search.substring(1);
Location is a host object and in some implementations the question
mark character is not part of location.search, so you need to check
for it before processing. And for compatibility reasons you should
use location.search, not window.location.search.
var parts = srch.split("\?");
See above.
for (var i = 0; i < parts.length; i++) {
var temp = parts[i].split("=");
`temp' is redefined on every loop which will yield a warning in Mozilla/5.0.

Use

var temp;
for (...)
{
// ...
temp = ...
// ...
}

instead.
switch (temp[0]) {
case "xx": xx = +temp[1]; break;
case "yy": yy = +temp[1]; break;
case "ff": ff = +temp[1]; break;
case "ll": level = +temp[1]; break;
}
}

Does this look good?


Quite. Using properties of a container object instead of switch...case
and global variables would look even better. Why reinventing the wheel,
check out JSX:search.js, it's for free. The only thing you are required
to respect is the GPL. And please copy and distribute it then.
HTH

PointedEars
Jul 20 '05 #10

P: n/a
Thomas 'PointedEars' Lahn <Po*********@web.de> writes:
Fabian wrote:

for (var i = 0; i < parts.length; i++) {
var temp = parts[i].split("=");


`temp' is redefined on every loop which will yield a warning in Mozilla/5.0.


Are you sure. I don't get any warning in Mozilla Firebird 0.7.

I believe that according to ECMA262, a variable declaration only generates
a local variable once, even if inside a loop. So the code following examples
are completely equivalent:

---
for (var i=0;i<4;i++) {
var temp = i;
}
---
and
---
var temp;
for (var i=0;i<4;i++) {
temp = i;
}
---
and even
---
var temp,i;
for (i=0;i<4;i++) {
temp = i;
}
---

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #11

P: n/a
Thomas 'PointedEars' Lahn hu kiteb:
... Why reinventing the
wheel, check out JSX:search.js, it's for free. The only thing you
are required
to respect is the GPL. And please copy and distribute it then.


The GPL is why I won't use it, but thanks for offering.
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #12

P: n/a
On Sat, 27 Dec 2003 05:31:22 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Why reinventing the wheel,
check out JSX:search.js, it's for free. The only thing you are required
to respect is the GPL. And please copy and distribute it then.


Fully agree with not re-inventing the wheel, but I'd strongly
recommend finding something other than a GPL solution, all you script
would then have to be GPL'd.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #13

P: n/a
Fabian wrote:
Thomas 'PointedEars' Lahn hu kiteb:
... Why reinventing the
wheel, check out JSX:search.js, it's for free. The only thing you
are required to respect is the GPL. And please copy and distribute
it then.
The GPL is why I won't use it, [...]


What exactly are you afraid of?
but thanks for offering.


You are welcome.
PointedEars
Jul 20 '05 #14

P: n/a
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Why reinventing the wheel, check out JSX:search.js, it's for free.
The only thing you are required to respect is the GPL. And please
copy and distribute it then.


Fully agree with not re-inventing the wheel, but I'd strongly
recommend finding something other than a GPL solution, all you script
would then have to be GPL'd.


And the problem is?
PointedEars
Jul 20 '05 #15

P: n/a
On Sun, 28 Dec 2003 01:14:55 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Why reinventing the wheel, check out JSX:search.js, it's for free.
The only thing you are required to respect is the GPL. And please
copy and distribute it then.


Fully agree with not re-inventing the wheel, but I'd strongly
recommend finding something other than a GPL solution, all you script
would then have to be GPL'd.


And the problem is?


The problem with GPL?

|b) You must cause any work that you distribute or publish, that in whole
|or in part contains or is derived from the Program or any part thereof, to
|be licensed as a whole at no charge to all third parties under the terms
|of this License.

So if I use a bit of GPL in my script, the whole script becomes GPL'd

|c) If the modified program normally reads commands interactively when
|run, you must cause it, when started running for such interactive use
|in the most ordinary way, to print or display an announcement
|including an appropriate copyright notice and a notice that there is
|no warranty (or else, saying that you provide a warranty) and that
|users may redistribute the program under these conditions, and
| telling the user how to view a copy of this License. (Exception:
| if the Program itself is interactive but does not normally print such
|an announcement, your work based on the Program is not
|required to print an announcement.)

Which is rather alarming (you might be able to argue the snippet was
interactive but didn't print an announcement, but I think that would
be a struggle in many cases.)

basically the GPL makes it hard to sell a whole work, even if only 1%
of your codebase is GPL, then you have to give everyone a RF licence.
I don't like this, I don't feel it's fair.

All my sourcecode that is not copyright someone else, is under a
modified BSD licence, this is much friendlier, and I would encourage
others to use the same or similar if they want an Open source licence.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #16

P: n/a
Thomas 'PointedEars' Lahn hu kiteb:
Fabian wrote:
Thomas 'PointedEars' Lahn hu kiteb:
... Why reinventing the
wheel, check out JSX:search.js, it's for free. The only thing you
are required to respect is the GPL. And please copy and distribute
it then.


The GPL is why I won't use it, [...]


What exactly are you afraid of?


Kind of weird to explain. For me, javascript and html is a hobby. I get
more pleasure out of the process of building the stuff than from
actually having the completed thing in front of me. Taking smething
pre-built wholesale defeats both of those goals. It also means I don't
understand the code I end up using so well. I appreciate pointers and
advice; the one thing I don't want is for the answer to be given to me.

I also have this mad dream that one day I may be able to use some of my
code
on a commercial basis, which would also ot be possible with GPL code.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #17

P: n/a
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Jim Ley wrote:
Thomas 'PointedEars' Lahn wrote:
Why reinventing the wheel, check out JSX:search.js, it's for free.
The only thing you are required to respect is the GPL. And please
copy and distribute it then.

Fully agree with not re-inventing the wheel, but I'd strongly
recommend finding something other than a GPL solution, all you script
would then have to be GPL'd.
And the problem is?


The problem with GPL?

|b) You must cause any work that you distribute or publish, that in whole
|or in part contains or is derived from the Program or any part thereof, to
|be licensed as a whole at no charge to all third parties under the terms
|of this License.


You destroyed the context. It reads:

| When we speak of free software, we are referring to freedom, not
| price. Our General Public Licenses are designed to make sure that you
| have the freedom to distribute copies of free software (and charge for
| this service if you wish), that you receive source code or can get it
| if you want it, that you can change the software or use pieces of it
| in new free programs; and that you know you can do these things.
| [...]
|
| TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
| [...]
| 2. You may modify your copy or copies of the Program or any portion
| of it, thus forming a work based on the Program, and copy and
| distribute such modifications or work under the terms of Section 1
| above, provided that you also meet all of these conditions:
|
| [...]
| b) You must cause any work that you distribute or publish, that in
| whole or in part contains or is derived from the Program or any
| part thereof, to be licensed as a whole at no charge to all third
| parties under the terms of this License.

It means that the license must be free of charge, not the program.
So if I use a bit of GPL in my script, the whole script becomes GPL'd
If used in a whole, yes.
|c) If the modified program normally reads commands interactively when
|run, you must cause it, when started running for such interactive use
|in the most ordinary way, to print or display an announcement
|including an appropriate copyright notice and a notice that there is
|no warranty (or else, saying that you provide a warranty) and that
|users may redistribute the program under these conditions, and
| telling the user how to view a copy of this License.(Exception:
| if the Program itself is interactive but does not normally print such
|an announcement, your work based on the Program is not
|required to print an announcement.)

Which is rather alarming (you might be able to argue the snippet was
interactive but didn't print an announcement, but I think that would
be a struggle in many cases.)
The above section obviously does not apply for JavaScript scripts.
basically the GPL makes it hard to sell a whole work,
It does not.
even if only 1% of your codebase is GPL, then you have to give everyone
a RF licence.
That's the idea. But they are not allowed to sell work based
on your ideas without mentioning your co-authorship.
I don't like this, I don't feel it's fair.
What is not fair about it? That others can use your work and
can modify it, provided that they still mention your authorship?
You got the wrong idea about free software.
I would encourage others to use the same or similar if they want an
Open source licence.


There is a difference between free software and Open Source software.
That difference is freedom. http://www.fsf.org/philosophy/free-sw.html
PointedEars
Jul 20 '05 #18

P: n/a
Fabian wrote:
Thomas 'PointedEars' Lahn hu kiteb:
Fabian wrote:
The GPL is why I won't use it, [...]
What exactly are you afraid of?


Kind of weird to explain. For me, javascript and html is a hobby. I get
more pleasure out of the process of building the stuff than from
actually having the completed thing in front of me. Taking smething
pre-built wholesale defeats both of those goals. It also means I don't
understand the code I end up using so well. I appreciate pointers and
advice; the one thing I don't want is for the answer to be given to me.


I can accept that.
I also have this mad dream that one day I may be able to use some of my
code on a commercial basis, which would also ot be possible with GPL code.


I cannot accept that since it is of course wrong.
Read http://www.fsf.org/philosophy/free-sw.html
PointedEars
Jul 20 '05 #19

P: n/a
On Sun, 28 Dec 2003 02:36:14 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Jim Ley wrote:
| b) You must cause any work that you distribute or publish, that in
| whole or in part contains or is derived from the Program or any
| part thereof, to be licensed as a whole at no charge to all third
| parties under the terms of this License.

It means that the license must be free of charge, not the program.
What? So you're saying I can sell copies of GPL software as long as I
don't sell the licence, just the software itself. (which I can't of
course sell as I don't own the parts I didn't write, I only have a
licence to use it...) I think you should consult a lawyer...
So if I use a bit of GPL in my script, the whole script becomes GPL'd


If used in a whole, yes.


How can it be used in a part but not the whole, please explain?
The above section obviously does not apply for JavaScript scripts.
Please cite legal opinion on this, preferably in a UK or European
court. I'm afraid I see nothing in the GPL which exclued javascript
from any part of it.
basically the GPL makes it hard to sell a whole work,


It does not.


Could you explain how I can achieve it then?
That's the idea. But they are not allowed to sell work based
on your ideas without mentioning your co-authorship.
That sounds like a BSD licence to me, not a GPL one.
What is not fair about it? That others can use your work and
can modify it, provided that they still mention your authorship?
You got the wrong idea about free software.
Nope, that's a BSD (or similar) licence, the GPL licence requires that
my modifications/additions etc. are also GPL'd, that's restrictive.
There is a difference between free software and Open Source software.
That difference is freedom. http://www.fsf.org/philosophy/free-sw.html


What are you talking about? the BSD licence is far less restrictive
than the GPL, if you also read further than the page you cited, you'll
see that the BSD is fully compatible with the GPL...

http://www.fsf.org/licenses/license-list.html

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #20

P: n/a
ji*@jibbering.com (Jim Ley) writes:

Ok, I'll just answer this thread once, and start out saying that it's
off topic (highly interesting, though, but probably not to everyone
who is here for Javascript).
On Sun, 28 Dec 2003 02:36:14 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
It means that the license must be free of charge, not the program.


What? So you're saying I can sell copies of GPL software as long as I
don't sell the licence, just the software itself. (which I can't of
course sell as I don't own the parts I didn't write, I only have a
licence to use it...) I think you should consult a lawyer...


I don't know what selling the license would entail, but yes, you can
sell copies of GPL'ed software. You don't need permission, the right
to distribute, even for money, is part of the GPL. The GPL is *not*
a license to *use* the software. It is a license to use the source,
make derivative programs, and distribute these as you see fit. The
catch is that you must also release the source of your derivative
under the GPL.

That is, you cannot distribute (for money or not) a program and refuse
to reveal the source. For an interpreted language, that is not really
a restriction, since all programs are distributed as source (unless
you obfuscate the source, then you must reveal unobfuscated source).

<URL:http://www.gnu.org/licenses/gpl-faq.html#DoesTheGPLAllowMoney>
basically the GPL makes it hard to sell a whole work,


It does not.


Could you explain how I can achieve it then?


Effectively, no. You are free to take money from the software.
You can't prevent other people from spreading it for free.

So, it's not hard to sell a whole work. What is hard is to make
money from it, unless you have a secondary means of income
(typically, that would be selling support for the product,
like, e.g., RedHat).

....
There is a difference between free software and Open Source software.
That difference is freedom. http://www.fsf.org/philosophy/free-sw.html


What are you talking about?


Did you follow the link? I think that page makes it quite clear.

Whether you care about whether the program is free software or
just open source, that is another matter.
the BSD licence is far less restrictive than the GPL,
Yes. That is why the (modified) BSD license is not a copyleft license.
It doesn't enforce that derivative works are also free.
if you also read further than the page you cited, you'll see that
the BSD is fully compatible with the GPL...


Yes. That means that you can include a module released under the BSD
license in a program covered by the GPL. The resulting program is
covered by the GPL license, and the included part also by the BSD
license.

Some licenses are not compatible with the GPL. Including a module
licensed under one of these in a GPL program would be in violation
of either that license or the GPL.

Being compatible does not mean that the lincense is a copyleft
license.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #21

P: n/a
On Sun, 28 Dec 2003 04:46:58 +0100, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
I don't know what selling the license would entail, but yes, you can
sell copies of GPL'ed software. You don't need permission, the right
to distribute, even for money, is part of the GPL.
Yes, the right to distribute for money, not the right to sell for
money (the distinction is in what the purchaser can do with the
product, and what they own.) Most of my work is done on a "work for
hire" basis where what I produce is owned and copyright by the person
who pays for my time (either because I'm an employee, or because the
contract states this) if I use a GPL part, then whilst they may own
it, there's very little protection for their IP as they have to
distribute full source and can only charge distribution costs. (which
since it's client side JS someone can just download it from the side
for free.)
The
catch is that you must also release the source of your derivative
under the GPL.
Which is one hell of a catch!

As you can only sell it once before you have competitors (since the
person you sell it to can then also sell it since they have a licence
which places no restriction that they don't)

http://www.gnu.org/philosophy/selling.html

So sure I can sell it once, but I can't sell it twice, as the 2nd
customer can just go either download it from the firsts site, or they
could even buy it from them at a lot less than I can do so.
What are you talking about?


Did you follow the link? I think that page makes it quite clear.


The page is clear, but I was trying to understand the context.
if you also read further than the page you cited, you'll see that
the BSD is fully compatible with the GPL...


Yes. That means that you can include a module released under the BSD
license in a program covered by the GPL. The resulting program is
covered by the GPL license, and the included part also by the BSD
license.


Yes...
Being compatible does not mean that the lincense is a copyleft
license.


Who said it was?

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #22

P: n/a
Thomas 'PointedEars' Lahn hu kiteb:

I also have this mad dream that one day I may be able to use some of
my code on a commercial basis, which would also ot be possible with
GPL code.


I cannot accept that since it is of course wrong.
Read http://www.fsf.org/philosophy/free-sw.html


As I understand the gpl license, it would be possible for me to sell it
one time, and possibly more if the initial purchaser does not
immediately start distributing it for no money, as would be his right
under that license. As I understand it.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #23

P: n/a
Fabian wrote:
Thomas 'PointedEars' Lahn hu kiteb:
I also have this mad dream that one day I may be able to use some of
my code on a commercial basis, which would also ot be possible with
GPL code.


I cannot accept that since it is of course wrong.
Read http://www.fsf.org/philosophy/free-sw.html


As I understand the gpl license, it would be possible for me to sell it
one time, and possibly more if the initial purchaser does not
immediately start distributing it for no money, as would be his right
under that license. As I understand it.


You misunderstood it, read Lasse's good clarification.
The GPL is not about money, it is about the freedom to
use the source code.
F'up2 poster

PointedEars
Jul 20 '05 #24

P: n/a
Thomas 'PointedEars' Lahn hu kiteb:

You misunderstood it, read Lasse's good clarification.
The GPL is not about money, it is about the freedom to
use the source code.


And wouldn't that include the freedom to compile said source code and
sell teh compiled form? That is, after all, using the source code.
--
--
Fabian
Visit my website often and for long periods!
http://www.lajzar.co.uk

Jul 20 '05 #25

P: n/a
"Fabian" <la****@hotmail.com> writes:
And wouldn't that include the freedom to compile said source code and
sell teh compiled form? That is, after all, using the source code.


Yes, you can do that under the GPL. "All" you are required to do is:
1) include the GPL, and
2) provide the source code to the binary program on demand.

It is not compatible with the traditional business model of software
producers (just selling the software).

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #26

P: n/a
On Mon, 29 Dec 2003 02:14:10 +0100, Lasse Reichstein Nielsen
<lr*@hotpop.com> wrote:
"Fabian" <la****@hotmail.com> writes:
And wouldn't that include the freedom to compile said source code and
sell teh compiled form? That is, after all, using the source code.
Yes, you can do that under the GPL. "All" you are required to do is:
1) include the GPL, and
2) provide the source code to the binary program on demand.


And forbid any derivative works and future modifications to also be
under the GPL.
It is not compatible with the traditional business model of software
producers (just selling the software).


Neither is compatible with most work carried out as a contractor or a
supplier of completed works, where the contract almost universally
requires that the end result be owned by the purchaser, Seen as most
commercial work in javascript is done on this basis, there is
virtually no chance I would get any work if I used GPL'd components.
I cannot sell it, selling script is more than a licence to use/modify
etc.

I'd love to see the contracts some of you are signing that allow for
GPL code to be provided!

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #27

P: n/a
Jim Ley wrote:
[...] Lasse Reichstein Nielsen [...] wrote:
"Fabian" <la****@hotmail.com> writes:
And wouldn't that include the freedom to compile said source code and
sell teh compiled form? That is, after all, using the source code.


Yes, you can do that under the GPL. "All" you are required to do is:
1) include the GPL, and
2) provide the source code to the binary program on demand.


And forbid any derivative works and future modifications to also be
under the GPL.


No, you cannot do that since it would restrict the freedom of people
using the source code and is thus explicitely forbidden by the GPL itself:

| 6. Each time you redistribute the Program (or any work based on the
| Program), the recipient automatically receives a license from the
| original licensor to copy, distribute or modify the Program
| subject to these terms and conditions. You may not impose any
| further restrictions on the recipients' exercise of the rights
| granted herein. You are not responsible for enforcing compliance
| by third parties to this License.
PointedEars
Jul 20 '05 #28

P: n/a
On Wed, 31 Dec 2003 19:40:13 +0100, Thomas 'PointedEars' Lahn
<Po*********@web.de> wrote:
Jim Ley wrote:
[...] Lasse Reichstein Nielsen [...] wrote:
"Fabian" <la****@hotmail.com> writes:
And wouldn't that include the freedom to compile said source code and
sell teh compiled form? That is, after all, using the source code.

Yes, you can do that under the GPL. "All" you are required to do is:
1) include the GPL, and
2) provide the source code to the binary program on demand.


And forbid any derivative works and future modifications to also be
under the GPL.


No, you cannot do that since it would restrict the freedom of people
using the source code and is thus explicitely forbidden by the GPL itself:


Exactly, so I cannot SELL the product, all I can do is sell the use of
the product under the restrictions the GPL gives, that's different
from selling it.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 20 '05 #29

This discussion thread is closed

Replies have been disabled for this discussion.