Skip to content

Tag: java

How to generate a CUSIP check digit

CUSIPs are a 9-digit alphanumeric code for uniquely identifying a financial security. https://en.wikipedia.org/wiki/CUSIP They were invented in the 1964, and given the reliability of data transmission in the 60’s, the 9th digit is actually a check digit used to confirm the validity of the first 8 charac…

Java – Asteroids – acceleration in two dimensions

I am currently writing Asteroids for extra credit in my computer science class, following a very loose guide that provided some starter code. I have a ship and I can use key presses to change its position. The starter code provided a method of drawing the ship based on a Point position. I was then given this …

Throw exception vs Logging

Is the following way to code good practice? Moreover, should I.. use only the logger? throw only the exception? do both? I understand that with throw I can catch the exception in another part of the callstack, but maybe additional logging has some hidden benefits and is useful as well. Answer I use both in so…

android get radio stream data

I am trying to get what song is on with this code: } Url I want to use are from this page: http://radio.m-1.fm/ so for example http://radio.m-1.fm/M-1PLIUS (which is http://84.46.147.81/m1plius/mp3) but I get error java.net.SocketException: Permission denied Any ideas what is wrong? Answer Add Internet Permis…