float java-me j2me [duplicate] - java-me

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Java - simple division in Java ---> bug/feature?
anyone know bigdecimal in j2me midp 2.0?
actually i just want to make j2me app, which is able to compute 1 / 6.
and print it as 0.1666667. just like embedded calculator in many(every) mobile phone.
i use float it prints 0.0
i use double it still prints 0.0
many thanks.

#Vuntic: yeah..., this is stupid question ever.
#Matt: thx, now i know the answer referring from the link question...
just cast it to float.. (float) 1 / (float) 6

Related

How to create an audio frequency visualizer [duplicate]

This question already has answers here:
Trying to get the frequencies of a .wav file in Python
(4 answers)
Closed last year.
I have a fun artistic project in mind :) Basically, I would like to load a music file (probably as a .wav), and take it up multiple octaves so that you can represent it on the color spectrum. My question is, how do I go about breaking down an audio file so that I can perform this transformation? I'm curious to see if colors can enhance the experience of listening to music if both are "in harmony" :)
All the best!
Anthony :)
Hey so I found a thread that pretty much answers my question! Trying to get the frequencies of a .wav file in Python Basically I can multiply the calculated frequency by 2^x to represent it with light :) Thanks for all the help!
Edit: While I was working on finishing up my program I stumbled upon this https://github.com/rho-bit/Psynesthesia. Looks like someone did exactly what I was trying to do back in 2003!! This was my first post and I totally love this website. Look forward to using it more! :)

Preload an image asset in flutter [duplicate]

This question already has answers here:
Flutter image preload
(8 answers)
Closed 3 years ago.
I'm building a game with flutter. I have around 130-150mo of pictures. And some of them must be preloaded or else the user experience doesn't feels smooth.
I found by myself a way to preload images :
final asset = new ExactAssetImage(assetPath);
final stream = asset.resolve(createLocalImageConfiguration(context));
While this works, there's a huge drawback : The memory cost is about 6 times bigger then the actual image size.
Consequence ? My app end up consuming 800 MO of ram just by loading images, which is insane (especially considering it's a relatively simple app).
In fact the ram consumption is so big that I get tons of frame lost.
So in short :
What is the most ideal way to preload an image ? Is there something I missed ?
If you want the UX to feel smooth then you can use FadeInImage() and give it an asset image to use as placeholder until the final image loads, and if you want to fade in image from a transparent background then you can use the transparent_image package.

Unclear on how sp works exactly (scaled pixels) [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Difference of px, dp, dip and sp in Android?
So I know I should use sp only for text font sizes. Now, what I don't understand is what they do exactly. Let's say I have the following attribute for a TextView in a layout for a normal screen size:
android:textSize="17dp"
If I replace it with this:
android:textSize="17sp"
What happens? In the visual editor, it doesn't look any different?
I am guessing that if I have, say a 3.2" screen which qualifies for the normal size layout, and a 4.0" screen which also qualifies for my normal size layout, then if I use sp, the text's size will be slightly scaled up? Is that right?
text rendered with sp is more compatible with accessibility options, for example if the users enables a high contrast mode or universally increases the size of text. Since sp is also density independent, that is the only difference between sp and dp.
I wouldn't like to start a new thread about it is so please have a look on a thread where it was already answered. Your question is answered mostly in the comments. Difference of px, dp, dip and sp in Android?

Is ReCaptcha too weak? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Has reCaptcha been cracked / hacked / OCR'd / defeated / broken?
I recognized that during some time reCaptcha is used without the horizontal line. I do not like the changes. Referring to some articles, google's captcha service is getting weaker and weaker. Do you guys think reCaptcha is still the best captcha there is, or should i think about using another implementation?
(I'm using play in my current project, and I'm also not very happy with the implementation play supplies.)
Have a read of this article at allspammedup from January 2011 which gives statistics on a crack rate of 17.5% on google reCAPTCHA
Two definites - people are getting better at programming algorithms to get around CAPTCHAs, and CAPTCHAs themselves are getting to the limit of being understood by peoples, so yeas - the effective strength of CAPTCHAs is decreasing, at at some point another solution will have to be used.

Best keyboard layout for a programmer? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
An Ideal Keyboard Layout for Programming
As a programmer I don't type as much human language as normal users. In fact, a lot of what I type are ASCII special characters such as $();:?=+-'"\[]{}<>. Needless to say, QWERTY is not good at programming.
function decode($t)
{
return preg_replace('/<(\/)?('.tuh::$tags.')>/i','<\1\2>',$t);
}
So I'm thinking about trying other layouts like Dvorak or Colemak, but they don't seem to be much better (Even the programming versions). So is there one that actually places the common keys right there next to the home row? No more stretching for each $ or ]?
I'd still say qwerty just because; at least in my job; I use a number of different keyboards/computers during the day and the adjustment can be rough moving across.

Resources