Can I get this code to stream a radio station?
I have a radio station in AAC format.
I got this code to play an m4a file, but how would I get it to play an m4a stream?
The stream I'd like to use is http://89.238.166.195:9162
var mySound:SoundTransform;
var connect_nc:NetConnection = new NetConnection();
connect_nc.connect(null);
var stream_ns:NetStream = new NetStream(connect_nc);
stream_ns.play("sample.m4a");
mySound = stream_ns.soundTransform;
mySound.volume = .5;
stream_ns.soundTransform = mySound;
how would I go about playing a streaming radio service.
Well, a RandomAccessFile together with a counter should work. However, you can also achieve this by buffering the input rather than writing it directly out
java.util.Vector vect = new java.util.Vector();
try{
while((c = istream.read()) != -1){
vect.append(c);
catch(IOException e){
System.out.println("Error: " + e.getMessage());
finally{
istream.close();
} with the help of
java.util.Vector.size() and
java.util.Vector.elementAt(int index)
you are able to display only 20 lines at a time, you just need the additional code for reading System.in
public static void prompt(String s){
System.out.print(s + " ");
System.out.flush();
public static String readData ( BufferedReader in) {
boolean verfuegbar = true;
while ( verfuegbar){
try{
S = in.readLine();
if ( S != null)verfuegbar = false ;
catch (IOException e){System.out.print (e);}
return S;
}now it should work with
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
prompt("return for continuing");
int twentscount = 0;
int count = 0;
do{
while( count < 20 && twentscount+count < vect.size() ){
outstream.write(vect.elementAt(twentscount + count).toString() );
count++;
prompt("return");
readData(in);
twentscount += 20;
count = 0;
while(twentscount + count < vect.size());sure, this is code from head, and you can make many changes (e.g. instead of using twentscount use the modulo (%) operator saving one variable (while count % 20 != 0 ).
I'm also not sure if it will definitly run , since i haven't tested it (especialy for index borders).
I hope this will give you enough hints for this possible solution.
Adrian
Similar Messages
-
How can i know how to redeem the code? how can i get this code?
how can i know how to redeem the code? how can i get this code? please i need you help
<Email Edited by Host>You are trying to create a new Apple ID? You don't have one yet? Is that correct?
If so, then see this article on how to creat your Apple ID - and make up a password for it. Remember to write it down immediately.
http://support.apple.com/en-us/HT203993 -
i m login in th my iphone in the itune ti download something after entering cc details its asking about something itune gift card secure code...i am not getting this..where can i get this code in order to dowanload frm itune...
Meen0902 wrote:
... after entering cc details its asking about something itune gift card secure code...i
Try the 3 or 4 digit code on the back of your Credit Card.... -
I want to install WhatsApp on my iphone 16gb, but I need a code of 3 figures! Where can I get this code? i tried looking at my messages folder, but i havent got any 3 digit code. plz help
post in the iPhone forum : https://discussions.apple.com/community/iphone/using_iphone
-
How can I get this code to display 20 lines
I need to get this code I have written to display 20 lines at a time, then the 20 using the Enter key.
How would I approach this?
I thought of making a RandomAcessFile object, but that seems like overthinking the problem, and I'm not sure that I could get that to work anyway.
import java.io.*;
public class ReadIt
public static void main(String[] args)
throws IOException
System.out.println ("Enter The Desired .java Filename.");
System.out.println ("Do not add the .java extention.");
String fname;
EasyIn type = new EasyIn();
fname = type.readString();
String fndotjava = new String(fname + ".java");
//System.out.println (fndotjava);
File inFile = new File(fndotjava);
InputStream istream;
OutputStream ostream;
istream = new FileInputStream(inFile);
ostream = System.out;
int c;
try
while((c = istream.read()) != -1)
ostream.write(c);
catch(IOException e)
System.out.println("Error: " + e.getMessage());
finally
istream.close();
ostream.close();
}Thanks
BradWell, a RandomAccessFile together with a counter should work. However, you can also achieve this by buffering the input rather than writing it directly out
java.util.Vector vect = new java.util.Vector();
try{
while((c = istream.read()) != -1){
vect.append(c);
catch(IOException e){
System.out.println("Error: " + e.getMessage());
finally{
istream.close();
} with the help of
java.util.Vector.size() and
java.util.Vector.elementAt(int index)
you are able to display only 20 lines at a time, you just need the additional code for reading System.in
public static void prompt(String s){
System.out.print(s + " ");
System.out.flush();
public static String readData ( BufferedReader in) {
boolean verfuegbar = true;
while ( verfuegbar){
try{
S = in.readLine();
if ( S != null)verfuegbar = false ;
catch (IOException e){System.out.print (e);}
return S;
}now it should work with
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
prompt("return for continuing");
int twentscount = 0;
int count = 0;
do{
while( count < 20 && twentscount+count < vect.size() ){
outstream.write(vect.elementAt(twentscount + count).toString() );
count++;
prompt("return");
readData(in);
twentscount += 20;
count = 0;
while(twentscount + count < vect.size());sure, this is code from head, and you can make many changes (e.g. instead of using twentscount use the modulo (%) operator saving one variable (while count % 20 != 0 ).
I'm also not sure if it will definitly run , since i haven't tested it (especialy for index borders).
I hope this will give you enough hints for this possible solution.
Adrian -
:( I Just can't get this code to work (Help plzzzz)
I was assigned a final exam project, but most of the stuff we never actually saw in class, so I just have to figure it out for myself.
The part I'm stucked in (among other stuff) is:
room = new JLabel[4];
selec = new JRadioButton[4];
roomg= new ButtonGroup();
for(int i = 0; i < 4; i++) {
room[i] = new JLabel(arean);
selec[i] = new JRadioButton();
selec[i].addActionListener(this);
areap.add(room[i]);
areap.add(selec[i]);
roomg.add(selec[i]);
areap.setBorder(new TitledBorder(""+arean[i]));
This part of the code successfully created a group of JRadioButtons each with the names previously established in arean[ ]. However, I'm supposed to make it so that whenever I press any of the RadioButtons, the border of the JPanel changes as well. As it is, Java will put only the last name, and won't change it as I click the different JRadioButtons.
I'm not sure if I made myself clear, so if anyone is interested in helping me and needs further information, plz let me know.
Thanks in advance.
Message was edited by:
SmaSh_If it's an array of Strings of area names, then the
append to an empty string in this line of code:
areap.setBorder(new TitledBorder(""+arean)); is extraneous (as
well as being a nasty idiom anyway, IMHO). I see
that you removed it in your example...
I agree that the empty string is a nasty idiom (hence my removal of it). I figured arean had to be an array of Strings, if it is passed to the JLabel constructor (because toString on an Icon would probably be usely). -
Hello, how can i get this code working?
public class TrivialApplication
public static void main(String args[]){
class HelloObject
String greeting="String Test";
void speak()
System.out.println(greeting);
?At a guess I'd say it wouldn't like that because you've defined the class HelloObject inside main.
Try like so (formatting is done with [ code ] and [ /code ] tags):
public class TrivialApplication
private String greeting;
public static void main(String[] args)
TrivialApplication ta = new TrivialApplication();
ta.speak();
public TrivialApplication()
greeting = "String Test";
public void speak()
System.out.println(greeting);
}This is a bit of overkill, I certainly could have done it with less code, but it shows the standard format. How you declare variables, and initialise them in the constructor. How to create an object and call methods of the object.
Or, if you really wanted the HelloObject class...
public class TrivialApplication
public static void main(String[] args)
HelloObject ho = new HelloObject();
ho.speak();
class HelloObject()
private String greeting;
public HelloObject()
greeting = "String Test";
public void speak()
System.out.println(greeting);
}HTH,
Radish21 -
Topic: Microsoft's Silverlight for Mac. I wanted to video stream a movie via Verizon FIOS. It demanded Silverlight.dmg. Macbok Pro refused to download from 3rd party supplier (CNET). How can I get this from Apple? The Verizon FIOS video website was churning on the error message, "Checking device registration status." It got stuck in a loop. Verizon tech support never came on. Was on terminal "Hold." Any recommendations?
Never download anything from CNET. The site is untrustworthy and is known to distribute Windows spyware intentionally.
-
HT2534 What is iTune gift card? How can i get the code from this?
What's iTune gift card? How can i get the code from this?
"What's iTune gift card?"
It is a gift card like any other gift card. It is a card that contains credit for purchases in the itunes store.
"How can i get the code from this?"
Genreally there is a scratch of area under which the code lies. -
Can anybody help me to build an interface that can work with this code
please help me to build an interface that can work with this code
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin'please help me i don t know how to go about this.my teacher ask me to build an interface that work with the code .
Here is the interface i just build
import java.util.Map;
import java.util.HashMap;
import java.util.Iterator;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileReader;
import java.awt.*;
import javax.swing.*;
public class boy extends JFrame
JTextArea englishtxt;
JLabel head,privatetxtwords;
JButton translateengtoprivatewords;
Container c1;
public boy()
super("HAKIMADE");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground(Color.white);
setLocationRelativeTo(null);
c1 = getContentPane();
head = new JLabel(" English to private talk Translator");
englishtxt = new JTextArea("Type your text here", 10,50);
translateengtoprivatewords = new JButton("Translate");
privatetxtwords = new JLabel();
JPanel headlabel = new JPanel();
headlabel.setLayout(new FlowLayout(FlowLayout.CENTER));
headlabel.add(head);
JPanel englishtxtpanel = new JPanel();
englishtxtpanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
englishtxtpanel.add(englishtxt);
JPanel panel1 = new JPanel();
panel1.setLayout(new BorderLayout());
panel1.add(headlabel,BorderLayout.NORTH);
panel1.add(englishtxtpanel,BorderLayout.CENTER);
JPanel translateengtoprivatewordspanel = new JPanel();
translateengtoprivatewordspanel.setLayout(new FlowLayout(FlowLayout.CENTER,10,40));
translateengtoprivatewordspanel.add(translateengtoprivatewords);
JPanel panel2 = new JPanel();
panel2.setLayout(new BorderLayout());
panel2.add(translateengtoprivatewordspanel,BorderLayout.NORTH);
panel2.add(privatetxtwords,BorderLayout.CENTER);
JPanel mainpanel = new JPanel();
mainpanel.setLayout(new BorderLayout());
mainpanel.add(panel1,BorderLayout.NORTH);
mainpanel.add(panel2,BorderLayout.CENTER);
c1.add(panel1, BorderLayout.NORTH);
c1.add(panel2);
public static void main(final String args[])
boy mp = new boy();
mp.setVisible(true);
}..............here is the code,please make this interface work with the code
public class Translate
public static void main(String [] args) throws IOException
if (args.length != 2)
System.err.println("usage: Translate wordmapfile textfile");
System.exit(1);
try
HashMap words = ReadHashMapFromFile(args[0]);
System.out.println(ProcessFile(words, args[1]));
catch (Exception e)
e.printStackTrace();
// static helper methods
* Reads a file into a HashMap. The file should contain lines of the format
* "key\tvalue\n"
* @returns a hashmap of the given file
@SuppressWarnings("unchecked")
private static HashMap ReadHashMapFromFile(String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
HashMap map = null;
try
in = new BufferedReader(new FileReader(filename));
String line;
map = new HashMap();
while ((line = in.readLine()) != null)
String[] fields = line.split("
t", 2);
if (fields.length != 2) continue; //just ignore "invalid" lines
map.put(fields[0], fields[1]);
finally
if(in!=null) in.close(); //may throw IOException
return(map); //returning a reference to local variable is safe in java (unlike C/C++)
* Process the given file
* @returns String contains the whole file.
private static String ProcessFile(Map words, String filename) throws FileNotFoundException, IOException
BufferedReader in = null;
StringBuffer out = null;
try
in = new BufferedReader(new FileReader(filename));
out = new StringBuffer();
String line = null;
while( (line=in.readLine()) != null )
out.append(SearchAndReplaceWordsInText(words, line)+"\n");
finally
if(in!=null) in.close(); //may throw IOException
return out.toString();
* Replaces all occurrences in text of each key in words with it's value.
* @returns String
private static String SearchAndReplaceWordsInText(Map words, String text)
Iterator it = words.keySet().iterator();
while( it.hasNext() )
String key = (String)it.next();
text = text.replaceAll("\\b"key"
b", (String)words.get(key));
return text;
* @returns: s with the first letter capitalized
String capitalize(String s)
return s.substring(0,0).toUpperCase() + s.substring(1);
}... here's the head of my pirate_words_map.txt
hello ahoy
hi yo-ho-ho
pardon me avast
excuse me arrr
yes aye
my me
friend me bucko
sir matey
madam proud beauty
miss comely wench
where whar
is be
are be
am be
the th'
you ye
your yer
tell be tellin' -
I have much fewer pics on my pc photo stream than my ipad and iphone. how can i get my pc photo stream to show all my pics?
This is all just a partial answer since details will depend upon how you want to do it.
Post by Zevoneer: iPod media recovery options - https://discussions.apple.com/message/11624224 - this is an older post and many of the links are also for old posts, so bear this in mind when reading them.
Commercial software utility for transferring songs from i-device to Mac - http://www.fadingred.com/senuti/
http://support.apple.com/kb/HT1848 - just media purchased from iTunes Store
You'll need to get it all onto one iTunes collection on your Mac Pro, then sync the devices to that. iTunes only lets you transfer purchases from a device, otherwise you have to use third party software.
I guess you could also look into getting iTunes Match. -
How can i get the code html and css of my form please help me
how can i get the code html and css of my form
HI,
If you like to embed the HTML form in your web page then you will need to obtain the form code from the Distribite/Embed tab. Additional information can be found here: http://forums.adobe.com/docs/DOC-1991
You will not be able to access/modify the css code or the rest of the form html code. If you like to view the source of of a HTML page, please use your browser 'view source code' functionality.
I hope this answer your question,
Thanks,
Lucia -
I need Internet Explorer for my MBP. How can I get this?
I need Internet Explorer for my MBP. How can I get this?
You can't — at least not if you want to run it in the Mac OS. If you have Winidows installed on your Mac, then of course you can run the Windows version of IE, but the Mac version hasn't been updated since June 2003 and is unsupported by Microsoft. It's very insecure, it can't handle a lot of current web sites, and it may not run at all in recent OS X versions. It was lousy in 2003, and it can't have gotten any better while the world was passing it by.
If there's a web site you want to access that says it requires IE, complain to its webmaster about the benighted design of the site. No responsible web designer codes sites for just one browser any more. Every web site should be tested and should work well with a large variety of browsers — IE, Firefox and Chrome at a bare minimum — and every site owner should insist that their designer(s) adhere to that "best practice." -
Need help getting this code to work
I am trying to get this code to work using "if else statment" but it will only do the first part and not do the second part in the else statement. Can anyone help me out? Here is the code:
var R1 = this.getField("Registration Fees1");
var R2 = this.getField("Registration Fees2");
var R3 = this.getField("Registration Fees3");
var R4 = this.getField("Registration Fees4");
var R0 = 0
if (R0 == 0)
event.value = Math.floor(R1.value);
else
event.value = Math.floor(R2.value + R3.value + R4.value);
I did notice that if I fiddled around this this part:
if (R0 == 0)
sometimes I can get the second part to work but not the first. I need it to do either or and this is getting frustrating.
I might also not even need "var R0 = 0". I put that there for the condition part. If that is what is causing the problem, I can take it out. But then what would the condition be? For this form, the default is 0 and then the calculation follows by user clicking on different prices. The first part is if they want to pay for the full conference and the second part is if they want to pay for either Monday, Tuesday or Wednesday or 2 of the 3 days. Is it possible to get this to work with both parts together? I am still stuck on getting just one or the other working. Any help would be greatly appreciated. Thanks in advance.I have posted this on another message board and a user by the name of gkaiseril offered this solution but it hasn't worked either.
// all four days
var R1 = this.getField("Registration Fees1").value;
// Monday
var R2 = this.getField("Registration Fees2").value;
// Tuesday
var R3 = this.getField("Registration Fees3").value;
// Wednesday
var R4 = this.getField("Registration Fees4").value;
var Fee = 0
event.value = ''; // default value
if (R1 != 'Off') {
Fee = Number(R1) + Fee;
} else {
if(R2 != 'Off') {
Fee = Number(Fee) + R2;
if(R3 != 'Off') {
Fee += Number(R3);
if(R4 != 'Off') {
Fee = Number(R4) + Fee;
event.value = Fee;
Maybe you are looking for
-
Bug & Conflict w/ Palm Destop 6 & Windows Media Player
I am a long time Palm user but my T2 was not getting much use considering I was already carrying Two cell phones. But I was excited to get an upgrade to a Centro for one of my phones. Now I am dealing with the differences between PalmDesktop4 (PD4) a
-
Nota Fiscal Eletrônica de Cancelamento
Prezados, As notas fiscais modelo 1 e 1A quando são canceladas é possível efetuar a visualização da NF de cancelamento pela J1B3N. Cancelei uma NFe através da J1BNFE e não foi possível visualizar a NFe de cancelamento através da J1B3N. O sistema exib
-
IF and SUBSTR in XML Publisher
Hi I am developing a XML RTF template for a report. All I am trying to do is, if first 4 letters of the data of xml tag ITEM = 'Summ' then print a constant word 'Notes' <?if: xdofx:substr(ITEM,1,4)='Summ'?> Notes<?end if?> I have been trying hard. IF
-
Unable to load comma separated number using sqlldr
Hi See the example below. I have problem in loading “bonus” into my emp table. Appreciate your help. Here I have appended the following. - demo04.ctl – controfile - demo04.dat – datafile - demo04.log - logfile Error : ====================
-
How can I display the correct enum ring value from a parameter file?
A user will make selections based on the menu ring (there are several of these) and then the values are saved for later use as a parameter (text) file. I have several menu rings which I write out to a parameter (text) file. How can I take these text