Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!

Marie Day

Greenhorn
+ Follow
since Jan 01, 2015
USA
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marie Day


Thanks for the cow, and clarification.
3 years ago

The purpose of this code is to store two bytes of a short sequentially in the buffer.
Why does this have to be an AND operation?

Couldn't you just cast short ss as a byte? The significant byte would be cut off, and the
other byte would be stored in the buffer, wouldn't it, without needing the AND operation?

I must be missing something. Code below.

This code is from
http://www.drdobbs.com/jvm/music-components-in-java-creating-oscill/230500178

3 years ago

Thanks so much, that answers my question.
3 years ago
I'm reading code for creating a digital oscillator. This part is storing sample values in a buffer.
On the line

short ss is shifted to the right, and then ss is used again on the next line.

The purpose of the code is to store two bytes of a short sequentially in the buffer,
but for the code to make sense wouldn't ss have to have it's original value on both lines, which means
the value of ss was not changed by >> 8? Otherwise, the first line gets rid of the least significant byte.

So, bit shifting operations don't change the value of the variable? That's my question.
Here's all the code. Comments are mine. Here's the source of the code:
http://www.drdobbs.com/jvm/music-components-in-java-creating-oscill/230500178

3 years ago

Mike. J. Thompson wrote:I've read the code, and the incomplete code snippet does not make it clear where the delay method is defined. I don't know if that is meant to be pseudo code or if there really is a delay method in their library, but I don't think you'll find it in any standard Java classes.

A likely implementation (if its a real method) will be to call Thread.sleep(long).



Thank you. He does offer a jar file containing all the code for all the sound synthesis components in the article series. The answer is most likely in there.
3 years ago

Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.



I meant it doesn't seem to be part of the code that defines a class, or inherited from a class that's being extended.
3 years ago

Mike. J. Thompson wrote:And what do you mean by outside of any class code? You can't write code outside of classes in Java.



Based on that statement, I looked up Object, and didn't see a delay method there. Could you tell me what class this line of code belongs to...
3 years ago

Mike. J. Thompson wrote:Can you post the code or a link to where you saw it? There isn't enough information there to tell you what it is.



Here's the link to the page. It's in the first listing.

http://www.drdobbs.com/jvm/music-components-in-java-creating-oscill/230500178?pgno=2
3 years ago
I'm looking at some code online, and there's this function:
delay(1000 * 4);
It doesn't appear to be associated with an object.
One of the objects in the code extends Thread, which doesn't have a delay() function.
At any rate, this line is outside of any class code.
I've searched for a java function index on the internet and haven't been able to
find one. Googling the function itself doesn't bring up anything.

Is this a static method? Where's the documentation on it?
3 years ago

I've written a program that inserts text into a doc file. This file is then read by some specialized software, which looks for certain tags when it opens the file. My program inserts the text without disturbing these tags. The program almost always works, but with some files it has been failing for some odd reason. Failing means the specialized software won't open the doc file after I process it with my program, giving an error message that the formatting is wrong.

For the last file that failed, I have narrowed the place of the failure down to a particular character. This phrase:
represented by Name
causes a failure (the file will not open in the specialized software), but if I take away the letter y and make it
represented b Name
the file will open in the specialized software.
If I change the phrase to
represented be Name
the file opens in the specialized software.

What is it with the letter y? I'm not expecting anyone to wade through my code, but is there some concept around text processing, characters..... that I don't know about?

Any ideas about this would be gratefully appreciated.
4 years ago

I'm just starting to use Android Studio. I'm doing the "Hello World" tutorial on the Android developers site. I've got this first app complete in Android studio, but I haven't run it yet. My computer doesn't have Intel HAXM enabled, so I can't run the emulator. I'm not willing to take the chance of changing a setting in my bios, because I read on another forum that it causes severe problems for some people (I need my computer for my job). So, I'm hoping I can use my HTC One. I think I need a driver. I went the HTC site and chatted with support, and they told me they don't support developers. So, here I am, hoping someone can tell me where to find the right driver for an HTC One Model PN07200. I'm on Windows 7 Professional.
4 years ago

Stefan Evans wrote:When you type java at the command line, it will find the first one on the path.
Presumably that is your JRE that you have installed.

Try typing this at the command line: %JAVA_HOME%\bin\java -version
That should tell you what the one in JAVA_HOME is.
Because it is installed under Program Files(x86) that is a good indication you have a 32bit installation.

What does your PATH variable look like?
Adding your java installation bin directory to the front of it should make the command line find the jre associated with the JAVA_HOME rather than the one it will have installed elsewhere.


EDIT:
In reaction to your new post.
Installing a JDK installs both a JDK and a JRE to your computer.
Take a look around for the jdk directory, also presumably under "Program Files"



I found the jdk folder. That was the problem, thank you.

4 years ago

Dave Tolls wrote:

Marie Day wrote:
I ran the installer, which placed the folder at C:\Program Files\Java\jre7, so I updated JAVA_HOME to that, ...



That's the JRE.
If that is the only folder it created then it hasn't installed a JDK.
There should be a jdk1.7.<whatever> folder. That's the JDK directory.



I found it, this worked, thank you.
4 years ago

Tapas Chand wrote:

Marie Day wrote:I read that Java version 8 is not compatible with Android studio, but 7 is


I have JDK 1.8.0_45 and Android Studio is running fine with it.
May be you have to install the latest version of Android Studio.
I have version 1.2.2



I just download Android studio a couple of days ago, so I assume it's the latest version. How can I find out if it's 1.2.2? I downloaded it from the link below, which says it's Android 5.
http://developer.android.com/sdk/index.html
4 years ago

Update: I read that Java version 8 is not compatible with Android studio, but 7 is. So I installed
Java SE Development Kit 7u80
for Windows x64
downloaded from
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
I ran the installer, which placed the folder at C:\Program Files\Java\jre7, so I updated JAVA_HOME to that, and now I get this error message when I launch Android Studio:
-----------------------
JDK required
'tools.jar' seems to be not in Studio classpath.
Please ensure JAVA_HOME point to JDK rather than JRE
------------------------------------------------------------------

Any ideas what I can do to fix this?
4 years ago