Hello,
I work on a university project in Amber, I must move an application in Smalltalk to Amber. I need to create 3 files .xml .csv .dat but I don't know to do that. A way is to use Ajax for sending text to the serveur and using PHP but I want to do that with only Amber, any idea? In an other message, I discover the library raphael.js and I think that i can use this to create an Image with LineSegment,... But anybody say how to use this? I don't know use a Javascript Library. Sorry, my english isn't perfect, Thanks, Muriel |
Hi!
Your english is fine, no problem. If you both want to build a web front end AND need to create files on the server the simplest approach is to just use the same setup that the IDE uses when you use the little webDAV server that Nicolas wrote that is under bin: 1. You build an Amber UI and then use code like you will find if you search for "commit" (I think the method is called that). I can post a followup when I get off the subway. 2. You just use the server Nicolas wrote, if you just want to save files to the server you will not even need to modify it. Regarding Raphael, yes, quite nice - I have been working with graphs lately too and we use Highcharts, a very nice js lib. I should make some example with it. regards, Göran -- Sent from my Palm Pre 2, wohoo! On Jan 17, 2012 20:46, M heyv <[hidden email]> wrote: Hello, I work on a university project in Amber, I must move an application in Smalltalk to Amber. I need to create 3 files .xml .csv .dat but I don't know to do that. A way is to use Ajax for sending text to the serveur and using PHP but I want to do that with only Amber, any idea? In an other message, I discover the library raphael.js and I think that i can use this to create an Image with LineSegment,... But anybody say how to use this? I don't know use a Javascript Library. Sorry, my english isn't perfect, Thanks, Muriel |
Oh thanks, I had not thought! Yes, I find the method ajaxPutAt: in the version 0.9.1. I begin to work with the previous version of amber, I don't know if the method is the same but in the new version I can't find class AjAx and JQuery so Can i do Ajax new url:' ' onSuccessDo:' '? I am not on my laptop today I can't verify it. I don't know to use Javascript libraries in Amber, I just load it in index.html and call it like that: <....>? If you can give me some examples, it could be very interesting because I need to build a complete application. Ps: I don't use node.js, I use a PHP server because I need to upload files on server and I find anything about uploading on Amber. My php server isn't configure for PUT request, I don't know how to do it. It seems that it could be a problem for me... Muriel |
Hi Muriel!
On Wed, 2012-01-18 at 01:29 -0800, M heyv wrote: > Oh thanks, I had not thought! > > Yes, I find the method ajaxPutAt: in the version 0.9.1. I begin to > work with the previous version of amber, I don't know if the method is > the same but in the new version I can't find class AjAx and JQuery so > Can i do Ajax new url:' ' onSuccessDo:' '? I am not on my laptop > today I can't verify it. In Amber 0.9.1 the jQuery binding is gone, simply because we don't need it anymore. There's no Ajax class anymore. Therefore you can do: jQuery ajax: anURL options: #{ 'success' -> ["do something here"]. 'error' -> [window alert: 'something went wrong'!] } which is equivalent to: jQuery.ajax(anUrl, { success: function() {}, error: function() {window.alert('something went wring!')} }); See http://api.jquery.com/jQuery.ajax/ about jQuery and this: http://amber-lang.net/documentation.html#JSObjectProxy about sending messages to JavaScript objects. Hope this helps, Nico > > I don't know to use Javascript libraries in Amber, I just load it in > index.html and call it like that: <....>? If you can give me some > examples, it could be very interesting because I need to build a > complete application. > > Ps: I don't use node.js, I use a PHP server because I need to upload > files on server and I find anything about uploading on Amber. My php > server isn't configure for PUT request, I don't know how to do it. It > seems that it could be a problem for me... > > Muriel |
Love it. Makes it painfully easy to include *whatlibever* into Smalltalk syntax! A great step forward for the Smalltalk community! Tnx, Guido Stepken Am 18.01.2012 10:41 schrieb "Nicolas Petton" <[hidden email]>:
Hi Muriel! |
In reply to this post by Nicolas Petton
On 01/18/2012 10:41 AM, Nicolas Petton wrote:
> Hi Muriel! > > On Wed, 2012-01-18 at 01:29 -0800, M heyv wrote: >> Oh thanks, I had not thought! >> >> Yes, I find the method ajaxPutAt: in the version 0.9.1. I begin to >> work with the previous version of amber, I don't know if the method is >> the same but in the new version I can't find class AjAx and JQuery so >> Can i do Ajax new url:' ' onSuccessDo:' '? I am not on my laptop >> today I can't verify it. > > In Amber 0.9.1 the jQuery binding is gone, simply because we don't need > it anymore. There's no Ajax class anymore. Therefore you can do: > > jQuery > ajax: anURL options: #{ > 'success' -> ["do something here"]. > 'error' -> [window alert: 'something went wrong'!] > } > > which is equivalent to: > > jQuery.ajax(anUrl, { > success: function() {}, > error: function() {window.alert('something went wring!')} > }); ...and yes, you can also use < ... > but if you can avoid it and just use Amber Smalltalk code - it looks and integrates much nicer :) regards, Göran |
Hi,
Now I can create my files, it's so good! But now I have some problem but it's not important like method removeFirst that isn't implement. Thanks. I discover the library highChart, it's good for me. In javascript I want to write code like: var options = { chart: { renderTo: 'container', defaultSeriesType: 'line' }, title: { text: 'Trait de cote' }, xAxis: { categories: [] }, yAxis: { title: { text: 'Distance' } }, series: [] }; $.get('test.csv', function(data) { // Split the lines var lines = data.split('\n'); // Iterate over the lines and add categories or series $.each(lines, function(lineNo, line) { var items = line.split(';'); if (lineNo == 0) { $.each(items, function(itemNo, item) { if (itemNo > 0) options.xAxis.categories.push(item); }); } // the rest of the lines contain data with their name in the first position else { var series = { data: [] }; $.each(items, function(itemNo, item) { if (itemNo == 0) { series.name = item; } else { series.data.push(parseFloat(item)); } }); options.series.push(series); } }); // Create the chart var chart = new Highcharts.Chart(options); }); </script> </head> <body> <div id="container"></div> </body> </html> With files that I have created. But I don't now how to use it in Amber. Humm, I don't see Jquery method in the Browser on Amber (like ajax: for ewample, it's hide??) Thanks, Muriel |
Hi!
Yes, Highcharts is very nice, we use it at work a lot. Regarding not finding jQuery methods etc, that is because Amber can use js libraries without any wrapper classes or other glue code - check the new documentation, read about JSObjectProxy in Kernel-Objects. Also: https://github.com/NicolasPetton/amber/wiki/From-smalltalk-to-javascript-and-back regards, Göran -- Sent from my Palm Pre 2, wohoo! On Jan 19, 2012 23:31, M heyv <[hidden email]> wrote: Hi, Now I can create my files, it's so good! But now I have some problem but it's not important like method removeFirst that isn't implement. Thanks. I discover the library highChart, it's good for me. In javascript I want to write code like: var options = { chart: { renderTo: 'container', defaultSeriesType: 'line' }, title: { text: 'Trait de cote' }, xAxis: { categories: [] }, yAxis: { title: { text: 'Distance' } }, series: [] }; $.get('test.csv', function(data) { // Split the lines var lines = data.split('\n'); // Iterate over the lines and add categories or series $.each(lines, function(lineNo, line) { var items = line.split(';'); if (lineNo == 0) { $.each(items, function(itemNo, item) { if (itemNo > 0) options.xAxis.categories.push(item); }); } // the rest of the lines contain data with their name in the first position else { var series = { data: [] }; $.each(items, function(itemNo, item) { if (itemNo == 0) { series.name = item; } else { series.data.push(parseFloat(item)); } }); options.series.push(series); } }); // Create the chart var chart = new Highcharts.Chart(options); }); </script> </head> <body> <div id="container"></div> </body> </html> With files that I have created. But I don't now how to use it in Amber. Humm, I don't see Jquery method in the Browser on Amber (like ajax: for ewample, it's hide??) Thanks, Muriel |
IMHO the best ideas in software engineering the last decade. Got this game painlessly converted to Amber Smalltalk within a few hours: Try the JS version here: http://sebleedelisle.com/demos/JSTouchController/TouchControl.html Sources: http://github.com/sebleedelisle/JSTouchController Authors homepage and videos: http://sebleedelisle.com/2011/04/multi-touch-game-controller-in-javascripthtml5-for-ipad/ Tnx so much! Keep up the good work! Guido Stepken Am 20.01.2012 08:41 schrieb "Göran Krampe" <[hidden email]>:
Hi! |
Hi, I have an other problem!
I have created 5 classes and one of these have 3 subclasses but this class don't appear when I reload the page. But I have committed the package and I can see classes in JS files, I don't understand how to see my classes. Thanks, Muriel |
On Tue, 2012-01-24 at 00:49 -0800, M heyv wrote:
> Hi, I have an other problem! > > I have created 5 classes and one of these have 3 subclasses but this > class don't appear when I reload the page. > But I have committed the package and I can see classes in JS files, I > don't understand how to see my classes. Do you have an error in the JavaScript console when your JS files are loading? Cheers, Nico > > Thanks, > > Muriel |
Concerning the us of js librairies, can I create a variable like that
< options = { chart: { renderTo: 'container', defaultSeriesType: 'line' }, title: { text: 'Trait de cote' }, xAxis: { categories: [] }, yAxis: { title: { text: 'Distance' } }, series: [] };> or <var myArrayName=[];> Or no? I try to do this: html script type: 'text/javascript'; src: './js/highcharts.js'. html script with: <script javascript> html div id: 'container'. But it doesn't work, I don't be surprise. I must to write like in smalltalk like: Highcharts.Chart new options: options. for example? Sorry, maybe it doesn't difficult but I am new in amber and I never see a concrete example with another librairies that jquery. Thanks, Muriel |
Finaly, I insert the script (aString) in the tag Script of my html canvas and it's work. So I can't use the library like Smalltalk but my aim it's just to create a chart to verify data that I have created. regards, Muriel |
Free forum by Nabble | Edit this page |