This week's book giveaway is in the Cloud forum.
We're giving away four copies of Terraform in Action and have Scott Winkler on-line!
See this thread for details.
Win a copy of Terraform in Action this week in the Cloud forum!

Casey Clayton

Ranch Hand
+ Follow
since Feb 17, 2014
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
6
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Casey Clayton

Ok so I have in-app billing setup in my app and it seems to work but I am having some weird problems. Let me give you guys a layout of code quickly.



Now the same updateUi() method is called in the onPurhcaseFinsishedListener as well as setting the mIsPurchased to true. Now the strange part is that the purchase Dialog no longer shows up but it doesn't transfer it to the new activity and when I set a toast to show the status of the boolean it says false, but yet the dialog still doesn't show which should. Any ideas? Note that the purchase is a success and goes through properly and the dialog never comes back after but yet the variable isn't true and it doesn't go to the new Activity.
7 years ago

Ulf Dittmer wrote:Well, the obvious and easy approach would be to use Google Play if you don't mind a 30% cut.

I mentioned some other payment options in https://coderanch.com/t/611538/Android/Mobile/SMS-SMS-ticket-system-simular#2793681, but those don't support the in-app aspect of several small items being sold to the same customer, AFAIK, it's more about a fixed price for the app. So you'd have to implement all that, regardless of payment method.



Haha I mean implementing the upgrade to pro and unlocking certain features using the Google Play Billing Library. I'm not really sure how to go about doing this. I would rather not have a bunch of stuff happening in my MainActivity either so I am looking for the best way to implement it, such as it's own activity or stand alone class with static methods.
7 years ago

Ulf Dittmer wrote:From what I've read anecdotally, in-app upgrades are preferable. It's harder to get people to switch to a different app (some will do, but you'll lose some in the process), and fewer people check out apps that cost money from the start. There's a clear trend away from paid apps towards in-app purchases.



Ok that's kind of what I was leaning towards. Are there any good tutorials on how to go about doing this??
7 years ago
I was wanting some opinions, I asked on stack overflow but it was off-topic. I have a lite version of my android app released right now and was wanting to have a pro version with many more features, downloadable themes, etc but I'm not sure the best way to go about this. Should it be done via in-app purchases or should I make a standalone pro-version??
7 years ago

John Damien Smith wrote:Wrap the contents of your run method in Platform.runLater to put it on the JavaFX Application thread. Or remove the Timer and replace it with a Timeline.



Ok so I switched the method over to this but it's saying "void" type not allowed here, what am I doing wrong?

7 years ago
Ok I am having an issue with a exception when trying to add new shapes to my JavaFx program. I have a randomizer that will randomly create a new Box object, which is converted to a rectangle for JavaFx use by a method I wrote, which all works fine. But when I setup the timer everything will run perfectly fine the first time through but then fails when it gets to this line when the timer kicks in. This is what the entire method looks like.



Here is using a timer to call the generateShapes method every 2 seconds or so.(As you notice I have a while loop that is commented out, which works perfectly fine but I need a timer which is causing the Thread exception.


If you need more information then let me know.
7 years ago
Thanks for all the help guys finally got it working properly!

7 years ago

Paul Clapham wrote:

Casey Clayton wrote:So what I have is a track, which has a set length in feet and a set speed which is feet per second... Now I need to take say a track length of 21 feet with a speed of 1ft/s and figure out how long the animation should last...



You want an answer in seconds, so you're going to have to multiply feet by seconds/feet (yes, the dimensions work just like their values do in arithmetic). So suppose your track length is 18 feet and the speed is 2 feet/second. To get seconds/feet you take the reciprocal, so that's 0.5 seconds/feet. Multiplying that by 18 feet gives you 9 seconds for the length of the animation.

Now, that's assuming you want your animation to take the same amount of time that the box actually takes to move along the conveyor. You might want to speed it up, because having it take 9 seconds to cross a small computer monitor might not produce the right effect. However I'd leave that part aside for now and just work on simulating the box's travel in real time. Inserting a speed-up (or slow-down) factor could be done later without too much difficulty.



See I have that basic calculation down but the problem occurs when the placing the boxes and then doing the calculation. I receive the boxes last known location in feet, which I need to convert to pixels to place it properly on the screen. This is the calculation I am having trouble with I guess, taking that data in feet and converting it to pixels since that the track will always be 1200px on the screen but the actual length in feet will vary from track to track. So say if it is a 40 foot track and the box is 12.5 feet in then how many pixels do I place box at on the X Axis.
7 years ago
I have a piece of software that I have been working on that takes some information about boxes on a conveyor from a database and then needs to do an animation based on that information to show the boxes moving across the conveyor. The problem I am having is figuring out the proper algorithm to calculate the duration of the animation for each box. So what I have is a track, which has a set length in feet and a set speed which is feet per second. Now the actual shape I am using for the track in javafx is 1200px. Now I need to take say a track length of 21 feet with a speed of 1ft/s and figure out how long the animation should last, for testing each box is being thrown on the conveyor in random positions and the track length could change between tracks.

So for example if we have a conveyor that is 21 feet with a speed of 1ft/s and the boxes current position is 10 feet in then we calculate how long it will take for the animation to complete for that specific box, the trouble comes in when converting things from pixels to feet since the physical track object in the program will always be equal to 1200px no matter what the actual size of the track is..so a 21 foot track will be displayed as a 1200px rectangle but a 500 foot track would also be a 1200px rectangle.

Hopefully I made it clear enough if not I can try to elaborate more if needed.
7 years ago
I have a JavaFX Application with the layout done in FXML. Currently it has a small controller to receive inputs from the TextFields and animate a rectangle based on those inputs, this rectangle is hard coded into the FXML (called "box") which really isn't what I need, that was for testing purposes only. What I really need to do is loop through an array of objects and create rectangles for each of those objects based on their properties and then be able to animate those. What is the best way to go about doing this?

7 years ago

John Damien Smith wrote:Also posted here:

JavaFX Scene Builder 2.0 dynamic css menubutton



Yep, these are my two main places for answers.
7 years ago
I am just learning JavaFx and have been playing with Scene Builder 2.0. I downloaded IssueTrackerLite from Oracle and followed that tutorial to make my UI using scene builder, I added a MenuButton to what I made and want to use that to load some pre-made css files and change the styling on the fly depending on which one is chosen. The problem is none of the tutorials I found teach anything about hooking scene builder up with your java application, they give you the code and just have you make the UI. How would I go about adding this feature?

Link to SourceCode: http://docs.oracle.com/javafx/scenebuilder/1/get_started/IssueTrackingLite.zip
7 years ago
I have a couple of select boxes in my spring form and when ever I submit it was returning a blank page, so I added some loggers and realized that it wasn't getting to my .save hibernate method to save it to the database so I started doing some debugging and realized that it isn't really grabbing anything from the select boxes instead it is filling the values as null and that isn't allowed in the DB what the issue could be?

Controller code



JSP Page(Not the complete code just the relevant part)
7 years ago
Ok I am having an issue and have been stuck for a few hours. I am running the current version of spring with Hibernate and need to take data from a form and save it do that database, that's all but it is giving me tons of trouble and have no idea how to go about it. Below is the controller, JSP, Model, and Dao.

Model


Dao


Controller


JSP
7 years ago

Pawel Pawlowicz wrote:

Casey Clayton wrote: when it should be "Metformin HCL, Januvia, Abilify" all in one position


No, it should be Metformin HCL, Januvia, Abilify.
Without the quotes.

Too bad you can't use opencsv or Apache commons CSV.



Well yea that's what I meant to put.
7 years ago