2014年06月

FragmentTransition custom animation onAnimationEnd callback

I have a FragmentTransaction which doesn't perform really fluid on older devices, so I want to enable hardware layers here.



This is the transaction code:



FragmentTransaction transaction = manager.beginTransaction();
transaction.setCustomAnimations(android.R.animator.fade_in, android.R.animator.fade_out);
transaction.add(R.id.container, new OverlayFragment(), Utilities.OVERLAY);
transaction.commitAllowingStateLoss();


Normally I would do this in the onAnimationEnd() of AnimatorListenerAdapter but I cannot set this on a resource objectAnimator.



What is the best way to set and reset the hardware layer of the views?





My JavaFX Tooltip isn't showing up on a chart data node

I'm playing around with JavaFX and wanted to add a tooltip that pops up with the data value when the mouse is hovering over the node. I found several links and answers out there describing CSS methods for doing it, or using Tooltip.install(node, tooltip) and while I could get a tooltip working on a dummy example, I was still having no luck with the chart, using code like so :



LineChart<Number, Number> chart = new LineChart(xaxis, yaxis);
ObservableList<Data<Number, Number>> data = FXCollections.observableArrayList();
Data<Number, Number> d1 = new XYChart.Data<Number, Number>(5, 15);
Tooltip tooltip = new Tooltip("15");
Tooltip.install(d1.getNode(), tooltip);
data.add(d1);
Data<Number, Number> d2 = new XYChart.Data<Number, Number>(10, 25);
Tooltip tooltip2 = new Tooltip("25");
Tooltip.install(d2.getNode(), tooltip2);
data.add(d2);
chart.setData(data);

//add chart to scene etc etc etc


Answers

After some digging, the issue here is that a data element (XYChart.Data) does not have a node created at construction time. chart.setData(data) will populate the node field - I believe this is to allow the user to create and set their own nodes if so desired. So d1.getNode() is actually returning null, and Tooltip.install() is silently failing.



Moving the Tooltip.install call after chart.setData solves the issue.





Excel Multiplication

Fixed Value Dynamic value   Calc Value
100 40 4000
10
30
20
20
40


I want to calculate all the calc value cell by multiplying Fixed Value with Dynamic Value.



Please help me to write one formula to calculate all the Calc Value Cell.



Answers

=$A$2*B2


The above works assuming "Fixed Value" is in cell A1.



The dollar sign before "A" means that it will refer to A even when the formula is dragged to the left/right. The dollar sign before "2" means that it will refer to the second row even when dragged up/down.



You can quickly toggle a reference between fixed and relative for rows/columns by hitting f4 with that reference selected in the formula bar.





how to pass '?' character in url (rails)

i want to pass a query to url like
http:/localhost:3000/saldo/;1010917745800000015?1



in my routes i have:



get 'saldo/:nomor' => 'kartus#show_saldo' , as: :show_saldo


and controller:



def show_saldo
@kartu = Kartu.find_by_nomor(params[:nomor])
end


but instead i get this params



Parameters {"1"=> nil,"nomor"=>";1010917745800000015"}


how can i get my param as {"nomor"=>";1010917745800000015?1"}



Answers

<%= link_to 'xyz' show_saldo_path(:nomor => 'nomor', :def => 'def'......) %>


In get everything you passed other than url parameter will become your query parameter. def will become your url parameter. More information here.



Answers

? is a special character in urls. If you want to include it in the value of a parameter then you should Uri Encode, eg with CGI.escape(), the parameter before submitting it: this will convert "?" to "%3F", and will similarly convert any other special characters (spaces, brackets etc). So, the parameter that is actually submitted will become "%3B1010917745800000015%3F1".



At the server side, rails will call CGI.unescape on the params, so it should show up in your controller as ";1010917745800000015?1" again.



This should happen automatically with form inputs - ie, if someone writes ;1010917745800000015?1 into a text field then it should actually be sent through as "%3B1010917745800000015%3F1"



If you want people to diagnose why this isn't happening then you should include the html (of the form or link which is submitting this value) to your question.





how to copy data between two DML forms APEX

I am using APEX 4.2.5



I have two different DML form with same design one for Creating new Record (Create Record form) and one for editing the data (update Record form).



If I update the design of "Create Record" form by including few more data points, same need to be redesigned for "update Record form". Is there any way where I copy the Fields from one form to another ?





↑このページのトップヘ