Hello,
-- I want to parse csv. I found a jquery plugin that does the job: Papa Parser. I have download one js file (jquery.parse.min.js) and put it in lib dir into my amber project. In index.html, I add 'lib' as path ( require.config( { paths: { 'lib' : lib', ... } } ); But, if i add 'jquery.parse.min' in require string, I have an error on loading: jQuery not found In my index.html, how to load this lib that depends on jquery ? Now, how to use it in amber smalltalk ? In js, it should be use as $.parse("csvstring"); Is $ identical to jQuery ? a+ Vicnet You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hi,
-- On Thu, Apr 17, 2014 at 6:42 PM, Vicnet <[hidden email]> wrote:
you can only be sure that jQuery is present after Amber has been loaded. Maybe you can load your library in the callback function of the following lines:
Or you add a require call that both depens on 'amber/devel' (in the above case) and your library. Best, Manfred
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Le jeudi 17 avril 2014 18:59:12 UTC+2, Manfred Kröhnert a écrit :
Something like that ?
Tanks, that seems ok for loading. No error on console. Now, how to use it amber ? $.parse ?!? a+ Vicnet You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Vicnet-2
Vicnet <[hidden email]>napísal/a: Hello, I want to parse csv. I found a jquery plugin that does the job: Papa Parser. I have download one js file (jquery.parse.min.js) and put it in lib dir into my amber project. In index.html, I add 'lib' as path ( require.config( { paths: { 'lib' : lib', ... } } ); But, if i add 'jquery.parse.min' in require string, I have an error on loading: jQuery not found You must shim the dependency. It is easy, you just add one more option beyond paths to your config call: `shim:{'lib/jquery.parse.min': { deps:[ 'jquery' ]}}`. In `shim` you can list dependencies this way for any number of libraries you liad with require; the property name is the path of library. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
That OK with shim. Thanks.
-- I test in js console and start to test in Workspace. $ is replaced by jQuery. I still need help to find how to produce a javascript dictionnary to handle parameter. In js: $.parse('one,two', { delimiter: ",", header: false, dynamicTyping:false}) In st: jQuery parse: 'one,two' config: ?!? How to convert config data in st ? a+ Vicnet Le jeudi 17 avril 2014 22:53:56 UTC+2, Herby a écrit :
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
I found it: HashedCollection with -> message !
-- jQuery parse: 'one,two' config: #{'delimiter'->','. 'header'->'false'. 'dynamicTyping'->'false'} easy and elegant (as st can do) ! a+ Vicnet Le vendredi 18 avril 2014 13:22:06 UTC+2, Vicnet a écrit :
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hi Vicnet,
-- On Fri, Apr 18, 2014 at 1:30 PM, Vicnet <[hidden email]> wrote:
great to hear that you could figure it out yourself. Basically the #{} syntax is a short form for creating a dictionary. Best, Manfred
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Vicnet-2
I would use false, not 'false'. Keys must be strings in #{}, but values can be anything (in original code you also used boolean, not string).
Manfred Kröhnert <[hidden email]>napísal/a: Hi Vicnet,
-- On Fri, Apr 18, 2014 at 1:30 PM, Vicnet <[hidden email]> wrote:
great to hear that you could figure it out yourself. Basically the #{} syntax is a short form for creating a dictionary. Best, Manfred
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Right.
-- I saw that it is not working with 'false' but OK with false. Is it something we could add in recipices (in web site) ? - How to add a external lib ? - How to create javascript dictionnary parameters. Regards, Vicnet Le vendredi 18 avril 2014 14:24:50 UTC+2, Herby a écrit : I would use false, not 'false'. Keys must be strings in #{}, but values can be anything (in original code you also used boolean, not string). You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
On 4/18/14, Vicnet <[hidden email]> wrote:
> Right. > I saw that it is not working with 'false' but OK with false. > > Is it something we could add in recipices (in web site) ? > - How to add a external lib ? > - How to create javascript dictionnary parameters. > > Regards, > Vicnet Vicnet May I ask you to add the information how you loaded a jQuery plugin (papa CSV parser) to the wiki? Regards --Hannes -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Sure,
-- No time to do it yet but I add a issue to remember this. https://github.com/vicnet/benevoles/issues/3 (samething for your hints on packages) a+ Vicnet Le mardi 29 avril 2014 11:47:10 UTC+2, Hannes a écrit : On 4/18/14, Vicnet <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="6ZwdPHdBvkYJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">ose...@...> wrote: You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hello,
-- Again on Papaparse integration. As said, I have add it with grunt, create amd file, declare in imports string of my package. It is OK on linux, Papa class is available every where, like in Workspace. On Windows, with exactly the same env (node 0.12, last amber, last firefox), I cannot access global class Papa, nor in Workspace nor inside my classes. What is wrong ? What can I do to investigate this problem ? a+ Vicnet You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Vicnet wrote: > Hello, > > Again on Papaparse integration. > As said, I have add it with grunt, create amd file, declare in imports > string of my package. > It is OK on linux, Papa class is available every where, like in Workspace. > > On Windows, with exactly the same env (node 0.12, last amber, last > firefox), I cannot access global class Papa, nor in Workspace nor What do you mean by "global class Papa"? > inside my classes. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
For example
--
I use Papa class message. It correspond to a global function in papaparse js:
a+ Vicnet Le lundi 4 mai 2015 13:47:50 UTC+2, Herby a écrit :
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Vicnet wrote: > For example > > || > Importeur>>importe:texte > ^Papaparse:texte > > I use Papa class message. > > It correspond to a global function in papaparse js: > || > (function(global) > { > global.Papa={}; Don't use global, use import variable, and properly shim export of a module that insists on using global. More in requirejs docs, on config options "shim" / "exports". > ... > > a+ > Vicnet > > Le lundi 4 mai 2015 13:47:50 UTC+2, Herby a écrit : > > > > Vicnet wrote: > > Hello, > > > > Again on Papaparse integration. > > As said, I have add it with grunt, create amd file, declare in > imports > > string of my package. > > It is OK on linux, Papa class is available every where, like in > Workspace. > > > > On Windows, with exactly the same env (node 0.12, last amber, last > > firefox), I cannot access global class Papa, nor in Workspace nor > > What do you mean by "global class Papa"? > > > inside my classe > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [hidden email] > <mailto:[hidden email]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Thanks for your help.
-- I add "shim" : { "papaparse": { "exports": "Papa" } } in papaparse.amd.json and do a grunt devel. config.js is filled with these informations and the.js also contains the same values. But if I enter Papa in Workspace and Ctrl-p, I get nil. Remark: I am not using shim on linux and it is OK. I see the pb only on windows. Remark2: if I enter a random string and do Ctrl-P , nil is displayed and also a error window. With Papa, only nil is displayed, no error window. A init pb ? a+ Vincent You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Of course you get nil. I said don't use global but instead use import variable (instead of string in imporys, put assocuation there, like 'papa' -> 'papaparse' (the key is var name, the value is module name). Then use variable 'papa' anywhere in the package (Workspace not supported yet, sorry).
Dňa 4. mája 2015 18:46:45 CEST používateľ Vicnet <[hidden email]> napísal:
--
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Vicnet-2
And if course, use same solution on all platforms.
Dňa 4. mája 2015 18:46:45 CEST používateľ Vicnet <[hidden email]> napísal:
--
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
That's OK now.
-- Thank you for your hep. I had multiple errors: - in my local papaparse.amd.json, I declare only 'papaparse' : '.' instead of 'papaparse' : 'papaparse' (there is only one js file papaparse(.min).js in papaparse dir) - I declare imports : { 'papaparse' } instead of { 'Papa' -> 'papaparse' } I saw that this is transformed in a require statement require(['papaparse], function(Papa) {... I suppose that Papa was available (in Workspace too) on linux because the papparse js file was just loaded but not injected in my package. With only this declaration imports :{ 'papa' -> 'papaparse' }, without amd correction, 'papa' variable was nil inside my package classses. On linux, library was loaded and global function executed but not on windows ? Now, it is ok in two systems. Thanks, a+ Vicnet Le lundi 4 mai 2015 20:32:53 UTC+2, Herby a écrit :
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
On 5/5/15, Vicnet <[hidden email]> wrote:
> That's OK now. > > Thank you for your hep. > > I had multiple errors: > - in my local papaparse.amd.json, I declare only 'papaparse' : '.' instead > of 'papaparse' : 'papaparse' > (there is only one js file papaparse(.min).js in papaparse dir) Great to see this { "paths": { "papaparse": "papaparse" }, "shim": { "papaparse": { "exports": "Papa" } } } https://github.com/vicnet/benevoles/blob/master/papaparse.amd.json > - I declare imports : { 'papaparse' } instead of { 'Papa' -> 'papaparse' } > I saw that this is transformed in a require statement > require(['papaparse], function(Papa) {... Which place are you refering to? > I suppose that Papa was available (in Workspace too) on linux because the > papparse js file was just loaded but not injected in my package. > With only this declaration imports :{ 'papa' -> 'papaparse' }, without amd > correction, 'papa' variable was nil inside my package classses. > On linux, library was loaded and global function executed but not on > windows ? I wonder why the difference? > Now, it is ok in two systems. > Thanks, Great that we now have a working example. Congratulations for your persistence. --Hannes > a+ > Vicnet > > Le lundi 4 mai 2015 20:32:53 UTC+2, Herby a écrit : >> >> And if course, use same solution on all platforms. >> >> Dňa 4. mája 2015 18:46:45 CEST používateľ Vicnet <[hidden email] >> <javascript:>> napísal: >>> >>> Thanks for your help. >>> >>> I add "shim" : { "papaparse": { "exports": "Papa" } } in >>> papaparse.amd.json >>> and do a grunt devel. >>> >>> config.js is filled with these informations and the.js also contains the >>> >>> same values. >>> >>> But if I enter Papa in Workspace and Ctrl-p, I get nil. >>> >>> Remark: I am not using shim on linux and it is OK. I see the pb only on >>> windows. >>> Remark2: if I enter a random string and do Ctrl-P , nil is displayed and >>> >>> also a error window. With Papa, only nil is displayed, no error window. >>> A init pb ? >>> >>> a+ >>> Vincent >>> >>> > > -- > You received this message because you are subscribed to the Google Groups > "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [hidden email]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |