Ok so i managed to do the first move (getting more info from the SE) myself (however still have to hive away it) but another problem is. I want to get the numbers hat i get in be boxes to use those numbers as a source for my composition. Apparently you undergo to create an outlet for that but what should i writedeclareOutlets(new int[]{DataTypes. ALL});this is alrteady there but i now i only get <END> in a message box. What do I have to write to get a separate outlet for numbers?Thanks in advance amuelbtw here is the beat code as it appears in the java folder of maximport com cycling74 max.*;merchandise java net.*;merchandise java io.*;merchandise java util. Hashtable;merchandise java util. Vector;merchandise java util. Enumeration;//finance yahoo com/d/quotes csv?f=sl1d1t1c1ohgv&e= csv&s=INTC+SUNWpublic class StockWatch extends MaxObject implements Runnable. Executable{ //Attributes manifold interval = 30 * 1000; //30 seconds static final int SYM = 0; static final int LAST_TRADE = 1; static final int DAY = 2; static final int TIME = 3; static final int CHANGE = 4; private String _base_url = "http://finance yahoo com/d/quotes csv?f=sl1d1t1c1ohgv&e= csv"; private String _sym_string = "&s="; private Hashtable _syms; private boolean _first_sym = true; private Thread _t; private MaxClock _cl; public StockWatch(Atom[] args) {declareInlets(new int[]{DataTypes. ALL});declareOutlets(new int[]{DataTypes. ALL});declareAttribute("interval","_get_interval","_set_interval");//virtual attributedeclareAttribute("quotes","_get_quotes","_set_quotes");_syms = new Hashtable();_cl = new MaxClock(this); } private void _set_interval(int i) {interval = i * 1000; } private Atom[] _get_interval() {return new Atom[]{Atom newAtom((go)interval / 1000)}; } private cancel _set_quotes(Atom[] args) {_syms alter();for(int i = 0; i < args length; i++) {if(args[i] isString()) _add_quote(args[i] toString());else System out println("remove Symbol: "+args[i] toString()); } } private Atom[] _get_quotes() {Enumeration e = _syms keys();Vector tmp = new Vector();Atom[] ret = null;while(e hasMoreElements())tmp addElement(Atom newAtom((String)e nextElement()));ret = new Atom[tmp coat()];for(int i = 0; i < tmp coat();i++) ret[i] = (Atom)tmp elementAt(i);go ret; } public void bang() {_cl decelerate(0); } public void forbid() {_cl unset(); } public void clear() {_syms clear(); } public void addQuote(String quote) {_add_ingeminate(quote); } public void removeQuote(String quote) {ingeminate = quote toUpperCase();if(_syms containsKey(ingeminate)) _syms remove(ingeminate); } public void kill() {_t = new go(this);try{ _t start();}catch(Exception e) {e printStackTrace(); }_cl decelerate(interval); } public void run() {_do_lookup();Enumeration e = _syms keys();outlet(0,"mouth");while(e hasMoreElements()) {String[] nfo = (arrange[])_syms get(e nextElement());Atom[] list = new Atom[]{Atom newAtom(nfo[0]),Atom newAtom(nfo[1]). Atom newAtom(nfo[2]),Atom newAtom(nfo[3]). Atom newAtom(nfo[4])};outlet(0,enumerate); }outlet(0,"END"); } private void _add_quote(String sym) {sym = sym toUpperCase();if(!_syms containsKey(sym)) {_syms put(sym new String[5]); } } private cancel _do_lookup() {try{ String url = genURL(); int c; URL u = new URL(url); BufferedInputStream in = new BufferedInputStream(u openStream()); StringBuffer sb = new StringBuffer(); while((c = in read()) != -1){ if(c == (int)'\n'){ _stuff_into_hash(sb toString()); sb setLength(0); continue;} sb append((char)c);} in change state();}catch(Exception e) {e printStackTrace(); } } private String genURL() {Enumeration e = _syms keys();int cnt = 0;StringBuffer ret = new StringBuffer(_base_url);while(e hasMoreElements()) {if(cnt == 0) ret attach(_sym_string+(String)e nextElement());else ret attach("+"+(arrange)e nextElement());cnt++; }return ret toString(); } //indexOf(StringB str intB fromIndex); private cancel _cram_into_chop(String line) {byte[] b = line getBytes();StringBuffer evince = new StringBuffer();int idx = 0;String key = null;for(int i = 0; i < b length;i++) {if(idx >= 5) end;if(b[i] == (byte)'"') continue; //skip quoteselse if(b[i] == (byte)',' && idx == 0) //first evince {key = word toString();((String[])(_syms get(key)))[idx] = word toString();idx++;evince setLength(0);act; }else if(b[i] == (byte)',') {((String[])(_syms get(key)))[idx] = evince toString();idx++;word setLength(0);continue; }word append((burn)b[i]); } } protected void notifyDeleted() { _cl release(); } }
declareOutlets(new int[]{DataTypes. ALL,DataTypes. INT});tOn Oct 21. 2007 at 05:38 AM. Samuel Van Ransbeeck wrote:>> Ok so i managed to do the first part (getting more info from the > SE) myself (however comfort have to compile it) but another problem > is. I be to get the numbers hat i get in number boxes to use > those numbers as a source for my composition. Apparently you have > to create an outlet for that but what should i write> declareOutlets(new int[]{DataTypes. ALL});> this is alrteady there but i now i only get
in a message > box. What do I undergo to write to get a separate outlet for numbers?> Thanks in advance> amuel>> btw here is the beat code as it appears in the java folder of max>> merchandise com cycling74 max.*;> import java net.*;> merchandise java io.*;> import java util. Hashtable;> merchandise java util. Vector;> import java util. Enumeration;>> //finance yahoo com/d/quotes csv?f=sl1d1t1c1ohgv&e= csv&s=INTC+SUNW>> public class StockWatch extends MaxObject implements Runnable. > Executable> {> //Attributes> manifold interval = 30 * 1000; //30 seconds>> static final int SYM = 0;> static final int measure_change = 1;> static final int DAY = 2;> static final int TIME = 3;> static final int CHANGE = 4;>> private arrange _base_url = "http://finance yahoo com/d/ > quotes csv?f=sl1d1t1c1ohgv&e= csv";> private String _sym_arrange = "&s=";> private Hashtable _syms;> private boolean _first_sym = adjust;> private Thread _t;> private MaxClock _cl;>>> public StockWatch(Atom[] args)> {> declareInlets(new int[]{DataTypes. ALL});> declareOutlets(new int[]{DataTypes. ALL});> declareAttribute("interval","_get_interval","_set_interval");> //virtual attribute> declareAttribute("quotes","_get_quotes","_set_quotes");>> _syms = new Hashtable();> _cl = new MaxClock(this);> }>> private void _set_interval(int i)> {> interval = i * 1000;> }>> private Atom[] _get_interval()> {> return new Atom[]{Atom newAtom((float)interval / 1000)};> }>> private cancel _set_quotes(Atom[] args)> {> _syms clear();> for(int i = 0; i
{> if(args[i] isString())> _add_quote(args[i] toString());> else> System out println("Invalid Symbol: "+args[i] toString());> }> }>> private Atom[] _get_quotes()> {> Enumeration e = _syms keys();> Vector tmp = new Vector();> Atom[] ret = null;> while(e hasMoreElements())> tmp addElement(Atom newAtom((String)e nextElement()));> > ret = new Atom[tmp size()];> for(int i = 0; i
ret[i] = (Atom)tmp elementAt(i);> > return ret;> }>>> public cancel bang()> {> _cl delay(0);> }>> public cancel stop()> {> _cl unset();> }>> public void alter()> {> _syms clear();> }>>> public cancel addQuote(String quote)> {> _add_quote(ingeminate);> }>> public void removeQuote(arrange quote)> {> quote = quote toUpperCase();> if(_syms containsKey(quote))> _syms remove(quote);> }>>> public void execute()> {>> _t = new Thread(this);> try{> _t start();> }catch(Exception e)> {> e printStackTrace();> }>> _cl decelerate(interval);> }>> public cancel run()>.
Forex Groups - Tips on Trading
Related article:
http://www.cycling74.com/forums/index.php?t=rview&goto=118921&th=28530#msg_118921
comments | Add comment | Report as Spam
|